diff --git a/lib/mutant/mutator.rb b/lib/mutant/mutator.rb index 8a176d92..1e772c2b 100644 --- a/lib/mutant/mutator.rb +++ b/lib/mutant/mutator.rb @@ -234,6 +234,20 @@ module Mutant end end + # Emit body mutations + # + # @return [undefined] + # + # @api private + # + def emit_body_mutations + Mutator.each(node.body) do |mutation| + node = dup_node + node.body = mutation + emit_unsafe(node) + end + end + # Emit element mutations # # @param [Array] elements diff --git a/lib/mutant/mutator/define.rb b/lib/mutant/mutator/define.rb index 8929a86e..5ccedeea 100644 --- a/lib/mutant/mutator/define.rb +++ b/lib/mutant/mutator/define.rb @@ -13,11 +13,7 @@ module Mutant # @api private # def dispatch - Mutator.each(node.body) do |mutation| - node = dup_node - node.body = mutation - emit_safe(node) - end + emit_body_mutations end end end diff --git a/lib/mutant/mutator/receiver_case.rb b/lib/mutant/mutator/receiver_case.rb index b9e3dda2..3d7fb46c 100644 --- a/lib/mutant/mutator/receiver_case.rb +++ b/lib/mutant/mutator/receiver_case.rb @@ -17,19 +17,6 @@ module Mutant emit_body_mutations end - # Emit body mutations - # - # @return [undefined] - # - # @api private - # - def emit_body_mutations - Mutator.each(node.body) do |mutation| - node = dup_node - node.body = mutation - emit_unsafe(node) - end - end end # Mutator for Rubinius::AST::ReceiverCase nodes