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

GDScript: Fix crash when superclass file is non-existent

Incidentally, allow EOF to be an end of statement.
This commit is contained in:
George Marques
2020-08-17 21:30:39 -03:00
parent fda6f3b600
commit 3abb3c0d6e
2 changed files with 18 additions and 3 deletions

View File

@@ -466,17 +466,17 @@ void GDScriptParser::pop_multiline() {
}
bool GDScriptParser::is_statement_end() {
return check(GDScriptTokenizer::Token::NEWLINE) || check(GDScriptTokenizer::Token::SEMICOLON);
return check(GDScriptTokenizer::Token::NEWLINE) || check(GDScriptTokenizer::Token::SEMICOLON) || check(GDScriptTokenizer::Token::TK_EOF);
}
void GDScriptParser::end_statement(const String &p_context) {
bool found = false;
while (is_statement_end()) {
while (is_statement_end() && !is_at_end()) {
// Remove sequential newlines/semicolons.
found = true;
advance();
}
if (!found) {
if (!found && !is_at_end()) {
push_error(vformat(R"(Expected end of statement after %s, found "%s" instead.)", p_context, current.get_name()));
}
}