diff options
author | lupoDharkael <izhe@hotmail.es> | 2019-04-15 15:51:52 +0200 |
---|---|---|
committer | lupoDharkael <izhe@hotmail.es> | 2019-04-15 18:19:14 +0200 |
commit | 14078fbb826811ca77e0eef3684f2e5d6f55a6b5 (patch) | |
tree | c05d5ae5396d82c9ff7f0117620c48d212159c06 /modules/gdscript/gdscript.cpp | |
parent | 0d87535dd776bb937c280d8465221e8e6661b017 (diff) | |
download | redot-engine-14078fbb826811ca77e0eef3684f2e5d6f55a6b5.tar.gz |
GDScript: add variable shadowing warning
Diffstat (limited to 'modules/gdscript/gdscript.cpp')
-rw-r--r-- | modules/gdscript/gdscript.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 0676317f6e..eada389c51 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1945,6 +1945,10 @@ String GDScriptWarning::get_message() const { CHECK_SYMBOLS(1); return "The local variable '" + symbols[0] + "' is declared but never used in the block."; } break; + case SHADOWED_VARIABLE: { + CHECK_SYMBOLS(2); + return "The local variable '" + symbols[0] + "' is shadowing an already defined variable at line " + symbols[1] + "."; + } break; case UNUSED_CLASS_VARIABLE: { CHECK_SYMBOLS(1); return "The class variable '" + symbols[0] + "' is declared but never used in the script."; @@ -2048,6 +2052,7 @@ String GDScriptWarning::get_name_from_code(Code p_code) { "UNASSIGNED_VARIABLE", "UNASSIGNED_VARIABLE_OP_ASSIGN", "UNUSED_VARIABLE", + "SHADOWED_VARIABLE", "UNUSED_CLASS_VARIABLE", "UNUSED_ARGUMENT", "UNREACHABLE_CODE", |