Skip to content

Commit 88ed08d

Browse files
committed
Merge pull request mbj#67 from mbj/fix/rubyspec-error
Fix block in while/unless condition
2 parents 92dba8f + 2f24da0 commit 88ed08d

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

lib/unparser/emitter/repetition.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ def emit_keyword
8787
#
8888
def emit_normal
8989
emit_keyword
90-
visit(condition)
90+
conditional_parentheses(condition.type.equal?(:block)) do
91+
visit(condition)
92+
end
9193
emit_body
9294
k_end
9395
end

spec/integrations.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,3 @@
3232
# parser crashes
3333
- core/symbol/casecmp_spec.rb
3434
- language/regexp/escapes_spec.rb
35-
- library/conditionvariable/broadcast_spec.rb
36-
- library/conditionvariable/signal_spec.rb

spec/unit/unparser_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,13 @@ def foo
15411541
3
15421542
end
15431543
RUBY
1544+
1545+
assert_source <<-'RUBY'
1546+
while (foo do
1547+
end)
1548+
:body
1549+
end
1550+
RUBY
15441551
end
15451552

15461553
context 'until' do
@@ -1554,6 +1561,13 @@ def foo
15541561
3
15551562
end
15561563
RUBY
1564+
1565+
assert_source <<-'RUBY'
1566+
until (foo do
1567+
end)
1568+
:body
1569+
end
1570+
RUBY
15571571
end
15581572

15591573
assert_source <<-'RUBY'

0 commit comments

Comments
 (0)