free_mutant/lib/mutant/mutator/node/block.rb

47 lines
837 B
Ruby
Raw Normal View History

module Mutant
class Mutator
class Node
# Emitter for mutations on 19 blocks
class Block < self
handle(:block)
2013-06-21 15:05:48 +02:00
children :send, :arguments, :body
2013-06-14 20:19:53 +02:00
private
# Emit mutants
#
# @return [undefined]
#
# @api private
#
def dispatch
emit_singletons
2013-06-21 15:05:48 +02:00
emit(send)
2014-07-18 23:50:48 +00:00
emit_send_mutations(&method(:n_send?))
2013-06-21 15:05:48 +02:00
emit_arguments_mutations
2014-07-25 18:09:27 +00:00
mutate_body
end
# Emit body mutations
#
# @return [undefined]
#
# @api private
#
def mutate_body
emit_body(nil)
emit_body(N_RAISE)
2014-08-05 10:50:06 +00:00
return unless body
emit(body)
emit_body_mutations
end
end # Block
end # Node
end # Mutator
end # Mutant