Skip to content

Commit

Permalink
Restore original .defined semantic in .minmax
Browse files Browse the repository at this point in the history
Except that a Failure will always throw.  Only noise-levels slower.
  • Loading branch information
lizmat committed May 1, 2016
1 parent 4379cf0 commit 6df0539
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/core/Any-iterable-methods.pm
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,10 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
my int $excludes-max;

for self.list {
if nqp::defined($_) {
if nqp::istype($_,Failure) {
.throw; # XXX or just ignore ???
}
elsif .defined {
if nqp::istype($_,Range) {
if !$min.defined || $cmp($_.min, $min) < 0 {
$min = .min;
Expand Down
5 changes: 4 additions & 1 deletion src/core/Supply.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,10 @@ my class Supply {
my $min;
my $max;
whenever self -> \val {
if nqp::defined(val) {
if nqp::istype(val,Failure) {
val.throw; # XXX or just ignore ???
}
elsif val.defined {
if !$min.defined {
emit( Range.new($min = val, $max = val) );
}
Expand Down

0 comments on commit 6df0539

Please sign in to comment.