mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
GDScript: Forbid implicit type conversion
Since types are not present in release builds, this could cause issues where a variable does not have the exact defined type.
This commit is contained in:
parent
a1e73dcc94
commit
d0b08342b8
4 changed files with 16 additions and 110 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue