Fix crash in gdscript when autocompleting virtual function and signature does not match base.

This commit is contained in:
Eric M 2023-02-02 22:47:41 +10:00
parent 315d3c4d21
commit 9b93bdb4e7

View file

@ -1953,6 +1953,7 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context,
case GDScriptParser::DataType::CLASS:
if (base_type.class_type->has_function(p_context.current_function->identifier->name)) {
GDScriptParser::FunctionNode *parent_function = base_type.class_type->get_member(p_context.current_function->identifier->name).function;
if (parent_function->parameters_indices.has(p_identifier)) {
const GDScriptParser::ParameterNode *parameter = parent_function->parameters[parent_function->parameters_indices[p_identifier]];
if ((!id_type.is_set() || id_type.is_variant()) && parameter->get_datatype().is_hard_type()) {
id_type = parameter->get_datatype();
@ -1967,6 +1968,7 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context,
}
}
}
}
base_type = base_type.class_type->base_type;
break;
case GDScriptParser::DataType::NATIVE: {