Skip to content
Permalink
Browse files

Upgrade parser

[Fix #970]
  • Loading branch information
mbj committed Jan 2, 2020
1 parent 4338496 commit 629f6116a3e1e7721ca153abb187e3490ee9107d
@@ -1,3 +1,7 @@
# v0.9.2 2020-01-02

* Upgrade to parser ~> 2.6.5

# v0.9.1 2020-01-02

* Packaging bugfix.
@@ -6,6 +6,8 @@ gemspec name: 'mutant'

eval_gemfile File.expand_path('Gemfile.shared', __dir__)

gem 'unparser', git: 'https://github.com/mbj/unparser.git'

gem(
'devtools',
git: 'https://github.com/mbj/devtools.git',
@@ -21,10 +21,23 @@ GIT
yard (~> 0.9.16)
yardstick (~> 0.9.9)

GIT
remote: https://github.com/mbj/unparser.git
revision: 157a5b3b43e9f1d540da74b1751dc2b6f7601c3b
specs:
unparser (0.4.6)
abstract_type (~> 0.0.7)
adamantium (~> 0.2.0)
concord (~> 0.1.5)
diff-lcs (~> 1.3)
equalizer (~> 0.0.9)
parser (~> 2.6.5)
procto (~> 0.0.2)

PATH
remote: .
specs:
mutant (0.9.0)
mutant (0.9.1)
abstract_type (~> 0.0.7)
adamantium (~> 0.2.0)
anima (~> 0.3.1)
@@ -35,7 +48,7 @@ PATH
ice_nine (~> 0.11.1)
memoizable (~> 0.4.2)
mutant-license (~> 0.1.0)
parser (= 2.6.3)
parser (~> 2.6.5)
procto (~> 0.0.2)
unparser (~> 0.4.5)

@@ -86,7 +99,7 @@ GEM
thread_safe (~> 0.3, >= 0.3.1)
mutant-license (0.1.0)
parallel (1.19.1)
parser (2.6.3.0)
parser (2.6.5.0)
ast (~> 2.4.0)
path_expander (1.1.0)
powerpack (0.1.2)
@@ -135,14 +148,6 @@ GEM
simplecov-html (0.10.2)
thread_safe (0.3.6)
unicode-display_width (1.4.1)
unparser (0.4.5)
abstract_type (~> 0.0.7)
adamantium (~> 0.2.0)
concord (~> 0.1.5)
diff-lcs (~> 1.3)
equalizer (~> 0.0.9)
parser (~> 2.6.3)
procto (~> 0.0.2)
virtus (1.0.5)
axiom-types (~> 0.1)
coercible (~> 1.0)
@@ -160,6 +165,7 @@ DEPENDENCIES
mutant!
mutant-license!
parallel (~> 1.3)
unparser!

BUNDLED WITH
1.17.3
@@ -66,11 +66,8 @@ module Types
# Nodes that are NOT generated by parser but used by mutant / unparser.
GENERATED = Set.new(%i[empty]).freeze

# Nodes missing from parser metadata
MISSING = Set.new(%i[index indexasgn lambda procarg0]).freeze

ALL = Set.new(
(Parser::Meta::NODE_TYPES + GENERATED + MISSING) - BLACKLIST
(Parser::Meta::NODE_TYPES + GENERATED) - BLACKLIST
).freeze
end # Types
end # AST
@@ -8,6 +8,8 @@ class Arguments < self

handle(:args)

PROCARG = %i[restarg mlhs].freeze

private

# Emit mutations
@@ -26,21 +28,12 @@ def emit_argument_presence
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
end

# Emit procarg form
#
# @return [undefined]
def emit_procarg(arg)
emit_type(s(:procarg0, *arg))
end

# Emit argument mutations
#
# @return [undefined]
@@ -22,11 +22,15 @@ class Generic < self
for
ident
iflipflop
kwnilarg
kwrestarg
kwsplat
match_with_lvasgn
meth_ref
module
numargs
numblock
numparam
objc_kwarg
objc_restarg
objc_varargs
@@ -21,23 +21,9 @@ class ProcargZero < self
#
# @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
@@ -2,5 +2,5 @@

module Mutant
# Current mutant version
VERSION = '0.9.1'
VERSION = '0.9.2'
end # Mutant
@@ -38,7 +38,6 @@
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| }'
@@ -81,13 +80,12 @@
end

Mutant::Meta::Example.add :block do
source 'foo { |(a)| }'
source 'foo { |a| }'

singleton_mutations
mutation 'foo { || }'
mutation 'foo { |a| }'
mutation 'foo { |(a)| raise }'
mutation 'foo { |(_a)| }'
mutation 'foo { |a| raise }'
mutation 'foo { |_a| }'
mutation 'foo'
end

@@ -31,7 +31,7 @@ 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('mutant-license', '~> 0.1.0')
gem.add_runtime_dependency('parser', '= 2.6.3')
gem.add_runtime_dependency('parser', '~> 2.6.5')
gem.add_runtime_dependency('procto', '~> 0.0.2')
gem.add_runtime_dependency('unparser', '~> 0.4.5')

0 comments on commit 629f611

Please sign in to comment.
You can’t perform that action at this time.