summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEarlopain <[email protected]>2025-01-05 13:54:38 +0100
committerKevin Newton <[email protected]>2025-01-11 19:09:05 -0500
commitd1a70014f9a1ee411c41338d0929443bab004cda (patch)
tree7b18105f3d20fd93e97596b0aae5fbd7b660ec2c /lib
parent7cbaa3b9298b4ab5027d75a7317ca43a9e745c16 (diff)
[ruby/prism] Fix parser translator ast when using anonymous forwarding in blocks/lambda
Blocks and lambdas inherit anonymous arguments from the method they are a part of. They themselves don't allow to introduce new anonymous arguments. While you can write this: ```rb def foo(*) bar { |**| } end ``` referecing the new parameter inside of the block will always be a syntax error. https://github.com/ruby/prism/commit/2cbd27e134
Diffstat (limited to 'lib')
-rw-r--r--lib/prism/translation/parser/compiler.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/prism/translation/parser/compiler.rb b/lib/prism/translation/parser/compiler.rb
index 3f0294bf62..54e08eb991 100644
--- a/lib/prism/translation/parser/compiler.rb
+++ b/lib/prism/translation/parser/compiler.rb
@@ -1187,7 +1187,7 @@ module Prism
false
)
end,
- node.body&.accept(copy_compiler(forwarding: implicit_parameters ? [] : find_forwarding(parameters&.parameters))),
+ visit(node.body),
[node.closing, srange(node.closing_loc)]
)
end
@@ -2042,7 +2042,7 @@ module Prism
false
)
end,
- block.body&.accept(copy_compiler(forwarding: implicit_parameters ? [] : find_forwarding(parameters&.parameters))),
+ visit(block.body),
token(block.closing_loc)
)
else