diff options
author | George Marques <george@gmarqu.es> | 2020-01-09 09:03:09 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2020-01-09 09:03:09 -0300 |
commit | 41ed905c1aa2f2a55648a5cb49113ef1474b6860 (patch) | |
tree | bae4b0c325c995564bbec5855043b029a6ceef6c | |
parent | be97c4cd48e2d531829798f87022ab9f9b85c1d8 (diff) |
GDScript: Allow copy constructor for built-in types
Those are implicitly defined in Variant.
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index fc35678e65..f9cd7d8115 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -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); |