GDScript: Fix if
after lambda being seen as ternary
This commit is contained in:
parent
0a28b4cd94
commit
969f1980d2
3 changed files with 10 additions and 1 deletions
|
@ -2103,7 +2103,7 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_precedence(Precedence p_pr
|
|||
ExpressionNode *previous_operand = (this->*prefix_rule)(nullptr, p_can_assign);
|
||||
|
||||
while (p_precedence <= get_rule(current.type)->precedence) {
|
||||
if (previous_operand == nullptr || (p_stop_on_assign && current.type == GDScriptTokenizer::Token::EQUAL)) {
|
||||
if (previous_operand == nullptr || (p_stop_on_assign && current.type == GDScriptTokenizer::Token::EQUAL) || (previous_operand->type == Node::LAMBDA && lambda_ended)) {
|
||||
return previous_operand;
|
||||
}
|
||||
// Also switch multiline mode on here for infix operators.
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# https://github.com/godotengine/godot/issues/61231
|
||||
|
||||
func test():
|
||||
var my_lambda = func():
|
||||
print("hello")
|
||||
if 0 == 0:
|
||||
my_lambda.call()
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_OK
|
||||
hello
|
Loading…
Reference in a new issue