diff --git a/lib/mutant/mutator/node.rb b/lib/mutant/mutator/node.rb index 36acd1fa..8701cfcf 100644 --- a/lib/mutant/mutator/node.rb +++ b/lib/mutant/mutator/node.rb @@ -125,11 +125,13 @@ module Mutant # # @api private # - def emit_body_mutations - Mutator.each(node.body) do |mutation| - node = dup_node - node.body = mutation - emit(node) + def emit_body_mutations(method = :body) + body = node.public_send(method) + + Mutator.each(body) do |mutation| + dup = dup_node + dup.public_send(:"#{method}=", mutation) + emit(dup) end end diff --git a/lib/mutant/mutator/node/send.rb b/lib/mutant/mutator/node/send.rb index ce7e0f14..21155132 100644 --- a/lib/mutant/mutator/node/send.rb +++ b/lib/mutant/mutator/node/send.rb @@ -102,22 +102,9 @@ module Mutant # def dispatch super - emit_argument_mutations + emit_body_mutations(:arguments) end - # Emit argument mutations - # - # @return [undefined] - # - # @api private - # - def emit_argument_mutations - Mutator.each(node.arguments) do |mutation| - dup = dup_node - dup.arguments = mutation - emit(dup) - end - end end end end