summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-06-09 08:23:18 +0100
committerDavid Mitchell <davem@iabyn.com>2015-06-19 08:44:17 +0100
commitc32ac924c5334939c7184c773ea5d07478b5df99 (patch)
treeaa475c8b7f032168c04e8cc0720433298089ec1a
parent988f25b6b104e36f72d842293f189b1317528547 (diff)
downloadperl-c32ac924c5334939c7184c773ea5d07478b5df99.tar.gz
lval subs: do arg shifting in pp_return
When an lvalue sub does an explicit return, currently pp_return doesn't touch the args stack and instead tail calls S_return_lvalues() which does both the leavesuby stuff (e.g. mortalise args) and the returny stuff (e.g. shift the args down in list context). Move the call to S_return_lvalues() further down in pp_return so that the arg shifty stuff is done in pp_return now (like it is for non-lvalue returns). This will allow us shortly to simply S_return_lvalues.
-rw-r--r--pp_ctl.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 007c073869..789875cca0 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2451,9 +2451,6 @@ PP(pp_return)
}
if (CxTYPE(cx) == CXt_SUB) {
- if (CvLVALUE(cx->blk_sub.cv))
- return S_return_lvalues(aTHX_ MARK);
- else {
SV **oldsp = PL_stack_base + cx->blk_oldsp;
if (oldsp != MARK) {
/* Handle extra junk on the stack. For example,
@@ -2479,8 +2476,9 @@ PP(pp_return)
PL_stack_sp = oldsp;
}
/* fall through to a normal sub exit */
- return Perl_pp_leavesub(aTHX);
- }
+ return CvLVALUE(cx->blk_sub.cv)
+ ? S_return_lvalues(aTHX_ NULL)
+ : Perl_pp_leavesub(aTHX);
}
POPBLOCK(cx,newpm);