mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
GDScript: Fix lambda resolution with cyclic references
This commit is contained in:
parent
6758a7f8c0
commit
89429b0273
10 changed files with 127 additions and 31 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue