diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-18 23:08:11 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-18 23:08:11 +0100 |
commit | 5f73d55dfb6a4423bb0d0974807b64a3332a362d (patch) | |
tree | 2ee42baee7c9c0059b4fbd95afa6451ae0f541cf | |
parent | 80b3813b1505a6bd195c0b0aac1555a7969e59c9 (diff) | |
parent | ef2aeca5dfbc7fd88132093b766439be244741fe (diff) |
Merge pull request #68854 from anvilfolk/highlight-var
Add error highlighting for duplicate variables/constants
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index ce14b412c7..6fd1362e68 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -1541,7 +1541,7 @@ GDScriptParser::SuiteNode *GDScriptParser::parse_suite(const String &p_context, VariableNode *variable = static_cast<VariableNode *>(statement); const SuiteNode::Local &local = current_suite->get_local(variable->identifier->name); if (local.type != SuiteNode::Local::UNDEFINED) { - push_error(vformat(R"(There is already a %s named "%s" declared in this scope.)", local.get_name(), variable->identifier->name)); + push_error(vformat(R"(There is already a %s named "%s" declared in this scope.)", local.get_name(), variable->identifier->name), variable->identifier); } current_suite->add_local(variable, current_function); break; @@ -1556,7 +1556,7 @@ GDScriptParser::SuiteNode *GDScriptParser::parse_suite(const String &p_context, } else { name = "variable"; } - push_error(vformat(R"(There is already a %s named "%s" declared in this scope.)", name, constant->identifier->name)); + push_error(vformat(R"(There is already a %s named "%s" declared in this scope.)", name, constant->identifier->name), constant->identifier); } current_suite->add_local(constant, current_function); break; |