godot
godot copied to clipboard
GDScript: Fix object iterator opcodes
- Fixes #89290.
See core methods for reference:
https://github.com/godotengine/godot/blob/7abe0c6014022874378cb64a11b26b0f0f178324/core/variant/variant_setget.cpp#L1304-L1924
There are some weird errors on the CI tests though, not sure what's going on.
There are some weird errors on the CI tests though, not sure what's going on.
- See #91120.
To fix #74686 and #91155 I added the following:
@@ -2998,11 +2998,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
VariantInternal::initialize(&vref, Variant::ARRAY);
*VariantInternal::get_array(&vref) = ref;
- Variant **args = instruction_args; // Overriding an instruction argument, but we don't need access to that anymore.
- args[0] = &vref;
+ const Variant *args[] = { &vref };
Callable::CallError ce;
- Variant has_next = obj->callp(CoreStringNames::get_singleton()->_iter_init, (const Variant **)args, 1, ce);
+ Variant has_next = obj->callp(CoreStringNames::get_singleton()->_iter_init, args, 1, ce);
#ifdef DEBUG_ENABLED
if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) {
@@ -3332,11 +3331,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
VariantInternal::initialize(&vref, Variant::ARRAY);
*VariantInternal::get_array(&vref) = ref;
- Variant **args = instruction_args; // Overriding an instruction argument, but we don't need access to that anymore.
- args[0] = &vref;
+ const Variant *args[] = { &vref };
Callable::CallError ce;
- Variant has_next = obj->callp(CoreStringNames::get_singleton()->_iter_next, (const Variant **)args, 1, ce);
+ Variant has_next = obj->callp(CoreStringNames::get_singleton()->_iter_next, args, 1, ce);
#ifdef DEBUG_ENABLED
if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) {
Thanks!