Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Prism::Translation::Parser::Compiler#visit_while_node
visit_while_node(node)
lib/prism/translation/parser/compiler.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/prism/translation/parser/compiler.rb, line 1857
def visit_while_node(node)
if node.location.start_offset == node.keyword_loc.start_offset
builder.loop(
:while,
token(node.keyword_loc),
visit(node.predicate),
if (do_keyword_loc = node.do_keyword_loc)
token(do_keyword_loc)
else
srange_find(node.predicate.location.end_offset, (node.statements&.location || node.closing_loc).start_offset, ";")
end,
visit(node.statements),
token(node.closing_loc)
)
else
builder.loop_mod(
:while,
visit(node.statements),
token(node.keyword_loc),
visit(node.predicate)
)
end
end
while foo; bar end ^^^^^^^^^^^^^^^^^^
bar while foo ^^^^^^^^^^^^^