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

29 lines
606 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-09-12 13:15:43 +00:00
module Mutant
class Mutator
class Node
# Mutation emitter to handle const nodes
class Const < self
handle(:const)
private
# Emit mutations
#
# @return [undefined]
def dispatch
2014-06-14 13:54:29 +00:00
emit_singletons unless parent_node && n_const?(parent_node)
2014-06-03 03:51:22 +00:00
emit_type(nil, *children.drop(1))
children.each_with_index do |child, index|
mutate_child(index) if child.instance_of?(::Parser::AST::Node)
end
end
end # Const
end # Node
end # Mutator
end # Mutant