free_mutant/lib/mutant/mutator/node/block.rb
Markus Schirp 36011568d5 Move nil body mutation to parent nodes
This ensures mutant all the time creates semantically valid asts.
2013-07-05 03:03:33 +02:00

32 lines
570 B
Ruby

module Mutant
class Mutator
class Node
# Emitter for mutations on 19 blocks
class Block < self
handle(:block)
children :send, :arguments, :body
private
# Emit mutants
#
# @return [undefined]
#
# @api private
#
def dispatch
emit(send)
emit_arguments_mutations
if body
emit_body_mutations
end
emit_body(nil)
emit_body(RAISE)
end
end # Block
end # Node
end # Mutator
end # Mutant