shodowed var warning for `for` loop counter
Fix: #39268
(cherry picked from commit 54835a5302
)
This commit is contained in:
parent
202ca3ce7f
commit
931a927a40
|
@ -3120,6 +3120,13 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
|
||||||
|
|
||||||
IdentifierNode *id = alloc_node<IdentifierNode>();
|
IdentifierNode *id = alloc_node<IdentifierNode>();
|
||||||
id->name = tokenizer->get_token_identifier();
|
id->name = tokenizer->get_token_identifier();
|
||||||
|
#ifdef DEBUG_ENABLED
|
||||||
|
for (int j = 0; j < current_class->variables.size(); j++) {
|
||||||
|
if (current_class->variables[j].identifier == id->name) {
|
||||||
|
_add_warning(GDScriptWarning::SHADOWED_VARIABLE, id->line, id->name, itos(current_class->variables[j].line));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // DEBUG_ENABLED
|
||||||
|
|
||||||
BlockNode *check_block = p_block;
|
BlockNode *check_block = p_block;
|
||||||
while (check_block) {
|
while (check_block) {
|
||||||
|
|
Loading…
Reference in New Issue