GDScript: Fix type deduction for functions without return statements
This commit is contained in:
@@ -2510,15 +2510,8 @@ GDScriptFunction *GDScriptCompiler::_parse_function(Error &r_error, GDScript *p_
|
||||
}
|
||||
|
||||
if (p_func) {
|
||||
// If no `return` statement, then return type is `void`, not `Variant`.
|
||||
if (p_func->body->has_return) {
|
||||
gd_function->return_type = _gdtype_from_datatype(p_func->get_datatype(), p_script);
|
||||
method_info.return_val = p_func->get_datatype().to_property_info(String());
|
||||
} else {
|
||||
gd_function->return_type = GDScriptDataType();
|
||||
gd_function->return_type.kind = GDScriptDataType::BUILTIN;
|
||||
gd_function->return_type.builtin_type = Variant::NIL;
|
||||
}
|
||||
gd_function->return_type = _gdtype_from_datatype(p_func->get_datatype(), p_script);
|
||||
method_info.return_val = p_func->get_datatype().to_property_info(String());
|
||||
|
||||
if (p_func->is_vararg()) {
|
||||
gd_function->_vararg_index = vararg_addr.address;
|
||||
|
||||
Reference in New Issue
Block a user