instance method
Prism::Translation::Ripper#visit_while_node
visit_while_node(node)
lib/prism/translation/ripper.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/translation/ripper.rb, line 3224
def visit_while_node(node)
if node.statements.nil? || (node.predicate.location.start_offset < node.statements.location.start_offset)
predicate = visit(node.predicate)
statements =
if node.statements.nil?
bounds(node.location)
on_stmts_add(on_stmts_new, on_void_stmt)
else
visit(node.statements)
end
bounds(node.location)
on_while(predicate, statements)
else
statements = visit(node.statements.body.first)
predicate = visit(node.predicate)
bounds(node.location)
on_while_mod(predicate, statements)
end
end
while foo; bar end ^^^^^^^^^^^^^^^^^^
bar while foo ^^^^^^^^^^^^^