Skip to content

Commit

Permalink
Make sure %h{|| foo} and @A[|| bar] are handled correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Nov 1, 2020
1 parent 86a208e commit 35213f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core.e/array_multislice.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ multi sub postcircumfix:<[; ]>(\SELF, @indices, :$BIND! is raw) is raw {
!! X::Bind::Slice.new(type => SELF.WHAT).throw
}

# handle the case of @a[|| 0]
multi sub postcircumfix:<[; ]>(\initial-SELF, \value, *%_) is raw {
postcircumfix:<[; ]>(initial-SELF, value.List, |%_)
}

# This candidate provides all of the multi-level array access, as well
# as providing the slow-path for assignment of a multi-level array.
multi sub postcircumfix:<[; ]>(\initial-SELF, @indices, *%_) is raw {
Expand Down
6 changes: 6 additions & 0 deletions src/core.e/hash_multislice.pm6
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# all 6.e specific sub postcircumfix {;} candidates here please

proto sub postcircumfix:<{; }>($, $, *%) is nodal {*}

# handle the case of %h{|| "a"}
multi sub postcircumfix:<{; }>(\initial-SELF, \value, *%_) is raw {
postcircumfix:<{; }>(initial-SELF, value.List, |%_)
}

multi sub postcircumfix:<{; }>(\initial-SELF, @indices,
:$exists, :$delete, :$k, :$kv, :$p, :$v
) is raw {
Expand Down

0 comments on commit 35213f6

Please sign in to comment.