Merge pull request #57520 from jordigcs/gd-rename-map

Add hint for identifiers renamed from 3.x to 4.0
This commit is contained in:
Rémi Verschelde 2023-01-31 15:55:25 +01:00
commit 361f3f1721
No known key found for this signature in database
GPG key ID: C3336907360768E1
7 changed files with 172 additions and 16 deletions

View file

@ -163,6 +163,9 @@ String GDScriptWarning::get_message() const {
CHECK_SYMBOLS(1);
return vformat(R"(The identifier "%s" has misleading characters and might be confused with something else.)", symbols[0]);
}
case RENAMED_IN_GD4_HINT: {
break; // Renamed identifier hint is taken care of by the GDScriptAnalyzer. No message needed here.
}
case WARNING_MAX:
break; // Can't happen, but silences warning
}
@ -184,6 +187,9 @@ int GDScriptWarning::get_default_value(Code p_code) {
PropertyInfo GDScriptWarning::get_property_info(Code p_code) {
// Making this a separate function in case a warning needs different PropertyInfo in the future.
if (p_code == Code::RENAMED_IN_GD4_HINT) {
return PropertyInfo(Variant::BOOL, get_settings_path_from_code(p_code));
}
return PropertyInfo(Variant::INT, get_settings_path_from_code(p_code), PROPERTY_HINT_ENUM, "Ignore,Warn,Error");
}
@ -229,6 +235,7 @@ String GDScriptWarning::get_name_from_code(Code p_code) {
"INT_AS_ENUM_WITHOUT_MATCH",
"STATIC_CALLED_ON_INSTANCE",
"CONFUSABLE_IDENTIFIER",
"RENAMED_IN_GODOT_4_HINT"
};
static_assert((sizeof(names) / sizeof(*names)) == WARNING_MAX, "Amount of warning types don't match the amount of warning names.");