GDScript: Allow copy constructor for built-in types

Those are implicitly defined in Variant.
This commit is contained in:
George Marques 2020-01-09 09:03:09 -03:00
parent be97c4cd48
commit 41ed905c1a
No known key found for this signature in database
GPG Key ID: 046BD46A3201E43D
1 changed files with 11 additions and 0 deletions

View File

@ -6965,6 +6965,17 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
if (error_set) return DataType();
// Special case: check copy constructor. Those are defined implicitly in Variant.
if (par_types.size() == 1) {
if (!par_types[0].has_type || (par_types[0].kind == DataType::BUILTIN && par_types[0].builtin_type == tn->vtype)) {
DataType result;
result.has_type = true;
result.kind = DataType::BUILTIN;
result.builtin_type = tn->vtype;
return result;
}
}
bool match = false;
List<MethodInfo> constructors;
Variant::get_constructor_list(tn->vtype, &constructors);