Generalize generation of body mutations for sends

This commit is contained in:
Markus Schirp 2012-12-06 21:54:18 +01:00
parent 5f215e1dc1
commit e164d1f4a9
2 changed files with 8 additions and 19 deletions

View file

@ -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

View file

@ -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