2012-12-06 21:30:28 +01:00
|
|
|
module Mutant
|
|
|
|
class Mutator
|
|
|
|
class Node
|
2013-07-05 01:21:07 +02:00
|
|
|
# Generic mutator
|
|
|
|
class Generic < self
|
2012-12-06 21:30:28 +01:00
|
|
|
|
2013-06-21 18:10:06 +02:00
|
|
|
handle(:self)
|
|
|
|
|
2013-07-14 21:37:22 +02:00
|
|
|
# These nodes still need a dedicated mutator,
|
|
|
|
# your contribution is that close!
|
2013-06-04 10:25:13 +02:00
|
|
|
handle(
|
2013-06-21 18:10:06 +02:00
|
|
|
:zsuper, :not, :or, :and, :defined,
|
|
|
|
:next, :break, :match, :gvar, :cvar, :ensure,
|
|
|
|
:dstr, :dsym, :yield, :rescue, :redo, :defined?,
|
2013-07-14 21:37:22 +02:00
|
|
|
:lvar, :splat, :const, :blockarg, :block_pass, :op_asgn, :and_asgn,
|
|
|
|
:regopt, :ivar, :restarg, :casgn, :resbody, :retry, :arg_expr,
|
2013-06-21 18:10:06 +02:00
|
|
|
:kwrestarg, :kwoptarg, :kwarg, :undef, :module, :cbase, :empty,
|
2013-07-14 21:37:22 +02:00
|
|
|
:alias, :for, :xstr, :back_ref, :nth_ref, :class,
|
|
|
|
:sclass, :match_with_lvasgn, :match_current_line, :or_asgn, :kwbegin
|
2013-06-04 10:25:13 +02:00
|
|
|
)
|
2013-04-17 20:31:21 -07:00
|
|
|
|
2012-12-06 21:30:28 +01:00
|
|
|
private
|
|
|
|
|
|
|
|
# Emit mutations
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def dispatch
|
2013-07-05 19:17:17 +02:00
|
|
|
children.each_with_index do |child, index|
|
|
|
|
next unless child.kind_of?(Parser::AST::Node)
|
|
|
|
mutate_child(index)
|
2013-07-05 01:21:07 +02:00
|
|
|
end
|
2012-12-06 21:30:28 +01:00
|
|
|
end
|
2013-06-04 23:44:32 +02:00
|
|
|
|
2013-06-14 20:54:02 +02:00
|
|
|
end # Noop
|
2013-06-04 23:44:32 +02:00
|
|
|
end # Node
|
|
|
|
end # Mutator
|
|
|
|
end # Mutant
|