1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Allow to extends constant class variable

This commit is contained in:
sanikoyes
2017-10-30 19:08:53 +08:00
parent 290b32ee57
commit 2004c24a6e
2 changed files with 51 additions and 9 deletions

View File

@@ -2132,18 +2132,37 @@ void GDParser::_parse_extends(ClassNode *p_class) {
}
while (true) {
if (tokenizer->get_token() != GDTokenizer::TK_IDENTIFIER) {
_set_error("Invalid 'extends' syntax, expected string constant (path) and/or identifier (parent class).");
return;
switch (tokenizer->get_token()) {
case GDTokenizer::TK_IDENTIFIER: {
StringName identifier = tokenizer->get_token_identifier();
p_class->extends_class.push_back(identifier);
}
break;
case GDTokenizer::TK_PERIOD:
break;
default: {
_set_error("Invalid 'extends' syntax, expected string constant (path) and/or identifier (parent class).");
return;
}
}
StringName identifier = tokenizer->get_token_identifier();
p_class->extends_class.push_back(identifier);
tokenizer->advance(1);
if (tokenizer->get_token() != GDTokenizer::TK_PERIOD)
return;
switch (tokenizer->get_token()) {
case GDTokenizer::TK_IDENTIFIER:
case GDTokenizer::TK_PERIOD:
continue;
default:
return;
}
}
}