}
/* dounwind(): pop all contexts above (but not including) cxix.
- * Leaves cxstack_ix equal to cxix. Note that for efficiency, it doesn't
- * call POPBLOCK at all; the caller should do
- * CX_LEAVE_SCOPE; POPFOO; POPBLOCK
- * or
- * TOPBLOCK
- * as appropriate.
+ * Note that it clears the savestack frame associated with each popped
+ * context entry, but doesn't free any temps.
+ * It does a POPBLOCK of the last frame that it pops, and leaves
+ * cxstack_ix equal to cxix.
*/
void
POPFORMAT(cx);
break;
}
+ if (cxstack_ix == cxix + 1) {
+ POPBLOCK(cx);
+ }
cxstack_ix--;
}
+
}
void
PUTBACK;
if (cx->blk_gimme != G_VOID)
leave_adjust_stacks(MARK, PL_stack_base + cx->blk_oldsp,
- cx->blk_gimme, 3);
+ cx->blk_gimme,
+ CxTYPE(cx) == CXt_SUB && CvLVALUE(cx->blk_sub.cv)
+ ? 3 : 0);
SPAGAIN;
dounwind(cxix);
cx = &cxstack[cxix]; /* CX stack may have been realloced */
}
}
+/* find the enclosing loop or labelled loop and dounwind() back to it.
+ * opname is for errors */
static I32
S_unwind_loop(pTHX_ const char * const opname)
set_up_inc('../lib');
}
-plan(tests => 62);
+plan(tests => 63);
sub empty_sub {}
sub g { !!(my $x = bless []); }
f(g());
}
+
+# return should have the right PL_curpm while copying its return args
+
+sub curpm {
+ "b" =~ /(.)/;
+ {
+ "c" =~ /(.)/;
+ return $1;
+ }
+}
+"a" =~ /(.)/;
+is(curpm(), 'c', 'return and PL_curpm');