diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-04-24 08:43:24 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-04-24 08:43:24 +0000 |
commit | 855383171f82b0033b4163a01d30ba375967a9d0 (patch) | |
tree | a22da01cd6f1a18ac0b25aef643b0b5f678f618a /pp_ctl.c | |
parent | 32b22042d2a54453bc0d4b6b7f1d2123903a49be (diff) | |
download | perl-855383171f82b0033b4163a01d30ba375967a9d0.tar.gz |
arrange for next() to resume at the unstack op rather than the
loop conditional, so that scope cleanup happens correctly
(from Stephen McCamant)
p4raw-id: //depot/perl@5927
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1985,7 +1985,7 @@ PP(pp_next) { I32 cxix; register PERL_CONTEXT *cx; - I32 oldsave; + I32 inner; if (PL_op->op_flags & OPf_SPECIAL) { cxix = dopoptoloop(cxstack_ix); @@ -2000,13 +2000,12 @@ PP(pp_next) if (cxix < cxstack_ix) dounwind(cxix); + /* clear off anything above the scope we're re-entering, but + * save the rest until after a possible continue block */ + inner = PL_scopestack_ix; 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); - } + if (PL_scopestack_ix < inner) + leave_scope(PL_scopestack[PL_scopestack_ix]); return cx->blk_loop.next_op; } |