lib/to_source/visitor.rb in to_source-0.2.3 vs lib/to_source/visitor.rb in to_source-0.2.4

- old
+ new

@@ -1045,11 +1045,11 @@ else false end end - # Emit send literal + # Emit send node # # @param [Rubinius::AST::Node] node # # @return [undefined] # @@ -1098,17 +1098,20 @@ emit(open) array_body(array) is_block_pass = block.kind_of?(Rubinius::AST::BlockPass) + empty = array.empty? + if arguments.splat - emit(', ') unless array.empty? + emit(', ') unless empty dispatch(arguments.splat) + empty = false end if is_block_pass - emit(', ') unless array.empty? + emit(', ') unless empty block_pass(block) end emit(close) @@ -1155,10 +1158,11 @@ # def send_with_arguments(node) if node.name == :[] return element_reference(node) end + return if process_binary_operator(node) if receiver(node) emit('.') end @@ -1547,10 +1551,22 @@ body(node.body) kend end + # Emit pattern variable + # + # @param [Rubinius::AST::PatternVariable] node + # + # @return [undefined] + # + # @api private + # + def pattern_variable(node) + emit(node.name) + end + # Emit pattern arguments # # @param [Rubinius::AST::PatternArguments] node # # @return [undefined] @@ -1559,11 +1575,11 @@ # def pattern_arguments(node) emit('(') arguments = node.arguments.body arguments.each_with_index do |argument, index| - emit(argument.name) + dispatch(argument) emit(', ') unless index == arguments.size - 1 end emit(')') end @@ -1746,9 +1762,10 @@ # def block_pass(node) emit('&') dispatch(node.body) end + alias_method :block_pass19, :block_pass # Emit return statement # # @param [Rubinius::AST::Node] node #