This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_leavewhen: simply for() handling
authorDavid Mitchell <davem@iabyn.com>
Mon, 5 Oct 2015 15:23:07 +0000 (16:23 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:40 +0000 (08:59 +0000)
when returning control to an enclosing for loop, the next op to execute
(i.e. my_op->op_nextop) will be an OP_UNSTACK, which handles popping stuff
of stacks and doing PERL_ASYNC_CHECK(); so no need to do it here too.

pp_ctl.c

index f6b142e..be098bb 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -5016,15 +5016,10 @@ PP(pp_leavewhen)
     cx = &cxstack[cxix];
 
     if (CxFOREACH(cx)) {
-       /* clear off anything above the scope we're re-entering */
-       I32 inner = PL_scopestack_ix;
-
+        /* emulate pp_next. Note that any stack(s) cleanup will be
+         * done by the pp_unstack which op_nextop should point to */
        TOPBLOCK(cx);
-       if (PL_scopestack_ix < inner)
-           leave_scope(PL_scopestack[PL_scopestack_ix]);
        PL_curcop = cx->blk_oldcop;
-
-       PERL_ASYNC_CHECK();
        return cx->blk_loop.my_op->op_nextop;
     }
     else {