Skip to content
Browse files

Replace several cheat returns of Mu with actual returns of fail messa…

…ges.
  • Loading branch information...
1 parent dc293ee commit 920640fd95e816adbb6b95935720b663d8bb1c59 @colomon colomon committed Dec 9, 2009
Showing with 6 additions and 8 deletions.
  1. +2 −4 src/core/Any-str.pm
  2. +4 −4 src/core/Array.pm
View
6 src/core/Any-str.pm
@@ -87,8 +87,7 @@ augment class Any {
}
my $result = pir::index__ISSi(self, $substring, $pos);
- # fail("Substring '$substring' not found in '{self}'") if ($result < 0);
- if $result < 0 { return Mu; } # no StrPos yet
+ fail("Substring '$substring' not found in '{self}'") if $result < 0;
return $result;
# also used to be a the following error message, but the condition
@@ -104,8 +103,7 @@ augment class Any {
# }
#
# my $result = pir::reverse_index__ISSi(self, $substring, $pos);
- # # fail("Substring '$substring' not found in '{self}'") if ($result < 0);
- # if $result < 0 { return Mu; } # no StrPos yet
+ # fail("Substring '$substring' not found in '{self}'") if $result < 0;
# return $result;
#
# # also used to be a the following error message, but the condition
View
8 src/core/Array.pm
@@ -27,14 +27,14 @@ augment class Array {
self;
}
- #CHEAT: Should return fail rather than Mu
our multi method pop() {
- self.elems > 0 ?? pir::pop__PP($!values) !! Mu;
+ self.elems > 0 ?? pir::pop__PP($!values)
+ !! fail('Undefined value popped from empty array');
}
- #CHEAT: Should return fail rather than Mu
our multi method shift() {
- self.elems > 0 ?? pir::shift__PP($!values) !! Mu;
+ self.elems > 0 ?? pir::shift__PP($!values)
+ !! fail('Undefined value shifted from empty array');
}
}

0 comments on commit 920640f

Please sign in to comment.
Something went wrong with that request. Please try again.