mirror of
https://github.com/godotengine/godot.git
synced 2025-11-02 06:31:13 +00:00
Add STATIC_CALLED_ON_INSTANCE warning to highlight
when static functions are called directly from objects
This commit is contained in:
parent
39534a7aec
commit
0a51bb4ca5
6 changed files with 31 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue