diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-09-26 13:44:56 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-09-26 13:44:56 +0200 |
commit | 10c3941a9a85958ec9fb2bd296a466659fb5363c (patch) | |
tree | cc50911f38802998bdf86a0beb6ce9bfefa5f373 /modules/gdscript/gdscript_analyzer.cpp | |
parent | 017541bcec6a6887a0e68d6eaa770163ed7b1846 (diff) | |
parent | ceda13720bea46d2471eea5be03ced3282ee2063 (diff) | |
download | redot-engine-10c3941a9a85958ec9fb2bd296a466659fb5363c.tar.gz |
Merge pull request #80587 from garychia/shadowed_class_name
Check if any global script class is shadowed by a variable
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 92050154b5..469c52dc9d 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -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"); |