free_mutant/lib/mutant/mutator/node/resbody.rb
2014-03-23 00:43:34 +00:00

45 lines
895 B
Ruby

# encoding: UTF-8
module Mutant
class Mutator
class Node
# Mutator for resbody nodes
class Resbody < self
handle(:resbody)
children :captures, :assignment, :block
private
# Emit mutations
#
# @return [undefined]
#
# @api private
#
def dispatch
emit_assignment(nil)
emit_block_mutations if block
mutate_captures
end
# Mutate captures
#
# @return [undefined]
#
# @api private
#
def mutate_captures
return unless captures
emit_captures(nil)
Util::Array.each(captures.children, self) do |matchers|
next if matchers.empty?
emit_captures(s(:array, *matchers))
end
end
end # Resbody
end # Node
end # Mutator
end # Mutant