instance method
Prism::Translation::Ripper#visit_when_node
visit_when_node(node)
lib/prism/translation/ripper.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/translation/ripper.rb, line 3203
def visit_when_node(node)
# This is a special case where we're not going to call on_when directly
# because we don't have access to the subsequent. Instead, we'll return
# the component parts and let the parent node handle it.
conditions = visit_arguments(node.conditions)
statements =
if node.statements.nil?
bounds(node.location)
on_stmts_add(on_stmts_new, on_void_stmt)
else
visit(node.statements)
end
[conditions, statements]
end
case foo; when bar; end ^^^^^^^^^^^^^