mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 23:31:53 -05:00
Check if any global script class is shadowed by a variable
This commit is contained in:
committed by
Chia-Hsiang Cheng
parent
7e67b496ff
commit
ceda13720b
@@ -5036,7 +5036,11 @@ void GDScriptAnalyzer::is_shadowing(GDScriptParser::IdentifierNode *p_identifier
|
||||
parser->push_warning(p_identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_context, name, "built-in function");
|
||||
return;
|
||||
} else if (ClassDB::class_exists(name)) {
|
||||
parser->push_warning(p_identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_context, name, "global class");
|
||||
parser->push_warning(p_identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_context, name, "native class");
|
||||
return;
|
||||
} else if (ScriptServer::is_global_class(name)) {
|
||||
String class_path = ScriptServer::get_global_class_path(name).get_file();
|
||||
parser->push_warning(p_identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_context, name, vformat(R"(global class defined in "%s")", class_path));
|
||||
return;
|
||||
} else if (GDScriptParser::get_builtin_type(name) != Variant::VARIANT_MAX) {
|
||||
parser->push_warning(p_identifier, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_context, name, "built-in type");
|
||||
|
||||
Reference in New Issue
Block a user