GDScript: Fix STANDALONE_EXPRESSION warning for preload()

This commit is contained in:
Danil Alexeev 2024-05-16 22:11:56 +03:00
parent 5708a3a02e
commit 7dd801c580
No known key found for this signature in database
GPG key ID: 124453E157DA8DC7
8 changed files with 30 additions and 7 deletions

View file

@ -3394,6 +3394,7 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
}
#ifdef DEBUG_ENABLED
// FIXME: No warning for built-in constructors and utilities due to early return.
if (p_is_root && return_type.kind != GDScriptParser::DataType::UNRESOLVED && return_type.builtin_type != Variant::NIL &&
!(p_call->is_super && p_call->function_name == GDScriptLanguage::get_singleton()->strings._init)) {
parser->push_warning(p_call, GDScriptWarning::RETURN_VALUE_DISCARDED, p_call->function_name);