Skip to content

Commit

Permalink
[js] Make nqp::p6stateinit behave more like it does on other backends
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Apr 16, 2018
1 parent 45a30db commit 1a95d05
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/vm/js/Perl6/Ops.nqp
Expand Up @@ -123,7 +123,14 @@ $ops.add_simple_op('p6argvmarray', $ops.OBJ, [], :side_effects, sub () {
"nqp.op.p6argvmarray($*CTX, Array.prototype.slice.call(arguments))"
});

$ops.add_simple_op('p6stateinit', $ops.INT, [], sub () { $*BLOCK.first_time_marker ~ 'Init' });
$ops.add_simple_op('p6stateinit', $ops.INT, [], sub () {
# XXX - this semantics seems suspect but rakudo seems to rely on this
my $block := $*BLOCK;
while $block.qast.blocktype eq 'immediate' {
$block := $block.outer;
}
$block.first_time_marker ~ 'Init';
});

$ops.add_simple_op('p6scalarfromdesc', $ops.OBJ, [$ops.OBJ], :side_effects); # TODO not really :side_effects just needs marking as returning a fresh value

Expand Down

0 comments on commit 1a95d05

Please sign in to comment.