diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2021-02-05 01:18:01 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2021-02-14 13:40:49 +0000 |
commit | 656489102eb44a763e82ae9961a7097021182677 (patch) | |
tree | b3178c98027b1478eab264867e1dd624470eca83 /perly.y | |
parent | ab2bb8aa34c9c9d6912e7103eba65d0a722bc93d (diff) | |
download | perl-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.y | 20 |
1 files changed, 2 insertions, 18 deletions
@@ -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 { |