Skip to content

Commit

Permalink
refactor on_paren
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Fuchs committed Jun 28, 2009
1 parent 2de0bc7 commit fa88763
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions lib/ripper/ruby_builder/events/statements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,9 @@ def on_body_stmt(body, rescue_block, else_block, ensure_block)
end

def on_paren(node)
if stack.last.type == :@rparen
# TODO crap. this should test more specifically for ArgList, Hash etc.
if node.is_a?(Ruby::List) && node.ldelim.nil? && node.rdelim.nil?
node.rdelim ||= pop_token(:@rparen)
node.ldelim ||= pop_token(:@lparen)
else
rdelim = pop_token(:@rparen)
ldelim = pop_token(:@lparen)
node = Ruby::Statements.new(node, ldelim, rdelim)
end
end
node = Ruby::Statements.new(node) if node.is_a?(Ruby::Hash)
node.rdelim ||= pop_token(:@rparen)
node.ldelim ||= pop_token(:@lparen)
node
end

Expand Down

0 comments on commit fa88763

Please sign in to comment.