summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/gdscript_function.cpp')
-rw-r--r--modules/gdscript/gdscript_function.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index 98871ddec3..b2757f1b0b 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -328,18 +328,18 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
continue;
}
- if (!argument_types[i].is_type(*p_args[i], true)) {
- r_err.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
- r_err.argument = i;
- r_err.expected = argument_types[i].kind == GDScriptDataType::BUILTIN ? argument_types[i].builtin_type : Variant::OBJECT;
- return Variant();
- }
- if (argument_types[i].kind == GDScriptDataType::BUILTIN) {
- Variant arg = Variant::construct(argument_types[i].builtin_type, &p_args[i], 1, r_err);
- memnew_placement(&stack[i], Variant(arg));
- } else {
- memnew_placement(&stack[i], Variant(*p_args[i]));
+ if (!argument_types[i].is_type(*p_args[i])) {
+ if (argument_types[i].is_type(Variant())) {
+ memnew_placement(&stack[i], Variant);
+ continue;
+ } else {
+ r_err.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_err.argument = i;
+ r_err.expected = argument_types[i].kind == GDScriptDataType::BUILTIN ? argument_types[i].builtin_type : Variant::OBJECT;
+ return Variant();
+ }
}
+ memnew_placement(&stack[i], Variant(*p_args[i]));
}
for (int i = p_argcount; i < _stack_size; i++) {
memnew_placement(&stack[i], Variant);