diff options
author | Vincent Pit <perl@profvince.com> | 2011-06-27 15:01:30 +0200 |
---|---|---|
committer | Vincent Pit <perl@profvince.com> | 2011-06-27 15:01:34 +0200 |
commit | 7c2d9d03f8b64a80661ece16e7bfc15456ae3400 (patch) | |
tree | 42352760a6536d35f091b115272e8525f2731811 /op.c | |
parent | fa22d357d948ce8e179d9c7a461076497fc9681e (diff) | |
download | perl-7c2d9d03f8b64a80661ece16e7bfc15456ae3400.tar.gz |
Fix context propagation below return()
A.k.a. "RT #38809 strikes back".
Back in the time of perl 5.003, there was no void context, so "do" blocks
below a return needed special handling to use the dynamic context of the
caller instead of the static context implied by the return op location.
But nowadays context is applied by the scalarvoid(), scalar() and list()
functions, and they all already skip the return ops. "do" blocks below a
return don't get a static context, and GIMME_V ought to correctly return
the caller's context. The old workaround isn't even required anymore.
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 13 |
1 files changed, 0 insertions, 13 deletions
@@ -8219,19 +8219,6 @@ Perl_ck_return(pTHX_ OP *o) if (CvLVALUE(PL_compcv)) { for (; kid; kid = kid->op_sibling) op_lvalue(kid, OP_LEAVESUBLV); - } else { - for (; kid; kid = kid->op_sibling) - if ((kid->op_type == OP_NULL) - && ((kid->op_flags & (OPf_SPECIAL|OPf_KIDS)) == (OPf_SPECIAL|OPf_KIDS))) { - /* This is a do block */ - OP *op = kUNOP->op_first; - if (op->op_type == OP_LEAVE && op->op_flags & OPf_KIDS) { - op = cUNOPx(op)->op_first; - assert(op->op_type == OP_ENTER && !(op->op_flags & OPf_SPECIAL)); - /* Force the use of the caller's context */ - op->op_flags |= OPf_SPECIAL; - } - } } return o; |