summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_analyzer.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-22 16:02:11 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-22 16:02:11 +0100
commit801ef6614db18969d2384e2045827996ed005cde (patch)
tree2c8d9edab5ca405123732ae1e405aa18ac8197f2 /modules/gdscript/gdscript_analyzer.cpp
parent866df52f4914a0ddd2c3ab5cc7d0d6520ba06b71 (diff)
parentd93dbab054f677227a74d3cd7b20ad8af8d43398 (diff)
Merge pull request #70138 from anvilfolk/signals
Add MethodInfo to signal datatype
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 0aea2b9c16..0c62fde29e 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -901,18 +901,19 @@ void GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode *p_class,
member.signal->set_datatype(resolving_datatype);
+ // This is the _only_ way to declare a signal. Therefore, we can generate its
+ // MethodInfo inline so it's a tiny bit more efficient.
+ MethodInfo mi = MethodInfo(member.signal->identifier->name);
+
for (int j = 0; j < member.signal->parameters.size(); j++) {
- GDScriptParser::DataType signal_type = resolve_datatype(member.signal->parameters[j]->datatype_specifier);
- signal_type.is_meta_type = false;
- member.signal->parameters[j]->set_datatype(signal_type);
+ GDScriptParser::ParameterNode *param = member.signal->parameters[j];
+ GDScriptParser::DataType param_type = resolve_datatype(param->datatype_specifier);
+ param_type.is_meta_type = false;
+ param->set_datatype(param_type);
+ mi.arguments.push_back(PropertyInfo(param_type.builtin_type, param->identifier->name));
+ // TODO: add signal parameter default values
}
- // TODO: Make MethodInfo from signal.
- GDScriptParser::DataType signal_type;
- signal_type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
- signal_type.kind = GDScriptParser::DataType::BUILTIN;
- signal_type.builtin_type = Variant::SIGNAL;
-
- member.signal->set_datatype(signal_type);
+ member.signal->set_datatype(make_signal_type(mi));
// Apply annotations.
for (GDScriptParser::AnnotationNode *&E : member.signal->annotations) {