if (null $op) {
# If the logop has no else branch, it can also return the *scalar* result of
# the conditional
- $l3 = { 1 => $c };
+ $l3 = { 1 => 1 };
} else {
($r3, $l3) = $self->inspect($op);
}
}
my $code = \&wut;
-$code = sub { while (do { return 2, 3 }) { } };
+
my $bd = B::Deparse->new();
print STDERR $bd->coderef2text($code), "\n";
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More tests => 17;
use Sub::Nary;
}
}
-sub retinif {
+sub retinif1 {
if (return 1, 2) {
return 1, 2, 3
} else {
}
}
+sub retinif2 {
+ if (do { return 2, 3 if $x }) {
+ return 4, 5, 6;
+ }
+}
+
my @tests = (
[ \&ret12, { 1 => 0.5, 2 => 0.5 } ],
[ \&ret12b, { 1 => 0.5, 2 => 0.5 } ],
[ \&ret1234, { 2 => 0.5, 3 => 0.25, 4 => 0.125, 1 => 0.125 } ],
- [ \&retinif, { 2 => 1 } ],
+ [ \&retinif1, { 2 => 1 } ],
+ [ \&retinif2, { 2 => 0.5, 3 => 0.25, 1 => 0.25 } ],
);
my $i = 1;