last;
}
}
- if (!is_state $ops[$i] and $ops[$i+1] and !null($ops[$i+1]) and
- $ops[$i+1]->name eq "leaveloop" and $self->{'expand'} < 3)
+ if (!is_state $ops[$i] and (my $ls = $ops[$i+1]) and
+ !null($ops[$i+1]) and $ops[$i+1]->name eq "lineseq")
{
- push @exprs, $expr . $self->for_loop($ops[$i], 0);
- $i++;
- next;
+ if ($ls->first && !null($ls->first) && is_state($ls->first)
+ && (my $sib = $ls->first->sibling)) {
+ if (!null($sib) && $sib->name eq "leaveloop") {
+ push @exprs, $expr . $self->for_loop($ops[$i], 0);
+ $i++;
+ next;
+ }
+ }
}
$expr .= $self->deparse($ops[$i], 0, (@ops != 1));
$expr =~ s/;\n?\z//;
$indir = $indir->first; # skip rv2gv
if (is_scope($indir)) {
$indir = "{" . $self->deparse($indir, 0) . "}";
+ } elsif ($indir->name eq "const" && $indir->private & OPpCONST_BARE) {
+ $indir = $self->const_sv($indir)->PV;
} else {
$indir = $self->deparse($indir, 24);
}
# block (or the last in a bare loop).
my $cont_start = $enter->nextop;
my $cont;
- if ($$cont_start != $$op and $ {$cont_start->sibling} != $ {$body->last}) {
+ if ($$cont_start != $$op && ${$cont_start->sibling} != ${$body->last}) {
if ($bare) {
$cont = $body->last;
} else {
}
} else {
return "" if !defined $body;
+ if (length $init) {
+ $head = "for ($init; $cond;) ";
+ }
$cont = "\cK";
$body = $self->deparse($body, 0);
}
my $self = shift;
my($op, $cx) = @_;
my $init = $self->deparse($op, 1);
- return $self->loop_common($op->sibling, $cx, $init);
+ return $self->loop_common($op->sibling->first->sibling, $cx, $init);
}
sub pp_leavetry {