summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2021-02-05 01:18:01 +0000
committerPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2021-02-14 13:40:49 +0000
commit656489102eb44a763e82ae9961a7097021182677 (patch)
treeb3178c98027b1478eab264867e1dd624470eca83 /perly.y
parentab2bb8aa34c9c9d6912e7103eba65d0a722bc93d (diff)
downloadperl-656489102eb44a763e82ae9961a7097021182677.tar.gz
Add a newTRYCATCHOP(); migrate the custom code out of perly.y into it
Diffstat (limited to 'perly.y')
-rw-r--r--perly.y20
1 files changed, 2 insertions, 18 deletions
diff --git a/perly.y b/perly.y
index 42156e3a42..184fb0c158 100644
--- a/perly.y
+++ b/perly.y
@@ -466,24 +466,8 @@ barestmt: PLUGSTMT
{ parser->in_my = 0; intro_my(); }
PERLY_PAREN_CLOSE mblock[catch]
{
- OP *tryblock, *catchblock;
-
- tryblock = newUNOP(OP_ENTERTRY, OPf_SPECIAL, $try);
-
- catchblock = newLOGOP(OP_CATCH, 0,
- newOP(OP_NULL, 0), /* LOGOP always needs an op_first */
- block_end($remember, op_scope($catch)));
-
- /* catchblock itself is an OP_NULL; the real OP_CATCH is
- * its op_first */
- assert(cUNOPx(catchblock)->op_first->op_type == OP_CATCH);
- cUNOPx(catchblock)->op_first->op_targ = $scalar->op_targ;
- op_free($scalar);
-
- $$ = op_append_list(OP_LEAVE,
- newOP(OP_ENTER, 0),
- op_append_list(OP_LINESEQ,
- tryblock, catchblock));
+ $$ = newTRYCATCHOP(0,
+ $try, $scalar, block_end($remember, op_scope($catch)));
}
| block cont
{