mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
GDScript: Rework type check
This commit is contained in:
parent
28db611f0f
commit
8fe023ad93
16 changed files with 504 additions and 195 deletions
|
@ -91,6 +91,7 @@ public:
|
|||
struct SuiteNode;
|
||||
struct TernaryOpNode;
|
||||
struct TypeNode;
|
||||
struct TypeTestNode;
|
||||
struct UnaryOpNode;
|
||||
struct VariableNode;
|
||||
struct WhileNode;
|
||||
|
@ -288,6 +289,7 @@ public:
|
|||
SUITE,
|
||||
TERNARY_OPERATOR,
|
||||
TYPE,
|
||||
TYPE_TEST,
|
||||
UNARY_OPERATOR,
|
||||
VARIABLE,
|
||||
WHILE,
|
||||
|
@ -426,7 +428,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 +1151,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 +1471,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 +1553,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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue