Upgrade dependency "parser" and fix code

This commit is contained in:
Alex Kotov 2021-01-17 09:53:49 +05:00
parent 657779c151
commit a92eb9b45c
5 changed files with 11 additions and 36 deletions

View file

@ -12,9 +12,9 @@ PATH
ice_nine (~> 0.11.1)
memoizable (~> 0.4.2)
morpher (~> 0.2.6)
parser (~> 2.5.1)
parser (~> 2.7.2)
procto (~> 0.0.2)
regexp_parser (~> 1.7, >= 1.7.1)
regexp_parser (~> 1.8.2)
unparser (~> 0.4.2)
mutant-rspec (0.8.24)
mutant (~> 0.8.24)
@ -97,8 +97,8 @@ GEM
ice_nine (~> 0.11.0)
procto (~> 0.0.2)
parallel (1.12.1)
parser (2.5.3.0)
ast (~> 2.4.0)
parser (2.7.2.0)
ast (~> 2.4.1)
path_expander (1.1.0)
powerpack (0.1.3)
procto (0.0.3)
@ -147,13 +147,13 @@ GEM
simplecov-html (0.10.2)
thread_safe (0.3.6)
unicode-display_width (1.4.1)
unparser (0.4.2)
unparser (0.4.7)
abstract_type (~> 0.0.7)
adamantium (~> 0.2.0)
concord (~> 0.1.5)
diff-lcs (~> 1.3)
equalizer (~> 0.0.9)
parser (>= 2.3.1.2, < 2.6)
parser (>= 2.6.5)
procto (~> 0.0.2)
virtus (1.0.5)
axiom-types (~> 0.1)

View file

@ -26,9 +26,7 @@ module Mutant
emit_type
Util::Array::Presence.call(children).each do |children|
if children.one? && n_mlhs?(Mutant::Util.one(children))
emit_procarg(Mutant::Util.one(children))
else
unless children.one? && n_mlhs?(children.first)
emit_type(*children)
end
end

View file

@ -4,13 +4,6 @@ module Mutant
class Mutator
class Node
class ProcargZero < self
MAP = {
::Parser::AST::Node => :emit_argument_node_mutations,
Symbol => :emit_argument_symbol_mutations
}.freeze
private_constant(*constants(false))
handle :procarg0
children :argument
@ -21,23 +14,9 @@ module Mutant
#
# @return [undefined]
def dispatch
__send__(MAP.fetch(argument.class))
end
name = Mutant::Util.one(argument.children)
# Emit argument symbol mutations
#
# @return [undefined]
def emit_argument_symbol_mutations
emit_type(:"_#{argument}") unless argument.to_s.start_with?('_')
end
# Emit argument node mutations
#
# @return [undefined]
def emit_argument_node_mutations
emit_argument_mutations
first = Mutant::Util.one(argument.children)
emit_type(first)
emit_type(s(:arg, :"_#{name}")) unless name.to_s.start_with?('_')
end
end # ProcargZero
end # Node

View file

@ -38,7 +38,6 @@ Mutant::Meta::Example.add :block do
mutation 'foo { |(a, b), c| raise }'
mutation 'foo { |(a), c| }'
mutation 'foo { |(b), c| }'
mutation 'foo { |(a, b)| }'
mutation 'foo { |c, | }'
mutation 'foo { |(_a, b), c| }'
mutation 'foo { |(a, _b), c| }'
@ -85,7 +84,6 @@ Mutant::Meta::Example.add :block do
singleton_mutations
mutation 'foo { || }'
mutation 'foo { |a| }'
mutation 'foo { |(a)| raise }'
mutation 'foo { |(_a)| }'
mutation 'foo'

View file

@ -31,9 +31,9 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency('ice_nine', '~> 0.11.1')
gem.add_runtime_dependency('memoizable', '~> 0.4.2')
gem.add_runtime_dependency('morpher', '~> 0.2.6')
gem.add_runtime_dependency('parser', '~> 2.5.1')
gem.add_runtime_dependency('parser', '~> 2.7.2')
gem.add_runtime_dependency('procto', '~> 0.0.2')
gem.add_runtime_dependency('regexp_parser', '~> 1.7', '>= 1.7.1')
gem.add_runtime_dependency('regexp_parser', '~> 1.8.2')
gem.add_runtime_dependency('unparser', '~> 0.4.2')
gem.add_development_dependency('parallel', '~> 1.3')