summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r--modules/gdscript/gdscript_parser.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index a06ecb1ea8..ca452bf008 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -2821,6 +2821,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
#ifdef DEBUG_ENABLED
+ pending_newline = -1; // reset for the new block
+
NewLineNode *nl = alloc_node<NewLineNode>();
nl->line = tokenizer->get_token_line();
@@ -3178,6 +3180,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
BlockNode *check_block = p_block;
while (check_block) {