Skip to content

Commit

Permalink
Merge pull request #3364 from Earlopain/parser-translator-forwarding-…
Browse files Browse the repository at this point in the history
…blocks
  • Loading branch information
kddnewton authored Jan 5, 2025
2 parents 8f086ac + 2cbd27e commit 66a95e6
Show file tree
Hide file tree
Showing 5 changed files with 637 additions and 474 deletions.
4 changes: 2 additions & 2 deletions lib/prism/translation/parser/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ def visit_lambda_node(node)
false
)
end,
node.body&.accept(copy_compiler(forwarding: implicit_parameters ? [] : find_forwarding(parameters&.parameters))),
visit(node.body),
[node.closing, srange(node.closing_loc)]
)
end
Expand Down Expand Up @@ -2042,7 +2042,7 @@ def visit_block(call, block)
false
)
end,
block.body&.accept(copy_compiler(forwarding: implicit_parameters ? [] : find_forwarding(parameters&.parameters))),
visit(block.body),
token(block.closing_loc)
)
else
Expand Down
4 changes: 4 additions & 0 deletions test/prism/fixtures/lambda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

-> foo: bar do end

def foo(*, **)
->() { bar(*, **) }
end

p{|a:
b|}

Expand Down
2 changes: 2 additions & 0 deletions test/prism/fixtures/methods.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def foo = 123

def a(*); b(*); end

def a(*, **); b { c(*, **) }; end

def a(...); b(...); end

def a(...); b(1, 2, ...); end
Expand Down
169 changes: 123 additions & 46 deletions test/prism/snapshots/lambda.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 66a95e6

Please sign in to comment.