mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 01:21:26 +00:00
Allow to extends constant class variable
This commit is contained in:
parent
290b32ee57
commit
2004c24a6e
2 changed files with 51 additions and 9 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue