diff options
Diffstat (limited to 'modules/gdscript/gdscript_parser.h')
-rw-r--r-- | modules/gdscript/gdscript_parser.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index 0ba0d5b6da..346c9bc45d 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -91,6 +91,7 @@ public: struct SuiteNode; struct TernaryOpNode; struct TypeNode; + struct TypeTestNode; struct UnaryOpNode; struct VariableNode; struct WhileNode; @@ -124,6 +125,7 @@ public: bool is_constant = false; bool is_read_only = false; bool is_meta_type = false; + bool is_pseudo_type = false; // For global names that can't be used standalone. bool is_coroutine = false; // For function calls. Variant::Type builtin_type = Variant::NIL; @@ -210,6 +212,7 @@ public: is_read_only = p_other.is_read_only; is_constant = p_other.is_constant; is_meta_type = p_other.is_meta_type; + is_pseudo_type = p_other.is_pseudo_type; is_coroutine = p_other.is_coroutine; builtin_type = p_other.builtin_type; native_type = p_other.native_type; @@ -288,6 +291,7 @@ public: SUITE, TERNARY_OPERATOR, TYPE, + TYPE_TEST, UNARY_OPERATOR, VARIABLE, WHILE, @@ -426,7 +430,6 @@ public: OP_BIT_XOR, OP_LOGIC_AND, OP_LOGIC_OR, - OP_TYPE_TEST, OP_CONTENT_TEST, OP_COMP_EQUAL, OP_COMP_NOT_EQUAL, @@ -1150,6 +1153,16 @@ public: } }; + struct TypeTestNode : public ExpressionNode { + ExpressionNode *operand = nullptr; + TypeNode *test_type = nullptr; + DataType test_datatype; + + TypeTestNode() { + type = TYPE_TEST; + } + }; + struct UnaryOpNode : public ExpressionNode { enum OpType { OP_POSITIVE, @@ -1460,6 +1473,7 @@ private: ExpressionNode *parse_attribute(ExpressionNode *p_previous_operand, bool p_can_assign); ExpressionNode *parse_subscript(ExpressionNode *p_previous_operand, bool p_can_assign); ExpressionNode *parse_lambda(ExpressionNode *p_previous_operand, bool p_can_assign); + ExpressionNode *parse_type_test(ExpressionNode *p_previous_operand, bool p_can_assign); ExpressionNode *parse_yield(ExpressionNode *p_previous_operand, bool p_can_assign); ExpressionNode *parse_invalid_token(ExpressionNode *p_previous_operand, bool p_can_assign); TypeNode *parse_type(bool p_allow_void = false); @@ -1541,8 +1555,9 @@ public: void print_statement(Node *p_statement); void print_subscript(SubscriptNode *p_subscript); void print_suite(SuiteNode *p_suite); - void print_type(TypeNode *p_type); void print_ternary_op(TernaryOpNode *p_ternary_op); + void print_type(TypeNode *p_type); + void print_type_test(TypeTestNode *p_type_test); void print_unary_op(UnaryOpNode *p_unary_op); void print_variable(VariableNode *p_variable); void print_while(WhileNode *p_while); |