Skip to content

Commit

Permalink
GDScript: Make singleton functions be seen as static
Browse files Browse the repository at this point in the history
Since those can be called without an instance.
  • Loading branch information
vnen committed Aug 20, 2021
1 parent 89695da commit 2e84a46
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/gdscript/gdscript_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2e84a46

Please sign in to comment.