You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Autocompletion: Don't use next for GET_NODE inference
This commit is contained in:
@@ -3142,8 +3142,21 @@ static bool _get_subscript_type(GDScriptParser::CompletionContext &p_context, co
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::IdentifierNode::Source::LOCAL_VARIABLE: {
|
case GDScriptParser::IdentifierNode::Source::LOCAL_VARIABLE: {
|
||||||
if (identifier_node->next != nullptr && identifier_node->next->type == GDScriptParser::ClassNode::Node::GET_NODE) {
|
// TODO: Do basic assignment flow analysis like in `_guess_expression_type`.
|
||||||
get_node = static_cast<GDScriptParser::GetNodeNode *>(identifier_node->next);
|
const GDScriptParser::SuiteNode::Local local = identifier_node->suite->get_local(identifier_node->name);
|
||||||
|
switch (local.type) {
|
||||||
|
case GDScriptParser::SuiteNode::Local::CONSTANT: {
|
||||||
|
if (local.constant->initializer && local.constant->initializer->type == GDScriptParser::Node::GET_NODE) {
|
||||||
|
get_node = static_cast<GDScriptParser::GetNodeNode *>(local.constant->initializer);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case GDScriptParser::SuiteNode::Local::VARIABLE: {
|
||||||
|
if (local.variable->initializer && local.variable->initializer->type == GDScriptParser::Node::GET_NODE) {
|
||||||
|
get_node = static_cast<GDScriptParser::GetNodeNode *>(local.variable->initializer);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
default: {
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ extends Node
|
|||||||
|
|
||||||
func a():
|
func a():
|
||||||
var test = $AnimationPlayer
|
var test = $AnimationPlayer
|
||||||
|
var foo = 10
|
||||||
test.➡
|
test.➡
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user