2018-09-12 14:21:24 +00:00
|
|
|
# frozen_string_literal: true
|
2018-09-12 13:15:43 +00:00
|
|
|
|
2013-07-23 21:57:39 -07: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))
|
2013-07-23 21:57:39 -07:00
|
|
|
children.each_with_index do |child, index|
|
2015-11-13 04:47:47 +00:00
|
|
|
mutate_child(index) if child.instance_of?(::Parser::AST::Node)
|
2013-07-23 21:57:39 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end # Const
|
|
|
|
end # Node
|
|
|
|
end # Mutator
|
|
|
|
end # Mutant
|