summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-22 10:00:05 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-22 10:00:05 +0100
commit0b2dc0f017c4495e7b3fbf5c5c173cf9ad61e0d8 (patch)
tree063898dbcda3e7b35cbe072d278ce8506241b4a7 /modules/gdscript
parentdff8a51c6c75902f71bf0279f874fc56e502824c (diff)
parentf6c8c140f047d6b25f267a74389bb8f62d91e8f4 (diff)
Merge pull request #68970 from Chaosus/gds_fix_lambda_signal
Fix using signals in lambda functions
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp4
-rw-r--r--modules/gdscript/gdscript_parser.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index f1c022c43c..584bb74e4f 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -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;
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index d8f5b866aa..7baa3ca3d9 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -786,6 +786,7 @@ public:
LOCAL_VARIABLE,
LOCAL_ITERATOR, // `for` loop iterator.
LOCAL_BIND, // Pattern bind.
+ MEMBER_SIGNAL,
MEMBER_VARIABLE,
MEMBER_CONSTANT,
INHERITED_VARIABLE,