Merge pull request #69897 from poohcom1/fix/function-return-completion
Fix autocomplete on functions returning variants
This commit is contained in:
commit
05097ded0a
|
@ -2272,6 +2272,11 @@ static bool _guess_method_return_type_from_base(GDScriptParser::CompletionContex
|
||||||
if (base_type.class_type->has_function(p_method)) {
|
if (base_type.class_type->has_function(p_method)) {
|
||||||
const GDScriptParser::FunctionNode *method = base_type.class_type->get_member(p_method).function;
|
const GDScriptParser::FunctionNode *method = base_type.class_type->get_member(p_method).function;
|
||||||
if (!is_static || method->is_static) {
|
if (!is_static || method->is_static) {
|
||||||
|
if (method->get_datatype().is_set() && !method->get_datatype().is_variant()) {
|
||||||
|
r_type.type = method->get_datatype();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int last_return_line = -1;
|
int last_return_line = -1;
|
||||||
const GDScriptParser::ExpressionNode *last_returned_value = nullptr;
|
const GDScriptParser::ExpressionNode *last_returned_value = nullptr;
|
||||||
GDScriptParser::CompletionContext c = p_context;
|
GDScriptParser::CompletionContext c = p_context;
|
||||||
|
@ -2285,10 +2290,6 @@ static bool _guess_method_return_type_from_base(GDScriptParser::CompletionContex
|
||||||
if (_guess_expression_type(c, last_returned_value, r_type)) {
|
if (_guess_expression_type(c, last_returned_value, r_type)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (method->get_datatype().is_set() && !method->get_datatype().is_variant()) {
|
|
||||||
r_type.type = method->get_datatype();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue