diff options
author | David Mitchell <davem@iabyn.com> | 2021-09-03 15:47:02 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2021-09-04 13:02:19 +0100 |
commit | 5eab7f7a833ea5e8588b0c02359c9b8e6c3b436e (patch) | |
tree | 209f2bc3d4db1d4a12a0e349bcd2df0638e566a4 /perly.y | |
parent | e5a468d33677d8d809b0b67b8f21b9ad022c96c9 (diff) | |
download | perl-5eab7f7a833ea5e8588b0c02359c9b8e6c3b436e.tar.gz |
fix line number of try block
Each 'try' block has a nextstate COP prepended to it. Currently this cop
has the line number of the line following the end of the try block. Fix
it so that it has the line number of the line containing the 'try'
keyword instead.
This is achieved using the same technique as other block-introducing
keywords like 'while': set the .ival of the 'try' token returned by the
lexer to the current line number, then set PL_parser->copline back to that
value after parsing the block but before creating the COP.
This issue was showing up as a failure in
cd t; ./TEST -deparse op/try.t
since that test script is line-number sensitive.
Diffstat (limited to 'perly.y')
-rw-r--r-- | perly.y | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -469,6 +469,7 @@ barestmt: PLUGSTMT { $$ = newTRYCATCHOP(0, $try, $scalar, block_end($remember, op_scope($catch))); + parser->copline = (line_t)$TRY; } | block cont { |