mirror of
https://github.com/godotengine/godot.git
synced 2025-10-29 20:51:14 +00:00
Check if any global script class is shadowed by a variable
This commit is contained in:
parent
7e67b496ff
commit
ceda13720b
3 changed files with 21 additions and 10 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue