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