Fix completion for the raw get_node call

This commit is contained in:
Yuri Rubinsky 2022-12-06 10:29:55 +03:00
parent f3e6750a7e
commit 20660bb23a

View file

@ -2512,8 +2512,17 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
}
static bool _get_subscript_type(GDScriptParser::CompletionContext &p_context, const GDScriptParser::SubscriptNode *p_subscript, GDScriptParser::DataType &r_base_type, Variant *r_base = nullptr) {
if (p_subscript->base->type == GDScriptParser::Node::IDENTIFIER && p_context.base != nullptr) {
if (p_context.base == nullptr) {
return false;
}
const GDScriptParser::GetNodeNode *get_node = nullptr;
switch (p_subscript->base->type) {
case GDScriptParser::Node::GET_NODE: {
get_node = static_cast<GDScriptParser::GetNodeNode *>(p_subscript->base);
} break;
case GDScriptParser::Node::IDENTIFIER: {
const GDScriptParser::IdentifierNode *identifier_node = static_cast<GDScriptParser::IdentifierNode *>(p_subscript->base);
switch (identifier_node->source) {
@ -2540,8 +2549,12 @@ static bool _get_subscript_type(GDScriptParser::CompletionContext &p_context, co
get_node = static_cast<GDScriptParser::GetNodeNode *>(identifier_node->next);
}
} break;
default:
break;
default: {
} break;
}
} break;
default: {
} break;
}
if (get_node != nullptr) {
@ -2557,7 +2570,6 @@ static bool _get_subscript_type(GDScriptParser::CompletionContext &p_context, co
return true;
}
}
}
return false;
}