Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix {begin,end}less {i,e}range flipflops #349

Merged
merged 1 commit into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

* Fix crash on kwrestarg hash member

[#349](https://github.com/mbj/unparser/pull/349)

* Fix {begin,end}less {i,e}range flipflops

# v0.6.8 2023-06-14

[#347](https://github.com/mbj/unparser/pull/347)
Expand Down
34 changes: 19 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PATH
specs:
unparser (0.6.9)
diff-lcs (~> 1.3)
parser (>= 3.2.0)
parser (>= 3.2.2.4)

GEM
remote: https://oss:Px2ENN7S91OmWaD5G7MIQJi1dmtmYrEh@gem.mutant.dev/
Expand All @@ -14,25 +14,27 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
base64 (0.1.1)
diff-lcs (1.5.0)
json (2.6.3)
mutant (0.11.20)
language_server-protocol (3.17.0.3)
mutant (0.11.22)
diff-lcs (~> 1.3)
parser (~> 3.2.2)
regexp_parser (~> 2.6.1)
sorbet-runtime (~> 0.5.0)
unparser (~> 0.6.7)
mutant-rspec (0.11.20)
mutant (= 0.11.20)
unparser (~> 0.6.8)
mutant-rspec (0.11.22)
mutant (= 0.11.22)
rspec-core (>= 3.8.0, < 4.0.0)
parallel (1.23.0)
parser (3.2.2.3)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
racc (1.7.1)
rainbow (3.1.1)
regexp_parser (2.6.2)
rexml (3.2.5)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
Expand All @@ -45,35 +47,37 @@ GEM
rspec-its (1.3.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.12.5)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.52.1)
rspec-support (3.12.1)
rubocop (1.56.4)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-packaging (0.5.2)
rubocop (>= 1.33, < 2.0)
ruby-progressbar (1.13.0)
sorbet-runtime (0.5.10878)
unicode-display_width (2.4.2)
sorbet-runtime (0.5.11064)
unicode-display_width (2.5.0)

PLATFORMS
ruby

DEPENDENCIES
mutant (~> 0.11.18)
mutant (~> 0.11.22)
mutant-license!
mutant-rspec (~> 0.11.18)
mutant-rspec (~> 0.11.22)
rspec (~> 3.9)
rspec-core (~> 3.9)
rspec-its (~> 1.3.0)
Expand Down
4 changes: 2 additions & 2 deletions bin/corpus
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module Unparser
puts(project.name)
end

Kernel.exit(true)
Kernel.exit
end
end

Expand Down Expand Up @@ -148,7 +148,7 @@ module Unparser
project.verify || Kernel.exit(false)
end

Kernel.exit(true)
Kernel.exit
end

end # CLI
Expand Down
9 changes: 7 additions & 2 deletions lib/unparser/emitter/flipflop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ def symbol_name
private

def dispatch
visit(left)
visit(left) if left
write(MAP.fetch(node.type))
visit(right)

if right
visit(right)
else
write(';')
end
end
end # FlipFLop
end # Emitter
Expand Down
4 changes: 4 additions & 0 deletions test/corpus/literal/flipflop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
if ((i == 4)...(i == 4))
foo
end
if ..foo
end
if foo..;
end
6 changes: 3 additions & 3 deletions unparser.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Gem::Specification.new do |gem|
gem.required_ruby_version = '>= 2.7'

gem.add_dependency('diff-lcs', '~> 1.3')
gem.add_dependency('parser', '>= 3.2.0')
gem.add_dependency('parser', '>= 3.2.2.4')

gem.add_development_dependency('mutant', '~> 0.11.18')
gem.add_development_dependency('mutant-rspec', '~> 0.11.18')
gem.add_development_dependency('mutant', '~> 0.11.22')
gem.add_development_dependency('mutant-rspec', '~> 0.11.22')
gem.add_development_dependency('rspec', '~> 3.9')
gem.add_development_dependency('rspec-core', '~> 3.9')
gem.add_development_dependency('rspec-its', '~> 1.3.0')
Expand Down