Merge pull request #99887 from JackErb/gdscript-parser-error-fix

Improve misleading `Unexpected "x" in class body.` GDScript parser error
This commit is contained in:
Thaddeus Crews 2024-12-10 14:15:50 -06:00
commit 79dd5179e3
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84
5 changed files with 20 additions and 1 deletions

View file

@ -1073,8 +1073,8 @@ void GDScriptParser::parse_class_body(bool p_is_multiline) {
default:
// Display a completion with identifiers.
make_completion_context(COMPLETION_IDENTIFIER, nullptr);
push_error(vformat(R"(Unexpected "%s" in class body.)", current.get_name()));
advance();
push_error(vformat(R"(Unexpected %s in class body.)", previous.get_debug_name()));
break;
}
if (token.type != GDScriptTokenizer::Token::STATIC) {