seattlerb / ruby_parser

ruby_parser is a ruby parser written in pure ruby. It outputs s-expressions which can be manipulated and converted back to ruby via the ruby2ruby gem.
http://www.zenspider.com/projects/ruby_parser.html
476 stars 100 forks source link

Should treat double-splat arguments to blocks as lvars #276

Closed mvz closed 5 years ago

mvz commented 5 years ago
>> RubyParser.new.parse 'foo { |*bar| bar }'
#=> s(:iter, s(:call, nil, :foo), s(:args, :"*bar"), s(:lvar, :bar))
>> RubyParser.new.parse 'foo { |**bar| bar }'
#=> s(:iter, s(:call, nil, :foo), s(:args, :"**bar"), s(:call, nil, :bar))

I would expect s(:lvar, :bar) in the second case.

zenspider commented 5 years ago

Fixed:

s(:iter, s(:call, nil, :foo), s(:args, :"**bar"), s(:lvar, :bar))