40 lines
1.1 KiB
Ruby
40 lines
1.1 KiB
Ruby
module Mutant
|
|
class Mutator
|
|
class Node
|
|
# Generic mutator
|
|
class Generic < self
|
|
|
|
handle(:self)
|
|
|
|
# These nodes still need a dedicated mutator, your contribution is that close!
|
|
handle(
|
|
:zsuper, :not, :or, :and, :defined,
|
|
:next, :break, :match, :gvar, :cvar, :ensure,
|
|
:dstr, :dsym, :yield, :rescue, :redo, :defined?,
|
|
:lvar, :splat, :const, :blockarg, :block_pass, :op_asgn, :regopt,
|
|
:ivar, :restarg, :casgn, :masgn, :resbody, :retry, :arg_expr,
|
|
:kwrestarg, :kwoptarg, :kwarg, :undef, :module, :cbase, :empty,
|
|
:alias, :for, :xstr, :back_ref, :nth_ref, :class, :sclass, :match_with_lvasgn,
|
|
:match_current_line, :or_asgn, :kwbegin
|
|
)
|
|
|
|
private
|
|
|
|
# Emit mutations
|
|
#
|
|
# @return [undefined]
|
|
#
|
|
# @api private
|
|
#
|
|
def dispatch
|
|
children.each_index do |index|
|
|
if children.at(index).kind_of?(Parser::AST::Node)
|
|
mutate_child(index)
|
|
end
|
|
end
|
|
end
|
|
|
|
end # Noop
|
|
end # Node
|
|
end # Mutator
|
|
end # Mutant
|