summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_analyzer.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-15 12:55:54 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-15 12:55:54 +0200
commitf546d70b8e5685efe962f28a944f9560d934cec7 (patch)
tree55455a80d88f5b3adf2e8cafdf5e7f25d38190d9 /modules/gdscript/gdscript_analyzer.cpp
parentf3428f7dbd405f5f0c57c534d131fe9aea0dcf6f (diff)
parent0a51bb4ca54fa9fd15b40dac28476eae6ff0c816 (diff)
Merge pull request #67365 from clayjohn/GDScript-static-warning
Add STATIC_CALLED_ON_INSTANCE warning
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index b3ca8ff00a..6fbdec863f 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -2552,6 +2552,10 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
if (p_is_root && return_type.kind != GDScriptParser::DataType::UNRESOLVED && return_type.builtin_type != Variant::NIL) {
parser->push_warning(p_call, GDScriptWarning::RETURN_VALUE_DISCARDED, p_call->function_name);
}
+
+ if (is_static && !base_type.is_meta_type && !(callee_type != GDScriptParser::Node::SUBSCRIPT && parser->current_function != nullptr && parser->current_function->is_static)) {
+ parser->push_warning(p_call, GDScriptWarning::STATIC_CALLED_ON_INSTANCE, p_call->function_name, base_type.to_string());
+ }
#endif // DEBUG_ENABLED
call_type = return_type;