Does not handle splat in array decomposition in block arguments #70

Closed
whitequark opened this Issue Oct 10, 2012 · 2 comments

Comments

Projects
None yet
2 participants

Demonstrated by this snippet:

[122] pry(main)> Ruby19Parser.new.parse('lambda { |(a, *x)| }')
RuntimeError: no9: [s(:array, s(:lasgn, :a)), ",", "*", :x]
from /home/whitequark/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/ruby_parser-3.0.0.a8/lib/ruby19_parser.rb:4890:in `_reduce_359'

Similar bug:

[174] pry(main)> Ruby19Parser.new.parse('lambda { |x=1,y=1| y }')
RuntimeError: no22: [s(:lasgn, :x, s(:lit, 1)), ",", s(:lasgn, :y, s(:lit, 1))]
from /home/whitequark/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/ruby_parser-3.0.0.a8/lib/ruby19_parser.rb:5892:in `_reduce_531'

@ghost ghost assigned zenspider Oct 10, 2012

Owner

zenspider commented Oct 26, 2012

>> Ruby19Parser.new.parse('lambda { |(a, *x)| }')
=> s(:iter, s(:call, nil, :lambda), s(:args, s(:masgn, :a, :"*x")))
>> Ruby19Parser.new.parse('lambda { |x=1,y=1| y }')
=> s(:iter, s(:call, nil, :lambda), s(:args, s(:lasgn, :x, s(:lit, 1)), s(:lasgn, :y, s(:lit, 1))), s(:lvar, :y))

@zenspider zenspider closed this Oct 26, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment