Remove Regexp::Generic

This commit is contained in:
John Backus 2016-08-14 13:52:04 -07:00
parent 18b6f453f6
commit 1037614d41
No known key found for this signature in database
GPG key ID: 9A91898D0B0B2FBE
2 changed files with 37 additions and 19 deletions

View file

@ -5,16 +5,45 @@ module Mutant
# Generic mutator
class Generic < self
unsupported_nodes = %i[
ensure
redo
retry
arg_expr
blockarg
kwrestarg
undef
module
empty
alias
for
xstr
back_ref
restarg
sclass
match_with_lvasgn
while_post
until_post
preexe
postexe
iflipflop
eflipflop
kwsplat
shadowarg
rational
complex
__FILE__
__LINE__
]
unsupported_regexp_nodes = AST::Types::REGEXP.to_a - %i[
regexp_root_expression
regexp_bol_anchor
]
# These nodes still need a dedicated mutator,
# your contribution is that close!
handle(
:ensure, :redo, :retry, :arg_expr, :blockarg,
:kwrestarg, :undef, :module, :empty,
:alias, :for, :xstr, :back_ref, :restarg,
:sclass, :match_with_lvasgn, :while_post,
:until_post, :preexe, :postexe, :iflipflop, :eflipflop, :kwsplat,
:shadowarg, :rational, :complex, :__FILE__, :__LINE__
)
handle(*(unsupported_nodes + unsupported_regexp_nodes))
private

View file

@ -2,17 +2,6 @@ module Mutant
class Mutator
class Node
module Regexp
# Generic regexp mutator
class Generic < Node
handle(*(AST::Types::REGEXP - %i[regexp_root_expression regexp_bol_anchor]))
# Noop dispatch
#
# @return [undefined]
def dispatch
end
end # Generic
# Mutator for root expression regexp wrapper
class RootExpression < Node
handle(:regexp_root_expression)