ruby-syntax-tree / syntax_tree

Interact with the Ruby syntax tree
https://ruby-syntax-tree.github.io/syntax_tree/
MIT License
563 stars 54 forks source link

Always use do/end for multiline lambdas #380

Closed etiennebarrie closed 1 year ago

etiennebarrie commented 1 year ago

Fixes #379

Previously lambda blocks inside a Command/CommandCall were always using braces, even when multiline.

This removes the special handling of multiline lambda blocks, that was forcing curly braces when any of the parents were a Command or CommandCall.

I don't understand why that was there so I can't tell if it's somehow important, but no tests failed and it made the two added fixtures pass.

kddnewton commented 1 year ago

For the life of me I can't figure out why that is there.

I think it was in there when the lambda was an argument? As in

foo -> { bar } do end

but that appears to be fine. Maybe it wasn't in 2.6 when I made this? Not sure. Either way, thanks for the PR!