instance method
Prism::Translation::Parser::Compiler#visit_when_node
visit_when_node(node)
lib/prism/translation/parser/compiler.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/translation/parser/compiler.rb, line 1859
def visit_when_node(node)
builder.when(
token(node.keyword_loc),
visit_all(node.conditions),
if (then_keyword_loc = node.then_keyword_loc)
token(then_keyword_loc)
else
srange_semicolon(node.conditions.last.location.end_offset, node.statements&.location&.start_offset)
end,
visit(node.statements)
)
end
case foo; when bar; end ^^^^^^^^^^^^^