Skip to content

Commit

Permalink
[js] Set the Iterable using nqp::p6setitertype
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Sep 23, 2017
1 parent f386b98 commit cc5d957
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/Iterable.pm
Expand Up @@ -192,7 +192,7 @@ my role Iterable {
multi method SetHash(Iterable:D:) { SETIFY(self,SetHash) }
}

#?if jvm
#?if !moar
nqp::p6setitertype(Iterable);
#?endif

Expand Down
4 changes: 1 addition & 3 deletions src/vm/js/Perl6/Ops.nqp
Expand Up @@ -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)"
Expand Down
7 changes: 7 additions & 0 deletions src/vm/js/perl6-runtime/runtime.js
Expand Up @@ -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) {
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit cc5d957

Please sign in to comment.