GDScript: Fix lambda resolution with cyclic references
This commit is contained in:
@ -3151,6 +3151,8 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_preload(ExpressionNode *p_
|
||||
GDScriptParser::ExpressionNode *GDScriptParser::parse_lambda(ExpressionNode *p_previous_operand, bool p_can_assign) {
|
||||
LambdaNode *lambda = alloc_node<LambdaNode>();
|
||||
lambda->parent_function = current_function;
|
||||
lambda->parent_lambda = current_lambda;
|
||||
|
||||
FunctionNode *function = alloc_node<FunctionNode>();
|
||||
function->source_lambda = lambda;
|
||||
|
||||
@ -3178,6 +3180,9 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_lambda(ExpressionNode *p_p
|
||||
FunctionNode *previous_function = current_function;
|
||||
current_function = function;
|
||||
|
||||
LambdaNode *previous_lambda = current_lambda;
|
||||
current_lambda = lambda;
|
||||
|
||||
SuiteNode *body = alloc_node<SuiteNode>();
|
||||
body->parent_function = current_function;
|
||||
body->parent_block = current_suite;
|
||||
@ -3215,6 +3220,7 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_lambda(ExpressionNode *p_p
|
||||
}
|
||||
|
||||
current_function = previous_function;
|
||||
current_lambda = previous_lambda;
|
||||
in_lambda = previous_in_lambda;
|
||||
lambda->function = function;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user