diff options
author | George Marques <george@gmarqu.es> | 2020-06-01 16:41:05 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2020-07-20 11:38:39 -0300 |
commit | 886732ac2b131de555494f292cbb7c5058b40cd9 (patch) | |
tree | dc8022a8edf33ef17c2ea0d00c4849ab114c287b /modules/gdscript/gdscript_parser.h | |
parent | 34c28eb2b8f3bb96edafba50d0689c49335146dc (diff) |
Add support for properties
Diffstat (limited to 'modules/gdscript/gdscript_parser.h')
-rw-r--r-- | modules/gdscript/gdscript_parser.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index 09cb17f010..0d775915cf 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -777,10 +777,28 @@ public: }; struct VariableNode : public Node { + enum PropertyStyle { + PROP_NONE, + PROP_INLINE, + PROP_SETGET, + }; + IdentifierNode *identifier = nullptr; ExpressionNode *initializer = nullptr; TypeNode *datatype_specifier = nullptr; bool infer_datatype = false; + + PropertyStyle property = PROP_NONE; + union { + SuiteNode *setter = nullptr; + IdentifierNode *setter_pointer; + }; + IdentifierNode *setter_parameter = nullptr; + union { + SuiteNode *getter = nullptr; + IdentifierNode *getter_pointer; + }; + bool exported = false; bool onready = false; PropertyInfo export_info; @@ -923,6 +941,10 @@ private: // Statements. Node *parse_statement(); VariableNode *parse_variable(); + VariableNode *parse_variable(bool p_allow_property); + VariableNode *parse_property(VariableNode *p_variable, bool p_need_indent); + void parse_property_getter(VariableNode *p_variable); + void parse_property_setter(VariableNode *p_variable); ConstantNode *parse_constant(); AssertNode *parse_assert(); BreakNode *parse_break(); |