Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Be more careful about preserving the values of Junctions
This allows autoviv to work in things like:

    my @A := [1,2]; @A[1|2] //= 3; say @A
  • Loading branch information
Mouq committed Mar 12, 2015
1 parent 3da1bbd commit 595ffe3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/Junction.pm
Expand Up @@ -74,10 +74,10 @@ my class Junction { # declared in BOOTSTRAP
my @states := nqp::getattr(nqp::decont($arg), Junction, '$!storage');

my Mu $res := nqp::list();
for @states -> $s {
for @states -> \st {
# Next line is Officially Naughty, since captures are meant to be
# immutable. But hey, it's our capture to be naughty with...
nqp::bindpos($pos_rpa, $i, $s);
nqp::bindpos($pos_rpa, $i, st);
nqp::push($res, call(|args));
Nil;
}
Expand Down Expand Up @@ -118,8 +118,8 @@ my class Junction { # declared in BOOTSTRAP
my @states := nqp::getattr(nqp::decont($v), Junction, '$!storage');
my $type := nqp::getattr(nqp::decont($v), Junction, '$!type');
my Mu $res := nqp::list();
for @states -> $s {
nqp::bindkey($nam_hash, $k, $s);
for @states -> \st {
nqp::bindkey($nam_hash, $k, st);
nqp::push($res, call(|args));
Nil;
}
Expand Down

0 comments on commit 595ffe3

Please sign in to comment.