Browse Source

GDScript: Allow "extends" to be used inside inner class

George Marques 5 years ago
parent
commit
edb4caf24e
1 changed files with 8 additions and 0 deletions
  1. 8 0
      modules/gdscript/gdscript_parser.cpp

+ 8 - 0
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.)");