free_mutant/lib/mutant/mutator/node/begin.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

46 lines
880 B
Ruby

module Mutant
class Mutator
class Node
# Mutator for begin nodes
class Begin < self
handle(:begin)
private
# Emit mutants
#
# @return [undefined]
#
# @api private
#
def dispatch
Util::Array.each(children, self) do |children|
if children.length > 1
emit_self(*children)
end
end
children.each do |child|
emit(child)
end
end
# Test if parent input is a send
#
# @return [true]
# if parent input is a send node
#
# @return [false]
# otherwise
#
# @api private
#
def parent_send?
parent && parent.input.type == :send
end
end # Block
end # Node
end # Mutator
end # Mutant