diff options
author | Thakee Nathees <thakeenathees@gmail.com> | 2020-06-04 10:28:09 +0530 |
---|---|---|
committer | Thakee Nathees <thakeenathees@gmail.com> | 2020-06-04 10:28:09 +0530 |
commit | 54835a530210c9620973a63dd30ff1d6bbe43a96 (patch) | |
tree | acead5402e402bde7b7d5763e050f2227f4f6244 /modules/gdscript | |
parent | 2aa46ee4ae252b9cd13e6c8e4ace8a68ee14398b (diff) |
shodowed var warning for `for` loop counter
Fix: #39268
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 0e498f6895..36ebf84502 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -3178,6 +3178,13 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { IdentifierNode *id = alloc_node<IdentifierNode>(); 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 tokenizer->advance(); |