Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
whitequark opened this Issue · 2 comments

2 participants

@whitequark

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'
@whitequark

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'
@zenspider zenspider was assigned
@zenspider
Owner
>> 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.