From d08e140859bc057b61174bcc6e3c235e6522a747 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Mon, 5 Feb 2024 15:04:04 -0500 Subject: [PATCH] Change the location of an implicit begin to method --- src/prism.c | 29 +++++-------------- test/prism/location_test.rb | 4 +-- test/prism/snapshots/arrays.txt | 4 +-- test/prism/snapshots/blocks.txt | 2 +- test/prism/snapshots/classes.txt | 8 ++--- test/prism/snapshots/methods.txt | 4 +-- test/prism/snapshots/modules.txt | 2 +- test/prism/snapshots/procs.txt | 4 +-- test/prism/snapshots/rescue.txt | 2 +- .../seattlerb/defn_oneliner_rescue.txt | 2 +- .../seattlerb/defs_oneliner_rescue.txt | 2 +- .../seattlerb/rescue_do_end_ensure_result.txt | 2 +- .../seattlerb/rescue_do_end_no_raise.txt | 2 +- .../seattlerb/rescue_do_end_raised.txt | 2 +- .../seattlerb/rescue_do_end_rescued.txt | 2 +- .../snapshots/seattlerb/rescue_in_block.txt | 2 +- .../unparser/corpus/literal/block.txt | 20 ++++++------- .../snapshots/unparser/corpus/literal/def.txt | 10 +++---- .../unparser/corpus/semantic/block.txt | 2 +- .../whitequark/rescue_in_lambda_block.txt | 2 +- .../whitequark/rescue_without_begin_end.txt | 2 +- 21 files changed, 47 insertions(+), 62 deletions(-) diff --git a/src/prism.c b/src/prism.c index 46c12c9ce09..3ed55f06d8c 100644 --- a/src/prism.c +++ b/src/prism.c @@ -12377,25 +12377,10 @@ parse_rescues(pm_parser_t *parser, pm_begin_node_t *parent_node, bool def_p) { } static inline pm_begin_node_t * -parse_rescues_as_begin(pm_parser_t *parser, pm_statements_node_t *statements, bool def_p) { +parse_rescues_as_begin(pm_parser_t *parser, const uint8_t *start, pm_statements_node_t *statements, bool def_p) { pm_token_t no_begin_token = not_provided(parser); pm_begin_node_t *begin_node = pm_begin_node_create(parser, &no_begin_token, statements); parse_rescues(parser, begin_node, def_p); - - // All nodes within a begin node are optional, so we look - // for the earliest possible node that we can use to set - // the BeginNode's start location - const uint8_t *start = begin_node->base.location.start; - if (begin_node->statements) { - start = begin_node->statements->base.location.start; - } else if (begin_node->rescue_clause) { - start = begin_node->rescue_clause->base.location.start; - } else if (begin_node->else_clause) { - start = begin_node->else_clause->base.location.start; - } else if (begin_node->ensure_clause) { - start = begin_node->ensure_clause->base.location.start; - } - begin_node->base.location.start = start; return begin_node; } @@ -12490,7 +12475,7 @@ parse_block(pm_parser_t *parser) { if (match2(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { assert(statements == NULL || PM_NODE_TYPE_P(statements, PM_STATEMENTS_NODE)); - statements = (pm_node_t *) parse_rescues_as_begin(parser, (pm_statements_node_t *) statements, false); + statements = (pm_node_t *) parse_rescues_as_begin(parser, opening.start, (pm_statements_node_t *) statements, false); } } @@ -15290,7 +15275,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (match2(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { assert(statements == NULL || PM_NODE_TYPE_P(statements, PM_STATEMENTS_NODE)); - statements = (pm_node_t *) parse_rescues_as_begin(parser, (pm_statements_node_t *) statements, false); + statements = (pm_node_t *) parse_rescues_as_begin(parser, class_keyword.start, (pm_statements_node_t *) statements, false); } expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CLASS_TERM); @@ -15343,7 +15328,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (match2(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { assert(statements == NULL || PM_NODE_TYPE_P(statements, PM_STATEMENTS_NODE)); - statements = (pm_node_t *) parse_rescues_as_begin(parser, (pm_statements_node_t *) statements, false); + statements = (pm_node_t *) parse_rescues_as_begin(parser, class_keyword.start, (pm_statements_node_t *) statements, false); } expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CLASS_TERM); @@ -15612,7 +15597,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (match2(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { assert(statements == NULL || PM_NODE_TYPE_P(statements, PM_STATEMENTS_NODE)); - statements = (pm_node_t *) parse_rescues_as_begin(parser, (pm_statements_node_t *) statements, true); + statements = (pm_node_t *) parse_rescues_as_begin(parser, def_keyword.start, (pm_statements_node_t *) statements, true); } pm_accepts_block_stack_pop(parser); @@ -15872,7 +15857,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (match2(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { assert(statements == NULL || PM_NODE_TYPE_P(statements, PM_STATEMENTS_NODE)); - statements = (pm_node_t *) parse_rescues_as_begin(parser, (pm_statements_node_t *) statements, false); + statements = (pm_node_t *) parse_rescues_as_begin(parser, module_keyword.start, (pm_statements_node_t *) statements, false); } pm_constant_id_list_t locals = parser->current_scope->locals; @@ -16605,7 +16590,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (match2(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { assert(body == NULL || PM_NODE_TYPE_P(body, PM_STATEMENTS_NODE)); - body = (pm_node_t *) parse_rescues_as_begin(parser, (pm_statements_node_t *) body, false); + body = (pm_node_t *) parse_rescues_as_begin(parser, opening.start, (pm_statements_node_t *) body, false); } expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_LAMBDA_TERM_END); diff --git a/test/prism/location_test.rb b/test/prism/location_test.rb index 9d583635e02..e6ef82b28bd 100644 --- a/test/prism/location_test.rb +++ b/test/prism/location_test.rb @@ -63,8 +63,8 @@ def test_BeginNode assert_location(BeginNode, "begin foo; rescue bar\nelse baz end") assert_location(BeginNode, "begin foo; rescue bar\nelse baz\nensure qux end") - assert_location(BeginNode, "class Foo\nrescue then end", 10..25, &:body) - assert_location(BeginNode, "module Foo\nrescue then end", 11..26, &:body) + assert_location(BeginNode, "class Foo\nrescue then end", 0..25, &:body) + assert_location(BeginNode, "module Foo\nrescue then end", 0..26, &:body) end def test_BlockArgumentNode diff --git a/test/prism/snapshots/arrays.txt b/test/prism/snapshots/arrays.txt index d6b37756988..0cd77eab296 100644 --- a/test/prism/snapshots/arrays.txt +++ b/test/prism/snapshots/arrays.txt @@ -2157,7 +2157,7 @@ │ │ ├── keyword_rest: ∅ │ │ └── block: ∅ │ ├── body: - │ │ @ BeginNode (location: (140,10)-(140,29)) + │ │ @ BeginNode (location: (140,0)-(140,29)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: ∅ │ │ ├── rescue_clause: @@ -2220,7 +2220,7 @@ │ ├── keyword_rest: ∅ │ └── block: ∅ ├── body: - │ @ BeginNode (location: (142,10)-(142,32)) + │ @ BeginNode (location: (142,0)-(142,32)) │ ├── begin_keyword_loc: ∅ │ ├── statements: ∅ │ ├── rescue_clause: diff --git a/test/prism/snapshots/blocks.txt b/test/prism/snapshots/blocks.txt index 398a228fd34..52a7b3990d4 100644 --- a/test/prism/snapshots/blocks.txt +++ b/test/prism/snapshots/blocks.txt @@ -373,7 +373,7 @@ │ ├── locals: [] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (21,0)-(22,3)) + │ │ @ BeginNode (location: (20,4)-(22,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: ∅ │ │ ├── rescue_clause: diff --git a/test/prism/snapshots/classes.txt b/test/prism/snapshots/classes.txt index 9b677580834..a6544d52bce 100644 --- a/test/prism/snapshots/classes.txt +++ b/test/prism/snapshots/classes.txt @@ -33,7 +33,7 @@ │ ├── inheritance_operator_loc: ∅ │ ├── superclass: ∅ │ ├── body: - │ │ @ BeginNode (location: (3,9)-(3,20)) + │ │ @ BeginNode (location: (3,0)-(3,20)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: ∅ │ │ ├── rescue_clause: ∅ @@ -55,7 +55,7 @@ │ ├── inheritance_operator_loc: ∅ │ ├── superclass: ∅ │ ├── body: - │ │ @ BeginNode (location: (5,9)-(5,34)) + │ │ @ BeginNode (location: (5,0)-(5,34)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: ∅ │ │ ├── rescue_clause: @@ -147,7 +147,7 @@ │ │ ├── expression: │ │ │ @ SelfNode (location: (14,18)-(14,22)) │ │ ├── body: - │ │ │ @ BeginNode (location: (14,24)-(14,35)) + │ │ │ @ BeginNode (location: (14,9)-(14,35)) │ │ │ ├── begin_keyword_loc: ∅ │ │ │ ├── statements: ∅ │ │ │ ├── rescue_clause: ∅ @@ -179,7 +179,7 @@ │ │ ├── expression: │ │ │ @ SelfNode (location: (16,18)-(16,22)) │ │ ├── body: - │ │ │ @ BeginNode (location: (16,24)-(16,49)) + │ │ │ @ BeginNode (location: (16,9)-(16,49)) │ │ │ ├── begin_keyword_loc: ∅ │ │ │ ├── statements: ∅ │ │ │ ├── rescue_clause: diff --git a/test/prism/snapshots/methods.txt b/test/prism/snapshots/methods.txt index 524f023fe92..a96abf92037 100644 --- a/test/prism/snapshots/methods.txt +++ b/test/prism/snapshots/methods.txt @@ -95,7 +95,7 @@ │ ├── receiver: ∅ │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (8,7)-(8,18)) + │ │ @ BeginNode (location: (8,0)-(8,18)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: ∅ │ │ ├── rescue_clause: ∅ @@ -643,7 +643,7 @@ │ ├── receiver: ∅ │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (77,7)-(77,32)) + │ │ @ BeginNode (location: (77,0)-(77,32)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: ∅ │ │ ├── rescue_clause: diff --git a/test/prism/snapshots/modules.txt b/test/prism/snapshots/modules.txt index 0de4b264f07..9b77f39b659 100644 --- a/test/prism/snapshots/modules.txt +++ b/test/prism/snapshots/modules.txt @@ -84,7 +84,7 @@ │ │ @ ConstantReadNode (location: (8,7)-(8,8)) │ │ └── name: :A │ ├── body: - │ │ @ BeginNode (location: (9,1)-(9,19)) + │ │ @ BeginNode (location: (8,0)-(9,19)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (9,1)-(9,6)) diff --git a/test/prism/snapshots/procs.txt b/test/prism/snapshots/procs.txt index 1c3e425c7b9..2cc30618a0a 100644 --- a/test/prism/snapshots/procs.txt +++ b/test/prism/snapshots/procs.txt @@ -47,7 +47,7 @@ │ ├── closing_loc: (5,0)-(5,3) = "end" │ ├── parameters: ∅ │ └── body: - │ @ BeginNode (location: (4,0)-(5,3)) + │ @ BeginNode (location: (3,3)-(5,3)) │ ├── begin_keyword_loc: ∅ │ ├── statements: ∅ │ ├── rescue_clause: ∅ @@ -65,7 +65,7 @@ │ ├── closing_loc: (11,0)-(11,3) = "end" │ ├── parameters: ∅ │ └── body: - │ @ BeginNode (location: (8,0)-(11,3)) + │ @ BeginNode (location: (7,3)-(11,3)) │ ├── begin_keyword_loc: ∅ │ ├── statements: ∅ │ ├── rescue_clause: diff --git a/test/prism/snapshots/rescue.txt b/test/prism/snapshots/rescue.txt index 4057b624e72..e75fe481a0f 100644 --- a/test/prism/snapshots/rescue.txt +++ b/test/prism/snapshots/rescue.txt @@ -325,7 +325,7 @@ │ ├── receiver: ∅ │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (29,2)-(31,3)) + │ │ @ BeginNode (location: (28,0)-(31,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (29,2)-(29,6)) diff --git a/test/prism/snapshots/seattlerb/defn_oneliner_rescue.txt b/test/prism/snapshots/seattlerb/defn_oneliner_rescue.txt index 3cfd09f16f3..b5b5dbe6ac6 100644 --- a/test/prism/snapshots/seattlerb/defn_oneliner_rescue.txt +++ b/test/prism/snapshots/seattlerb/defn_oneliner_rescue.txt @@ -20,7 +20,7 @@ │ │ ├── keyword_rest: ∅ │ │ └── block: ∅ │ ├── body: - │ │ @ BeginNode (location: (2,2)-(5,3)) + │ │ @ BeginNode (location: (1,0)-(5,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (2,2)-(2,13)) diff --git a/test/prism/snapshots/seattlerb/defs_oneliner_rescue.txt b/test/prism/snapshots/seattlerb/defs_oneliner_rescue.txt index 46a65e50d6e..f7762107682 100644 --- a/test/prism/snapshots/seattlerb/defs_oneliner_rescue.txt +++ b/test/prism/snapshots/seattlerb/defs_oneliner_rescue.txt @@ -21,7 +21,7 @@ │ │ ├── keyword_rest: ∅ │ │ └── block: ∅ │ ├── body: - │ │ @ BeginNode (location: (2,2)-(5,3)) + │ │ @ BeginNode (location: (1,0)-(5,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (2,2)-(2,13)) diff --git a/test/prism/snapshots/seattlerb/rescue_do_end_ensure_result.txt b/test/prism/snapshots/seattlerb/rescue_do_end_ensure_result.txt index 76e8ac396aa..21f8bb08a5c 100644 --- a/test/prism/snapshots/seattlerb/rescue_do_end_ensure_result.txt +++ b/test/prism/snapshots/seattlerb/rescue_do_end_ensure_result.txt @@ -20,7 +20,7 @@ │ ├── locals: [] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (2,2)-(5,3)) + │ │ @ BeginNode (location: (1,5)-(5,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (2,2)-(2,8)) diff --git a/test/prism/snapshots/seattlerb/rescue_do_end_no_raise.txt b/test/prism/snapshots/seattlerb/rescue_do_end_no_raise.txt index 3f4ea6a7809..aa4e85c171b 100644 --- a/test/prism/snapshots/seattlerb/rescue_do_end_no_raise.txt +++ b/test/prism/snapshots/seattlerb/rescue_do_end_no_raise.txt @@ -17,7 +17,7 @@ ├── locals: [] ├── parameters: ∅ ├── body: - │ @ BeginNode (location: (2,2)-(9,3)) + │ @ BeginNode (location: (1,4)-(9,3)) │ ├── begin_keyword_loc: ∅ │ ├── statements: │ │ @ StatementsNode (location: (2,2)-(2,8)) diff --git a/test/prism/snapshots/seattlerb/rescue_do_end_raised.txt b/test/prism/snapshots/seattlerb/rescue_do_end_raised.txt index b3183af9896..06f67fae690 100644 --- a/test/prism/snapshots/seattlerb/rescue_do_end_raised.txt +++ b/test/prism/snapshots/seattlerb/rescue_do_end_raised.txt @@ -17,7 +17,7 @@ ├── locals: [] ├── parameters: ∅ ├── body: - │ @ BeginNode (location: (2,2)-(5,3)) + │ @ BeginNode (location: (1,4)-(5,3)) │ ├── begin_keyword_loc: ∅ │ ├── statements: │ │ @ StatementsNode (location: (2,2)-(2,7)) diff --git a/test/prism/snapshots/seattlerb/rescue_do_end_rescued.txt b/test/prism/snapshots/seattlerb/rescue_do_end_rescued.txt index f5b7a91a7b7..b4576c3bb2e 100644 --- a/test/prism/snapshots/seattlerb/rescue_do_end_rescued.txt +++ b/test/prism/snapshots/seattlerb/rescue_do_end_rescued.txt @@ -17,7 +17,7 @@ ├── locals: [] ├── parameters: ∅ ├── body: - │ @ BeginNode (location: (2,2)-(9,3)) + │ @ BeginNode (location: (1,4)-(9,3)) │ ├── begin_keyword_loc: ∅ │ ├── statements: │ │ @ StatementsNode (location: (2,2)-(2,7)) diff --git a/test/prism/snapshots/seattlerb/rescue_in_block.txt b/test/prism/snapshots/seattlerb/rescue_in_block.txt index f3d42aa548e..daac2b67763 100644 --- a/test/prism/snapshots/seattlerb/rescue_in_block.txt +++ b/test/prism/snapshots/seattlerb/rescue_in_block.txt @@ -17,7 +17,7 @@ ├── locals: [] ├── parameters: ∅ ├── body: - │ @ BeginNode (location: (2,0)-(4,3)) + │ @ BeginNode (location: (1,5)-(4,3)) │ ├── begin_keyword_loc: ∅ │ ├── statements: ∅ │ ├── rescue_clause: diff --git a/test/prism/snapshots/unparser/corpus/literal/block.txt b/test/prism/snapshots/unparser/corpus/literal/block.txt index 1cf3823e488..b7c571158f8 100644 --- a/test/prism/snapshots/unparser/corpus/literal/block.txt +++ b/test/prism/snapshots/unparser/corpus/literal/block.txt @@ -846,7 +846,7 @@ │ ├── locals: [:e] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (50,0)-(51,3)) + │ │ @ BeginNode (location: (49,2)-(51,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: ∅ │ │ ├── rescue_clause: @@ -881,7 +881,7 @@ │ ├── locals: [:bar] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (53,2)-(56,3)) + │ │ @ BeginNode (location: (52,2)-(56,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (53,2)-(53,5)) @@ -933,7 +933,7 @@ │ ├── locals: [] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (58,2)-(61,3)) + │ │ @ BeginNode (location: (57,2)-(61,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (58,2)-(58,5)) @@ -1002,7 +1002,7 @@ │ ├── locals: [:exception] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (63,2)-(66,3)) + │ │ @ BeginNode (location: (62,2)-(66,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (63,2)-(63,5)) @@ -1074,7 +1074,7 @@ │ ├── locals: [] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (68,2)-(71,3)) + │ │ @ BeginNode (location: (67,2)-(71,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (68,2)-(68,5)) @@ -1141,7 +1141,7 @@ │ ├── locals: [] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (73,2)-(75,3)) + │ │ @ BeginNode (location: (72,2)-(75,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (73,2)-(73,5)) @@ -1185,7 +1185,7 @@ │ ├── locals: [] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (77,2)-(81,3)) + │ │ @ BeginNode (location: (76,2)-(81,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (77,2)-(77,5)) @@ -1243,7 +1243,7 @@ │ ├── locals: [:exception] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (83,2)-(86,3)) + │ │ @ BeginNode (location: (82,2)-(86,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (83,2)-(83,5)) @@ -1313,7 +1313,7 @@ │ ├── locals: [] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (88,0)-(89,3)) + │ │ @ BeginNode (location: (87,2)-(89,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: ∅ │ │ ├── rescue_clause: ∅ @@ -1340,7 +1340,7 @@ │ ├── locals: [] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (91,0)-(93,3)) + │ │ @ BeginNode (location: (90,2)-(93,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: ∅ │ │ ├── rescue_clause: diff --git a/test/prism/snapshots/unparser/corpus/literal/def.txt b/test/prism/snapshots/unparser/corpus/literal/def.txt index f1ee5dd046a..c8c571a1a70 100644 --- a/test/prism/snapshots/unparser/corpus/literal/def.txt +++ b/test/prism/snapshots/unparser/corpus/literal/def.txt @@ -9,7 +9,7 @@ │ ├── receiver: ∅ │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (2,2)-(9,3)) + │ │ @ BeginNode (location: (1,0)-(9,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (2,2)-(2,3)) @@ -92,7 +92,7 @@ │ ├── receiver: ∅ │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (12,2)-(19,3)) + │ │ @ BeginNode (location: (11,0)-(19,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (12,2)-(12,12)) @@ -256,7 +256,7 @@ │ ├── receiver: ∅ │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (32,2)-(37,3)) + │ │ @ BeginNode (location: (31,0)-(37,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (32,2)-(32,5)) @@ -323,7 +323,7 @@ │ ├── receiver: ∅ │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (40,2)-(43,3)) + │ │ @ BeginNode (location: (39,0)-(43,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (40,2)-(40,5)) @@ -371,7 +371,7 @@ │ ├── receiver: ∅ │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (46,2)-(49,3)) + │ │ @ BeginNode (location: (45,0)-(49,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (46,2)-(46,5)) diff --git a/test/prism/snapshots/unparser/corpus/semantic/block.txt b/test/prism/snapshots/unparser/corpus/semantic/block.txt index 4e4b6ea928e..b9aa6b21844 100644 --- a/test/prism/snapshots/unparser/corpus/semantic/block.txt +++ b/test/prism/snapshots/unparser/corpus/semantic/block.txt @@ -33,7 +33,7 @@ │ ├── locals: [] │ ├── parameters: ∅ │ ├── body: - │ │ @ BeginNode (location: (5,0)-(6,3)) + │ │ @ BeginNode (location: (4,4)-(6,3)) │ │ ├── begin_keyword_loc: ∅ │ │ ├── statements: ∅ │ │ ├── rescue_clause: diff --git a/test/prism/snapshots/whitequark/rescue_in_lambda_block.txt b/test/prism/snapshots/whitequark/rescue_in_lambda_block.txt index 72b6842f425..2ab854cdd77 100644 --- a/test/prism/snapshots/whitequark/rescue_in_lambda_block.txt +++ b/test/prism/snapshots/whitequark/rescue_in_lambda_block.txt @@ -10,7 +10,7 @@ ├── closing_loc: (1,14)-(1,17) = "end" ├── parameters: ∅ └── body: - @ BeginNode (location: (1,6)-(1,17)) + @ BeginNode (location: (1,3)-(1,17)) ├── begin_keyword_loc: ∅ ├── statements: ∅ ├── rescue_clause: diff --git a/test/prism/snapshots/whitequark/rescue_without_begin_end.txt b/test/prism/snapshots/whitequark/rescue_without_begin_end.txt index 22b9b4035e2..4281442ab23 100644 --- a/test/prism/snapshots/whitequark/rescue_without_begin_end.txt +++ b/test/prism/snapshots/whitequark/rescue_without_begin_end.txt @@ -17,7 +17,7 @@ ├── locals: [] ├── parameters: ∅ ├── body: - │ @ BeginNode (location: (1,9)-(1,30)) + │ @ BeginNode (location: (1,5)-(1,30)) │ ├── begin_keyword_loc: ∅ │ ├── statements: │ │ @ StatementsNode (location: (1,9)-(1,12))