Skip to content

Commit

Permalink
Upgrade to unparser 0.7.x interface
Browse files Browse the repository at this point in the history
  • Loading branch information
mbj committed Sep 20, 2024
1 parent 7ee17ba commit 4d83713
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ source 'https://rubygems.org'

gemspec name: 'mutant'

gem 'unparser', path: '../unparser'

eval_gemfile 'Gemfile.shared'
13 changes: 9 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
PATH
remote: ../unparser
specs:
unparser (0.7.0)
diff-lcs (~> 1.3)
parser (>= 3.3.0)

PATH
remote: .
specs:
Expand All @@ -6,7 +13,7 @@ PATH
parser (~> 3.3.0)
regexp_parser (~> 2.9.0)
sorbet-runtime (~> 0.5.0)
unparser (~> 0.6.14)
unparser (~> 0.7.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -57,9 +64,6 @@ GEM
sorbet-runtime (0.5.11422)
strscan (3.1.0)
unicode-display_width (2.5.0)
unparser (0.6.14)
diff-lcs (~> 1.3)
parser (>= 3.3.0)

PLATFORMS
ruby
Expand All @@ -70,6 +74,7 @@ DEPENDENCIES
rspec-core (~> 3.10)
rspec-its (~> 1.3.0)
rubocop (~> 1.7)
unparser!

BUNDLED WITH
2.5.6
6 changes: 3 additions & 3 deletions lib/mutant/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def call(path)
private

def parse(source)
node, comments = Unparser.parse_with_comments(source)
ast = Unparser.parse_ast_either(source).from_right

AST.new(
node:,
comment_associations: ::Parser::Source::Comment.associate_by_identity(node, comments)
comment_associations: ::Parser::Source::Comment.associate_by_identity(ast.node, ast.comments),
node: ast.node
)
end

Expand Down
2 changes: 1 addition & 1 deletion mutant.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency('parser', '~> 3.3.0')
gem.add_runtime_dependency('regexp_parser', '~> 2.9.0')
gem.add_runtime_dependency('sorbet-runtime', '~> 0.5.0')
gem.add_runtime_dependency('unparser', '~> 0.6.14')
gem.add_runtime_dependency('unparser', '~> 0.7.0')

gem.add_development_dependency('rspec', '~> 3.10')
gem.add_development_dependency('rspec-core', '~> 3.10')
Expand Down

0 comments on commit 4d83713

Please sign in to comment.