X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FSub%2FNary.pm;fp=lib%2FSub%2FNary.pm;h=52a3f8402e4c4783a0441da8ed35b24f4466ad9f;hb=02510517a867d6f89d6dac825672e183e075e97e;hp=14b882285723a2e3d20bbb7472c8502df1166d8a;hpb=3b10ab9a7a01f579892a98a1ffc53202d6adc8d6;p=perl%2Fmodules%2FSub-Nary.git diff --git a/lib/Sub/Nary.pm b/lib/Sub/Nary.pm index 14b8822..52a3f84 100644 --- a/lib/Sub/Nary.pm +++ b/lib/Sub/Nary.pm @@ -262,7 +262,7 @@ sub inspect { my $op = $op->first; my ($r1, $l1) = $self->inspect($op); - return $r1, $l1 if $r1 and zero $l1; + return $r1, $l1 if defined $r1 and zero $l1; my $c = count $l1; $op = $op->sibling; @@ -551,11 +551,12 @@ sub pp_grepwhile { $op = $op->first->sibling; my ($r2, $l2) = $self->inspect($op->sibling); - return $r2, $l2 if $r2 and zero $l2; + return $r2, $l2 if defined $r2 and zero $l2; my $c2 = count $l2; # First one to happen my ($r1, $l1) = $self->inspect($op); - return (add $r2, scale $c2, $r1), undef if $r1 and zero $l1 and not zero $l2; + return (add $r2, scale $c2, $r1), undef if defined $r1 and zero $l1 + and not zero $l2; diag Dumper [ [ $r1, $l1 ], [ $r2, $l2 ] ] if $DEBUG; my $c1 = count $l1; @@ -575,11 +576,12 @@ sub pp_mapwhile { $op = $op->first->sibling; my ($r2, $l2) = $self->inspect($op->sibling); - return $r2, $l2 if $r2 and zero $l2; + return $r2, $l2 if defined $r2 and zero $l2; my $c2 = count $l2; # First one to happen my ($r1, $l1) = $self->inspect($op); - return (add $r2, scale $c2, $r1), undef if $r1 and zero $l1 and not zero $l2; + return (add $r2, scale $c2, $r1), undef if defined $r1 and zero $l1 + and not zero $l2; diag Dumper [ [ $r1, $l1 ], [ $r2, $l2 ] ] if $DEBUG; my $c1 = count $l1;