Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't treat scalar Positionals as slices. Fixes RT #112362.
  • Loading branch information
pmichaud committed Apr 9, 2012
1 parent f911bae commit 2c9f46f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/core/Any.pm
Expand Up @@ -129,7 +129,11 @@ my class Any {
fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
self.bind_pos($pos, $BIND)
}
multi method postcircumfix:<[ ]>(Positional $pos) is rw {
multi method postcircumfix:<[ ]>(Positional \$pos) is rw {
if nqp::iscont($pos) {
fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
return self.at_pos($pos)
}
my $list = $pos.flat;
$list.gimme(*);
$list.map($list.infinite
Expand Down Expand Up @@ -180,8 +184,10 @@ my class Any {
multi method postcircumfix:<{ }>($key, :$BIND! is parcel) is rw {
self.bind_key($key, $BIND)
}
multi method postcircumfix:<{ }>(Positional $key) is rw {
$key.map({ self{$_} }).eager.Parcel
multi method postcircumfix:<{ }>(Positional \$key) is rw {
nqp::iscont($key)
?? self.at_key($key)
!! $key.map({ self{$_} }).eager.Parcel
}
multi method postcircumfix:<{ }>(Positional $key, :$BIND!) is rw {
die "Cannot bind to a hash slice"
Expand Down

0 comments on commit 2c9f46f

Please sign in to comment.