/
generic.rb
87 lines (80 loc) · 1.71 KB
/
generic.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# frozen_string_literal: true
module Mutant
class Mutator
class Node
# Generic mutator
class Generic < self
unsupported_nodes = %i[
__FILE__
__LINE__
alias
arg_expr
array_pattern
array_pattern_with_tail
back_ref
blockarg
blockarg_expr
case_match
complex
const_pattern
eflipflop
empty
ensure
for
forward_args
forwarded_args
hash_pattern
ident
if_guard
iflipflop
in_match
in_pattern
kwnilarg
kwrestarg
kwsplat
match_alt
match_as
match_nil_pattern
match_rest
match_var
match_with_lvasgn
match_with_trailing_comma
module
numargs
numblock
objc_kwarg
objc_restarg
objc_varargs
pin
postexe
preexe
rational
redo
restarg
restarg_expr
retry
root
sclass
shadowarg
undef
unless_guard
until_post
while_post
xstr
]
# These nodes still need a dedicated mutator,
# your contribution is that close!
handle(*unsupported_nodes)
private
# Emit mutations
#
# @return [undefined]
def dispatch
children.each_with_index do |child, index|
mutate_child(index) if child.instance_of?(::Parser::AST::Node)
end
end
end # Generic
end # Node
end # Mutator
end # Mutant