diff options
author | George Marques <george@gmarqu.es> | 2021-09-13 09:09:58 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-13 09:09:58 -0300 |
commit | 64da50c88a8b9e8c8f67bd473cb4f68734003c79 (patch) | |
tree | a918d2153e6604833ba40ee9181f3d84cb4da01e /modules/gdscript/gdscript_parser.cpp | |
parent | 1994525fc285f903e8603ea5403c6062c112ce7d (diff) | |
parent | 1d1aa7a02fc64286a0c81cfb40fbf16f704d017e (diff) | |
download | redot-engine-64da50c88a8b9e8c8f67bd473cb4f68734003c79.tar.gz |
Merge pull request #52553 from ZuBsPaCe/gdscript-spurious-unassigned-variable-warning
GDScript: Removed spurious UNASSIGNED_VARIABLE warning for locals
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 6c3d4367e4..6ae3e36017 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2369,8 +2369,12 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_assignment(ExpressionNode } #ifdef DEBUG_ENABLED - if (has_operator && source_variable != nullptr && source_variable->assignments == 0) { - push_warning(assignment, GDScriptWarning::UNASSIGNED_VARIABLE_OP_ASSIGN, source_variable->identifier->name); + if (source_variable != nullptr) { + if (has_operator && source_variable->assignments == 0) { + push_warning(assignment, GDScriptWarning::UNASSIGNED_VARIABLE_OP_ASSIGN, source_variable->identifier->name); + } + + source_variable->assignments += 1; } #endif |