Merge pull request #72592 from EricEzaM/67008-autocomplete-crash-virtual-fn
Fix crash in gdscript when autocompleting virtual function and signature does not match base.
This commit is contained in:
commit
50022484a3
|
@ -1953,17 +1953,19 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context,
|
||||||
case GDScriptParser::DataType::CLASS:
|
case GDScriptParser::DataType::CLASS:
|
||||||
if (base_type.class_type->has_function(p_context.current_function->identifier->name)) {
|
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;
|
GDScriptParser::FunctionNode *parent_function = base_type.class_type->get_member(p_context.current_function->identifier->name).function;
|
||||||
const GDScriptParser::ParameterNode *parameter = parent_function->parameters[parent_function->parameters_indices[p_identifier]];
|
if (parent_function->parameters_indices.has(p_identifier)) {
|
||||||
if ((!id_type.is_set() || id_type.is_variant()) && parameter->get_datatype().is_hard_type()) {
|
const GDScriptParser::ParameterNode *parameter = parent_function->parameters[parent_function->parameters_indices[p_identifier]];
|
||||||
id_type = parameter->get_datatype();
|
if ((!id_type.is_set() || id_type.is_variant()) && parameter->get_datatype().is_hard_type()) {
|
||||||
}
|
id_type = parameter->get_datatype();
|
||||||
if (parameter->initializer) {
|
}
|
||||||
GDScriptParser::CompletionContext c = p_context;
|
if (parameter->initializer) {
|
||||||
c.current_function = parent_function;
|
GDScriptParser::CompletionContext c = p_context;
|
||||||
c.current_class = base_type.class_type;
|
c.current_function = parent_function;
|
||||||
c.base = nullptr;
|
c.current_class = base_type.class_type;
|
||||||
if (_guess_expression_type(c, parameter->initializer, r_type)) {
|
c.base = nullptr;
|
||||||
return true;
|
if (_guess_expression_type(c, parameter->initializer, r_type)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue