Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More True/False changes.
  • Loading branch information
pmichaud committed Jul 5, 2011
1 parent 7019642 commit 87e9756
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/core/Failure.pm
Expand Up @@ -16,10 +16,10 @@ my class Failure {
# but obscure problems prevent us from making Mu.defined
# a multi. See http://irclog.perlgeek.de/perl6/2011-06-28#i_4016747
method defined() {
$!handled =1 if nqp::p6bool(pir::repr_defined__IP(self));
0.Bool;
$!handled =1 if pir::repr_defined__IP(self);
Bool::False;
}
multi method Bool(Failure:D:) { $!handled = 1; 0.Bool; }
multi method Bool(Failure:D:) { $!handled = 1; Bool::False; }

method Int(Failure:D:) { $!handled ?? 0 !! $!exception.rethrow; }
method Num(Failure:D:) { $!handled ?? 0e0 !! $!exception.rethrow; }
Expand Down
3 changes: 1 addition & 2 deletions src/core/Int.pm
Expand Up @@ -2,8 +2,7 @@ class Rat { ... }

my class Int {
method Bool() {
nqp::p6bool(
nqp::isne_i(nqp::unbox_i(self), nqp::unbox_i(0)))
nqp::p6bool(nqp::isne_i(nqp::unbox_i(self), 0))
}

method Int() { self }
Expand Down
2 changes: 1 addition & 1 deletion src/core/ListIter.pm
Expand Up @@ -62,7 +62,7 @@ my class ListIter {
?? nqp::istype(nqp::atpos($!rest, 0), Iterable)
&& nqp::atpos($!rest,0).infinite
|| Mu
!! 0.Bool
!! Bool::False
}

method iterator() { self }
Expand Down
4 changes: 2 additions & 2 deletions src/core/Mu.pm
Expand Up @@ -124,11 +124,11 @@ my class Mu {
while $i < +@mro {
my $obj = @mro[$i];
if $obj.HOW.name($obj) eq $name {
return nqp::p6bool(1);
return Bool::True;
}
$i++;
}
nqp::p6bool(0)
Bool::False
}

method does(Mu $type) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/operators.pm
Expand Up @@ -11,7 +11,7 @@ sub SEQUENCE($left, $right, :$exclude_end) {
my @right := ($right,).list;
my $endpoint = @right.shift;
my $infinite = $endpoint ~~ Whatever;
$endpoint = 0.Bool if $infinite;
$endpoint = Bool::False if $infinite;
my $tail := ().list;

my sub generate($code) {
Expand Down

0 comments on commit 87e9756

Please sign in to comment.