mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fixed up rest, keywords, keyword rest and block arguments
This commit is contained in:
parent
997133d595
commit
b22bfdaa9a
1 changed files with 9 additions and 2 deletions
|
@ -53,8 +53,15 @@ def collect_params tree
|
|||
while tree
|
||||
case tree.first
|
||||
when :params
|
||||
idents = (tree[1] || []) + (tree[2] || []).map(&:first)
|
||||
return idents.map { |ident| ident[1].to_sym }
|
||||
params = []
|
||||
_, mand, opt, rest, post, kwds, kwrest, block = tree
|
||||
mand.each {|_, v| params << v.to_sym} if mand
|
||||
opt.each {|(_, v), | params << v.to_sym} if opt
|
||||
params << rest[1][1].to_sym if rest
|
||||
post.each {|_, v| params << v.to_sym} if post
|
||||
params << kwrest[1][1].to_sym if kwrest
|
||||
params << block[1][1].to_sym if block
|
||||
return params
|
||||
when :paren
|
||||
tree = tree[1]
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue