From 8e708e4a077d85e50cd797b2478aba7bfd5e4ac3 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 25 Jan 2024 15:08:44 -0800 Subject: Update forwarding locals for prism --- test/prism/errors_test.rb | 12 +++---- test/prism/snapshots/arrays.txt | 36 +++++++++---------- test/prism/snapshots/method_calls.txt | 4 +-- test/prism/snapshots/methods.txt | 40 +++++++++++----------- test/prism/snapshots/seattlerb/block_arg__bare.txt | 4 +-- .../snapshots/seattlerb/defn_arg_asplat_arg.txt | 4 +-- .../snapshots/seattlerb/defn_arg_forward_args.txt | 4 +-- .../snapshots/seattlerb/defn_args_forward_args.txt | 4 +-- .../snapshots/seattlerb/defn_forward_args.txt | 4 +-- .../seattlerb/defn_forward_args__no_parens.txt | 4 +-- .../seattlerb/defn_kwarg_kwsplat_anon.txt | 4 +-- test/prism/snapshots/seattlerb/defn_splat_arg.txt | 4 +-- .../snapshots/unparser/corpus/literal/def.txt | 4 +-- .../snapshots/unparser/corpus/literal/since/31.txt | 8 ++--- .../snapshots/unparser/corpus/literal/since/32.txt | 8 ++--- .../snapshots/whitequark/anonymous_blockarg.txt | 4 +-- test/prism/snapshots/whitequark/args.txt | 4 +-- .../endless_method_forwarded_args_legacy.txt | 4 +-- test/prism/snapshots/whitequark/forward_arg.txt | 4 +-- .../whitequark/forward_arg_with_open_args.txt | 40 +++++++++++----------- .../snapshots/whitequark/forward_args_legacy.txt | 12 +++---- .../forwarded_argument_with_kwrestarg.txt | 4 +-- .../whitequark/forwarded_argument_with_restarg.txt | 4 +-- .../snapshots/whitequark/forwarded_kwrestarg.txt | 4 +-- .../forwarded_kwrestarg_with_additional_kwarg.txt | 4 +-- .../snapshots/whitequark/forwarded_restarg.txt | 4 +-- .../kwoptarg_with_kwrestarg_and_forwarded_args.txt | 4 +-- .../snapshots/whitequark/kwrestarg_unnamed.txt | 4 +-- .../prism/snapshots/whitequark/restarg_unnamed.txt | 4 +-- .../snapshots/whitequark/trailing_forward_arg.txt | 4 +-- test/ruby/test_compile_prism.rb | 24 +++++++++++++ 31 files changed, 148 insertions(+), 124 deletions(-) (limited to 'test') diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb index 4518c8a65d..62e72ea16a 100644 --- a/test/prism/errors_test.rb +++ b/test/prism/errors_test.rb @@ -754,8 +754,8 @@ module Prism nil, ParametersNode([], [], nil, [RequiredParameterNode(0, :a)], [], nil, BlockParameterNode(0, nil, nil, Location())), nil, - [:&, :a], - 2, + [:a], + 1, Location(), nil, Location(), @@ -784,8 +784,8 @@ module Prism nil ), nil, - [:"...", :a], - 2, + [:a], + 1, Location(), nil, Location(), @@ -864,8 +864,8 @@ module Prism nil, ParametersNode([], [], nil, [], [], ForwardingParameterNode(), nil), nil, - [:"..."], - 1, + [], + 0, Location(), nil, Location(), diff --git a/test/prism/snapshots/arrays.txt b/test/prism/snapshots/arrays.txt index bea52be855..dd84e25b4a 100644 --- a/test/prism/snapshots/arrays.txt +++ b/test/prism/snapshots/arrays.txt @@ -1066,8 +1066,8 @@ │ │ @ BlockArgumentNode (location: (89,6)-(89,7)) │ │ ├── expression: ∅ │ │ └── operator_loc: (89,6)-(89,7) = "&" - │ ├── locals: [:&] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (88,0)-(88,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (88,7)-(88,8) = "(" @@ -1847,8 +1847,8 @@ │ │ │ └── expression: ∅ │ │ ├── closing_loc: (128,13)-(128,14) = "]" │ │ └── block: ∅ - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (128,0)-(128,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (128,5)-(128,6) = "(" @@ -1904,8 +1904,8 @@ │ │ │ └── expression: ∅ │ │ ├── closing_loc: (130,16)-(130,17) = "]" │ │ └── block: ∅ - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (130,0)-(130,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (130,5)-(130,6) = "(" @@ -1961,8 +1961,8 @@ │ │ │ └── flags: decimal │ │ ├── closing_loc: (132,13)-(132,14) = "]" │ │ └── block: ∅ - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (132,0)-(132,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (132,5)-(132,6) = "(" @@ -2020,8 +2020,8 @@ │ │ │ └── flags: decimal │ │ ├── closing_loc: (134,16)-(134,17) = "]" │ │ └── block: ∅ - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (134,0)-(134,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (134,5)-(134,6) = "(" @@ -2078,8 +2078,8 @@ │ │ └── value: │ │ @ IntegerNode (location: (136,18)-(136,19)) │ │ └── flags: decimal - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (136,0)-(136,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (136,5)-(136,6) = "(" @@ -2137,8 +2137,8 @@ │ │ └── value: │ │ @ IntegerNode (location: (138,22)-(138,23)) │ │ └── flags: decimal - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (138,0)-(138,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (138,5)-(138,6) = "(" @@ -2201,8 +2201,8 @@ │ │ ├── else_clause: ∅ │ │ ├── ensure_clause: ∅ │ │ └── end_keyword_loc: (140,26)-(140,29) = "end" - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (140,0)-(140,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (140,5)-(140,6) = "(" @@ -2267,8 +2267,8 @@ │ ├── else_clause: ∅ │ ├── ensure_clause: ∅ │ └── end_keyword_loc: (142,29)-(142,32) = "end" - ├── locals: [:*] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (142,0)-(142,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (142,5)-(142,6) = "(" diff --git a/test/prism/snapshots/method_calls.txt b/test/prism/snapshots/method_calls.txt index adf02ef187..f40c2158e4 100644 --- a/test/prism/snapshots/method_calls.txt +++ b/test/prism/snapshots/method_calls.txt @@ -2341,8 +2341,8 @@ │ │ │ └── expression: ∅ │ │ ├── closing_loc: ∅ │ │ └── block: ∅ - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (149,0)-(149,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (149,5)-(149,6) = "(" diff --git a/test/prism/snapshots/methods.txt b/test/prism/snapshots/methods.txt index c4f4b70f50..7f3b61f75d 100644 --- a/test/prism/snapshots/methods.txt +++ b/test/prism/snapshots/methods.txt @@ -202,8 +202,8 @@ │ │ │ @ ForwardingParameterNode (location: (19,6)-(19,9)) │ │ └── block: ∅ │ ├── body: ∅ - │ ├── locals: [:"..."] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (19,0)-(19,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (19,5)-(19,6) = "(" @@ -370,8 +370,8 @@ │ │ │ └── operator_loc: (41,6)-(41,8) = "**" │ │ └── block: ∅ │ ├── body: ∅ - │ ├── locals: [:**] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (41,0)-(41,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (41,5)-(41,6) = "(" @@ -743,8 +743,8 @@ │ │ ├── keyword_rest: ∅ │ │ └── block: ∅ │ ├── body: ∅ - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (82,0)-(82,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (82,5)-(82,6) = "(" @@ -983,8 +983,8 @@ │ │ │ └── expression: ∅ │ │ ├── closing_loc: (110,13)-(110,14) = ")" │ │ └── block: ∅ - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (110,0)-(110,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (110,5)-(110,6) = "(" @@ -1022,8 +1022,8 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (112,14)-(112,17)) │ │ ├── closing_loc: (112,17)-(112,18) = ")" │ │ └── block: ∅ - │ ├── locals: [:"..."] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (112,0)-(112,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (112,5)-(112,6) = "(" @@ -1065,8 +1065,8 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (114,20)-(114,23)) │ │ ├── closing_loc: (114,23)-(114,24) = ")" │ │ └── block: ∅ - │ ├── locals: [:"..."] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (114,0)-(114,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (114,5)-(114,6) = "(" @@ -1153,8 +1153,8 @@ │ │ ├── name_loc: ∅ │ │ └── operator_loc: (122,6)-(122,7) = "&" │ ├── body: ∅ - │ ├── locals: [:&] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (122,0)-(122,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (122,5)-(122,6) = "(" @@ -1296,8 +1296,8 @@ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (136,24)-(136,25) = "}" │ │ └── closing_loc: (136,25)-(136,26) = "\"" - │ ├── locals: [:"..."] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (136,0)-(136,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (136,5)-(136,6) = "(" @@ -1747,8 +1747,8 @@ │ │ │ └── expression: ∅ │ │ ├── opening_loc: (167,10)-(167,11) = "[" │ │ └── closing_loc: (167,12)-(167,13) = "]" - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (167,0)-(167,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (167,5)-(167,6) = "(" @@ -1959,8 +1959,8 @@ │ │ @ BlockArgumentNode (location: (178,6)-(178,7)) │ │ ├── expression: ∅ │ │ └── operator_loc: (178,6)-(178,7) = "&" - │ ├── locals: [:"..."] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (177,0)-(177,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (177,7)-(177,8) = "(" diff --git a/test/prism/snapshots/seattlerb/block_arg__bare.txt b/test/prism/snapshots/seattlerb/block_arg__bare.txt index f3b6d3c11c..9bf5016ad1 100644 --- a/test/prism/snapshots/seattlerb/block_arg__bare.txt +++ b/test/prism/snapshots/seattlerb/block_arg__bare.txt @@ -22,8 +22,8 @@ │ ├── name_loc: ∅ │ └── operator_loc: (1,6)-(1,7) = "&" ├── body: ∅ - ├── locals: [:&] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,5)-(1,6) = "(" diff --git a/test/prism/snapshots/seattlerb/defn_arg_asplat_arg.txt b/test/prism/snapshots/seattlerb/defn_arg_asplat_arg.txt index ecc7ad04a4..fc726fe4de 100644 --- a/test/prism/snapshots/seattlerb/defn_arg_asplat_arg.txt +++ b/test/prism/snapshots/seattlerb/defn_arg_asplat_arg.txt @@ -28,8 +28,8 @@ │ ├── keyword_rest: ∅ │ └── block: ∅ ├── body: ∅ - ├── locals: [:interp, :*, :args] - ├── locals_body_index: 3 + ├── locals: [:interp, :args] + ├── locals_body_index: 2 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,8)-(1,9) = "(" diff --git a/test/prism/snapshots/seattlerb/defn_arg_forward_args.txt b/test/prism/snapshots/seattlerb/defn_arg_forward_args.txt index 46c0e91ade..2068a8011b 100644 --- a/test/prism/snapshots/seattlerb/defn_arg_forward_args.txt +++ b/test/prism/snapshots/seattlerb/defn_arg_forward_args.txt @@ -40,8 +40,8 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,20)-(1,23)) │ ├── closing_loc: (1,23)-(1,24) = ")" │ └── block: ∅ - ├── locals: [:x, :"..."] - ├── locals_body_index: 2 + ├── locals: [:x] + ├── locals_body_index: 1 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,5)-(1,6) = "(" diff --git a/test/prism/snapshots/seattlerb/defn_args_forward_args.txt b/test/prism/snapshots/seattlerb/defn_args_forward_args.txt index e6b72907b0..b6802c2fd8 100644 --- a/test/prism/snapshots/seattlerb/defn_args_forward_args.txt +++ b/test/prism/snapshots/seattlerb/defn_args_forward_args.txt @@ -52,8 +52,8 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,32)-(1,35)) │ ├── closing_loc: (1,35)-(1,36) = ")" │ └── block: ∅ - ├── locals: [:x, :y, :z, :"..."] - ├── locals_body_index: 4 + ├── locals: [:x, :y, :z] + ├── locals_body_index: 3 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,5)-(1,6) = "(" diff --git a/test/prism/snapshots/seattlerb/defn_forward_args.txt b/test/prism/snapshots/seattlerb/defn_forward_args.txt index 4782e055ec..e13c469f87 100644 --- a/test/prism/snapshots/seattlerb/defn_forward_args.txt +++ b/test/prism/snapshots/seattlerb/defn_forward_args.txt @@ -34,8 +34,8 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,14)-(1,17)) │ ├── closing_loc: (1,17)-(1,18) = ")" │ └── block: ∅ - ├── locals: [:"..."] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,5)-(1,6) = "(" diff --git a/test/prism/snapshots/seattlerb/defn_forward_args__no_parens.txt b/test/prism/snapshots/seattlerb/defn_forward_args__no_parens.txt index c357b76bed..8b62141c99 100644 --- a/test/prism/snapshots/seattlerb/defn_forward_args__no_parens.txt +++ b/test/prism/snapshots/seattlerb/defn_forward_args__no_parens.txt @@ -34,8 +34,8 @@ │ │ └── @ ForwardingArgumentsNode (location: (2,4)-(2,7)) │ ├── closing_loc: (2,7)-(2,8) = ")" │ └── block: ∅ - ├── locals: [:"..."] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: ∅ diff --git a/test/prism/snapshots/seattlerb/defn_kwarg_kwsplat_anon.txt b/test/prism/snapshots/seattlerb/defn_kwarg_kwsplat_anon.txt index 897a36bc6a..d1cab9b225 100644 --- a/test/prism/snapshots/seattlerb/defn_kwarg_kwsplat_anon.txt +++ b/test/prism/snapshots/seattlerb/defn_kwarg_kwsplat_anon.txt @@ -29,8 +29,8 @@ │ │ └── operator_loc: (1,12)-(1,14) = "**" │ └── block: ∅ ├── body: ∅ - ├── locals: [:b, :**] - ├── locals_body_index: 2 + ├── locals: [:b] + ├── locals_body_index: 1 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,5)-(1,6) = "(" diff --git a/test/prism/snapshots/seattlerb/defn_splat_arg.txt b/test/prism/snapshots/seattlerb/defn_splat_arg.txt index 6533258fe6..a187ae49a8 100644 --- a/test/prism/snapshots/seattlerb/defn_splat_arg.txt +++ b/test/prism/snapshots/seattlerb/defn_splat_arg.txt @@ -25,8 +25,8 @@ │ ├── keyword_rest: ∅ │ └── block: ∅ ├── body: ∅ - ├── locals: [:*, :a] - ├── locals_body_index: 2 + ├── locals: [:a] + ├── locals_body_index: 1 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,5)-(1,6) = "(" diff --git a/test/prism/snapshots/unparser/corpus/literal/def.txt b/test/prism/snapshots/unparser/corpus/literal/def.txt index d1face8810..b6d88a4e0f 100644 --- a/test/prism/snapshots/unparser/corpus/literal/def.txt +++ b/test/prism/snapshots/unparser/corpus/literal/def.txt @@ -774,8 +774,8 @@ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ │ │ └── block: ∅ - │ ├── locals: [:*] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (83,0)-(83,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (83,7)-(83,8) = "(" diff --git a/test/prism/snapshots/unparser/corpus/literal/since/31.txt b/test/prism/snapshots/unparser/corpus/literal/since/31.txt index 7927a8e44a..09e94d6b7f 100644 --- a/test/prism/snapshots/unparser/corpus/literal/since/31.txt +++ b/test/prism/snapshots/unparser/corpus/literal/since/31.txt @@ -37,8 +37,8 @@ │ │ @ BlockArgumentNode (location: (2,6)-(2,7)) │ │ ├── expression: ∅ │ │ └── operator_loc: (2,6)-(2,7) = "&" - │ ├── locals: [:&] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (1,0)-(1,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (1,7)-(1,8) = "(" @@ -82,8 +82,8 @@ │ @ BlockArgumentNode (location: (6,6)-(6,7)) │ ├── expression: ∅ │ └── operator_loc: (6,6)-(6,7) = "&" - ├── locals: [:a, :&] - ├── locals_body_index: 2 + ├── locals: [:a] + ├── locals_body_index: 1 ├── def_keyword_loc: (5,0)-(5,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (5,7)-(5,8) = "(" diff --git a/test/prism/snapshots/unparser/corpus/literal/since/32.txt b/test/prism/snapshots/unparser/corpus/literal/since/32.txt index a202628595..9b7fa85fe0 100644 --- a/test/prism/snapshots/unparser/corpus/literal/since/32.txt +++ b/test/prism/snapshots/unparser/corpus/literal/since/32.txt @@ -49,8 +49,8 @@ │ │ │ └── operator_loc: (2,16)-(2,18) = "**" │ │ ├── closing_loc: (2,18)-(2,19) = ")" │ │ └── block: ∅ - │ ├── locals: [:argument, :**] - │ ├── locals_body_index: 2 + │ ├── locals: [:argument] + │ ├── locals_body_index: 1 │ ├── def_keyword_loc: (1,0)-(1,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (1,7)-(1,8) = "(" @@ -100,8 +100,8 @@ │ │ └── expression: ∅ │ ├── closing_loc: (6,17)-(6,18) = ")" │ └── block: ∅ - ├── locals: [:argument, :*] - ├── locals_body_index: 2 + ├── locals: [:argument] + ├── locals_body_index: 1 ├── def_keyword_loc: (5,0)-(5,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (5,7)-(5,8) = "(" diff --git a/test/prism/snapshots/whitequark/anonymous_blockarg.txt b/test/prism/snapshots/whitequark/anonymous_blockarg.txt index aaeef280a0..da760b785f 100644 --- a/test/prism/snapshots/whitequark/anonymous_blockarg.txt +++ b/test/prism/snapshots/whitequark/anonymous_blockarg.txt @@ -37,8 +37,8 @@ │ @ BlockArgumentNode (location: (1,16)-(1,17)) │ ├── expression: ∅ │ └── operator_loc: (1,16)-(1,17) = "&" - ├── locals: [:&] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,7)-(1,8) = "(" diff --git a/test/prism/snapshots/whitequark/args.txt b/test/prism/snapshots/whitequark/args.txt index 927ee3c1fe..53bd2ebbc3 100644 --- a/test/prism/snapshots/whitequark/args.txt +++ b/test/prism/snapshots/whitequark/args.txt @@ -521,8 +521,8 @@ │ │ │ └── operator_loc: (29,9)-(29,11) = "**" │ │ └── block: ∅ │ ├── body: ∅ - │ ├── locals: [:*, :**] - │ ├── locals_body_index: 2 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (29,0)-(29,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: ∅ diff --git a/test/prism/snapshots/whitequark/endless_method_forwarded_args_legacy.txt b/test/prism/snapshots/whitequark/endless_method_forwarded_args_legacy.txt index 366258cf92..039b014a1c 100644 --- a/test/prism/snapshots/whitequark/endless_method_forwarded_args_legacy.txt +++ b/test/prism/snapshots/whitequark/endless_method_forwarded_args_legacy.txt @@ -34,8 +34,8 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,19)-(1,22)) │ ├── closing_loc: (1,22)-(1,23) = ")" │ └── block: ∅ - ├── locals: [:"..."] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,7)-(1,8) = "(" diff --git a/test/prism/snapshots/whitequark/forward_arg.txt b/test/prism/snapshots/whitequark/forward_arg.txt index c81fc7a142..0ec875106d 100644 --- a/test/prism/snapshots/whitequark/forward_arg.txt +++ b/test/prism/snapshots/whitequark/forward_arg.txt @@ -34,8 +34,8 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,18)-(1,21)) │ ├── closing_loc: (1,21)-(1,22) = ")" │ └── block: ∅ - ├── locals: [:"..."] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,7)-(1,8) = "(" diff --git a/test/prism/snapshots/whitequark/forward_arg_with_open_args.txt b/test/prism/snapshots/whitequark/forward_arg_with_open_args.txt index 75fb87e0e7..a85400a37f 100644 --- a/test/prism/snapshots/whitequark/forward_arg_with_open_args.txt +++ b/test/prism/snapshots/whitequark/forward_arg_with_open_args.txt @@ -38,8 +38,8 @@ │ │ │ │ └── @ ForwardingArgumentsNode (location: (2,6)-(2,9)) │ │ │ ├── closing_loc: (2,9)-(2,10) = ")" │ │ │ └── block: ∅ - │ │ ├── locals: [:"..."] - │ │ ├── locals_body_index: 1 + │ │ ├── locals: [] + │ │ ├── locals_body_index: 0 │ │ ├── def_keyword_loc: (1,1)-(1,4) = "def" │ │ ├── operator_loc: ∅ │ │ ├── lparen_loc: ∅ @@ -83,8 +83,8 @@ │ │ │ │ └── @ ForwardingArgumentsNode (location: (5,18)-(5,21)) │ │ │ ├── closing_loc: (5,21)-(5,22) = ")" │ │ │ └── block: ∅ - │ │ ├── locals: [:"..."] - │ │ ├── locals_body_index: 1 + │ │ ├── locals: [] + │ │ ├── locals_body_index: 0 │ │ ├── def_keyword_loc: (5,1)-(5,4) = "def" │ │ ├── operator_loc: ∅ │ │ ├── lparen_loc: ∅ @@ -108,8 +108,8 @@ │ │ │ @ ForwardingParameterNode (location: (7,8)-(7,11)) │ │ └── block: ∅ │ ├── body: ∅ - │ ├── locals: [:"..."] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (7,0)-(7,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: ∅ @@ -147,8 +147,8 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (10,17)-(10,20)) │ │ ├── closing_loc: (10,20)-(10,21) = ")" │ │ └── block: ∅ - │ ├── locals: [:"..."] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (10,0)-(10,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: ∅ @@ -189,8 +189,8 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (13,6)-(13,9)) │ │ ├── closing_loc: (13,9)-(13,10) = ")" │ │ └── block: ∅ - │ ├── locals: [:a, :"..."] - │ ├── locals_body_index: 2 + │ ├── locals: [:a] + │ ├── locals_body_index: 1 │ ├── def_keyword_loc: (12,0)-(12,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: ∅ @@ -231,8 +231,8 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (16,20)-(16,23)) │ │ ├── closing_loc: (16,23)-(16,24) = ")" │ │ └── block: ∅ - │ ├── locals: [:a, :"..."] - │ ├── locals_body_index: 2 + │ ├── locals: [:a] + │ ├── locals_body_index: 1 │ ├── def_keyword_loc: (16,0)-(16,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: ∅ @@ -265,8 +265,8 @@ │ │ │ @ ForwardingParameterNode (location: (18,18)-(18,21)) │ │ └── block: ∅ │ ├── body: ∅ - │ ├── locals: [:a, :b, :"..."] - │ ├── locals_body_index: 3 + │ ├── locals: [:a, :b] + │ ├── locals_body_index: 2 │ ├── def_keyword_loc: (18,0)-(18,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: ∅ @@ -312,8 +312,8 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (22,6)-(22,9)) │ │ ├── closing_loc: (22,9)-(22,10) = ")" │ │ └── block: ∅ - │ ├── locals: [:b, :"..."] - │ ├── locals_body_index: 2 + │ ├── locals: [:b] + │ ├── locals_body_index: 1 │ ├── def_keyword_loc: (21,0)-(21,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: ∅ @@ -359,8 +359,8 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (25,24)-(25,27)) │ │ ├── closing_loc: (25,27)-(25,28) = ")" │ │ └── block: ∅ - │ ├── locals: [:b, :"..."] - │ ├── locals_body_index: 2 + │ ├── locals: [:b] + │ ├── locals_body_index: 1 │ ├── def_keyword_loc: (25,0)-(25,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: ∅ @@ -401,8 +401,8 @@ │ │ └── @ ForwardingArgumentsNode (location: (27,20)-(27,23)) │ ├── closing_loc: (27,23)-(27,24) = ")" │ └── block: ∅ - ├── locals: [:a, :"..."] - ├── locals_body_index: 2 + ├── locals: [:a] + ├── locals_body_index: 1 ├── def_keyword_loc: (27,0)-(27,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (27,7)-(27,8) = "(" diff --git a/test/prism/snapshots/whitequark/forward_args_legacy.txt b/test/prism/snapshots/whitequark/forward_args_legacy.txt index 6175e6588f..d2774737e9 100644 --- a/test/prism/snapshots/whitequark/forward_args_legacy.txt +++ b/test/prism/snapshots/whitequark/forward_args_legacy.txt @@ -34,8 +34,8 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (1,18)-(1,21)) │ │ ├── closing_loc: (1,21)-(1,22) = ")" │ │ └── block: ∅ - │ ├── locals: [:"..."] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (1,0)-(1,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (1,7)-(1,8) = "(" @@ -57,8 +57,8 @@ │ │ │ @ ForwardingParameterNode (location: (3,8)-(3,11)) │ │ └── block: ∅ │ ├── body: ∅ - │ ├── locals: [:"..."] - │ ├── locals_body_index: 1 + │ ├── locals: [] + │ ├── locals_body_index: 0 │ ├── def_keyword_loc: (3,0)-(3,3) = "def" │ ├── operator_loc: ∅ │ ├── lparen_loc: (3,7)-(3,8) = "(" @@ -92,8 +92,8 @@ │ │ └── @ ForwardingArgumentsNode (location: (5,20)-(5,23)) │ ├── rparen_loc: (5,23)-(5,24) = ")" │ └── block: ∅ - ├── locals: [:"..."] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (5,0)-(5,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (5,7)-(5,8) = "(" diff --git a/test/prism/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt b/test/prism/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt index ff7a094575..d7a1d53d83 100644 --- a/test/prism/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt +++ b/test/prism/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt @@ -49,8 +49,8 @@ │ │ └── operator_loc: (1,37)-(1,39) = "**" │ ├── closing_loc: (1,39)-(1,40) = ")" │ └── block: ∅ - ├── locals: [:argument, :**] - ├── locals_body_index: 2 + ├── locals: [:argument] + ├── locals_body_index: 1 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,7)-(1,8) = "(" diff --git a/test/prism/snapshots/whitequark/forwarded_argument_with_restarg.txt b/test/prism/snapshots/whitequark/forwarded_argument_with_restarg.txt index 249a6260ce..df93c463a3 100644 --- a/test/prism/snapshots/whitequark/forwarded_argument_with_restarg.txt +++ b/test/prism/snapshots/whitequark/forwarded_argument_with_restarg.txt @@ -46,8 +46,8 @@ │ │ └── expression: ∅ │ ├── closing_loc: (1,37)-(1,38) = ")" │ └── block: ∅ - ├── locals: [:argument, :*] - ├── locals_body_index: 2 + ├── locals: [:argument] + ├── locals_body_index: 1 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,7)-(1,8) = "(" diff --git a/test/prism/snapshots/whitequark/forwarded_kwrestarg.txt b/test/prism/snapshots/whitequark/forwarded_kwrestarg.txt index bd2f55aeba..2d44055e21 100644 --- a/test/prism/snapshots/whitequark/forwarded_kwrestarg.txt +++ b/test/prism/snapshots/whitequark/forwarded_kwrestarg.txt @@ -43,8 +43,8 @@ │ │ └── operator_loc: (1,17)-(1,19) = "**" │ ├── closing_loc: (1,19)-(1,20) = ")" │ └── block: ∅ - ├── locals: [:**] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,7)-(1,8) = "(" diff --git a/test/prism/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt b/test/prism/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt index 4299036bf8..5f29c7d61d 100644 --- a/test/prism/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt +++ b/test/prism/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt @@ -54,8 +54,8 @@ │ │ └── operator_loc: ∅ │ ├── closing_loc: (1,35)-(1,36) = ")" │ └── block: ∅ - ├── locals: [:**] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,7)-(1,8) = "(" diff --git a/test/prism/snapshots/whitequark/forwarded_restarg.txt b/test/prism/snapshots/whitequark/forwarded_restarg.txt index 43e514bde5..ac24409eb4 100644 --- a/test/prism/snapshots/whitequark/forwarded_restarg.txt +++ b/test/prism/snapshots/whitequark/forwarded_restarg.txt @@ -40,8 +40,8 @@ │ │ └── expression: ∅ │ ├── closing_loc: (1,17)-(1,18) = ")" │ └── block: ∅ - ├── locals: [:*] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,7)-(1,8) = "(" diff --git a/test/prism/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt b/test/prism/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt index f39e6e4466..d951497293 100644 --- a/test/prism/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt +++ b/test/prism/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt @@ -49,8 +49,8 @@ │ │ └── operator_loc: (1,21)-(1,23) = "**" │ ├── closing_loc: (1,23)-(1,24) = ")" │ └── block: ∅ - ├── locals: [:a, :**] - ├── locals_body_index: 2 + ├── locals: [:a] + ├── locals_body_index: 1 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,5)-(1,6) = "(" diff --git a/test/prism/snapshots/whitequark/kwrestarg_unnamed.txt b/test/prism/snapshots/whitequark/kwrestarg_unnamed.txt index 564dfbcd6f..92e65deb56 100644 --- a/test/prism/snapshots/whitequark/kwrestarg_unnamed.txt +++ b/test/prism/snapshots/whitequark/kwrestarg_unnamed.txt @@ -22,8 +22,8 @@ │ │ └── operator_loc: (1,6)-(1,8) = "**" │ └── block: ∅ ├── body: ∅ - ├── locals: [:**] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,5)-(1,6) = "(" diff --git a/test/prism/snapshots/whitequark/restarg_unnamed.txt b/test/prism/snapshots/whitequark/restarg_unnamed.txt index 388dad1972..cf8c57f004 100644 --- a/test/prism/snapshots/whitequark/restarg_unnamed.txt +++ b/test/prism/snapshots/whitequark/restarg_unnamed.txt @@ -22,8 +22,8 @@ │ ├── keyword_rest: ∅ │ └── block: ∅ ├── body: ∅ - ├── locals: [:*] - ├── locals_body_index: 1 + ├── locals: [] + ├── locals_body_index: 0 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,5)-(1,6) = "(" diff --git a/test/prism/snapshots/whitequark/trailing_forward_arg.txt b/test/prism/snapshots/whitequark/trailing_forward_arg.txt index fa6036e469..20bfe57428 100644 --- a/test/prism/snapshots/whitequark/trailing_forward_arg.txt +++ b/test/prism/snapshots/whitequark/trailing_forward_arg.txt @@ -45,8 +45,8 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,31)-(1,34)) │ ├── closing_loc: (1,34)-(1,35) = ")" │ └── block: ∅ - ├── locals: [:a, :b, :"..."] - ├── locals_body_index: 3 + ├── locals: [:a, :b] + ├── locals_body_index: 2 ├── def_keyword_loc: (1,0)-(1,3) = "def" ├── operator_loc: ∅ ├── lparen_loc: (1,7)-(1,8) = "(" diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 901cc0741e..fc11eb21b7 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1616,6 +1616,30 @@ a CODE end + def test_pow_parameters + assert_prism_eval("def self.m(a, **); end; method(:m).parameters") + end + + def test_star_parameters + assert_prism_eval("def self.m(a, *, b); end; method(:m).parameters") + end + + def test_repeated_block_params + assert_prism_eval("def self.x(&blk); blk; end; x { |_, _, _ = 1, *_, _:, _: 2, **_, &_| }.parameters") + end + + def test_repeated_proc_params + assert_prism_eval("proc {|_, _, _ = 1, *_, _:, _: 2, **_, &_| }.parameters") + end + + def test_forward_parameters_block + assert_prism_eval("def self.m(&); end; method(:m).parameters") + end + + def test_forward_parameters + assert_prism_eval("def self.m(...); end; method(:m).parameters") + end + def test_repeated_block_underscore assert_prism_eval("def self.m(_, **_, &_); _; end; method(:m).parameters") end -- cgit v1.2.3