From 5eab7f7a833ea5e8588b0c02359c9b8e6c3b436e Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Fri, 3 Sep 2021 15:47:02 +0100 Subject: 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. --- perly.y | 1 + 1 file changed, 1 insertion(+) (limited to 'perly.y') diff --git a/perly.y b/perly.y index bcebece3e3..18ed6e8fc9 100644 --- a/perly.y +++ b/perly.y @@ -469,6 +469,7 @@ barestmt: PLUGSTMT { $$ = newTRYCATCHOP(0, $try, $scalar, block_end($remember, op_scope($catch))); + parser->copline = (line_t)$TRY; } | block cont { -- cgit v1.2.1