diff options
author | Kevin Newton <kddnewton@gmail.com> | 2024-02-05 15:04:04 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-02-05 20:40:24 +0000 |
commit | c42b1029d94cdc6dcdaf654fdf7ee7324658008d (patch) | |
tree | d6a11e40a658ceda679124ffa4ca334e6f0e3b9a /test | |
parent | c5694c647afbacaf2d9e570b106d23f533601294 (diff) |
[ruby/prism] Change the location of an implicit begin to method
https://github.com/ruby/prism/commit/d08e140859
Diffstat (limited to 'test')
20 files changed, 40 insertions, 40 deletions
diff --git a/test/prism/location_test.rb b/test/prism/location_test.rb index 9d583635e0..e6ef82b28b 100644 --- a/test/prism/location_test.rb +++ b/test/prism/location_test.rb @@ -63,8 +63,8 @@ module Prism 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 d6b3775698..0cd77eab29 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 398a228fd3..52a7b3990d 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 9b67758083..a6544d52bc 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 524f023fe9..a96abf9203 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 0de4b264f0..9b77f39b65 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 1c3e425c7b..2cc30618a0 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 4057b624e7..e75fe481a0 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 3cfd09f16f..b5b5dbe6ac 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 46a65e50d6..f776210768 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 76e8ac396a..21f8bb08a5 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 3f4ea6a780..aa4e85c171 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 b3183af989..06f67fae69 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 f5b7a91a7b..b4576c3bb2 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 f3d42aa548..daac2b6776 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 1cf3823e48..b7c571158f 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 f1ee5dd046..c8c571a1a7 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 4e4b6ea928..b9aa6b2184 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 72b6842f42..2ab854cdd7 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 22b9b4035e..4281442ab2 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)) |