Skip to content

Commit

Permalink
Implement @A[1;1] := ....
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Sep 9, 2015
1 parent 62cbcec commit fe5ef83
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Perl6/Actions.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -5724,14 +5724,18 @@ Compilation unit '$file' contained the following violations:
}
elsif $target.isa(QAST::Op) && $target.op eq 'hllize' &&
$target[0].isa(QAST::Op) && $target[0].op eq 'call' &&
($target[0].name eq '&postcircumfix:<[ ]>' || $target[0].name eq '&postcircumfix:<{ }>') {
($target[0].name eq '&postcircumfix:<[ ]>' ||
$target[0].name eq '&postcircumfix:<{ }>' ||
$target[0].name eq '&postcircumfix:<[; ]>') {
$source.named('BIND');
$target[0].push($source);
$target.annotate('nosink', 1);
make $target;
}
elsif $target.isa(QAST::Op) && $target.op eq 'call' &&
($target.name eq '&postcircumfix:<[ ]>' || $target.name eq '&postcircumfix:<{ }>') {
($target.name eq '&postcircumfix:<[ ]>' ||
$target.name eq '&postcircumfix:<{ }>' ||
$target.name eq '&postcircumfix:<[; ]>') {
$source.named('BIND');
$target.push($source);
$target.annotate('nosink', 1);
Expand Down
13 changes: 13 additions & 0 deletions src/core/array_slice.pm
Original file line number Diff line number Diff line change
Expand Up @@ -501,4 +501,17 @@ multi sub postcircumfix:<[; ]>(\SELF, @indices, :$delete!) is rw {
}
}

multi sub postcircumfix:<[; ]>(\SELF, @indices, :$BIND! is rw) is rw {
my int $n = @indices.elems;
my int $i = 0;
my $all-ints := True;
while $i < $n {
$all-ints := False unless nqp::istype(@indices.AT-POS($i), Int);
$i = $i + 1;
}
$all-ints
?? SELF.BIND-POS(|@indices, $BIND)
!! X::Bind::Slice.new(type => SELF.WHAT).throw;
}

# vim: ft=perl6 expandtab sw=4

0 comments on commit fe5ef83

Please sign in to comment.