Skip to content

Commit c8037df

Browse files
committed
Fix parse.y translation for locals test
1 parent ee1cff7 commit c8037df

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

test/prism/locals_test.rb

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,17 @@ def prism_locals(source)
140140
case node
141141
when BlockNode, DefNode, LambdaNode
142142
names = node.locals
143-
params =
144-
if node.is_a?(DefNode)
145-
node.parameters
146-
elsif node.parameters.is_a?(NumberedParametersNode)
147-
nil
148-
else
149-
node.parameters&.parameters
150-
end
143+
params = nil
144+
145+
if node.is_a?(DefNode)
146+
params = node.parameters
147+
elsif node.parameters.is_a?(NumberedParametersNode)
148+
# nothing
149+
elsif node.parameters.is_a?(ItParametersNode)
150+
names << AnonymousLocal
151+
else
152+
params = node.parameters&.parameters
153+
end
151154

152155
# prism places parameters in the same order that they appear in the
153156
# source. CRuby places them in the order that they need to appear

0 commit comments

Comments
 (0)