summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2021-08-20 10:52:58 -0300
committerGeorge Marques <george@gmarqu.es>2021-08-20 10:52:58 -0300
commit2e84a46a0f54cea0806e98b27e911ebae6be1976 (patch)
tree2d63013ffd54e2ba44596ddf796f2ae5584532e9 /modules/gdscript
parent89695da3376f551379255a0fbb8780e47815927e (diff)
GDScript: Make singleton functions be seen as static
Since those can be called without an instance.
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 57d999f8af..6b7403d854 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -30,6 +30,7 @@
#include "gdscript_analyzer.h"
+#include "core/config/engine.h"
#include "core/config/project_settings.h"
#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
@@ -3335,7 +3336,11 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::CallNode *p_source
MethodInfo info;
if (ClassDB::get_method_info(base_native, function_name, &info)) {
- return function_signature_from_info(info, r_return_type, r_par_types, r_default_arg_count, r_static, r_vararg);
+ bool valid = function_signature_from_info(info, r_return_type, r_par_types, r_default_arg_count, r_static, r_vararg);
+ if (valid && Engine::get_singleton()->has_singleton(base_native)) {
+ r_static = true;
+ }
+ return valid;
}
return false;