diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-09-01 14:49:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 14:49:35 +0200 |
commit | 64e0a129001b670a81ffa833aa85d8ed7bc73d39 (patch) | |
tree | 257463c24b484d6a7fda02f0af6eded7dcfdf21c /modules/gdscript/gdscript_parser.cpp | |
parent | 7844775a76fbc50e725e7f0c3aebb944b5e2b066 (diff) | |
parent | a889084864f44db3a72a0320a6df656293c2044e (diff) |
Merge pull request #41674 from vnen/gdscript-2-fixes
GDScript bugfixing
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 03da5e926b..4761506381 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -586,6 +586,14 @@ GDScriptParser::ClassNode *GDScriptParser::parse_class() { return n_class; } + if (match(GDScriptTokenizer::Token::EXTENDS)) { + if (n_class->extends_used) { + push_error(R"(Cannot use "extends" more than once in the same class.)"); + } + parse_extends(); + end_statement("superclass"); + } + parse_class_body(); consume(GDScriptTokenizer::Token::DEDENT, R"(Missing unindent at the end of the class body.)"); @@ -1941,8 +1949,8 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_literal(ExpressionNode *p_ } GDScriptParser::ExpressionNode *GDScriptParser::parse_self(ExpressionNode *p_previous_operand, bool p_can_assign) { - if (!current_function || current_function->is_static) { - push_error(R"(Cannot use "self" outside a non-static function.)"); + if (current_function && current_function->is_static) { + push_error(R"(Cannot use "self" inside a static function.)"); } SelfNode *self = alloc_node<SelfNode>(); self->current_class = current_class; |