From 41894d5b77fce5871fa09ca8dca0f9eaf5c90be9 Mon Sep 17 00:00:00 2001 From: Malcolm Anderson Date: Mon, 3 Feb 2025 17:35:19 -0800 Subject: [PATCH] Display correct symbol in warning when unique name is used without @onready annotation --- modules/gdscript/gdscript_analyzer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 60109efc4d5b..99fab724e8da 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -1093,7 +1093,12 @@ void GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode *p_class, } } if (is_get_node) { - parser->push_warning(member.variable, GDScriptWarning::GET_NODE_DEFAULT_WITHOUT_ONREADY, is_using_shorthand ? "$" : "get_node()"); + String offending_syntax = "get_node()"; + if (is_using_shorthand) { + GDScriptParser::GetNodeNode *get_node_node = static_cast(expr); + offending_syntax = get_node_node->use_dollar ? "$" : "%"; + } + parser->push_warning(member.variable, GDScriptWarning::GET_NODE_DEFAULT_WITHOUT_ONREADY, offending_syntax); } } }