summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_parser.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-09 13:42:10 +0100
committerGitHub <noreply@github.com>2020-01-09 13:42:10 +0100
commite97e951741c5f1a5865e1b551edb184af6374999 (patch)
treec00d1dd1ee1e73dd3ab6c77563f7a894ab7026b5 /modules/gdscript/gdscript_parser.cpp
parent05a3e0e34420cd4692b74e64a0b7660338b30bc5 (diff)
parent41ed905c1aa2f2a55648a5cb49113ef1474b6860 (diff)
Merge pull request #34948 from vnen/gdscript-copy-constructor
GDScript: Allow copy constructor for built-in types
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r--modules/gdscript/gdscript_parser.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 54e6f43917..a33d20e433 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);