lib/mutant/mutator/node.rb in mutant-0.2.7 vs lib/mutant/mutator/node.rb in mutant-0.2.8
- old
+ new
@@ -15,11 +15,11 @@
#
def self.identity(node)
ToSource.to_source(node)
end
- private
+ private
# Return mutated node
#
# @return [Rubinius::AST::Node]
#
@@ -87,36 +87,22 @@
#
def emit_self(*arguments)
emit(new_self(*arguments))
end
- # Emit a new node with wrapping class for each entry in values
- #
- # @param [Array] values
- #
- # @return [undefined]
- #
- # @api private
- #
- def emit_values(values)
- values.each do |value|
- emit_self(value)
- end
- end
-
# Emit body mutations
#
# @param [Symbol] name
#
# @return [undefined]
#
# @api private
#
- def emit_attribute_mutations(name)
- body = node.public_send(name)
+ def emit_attribute_mutations(name, mutator = Mutator)
+ value = node.public_send(name)
- Mutator.each(body) do |mutation|
+ mutator.each(value) do |mutation|
dup = dup_node
dup.public_send(:"#{name}=", mutation)
yield dup if block_given?
emit(dup)
end
@@ -155,8 +141,9 @@
# @return [Rubinius::AST::Node]
#
# @api private
#
alias_method :dup_node, :dup_input
+
end
end
end