Merge pull request #68970 from Chaosus/gds_fix_lambda_signal

Fix using signals in lambda functions
This commit is contained in:
Rémi Verschelde 2022-11-22 10:00:05 +01:00
commit 0b2dc0f017
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 5 additions and 0 deletions

View file

@ -2865,6 +2865,9 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
p_identifier->variable_source = member.variable;
member.variable->usages += 1;
break;
case GDScriptParser::ClassNode::Member::SIGNAL:
p_identifier->source = GDScriptParser::IdentifierNode::MEMBER_SIGNAL;
break;
case GDScriptParser::ClassNode::Member::FUNCTION:
resolve_function_signature(member.function);
p_identifier->set_datatype(make_callable_type(member.function->info));
@ -3009,6 +3012,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
p_identifier->reduced_value = p_identifier->constant_source->initializer->reduced_value;
found_source = true;
break;
case GDScriptParser::IdentifierNode::MEMBER_SIGNAL:
case GDScriptParser::IdentifierNode::INHERITED_VARIABLE:
mark_lambda_use_self();
break;

View file

@ -786,6 +786,7 @@ public:
LOCAL_VARIABLE,
LOCAL_ITERATOR, // `for` loop iterator.
LOCAL_BIND, // Pattern bind.
MEMBER_SIGNAL,
MEMBER_VARIABLE,
MEMBER_CONSTANT,
INHERITED_VARIABLE,