seattlerb/ruby2ruby

mishandles nested `masgn` nodes in block args

jaynetics opened this issue · 3 comments

str = 'a { |(b, (c, d))| }'
ast = RubyParser.new.parse(str)
# => s(:iter, s(:call, nil, :a), s(:args, s(:masgn, :b, s(:masgn, :c, :d))))
Ruby2Ruby.new.process(ast)
# => "a { |(b, masgn, c, d)| }"
str = 'a { |((b))| }'
ast = RubyParser.new.parse(str)
# => s(:iter, s(:call, nil, :a), s(:args, s(:masgn, s(:masgn, :b))))
Ruby2Ruby.new.process(ast)
# => RuntimeError (no clue: s(:masgn, :b))

Nice catch. Wanna take a whack at it? (no is perfectly fine)

here's the whack :)

Fixed. Thank you!