You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Fix analyzer pushing SHADOWED_VARIABLE warning for members shadowed in subclasses
This fixes a bug in the analyzer where it did not push the SHADOWED_VARIABLE_BASE_CLASS warning for members shadowed by variable in subclass. It does this by comparing the class which contains the shadowed member with the class containing the variable, and pushing SHADOWED_VARIABLE only if the classes are the same. Additionally, SHADOWED_VARIABLE_BASE_CLASS can take an extra symbol which helps to specify the line for non native base class.
This commit is contained in:
@@ -61,10 +61,13 @@ String GDScriptWarning::get_message() const {
|
||||
return vformat(R"(The signal "%s" is declared but never explicitly used in the class.)", symbols[0]);
|
||||
case SHADOWED_VARIABLE:
|
||||
CHECK_SYMBOLS(4);
|
||||
return vformat(R"(The local %s "%s" is shadowing an already-declared %s at line %s.)", symbols[0], symbols[1], symbols[2], symbols[3]);
|
||||
return vformat(R"(The local %s "%s" is shadowing an already-declared %s at line %s in the current class.)", symbols[0], symbols[1], symbols[2], symbols[3]);
|
||||
case SHADOWED_VARIABLE_BASE_CLASS:
|
||||
CHECK_SYMBOLS(4);
|
||||
return vformat(R"(The local %s "%s" is shadowing an already-declared %s at the base class "%s".)", symbols[0], symbols[1], symbols[2], symbols[3]);
|
||||
if (symbols.size() > 4) {
|
||||
return vformat(R"(The local %s "%s" is shadowing an already-declared %s at line %s in the base class "%s".)", symbols[0], symbols[1], symbols[2], symbols[3], symbols[4]);
|
||||
}
|
||||
return vformat(R"(The local %s "%s" is shadowing an already-declared %s in the base class "%s".)", symbols[0], symbols[1], symbols[2], symbols[3]);
|
||||
case SHADOWED_GLOBAL_IDENTIFIER:
|
||||
CHECK_SYMBOLS(3);
|
||||
return vformat(R"(The %s "%s" has the same name as a %s.)", symbols[0], symbols[1], symbols[2]);
|
||||
|
||||
Reference in New Issue
Block a user