2013-06-04 16:16:04 -04:00
|
|
|
module Mutant
|
|
|
|
class Mutator
|
|
|
|
class Node
|
2013-06-21 09:05:27 -04:00
|
|
|
|
2013-06-04 16:16:04 -04:00
|
|
|
# Mutator for begin nodes
|
|
|
|
class Begin < self
|
|
|
|
|
|
|
|
handle(:begin)
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# Emit mutants
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def dispatch
|
2013-06-24 16:10:40 -04:00
|
|
|
Util::Array.each(children, self) do |children|
|
2013-06-21 09:05:27 -04:00
|
|
|
if children.length > 1
|
|
|
|
emit_self(*children)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
children.each do |child|
|
|
|
|
emit(child)
|
|
|
|
end
|
2013-06-24 16:10:40 -04:00
|
|
|
emit(nil) unless parent_send?
|
|
|
|
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
|
2013-06-04 16:16:04 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end # Block
|
|
|
|
end # Node
|
|
|
|
end # Mutator
|
|
|
|
end # Mutant
|