On Wednesday 04 June 2008 11:28:58 Geoffrey Broadwell wrote:
> The op '$P0 = iter $P1' doesn't work if $P1 is a ResizableStringArray.
> I haven't tested, but I suspect the same may be true of the some other
> *Array PMCs as well.
>
> This should be fixed up, so we can move the 'iter' op from experimental
> to standard status.
This should do it. If you want to work up some tests, we can get this
applied.
-- c
=== src/pmc/fixedstringarray.pmc
==================================================================
--- src/pmc/fixedstringarray.pmc (revision 28076)
+++ src/pmc/fixedstringarray.pmc (local)
@@ -128,6 +128,17 @@
return (INTVAL)(size != 0);
}
+ VTABLE PMC *get_iter() {
+ PMC * const iter = pmc_new_init(INTERP, enum_class_Iterator, SELF);
+ PMC * const key = pmc_new(INTERP, enum_class_Key);
+ PMC_struct_val(iter) = key;
+ PObj_get_FLAGS(key) |= KEY_integer_FLAG;
+ VTABLE_set_integer_native(INTERP, key,
+ VTABLE_get_bool(INTERP, SELF) ? 0 : -1);
+
+ return iter;
+ }
+
/*
=item C<INTVAL elements()>