GDScript: Suppress unused constant warning with underscore

The warning message mentions that local constants prefixed with `_` does
not generate the warning. This commit actually implements this warning
suppression.
This commit is contained in:
George Marques 2024-04-17 09:40:58 -03:00
parent 658e97c93a
commit a3b3a20ac0
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
5 changed files with 10 additions and 53 deletions

View file

@ -1985,7 +1985,7 @@ void GDScriptAnalyzer::resolve_constant(GDScriptParser::ConstantNode *p_constant
#ifdef DEBUG_ENABLED
if (p_is_local) {
if (p_constant->usages == 0) {
if (p_constant->usages == 0 && !String(p_constant->identifier->name).begins_with("_")) {
parser->push_warning(p_constant, GDScriptWarning::UNUSED_LOCAL_CONSTANT, p_constant->identifier->name);
}
}