free_mutant/lib/mutant/mutator/node/const.rb
Dan Kubb 523807b9cb Fix constant mutation to not emit nil::Const anymnore
* Add proper mutations to constant names
2013-08-07 11:15:22 -07:00

31 lines
609 B
Ruby

# encoding: utf-8
module Mutant
class Mutator
class Node
# Mutation emitter to handle const nodes
class Const < self
handle(:const)
private
# Emit mutations
#
# @return [undefined]
#
# @api private
#
def dispatch
emit_nil unless parent_type == :const
emit_self(nil, *children.drop(1))
children.each_with_index do |child, index|
mutate_child(index) if child.kind_of?(Parser::AST::Node)
end
end
end # Const
end # Node
end # Mutator
end # Mutant