Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Prism::Translation::Ripper#visit_rescue_node
visit_rescue_node(node)
lib/prism/translation/ripper.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/prism/translation/ripper.rb, line 2764
def visit_rescue_node(node)
exceptions =
case node.exceptions.length
when 0
nil
when 1
if (exception = node.exceptions.first).is_a?(SplatNode)
bounds(exception.location)
on_mrhs_add_star(on_mrhs_new, visit(exception))
else
[visit(node.exceptions.first)]
end
else
bounds(node.location)
length = node.exceptions.length
node.exceptions.each_with_index.inject(on_args_new) do |mrhs, (exception, index)|
arg = visit(exception)
bounds(exception.location)
mrhs = on_mrhs_new_from_args(mrhs) if index == length - 1
if exception.is_a?(SplatNode)
if index == length - 1
on_mrhs_add_star(mrhs, arg)
else
on_args_add_star(mrhs, arg)
end
else
if index == length - 1
on_mrhs_add(mrhs, arg)
else
on_args_add(mrhs, arg)
end
end
end
end
reference = visit(node.reference)
statements =
if node.statements.nil?
bounds(node.location)
on_stmts_add(on_stmts_new, on_void_stmt)
else
visit(node.statements)
end
subsequent = visit(node.subsequent)
bounds(node.location)
on_rescue(exceptions, reference, statements, subsequent)
end
begin; rescue; end
^^^^^^^