lib/to_source/visitor.rb in to_source-0.2.1 vs lib/to_source/visitor.rb in to_source-0.2.2
- old
+ new
@@ -1322,11 +1322,11 @@
#
def iter19(node)
emit(' do')
arguments = node.arguments
- unless arguments.names.empty?
+ unless arguments.required.empty?
emit(' ')
formal_arguments_generic(node.arguments,'|','|')
end
nl
@@ -1573,13 +1573,13 @@
#
# @return [undefined]
#
# @api private
#
- def formal_arguments_generic(node,open,close)
- return if node.names.empty?
- required, defaults, splat = node.required, node.defaults, node.splat
+ def formal_arguments_generic(node, open, close)
+ required, defaults, splat, block_arg = node.required, node.defaults, node.splat, node.block_arg
+ return unless required.any? or defaults or splat or block_arg
emit(open)
required.each_with_index do |node, index|
if node.kind_of?(Rubinius::AST::Node)
@@ -1604,13 +1604,13 @@
unless splat == :@unnamed_splat
emit(splat)
end
end
- if node.block_arg
+ if block_arg
emit(', ') unless empty
- dispatch(node.block_arg)
+ dispatch(block_arg)
end
emit(close)
end