Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make .pick/.roll on Enums behave sanely
Same.pick could return Less or More.  Now only Order.pick will return either
Less, Same or More.  Same for .roll.  As discussed from
http://irclog.perlgeek.de/perl6/2014-03-26#i_8496012
  • Loading branch information
lizmat committed Mar 27, 2014
1 parent 15ece87 commit 68e0948
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/Enumeration.pm
Expand Up @@ -24,10 +24,14 @@ my role Enumeration {
}

method pick(*@pos, *%named) {
self.^enum_value_list.pick(|@pos, |%named)
self.defined
?? self xx +?( @pos[0] // 1 )
!! self.^enum_value_list.pick(|@pos, |%named);
}
method roll(*@pos, *%named) {
self.^enum_value_list.roll(|@pos, |%named)
self.defined
?? self xx ( @pos[0] // 1 )
!! self.^enum_value_list.roll(|@pos, |%named);
}

method Int(::?CLASS:D:) {
Expand Down

0 comments on commit 68e0948

Please sign in to comment.