mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Display correct symbol in warning when unique name is used without @onready annotation
Add tests for `GET_NODE_DEFAULT_WITHOUT_ONREADY` warning with unique nodes Small modifications to tests
This commit is contained in:
parent
f0f5319b0b
commit
8e8f93cf0c
3 changed files with 24 additions and 3 deletions
|
|
@ -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<GDScriptParser::GetNodeNode *>(expr);
|
||||
offending_syntax = get_node_node->use_dollar ? "$" : "%";
|
||||
}
|
||||
parser->push_warning(member.variable, GDScriptWarning::GET_NODE_DEFAULT_WITHOUT_ONREADY, offending_syntax);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue