diff options
author | Jemma Issroff <jemmaissroff@gmail.com> | 2023-11-28 15:42:33 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-11-28 21:08:46 +0000 |
commit | 04cbcd37b1c18c4db4b9df8d80abb4efec11755c (patch) | |
tree | cda45c96254e9720ac53101b74a962f4dace7c8a /test/prism/snapshots/unparser/corpus/literal/block.txt | |
parent | 6310522a9a33c19e963e56a8f87388d802525937 (diff) |
[ruby/prism] Add numbered_parameters field to BlockNode and LambdaNode
We are aware at parse time how many numbered parameters we have
on a BlockNode or LambdaNode, but prior to this commit, did not
store that information anywhere in its own right.
The numbered parameters were stored as locals, but this does not
distinguish them from other locals that have been set, for example
in `a { b = 1; _1 }` there is nothing on the AST that distinguishes
b from _1.
Consumers such as the compiler need to know information about how
many numbered parameters exist to set up their own tables around
parameters. Since we have this information at parse time, we should
compute it here, instead of deferring the work later on.
https://github.com/ruby/prism/commit/bf4a1e124d
Diffstat (limited to 'test/prism/snapshots/unparser/corpus/literal/block.txt')
-rw-r--r-- | test/prism/snapshots/unparser/corpus/literal/block.txt | 90 |
1 files changed, 60 insertions, 30 deletions
diff --git a/test/prism/snapshots/unparser/corpus/literal/block.txt b/test/prism/snapshots/unparser/corpus/literal/block.txt index b88e5f23a1..76d51d709e 100644 --- a/test/prism/snapshots/unparser/corpus/literal/block.txt +++ b/test/prism/snapshots/unparser/corpus/literal/block.txt @@ -17,7 +17,8 @@ │ │ ├── parameters: ∅ │ │ ├── body: ∅ │ │ ├── opening_loc: (1,4)-(1,5) = "{" - │ │ └── closing_loc: (2,0)-(2,1) = "}" + │ │ ├── closing_loc: (2,0)-(2,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (3,0)-(4,1)) │ ├── receiver: ∅ @@ -48,7 +49,8 @@ │ │ │ └── closing_loc: (3,8)-(3,9) = "|" │ │ ├── body: ∅ │ │ ├── opening_loc: (3,4)-(3,5) = "{" - │ │ └── closing_loc: (4,0)-(4,1) = "}" + │ │ ├── closing_loc: (4,0)-(4,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (5,0)-(6,1)) │ ├── receiver: ∅ @@ -83,7 +85,8 @@ │ │ │ └── closing_loc: (5,9)-(5,10) = "|" │ │ ├── body: ∅ │ │ ├── opening_loc: (5,4)-(5,5) = "{" - │ │ └── closing_loc: (6,0)-(6,1) = "}" + │ │ ├── closing_loc: (6,0)-(6,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (7,0)-(8,1)) │ ├── receiver: ∅ @@ -120,7 +123,8 @@ │ │ │ └── closing_loc: (7,12)-(7,13) = "|" │ │ ├── body: ∅ │ │ ├── opening_loc: (7,4)-(7,5) = "{" - │ │ └── closing_loc: (8,0)-(8,1) = "}" + │ │ ├── closing_loc: (8,0)-(8,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (9,0)-(10,1)) │ ├── receiver: ∅ @@ -153,7 +157,8 @@ │ │ │ └── closing_loc: (9,11)-(9,12) = "|" │ │ ├── body: ∅ │ │ ├── opening_loc: (9,4)-(9,5) = "{" - │ │ └── closing_loc: (10,0)-(10,1) = "}" + │ │ ├── closing_loc: (10,0)-(10,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (11,0)-(13,1)) │ ├── receiver: ∅ @@ -177,7 +182,8 @@ │ │ │ └── body: (length: 1) │ │ │ └── @ NilNode (location: (12,2)-(12,5)) │ │ ├── opening_loc: (11,7)-(11,8) = "{" - │ │ └── closing_loc: (13,0)-(13,1) = "}" + │ │ ├── closing_loc: (13,0)-(13,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (14,0)-(16,1)) │ ├── receiver: ∅ @@ -215,7 +221,8 @@ │ │ │ └── body: (length: 1) │ │ │ └── @ NilNode (location: (15,2)-(15,5)) │ │ ├── opening_loc: (14,4)-(14,5) = "{" - │ │ └── closing_loc: (16,0)-(16,1) = "}" + │ │ ├── closing_loc: (16,0)-(16,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (17,0)-(19,1)) │ ├── receiver: ∅ @@ -253,7 +260,8 @@ │ │ │ └── body: (length: 1) │ │ │ └── @ NilNode (location: (18,2)-(18,5)) │ │ ├── opening_loc: (17,4)-(17,5) = "{" - │ │ └── closing_loc: (19,0)-(19,1) = "}" + │ │ ├── closing_loc: (19,0)-(19,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (20,0)-(22,1)) │ ├── receiver: ∅ @@ -281,7 +289,8 @@ │ │ │ ├── block: ∅ │ │ │ └── flags: variable_call │ │ ├── opening_loc: (20,4)-(20,5) = "{" - │ │ └── closing_loc: (22,0)-(22,1) = "}" + │ │ ├── closing_loc: (22,0)-(22,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (23,0)-(25,1)) │ ├── receiver: @@ -344,7 +353,8 @@ │ │ │ ├── block: ∅ │ │ │ └── flags: variable_call │ │ ├── opening_loc: (23,8)-(23,9) = "{" - │ │ └── closing_loc: (25,0)-(25,1) = "}" + │ │ ├── closing_loc: (25,0)-(25,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (26,0)-(27,1)) │ ├── receiver: @@ -389,7 +399,8 @@ │ │ │ └── closing_loc: (26,16)-(26,17) = "|" │ │ ├── body: ∅ │ │ ├── opening_loc: (26,8)-(26,9) = "{" - │ │ └── closing_loc: (27,0)-(27,1) = "}" + │ │ ├── closing_loc: (27,0)-(27,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (28,0)-(29,1)) │ ├── receiver: @@ -432,7 +443,8 @@ │ │ │ └── closing_loc: (28,15)-(28,16) = "|" │ │ ├── body: ∅ │ │ ├── opening_loc: (28,8)-(28,9) = "{" - │ │ └── closing_loc: (29,0)-(29,1) = "}" + │ │ ├── closing_loc: (29,0)-(29,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (30,0)-(31,1)) │ ├── receiver: @@ -467,7 +479,8 @@ │ │ │ └── closing_loc: (30,17)-(30,18) = "|" │ │ ├── body: ∅ │ │ ├── opening_loc: (30,8)-(30,9) = "{" - │ │ └── closing_loc: (31,0)-(31,1) = "}" + │ │ ├── closing_loc: (31,0)-(31,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (32,0)-(34,1)) │ ├── receiver: @@ -522,7 +535,8 @@ │ │ │ ├── block: ∅ │ │ │ └── flags: variable_call │ │ ├── opening_loc: (32,8)-(32,9) = "{" - │ │ └── closing_loc: (34,0)-(34,1) = "}" + │ │ ├── closing_loc: (34,0)-(34,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (35,0)-(37,1)) │ ├── receiver: @@ -582,7 +596,8 @@ │ │ │ ├── block: ∅ │ │ │ └── flags: variable_call │ │ ├── opening_loc: (35,8)-(35,9) = "{" - │ │ └── closing_loc: (37,0)-(37,1) = "}" + │ │ ├── closing_loc: (37,0)-(37,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (38,0)-(40,1)) │ ├── receiver: @@ -648,7 +663,8 @@ │ │ │ ├── block: ∅ │ │ │ └── flags: variable_call │ │ ├── opening_loc: (38,8)-(38,9) = "{" - │ │ └── closing_loc: (40,0)-(40,1) = "}" + │ │ ├── closing_loc: (40,0)-(40,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (41,0)-(43,1)) │ ├── receiver: @@ -716,7 +732,8 @@ │ │ │ ├── block: ∅ │ │ │ └── flags: variable_call │ │ ├── opening_loc: (41,8)-(41,9) = "{" - │ │ └── closing_loc: (43,0)-(43,1) = "}" + │ │ ├── closing_loc: (43,0)-(43,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (44,0)-(46,1)) │ ├── receiver: @@ -777,7 +794,8 @@ │ │ │ ├── block: ∅ │ │ │ └── flags: variable_call │ │ ├── opening_loc: (44,8)-(44,9) = "{" - │ │ └── closing_loc: (46,0)-(46,1) = "}" + │ │ ├── closing_loc: (46,0)-(46,1) = "}" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (47,0)-(48,5)) │ ├── receiver: @@ -805,7 +823,8 @@ │ │ │ ├── parameters: ∅ │ │ │ ├── body: ∅ │ │ │ ├── opening_loc: (47,8)-(47,9) = "{" - │ │ │ └── closing_loc: (48,0)-(48,1) = "}" + │ │ │ ├── closing_loc: (48,0)-(48,1) = "}" + │ │ │ └── numbered_parameters: 0 │ │ └── flags: ∅ │ ├── call_operator_loc: (48,1)-(48,2) = "." │ ├── name: :baz @@ -848,7 +867,8 @@ │ │ │ ├── ensure_clause: ∅ │ │ │ └── end_keyword_loc: (51,0)-(51,3) = "end" │ │ ├── opening_loc: (49,2)-(49,4) = "do" - │ │ └── closing_loc: (51,0)-(51,3) = "end" + │ │ ├── closing_loc: (51,0)-(51,3) = "end" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (52,0)-(56,3)) │ ├── receiver: ∅ @@ -900,7 +920,8 @@ │ │ │ ├── ensure_clause: ∅ │ │ │ └── end_keyword_loc: (56,0)-(56,3) = "end" │ │ ├── opening_loc: (52,2)-(52,4) = "do" - │ │ └── closing_loc: (56,0)-(56,3) = "end" + │ │ ├── closing_loc: (56,0)-(56,3) = "end" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (57,0)-(61,3)) │ ├── receiver: ∅ @@ -969,7 +990,8 @@ │ │ │ ├── ensure_clause: ∅ │ │ │ └── end_keyword_loc: (61,0)-(61,3) = "end" │ │ ├── opening_loc: (57,2)-(57,4) = "do" - │ │ └── closing_loc: (61,0)-(61,3) = "end" + │ │ ├── closing_loc: (61,0)-(61,3) = "end" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (62,0)-(66,3)) │ ├── receiver: ∅ @@ -1041,7 +1063,8 @@ │ │ │ ├── ensure_clause: ∅ │ │ │ └── end_keyword_loc: (66,0)-(66,3) = "end" │ │ ├── opening_loc: (62,2)-(62,4) = "do" - │ │ └── closing_loc: (66,0)-(66,3) = "end" + │ │ ├── closing_loc: (66,0)-(66,3) = "end" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (67,0)-(71,3)) │ ├── receiver: ∅ @@ -1108,7 +1131,8 @@ │ │ │ ├── ensure_clause: ∅ │ │ │ └── end_keyword_loc: (71,0)-(71,3) = "end" │ │ ├── opening_loc: (67,2)-(67,4) = "do" - │ │ └── closing_loc: (71,0)-(71,3) = "end" + │ │ ├── closing_loc: (71,0)-(71,3) = "end" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (72,0)-(75,3)) │ ├── receiver: ∅ @@ -1152,7 +1176,8 @@ │ │ │ ├── ensure_clause: ∅ │ │ │ └── end_keyword_loc: (75,0)-(75,3) = "end" │ │ ├── opening_loc: (72,2)-(72,4) = "do" - │ │ └── closing_loc: (75,0)-(75,3) = "end" + │ │ ├── closing_loc: (75,0)-(75,3) = "end" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (76,0)-(81,3)) │ ├── receiver: ∅ @@ -1210,7 +1235,8 @@ │ │ │ ├── ensure_clause: ∅ │ │ │ └── end_keyword_loc: (81,0)-(81,3) = "end" │ │ ├── opening_loc: (76,2)-(76,4) = "do" - │ │ └── closing_loc: (81,0)-(81,3) = "end" + │ │ ├── closing_loc: (81,0)-(81,3) = "end" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (82,0)-(86,3)) │ ├── receiver: ∅ @@ -1280,7 +1306,8 @@ │ │ │ ├── ensure_clause: ∅ │ │ │ └── end_keyword_loc: (86,0)-(86,3) = "end" │ │ ├── opening_loc: (82,2)-(82,4) = "do" - │ │ └── closing_loc: (86,0)-(86,3) = "end" + │ │ ├── closing_loc: (86,0)-(86,3) = "end" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (87,0)-(89,3)) │ ├── receiver: ∅ @@ -1307,7 +1334,8 @@ │ │ │ │ └── end_keyword_loc: (89,0)-(89,3) = "end" │ │ │ └── end_keyword_loc: (89,0)-(89,3) = "end" │ │ ├── opening_loc: (87,2)-(87,4) = "do" - │ │ └── closing_loc: (89,0)-(89,3) = "end" + │ │ ├── closing_loc: (89,0)-(89,3) = "end" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ ├── @ CallNode (location: (90,0)-(93,3)) │ ├── receiver: ∅ @@ -1341,7 +1369,8 @@ │ │ │ │ └── end_keyword_loc: (93,0)-(93,3) = "end" │ │ │ └── end_keyword_loc: (93,0)-(93,3) = "end" │ │ ├── opening_loc: (90,2)-(90,4) = "do" - │ │ └── closing_loc: (93,0)-(93,3) = "end" + │ │ ├── closing_loc: (93,0)-(93,3) = "end" + │ │ └── numbered_parameters: 0 │ └── flags: ∅ └── @ CallNode (location: (94,0)-(96,1)) ├── receiver: ∅ @@ -1378,5 +1407,6 @@ │ │ ├── block: ∅ │ │ └── flags: ∅ │ ├── opening_loc: (94,4)-(94,5) = "{" - │ └── closing_loc: (96,0)-(96,1) = "}" + │ ├── closing_loc: (96,0)-(96,1) = "}" + │ └── numbered_parameters: 2 └── flags: ∅ |