diff --git a/src/core/Iterable.pm b/src/core/Iterable.pm index 838612208bc..2c4a1ee80fb 100644 --- a/src/core/Iterable.pm +++ b/src/core/Iterable.pm @@ -192,7 +192,7 @@ my role Iterable { multi method SetHash(Iterable:D:) { SETIFY(self,SetHash) } } -#?if jvm +#?if !moar nqp::p6setitertype(Iterable); #?endif diff --git a/src/vm/js/Perl6/Ops.nqp b/src/vm/js/Perl6/Ops.nqp index 78dc1aec164..04dee35b5d4 100644 --- a/src/vm/js/Perl6/Ops.nqp +++ b/src/vm/js/Perl6/Ops.nqp @@ -40,9 +40,7 @@ $ops.add_simple_op('p6setautothreader', $ops.VOID, [$ops.OBJ], sub ($autothreade "nqp.p6binder.set_autothreader($*CTX, null, nqp.p6binder, $autothreader)" }, :side_effects); -$ops.add_simple_op('p6setitertype', $ops.VOID, [$ops.OBJ], sub ($iterable) { - "nqp.p6binder.set_iterable($*CTX, null, nqp.p6binder, $iterable)" -}, :side_effects); +$ops.add_simple_op('p6setitertype', $ops.VOID, [$ops.OBJ], :side_effects); $ops.add_simple_op('p6trialbind', $ops.OBJ, [$ops.OBJ, $ops.OBJ, $ops.OBJ], :!inlinable, sub ($sig, $args, $sig_flags) { "nqp.p6binder.trial_bind($*CTX, null, nqp.p6binder, $sig, $args, $sig_flags)" diff --git a/src/vm/js/perl6-runtime/runtime.js b/src/vm/js/perl6-runtime/runtime.js index de16bbde155..0c339cb296c 100644 --- a/src/vm/js/perl6-runtime/runtime.js +++ b/src/vm/js/perl6-runtime/runtime.js @@ -4,6 +4,8 @@ module.exports.load = function(nqp, CodeRef, Capture, containerSpecs) { let Scalar, True, False, Int, Num, Str, Code, Mu, Any, ContainerDescriptor, Routine; + let Iterable; + let defaultContainerDescriptor; op.p6settypes = function(types) { @@ -227,6 +229,11 @@ module.exports.load = function(nqp, CodeRef, Capture, containerSpecs) { return value; }; + op.p6setitertype = function(type) { + Iterable = type; + return type; + }; + op.p6store = function(ctx, cont, value) { if (cont.$$assign) { cont.$$assign(ctx, value.$$decont(ctx));