Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "get "is default" working in the setting"
This breaks the @A[my int $a=4]:adverb case  :-(
  • Loading branch information
lizmat committed Oct 9, 2013
1 parent dfe582d commit 2df2426
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
21 changes: 18 additions & 3 deletions src/core/array_slice.pm
Expand Up @@ -17,16 +17,31 @@ sub POSITIONS (\SELF, \pos) { # handle possible infinite slices
proto sub postcircumfix:<[ ]>(|) { * }

# @a[1]
multi sub postcircumfix:<[ ]>( \SELF, int $pos ) is rw is default {
multi sub postcircumfix:<[ ]>( \SELF, int $pos ) is rw {
fail "Cannot use negative index $pos on {SELF.WHAT.perl}" if $pos < 0;
SELF.at_pos($pos);
}
multi sub postcircumfix:<[ ]>(\SELF, int $pos, Mu :$BIND! is parcel) is rw {
fail "Cannot use negative index $pos on {SELF.WHAT.perl}" if $pos < 0;
SELF.bind_pos($pos, $BIND);
}
multi sub postcircumfix:<[ ]>( \SELF, int $pos, *%adv ) is rw {
SLICE_ONE( SELF, $pos, True, |%adv );
multi sub postcircumfix:<[ ]>( \SELF, int $pos, :$delete!, *%other ) is rw {
SLICE_ONE( SELF, $pos, True, :$delete, |%other );
}
multi sub postcircumfix:<[ ]>( \SELF, int $pos, :$exists!, *%other ) is rw {
SLICE_ONE( SELF, $pos, True, :$exists, |%other );
}
multi sub postcircumfix:<[ ]>( \SELF, int $pos, :$kv!, *%other ) is rw {
SLICE_ONE( SELF, $pos, True, :$kv, |%other );
}
multi sub postcircumfix:<[ ]>( \SELF, int $pos, :$p!, *%other ) is rw {
SLICE_ONE( SELF, $pos, True, :$p, |%other );
}
multi sub postcircumfix:<[ ]>( \SELF, int $pos, :$k!, *%other ) is rw {
SLICE_ONE( SELF, $pos, True, :$k, |%other );
}
multi sub postcircumfix:<[ ]>( \SELF, int $pos, :$v!, *%other ) is rw {
SLICE_ONE( SELF, $pos, True, :$v, |%other );
}

# @a[$x]
Expand Down
4 changes: 1 addition & 3 deletions src/core/traits.pm
Expand Up @@ -91,9 +91,7 @@ multi trait_mod:<is>(Routine:D $r, :$parcel!) {
$r.set_rw(); # for now, until we have real parcel handling
}
multi trait_mod:<is>(Routine:D $r, :$default!) {
# needed in bootstrap of postcircumfix:<[ ]> where infix:<does> isn't
# defined yet, so cheat.
$r.HOW.mixin($r, role { method default() { True } });
$r does role { method default() { True } }
}
multi trait_mod:<is>(Routine:D $r, :$DEPRECATED!) {
my $new := $DEPRECATED ~~ Bool
Expand Down

0 comments on commit 2df2426

Please sign in to comment.