OP *listop;
OP *o;
OP *condop;
+ U8 loopflags = 0;
if (expr && (expr->op_type == OP_READLINE || expr->op_type == OP_GLOB
|| (expr->op_type == OP_NULL && expr->op_targ == OP_GLOB))) {
block = scope(block);
}
- if (cont)
+ if (cont) {
next = LINKLIST(cont);
+ loopflags |= OPpLOOP_CONTINUE;
+ }
if (expr) {
cont = append_elem(OP_LINESEQ, cont, newOP(OP_UNSTACK, 0));
if ((line_t)whileline != NOLINE) {
loop->op_redoop = redo;
loop->op_lastop = o;
+ o->op_private |= loopflags;
if (next)
loop->op_nextop = next;
/* Private for OP_REPEAT */
#define OPpREPEAT_DOLIST 64 /* List replication. */
+/* Private for OP_LEAVELOOP */
+#define OPpLOOP_CONTINUE 64 /* a continue block is present */
+
/* Private for OP_RV2?V, OP_?ELEM */
#define OPpDEREF (32|64) /* Want ref to something: */
#define OPpDEREF_AV 32 /* Want ref to AV. */
if (cxix < cxstack_ix)
dounwind(cxix);
- cx = &cxstack[cxstack_ix];
- {
- OP *nextop = cx->blk_loop.next_op;
- /* clean scope, but only if there's no continue block */
- if (nextop == cUNOPx(cx->blk_loop.last_op)->op_first->op_next) {
- TOPBLOCK(cx);
- oldsave = PL_scopestack[PL_scopestack_ix - 1];
- LEAVE_SCOPE(oldsave);
- }
- return nextop;
+ TOPBLOCK(cx);
+
+ /* clean scope, but only if there's no continue block */
+ if (!(cx->blk_loop.last_op->op_private & OPpLOOP_CONTINUE)) {
+ oldsave = PL_scopestack[PL_scopestack_ix - 1];
+ LEAVE_SCOPE(oldsave);
}
+ return cx->blk_loop.next_op;
}
PP(pp_redo)
#!./perl
-print "1..19\n";
+print "1..22\n";
open (tmp,'>Cmd_while.tmp') || die "Can't create Cmd_while.tmp.";
print tmp "tvi925\n";
print "ok $l\n"
}
}
+
+$i = 20;
+{
+ while (1) {
+ my $x;
+ print $x if defined $x;
+ $x = "not ";
+ print "ok $i\n"; ++$i;
+ if ($i == 21) {
+ next;
+ }
+ last;
+ }
+ continue {
+ print "ok $i\n"; ++$i;
+ }
+}