e93960ca35
* Mutant prevents double emits via guarding on source representation of partial AST nodes. Not all AST nodes are valid as roots, so this change creates a valid root around an leave. * Over the time multiple of these situartions must be solved, we'll end up in a more deduplicated solution. * Closes: #165
38 lines
949 B
Ruby
38 lines
949 B
Ruby
# encoding: utf-8
|
|
|
|
module Mutant
|
|
class Mutator
|
|
class Node
|
|
|
|
# Generic mutator
|
|
class Generic < self
|
|
|
|
# These nodes still need a dedicated mutator,
|
|
# your contribution is that close!
|
|
handle(
|
|
:ensure, :redo, :defined?, :regopt, :retry, :arg_expr,
|
|
:kwrestarg, :kwoptarg, :kwarg, :undef, :module, :empty,
|
|
:alias, :for, :xstr, :back_ref, :class,
|
|
:sclass, :match_with_lvasgn, :match_current_line, :while_post,
|
|
:until_post, :preexe, :postexe, :iflipflop, :eflipflop, :kwsplat,
|
|
:shadowarg
|
|
)
|
|
|
|
private
|
|
|
|
# Emit mutations
|
|
#
|
|
# @return [undefined]
|
|
#
|
|
# @api private
|
|
#
|
|
def dispatch
|
|
children.each_with_index do |child, index|
|
|
mutate_child(index) if child.kind_of?(Parser::AST::Node)
|
|
end
|
|
end
|
|
|
|
end # Generic
|
|
end # Node
|
|
end # Mutator
|
|
end # Mutant
|