summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2021-02-10 11:18:45 +1100
committerPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2021-02-14 13:40:50 +0000
commit6b729d2440b795f848f610a8cc410a3f6be6388b (patch)
tree68143844990d5b45cbe0ceccf9b3fef2458a505a /pp_ctl.c
parent683e0651b057a7be4b2765ceb3d9f6617cd4c464 (diff)
downloadperl-6b729d2440b795f848f610a8cc410a3f6be6388b.tar.gz
try isn't treated as a sub call like eval is
The try change added code to pp_return to skip past try contexts when looking for the sub/sort/eval context to return from. This was only needed because cx_pusheval() sets si_cxsubix to the current frame and try uses that function to push it's context, that value is then used by the dopopto_cursub() macro to shortcut walking the context stack. Since we don't need to treat try as a sub for return, list vs array checks or lvalue sub checks, don't set si_cxsubix on try.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 9d7de39bcf..a480bb762d 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2486,16 +2486,6 @@ PP(pp_return)
PERL_CONTEXT *cx;
I32 cxix = dopopto_cursub();
-again:
- if (cxix >= 0) {
- cx = &cxstack[cxix];
- if (CxTRY(cx)) {
- /* This was a try {}. keep going */
- cxix = dopoptosub_at(cxstack, cxix - 1);
- goto again;
- }
- }
-
assert(cxstack_ix >= 0);
if (cxix < cxstack_ix) {
if (cxix < 0) {
@@ -4639,7 +4629,7 @@ PP(pp_entertrycatch)
cx = cx_pushblock((CXt_EVAL|CXp_EVALBLOCK|CXp_TRY), gimme,
PL_stack_sp, PL_savestack_ix);
- cx_pusheval(cx, cLOGOP->op_other, NULL);
+ cx_pushtry(cx, cLOGOP->op_other);
PL_in_eval = EVAL_INEVAL;