Skip to content

Commit

Permalink
recognize splat for redparse
Browse files Browse the repository at this point in the history
  • Loading branch information
quix committed Jan 14, 2010
1 parent 9669bc0 commit 3f04851
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/pure/parser/impl/red_parse.rb
Expand Up @@ -42,18 +42,20 @@ def process_callback(node)
def process_method_node(node)
line = node.startline
name = node[1].to_sym
args = (
splat, args = (
if node[2].nil?
[]
[false, []]
elsif node[2].any? { |elem| elem.is_a? ::RedParse::UnaryStarNode }
[true, []]
else
node[2].map { |var| var.first.to_sym }
[false, node[2].map { |var| var.first.to_sym }]
end
)
@defs[line] = {
:name => name,
:args => args,
:code => node,
:splat => false, # TODO: whether splat arg is present
:splat => splat,
:default => false, # TODO: whether any default args are present
}
end
Expand Down

0 comments on commit 3f04851

Please sign in to comment.