summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_function.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-03-04 10:19:00 +0100
committerGitHub <noreply@github.com>2019-03-04 10:19:00 +0100
commit7889e9b7ca30418d914b8c698ea39490bc9be990 (patch)
treea2ebacc202fdca89f0e958e0c8af7cf0b34975cd /modules/gdscript/gdscript_function.cpp
parent31206ca4e98d55767f73416a4ce1b915be4c928e (diff)
parentd0b08342b8250aa76cdf934b97f2ab3ac114e259 (diff)
Merge pull request #26562 from vnen/gdscript-no-implicit-cast
Forbid implicit type conversion in GDScript
Diffstat (limited to 'modules/gdscript/gdscript_function.cpp')
-rw-r--r--modules/gdscript/gdscript_function.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index cff9ba55b8..b2757f1b0b 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -328,8 +328,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
continue;
}
- if (!argument_types[i].is_type(*p_args[i], true)) {
- if (argument_types[i].is_type(Variant(), true)) {
+ if (!argument_types[i].is_type(*p_args[i])) {
+ if (argument_types[i].is_type(Variant())) {
memnew_placement(&stack[i], Variant);
continue;
} else {
@@ -339,12 +339,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
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]));
- }
+ memnew_placement(&stack[i], Variant(*p_args[i]));
}
for (int i = p_argcount; i < _stack_size; i++) {
memnew_placement(&stack[i], Variant);