Merge pull request #104509 from HolonProduction/completion-super-method

GDScript: Return early when parsing invalid super call
This commit is contained in:
Thaddeus Crews 2025-03-24 15:27:26 -05:00
commit c687e4f692
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84
5 changed files with 29 additions and 1 deletions

View file

@ -3301,7 +3301,11 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_call(ExpressionNode *p_pre
IdentifierNode *identifier = parse_identifier();
call->callee = identifier;
call->function_name = identifier->name;
consume(GDScriptTokenizer::Token::PARENTHESIS_OPEN, R"(Expected "(" after function name.)");
if (!consume(GDScriptTokenizer::Token::PARENTHESIS_OPEN, R"(Expected "(" after function name.)")) {
pop_multiline();
complete_extents(call);
return nullptr;
}
}
} else {
call->callee = p_previous_operand;

View file

@ -0,0 +1,5 @@
[output]
include=[
; GDScript: class_a.notest.gd
{"display": "func_of_a()"},
]

View file

@ -0,0 +1,7 @@
extends "res://completion/class_a.notest.gd"
func test():
super.
if true:
pass

View file

@ -0,0 +1,5 @@
[output]
include=[
; GDScript: class_a.notest.gd
{"display": "func_of_a()"},
]

View file

@ -0,0 +1,7 @@
extends "res://completion/class_a.notest.gd"
func test():
super.f
if true:
pass