instance method
Prism::DotVisitor#visit_rescue_node
visit_rescue_node(node)
lib/prism/dot_visitor.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/dot_visitor.rb, line 3938
def visit_rescue_node(node)
table = Table.new("RescueNode")
id = node_id(node)
# keyword_loc
table.field("keyword_loc", location_inspect(node.keyword_loc))
# exceptions
if node.exceptions.any?
table.field("exceptions", port: true)
waypoint = "#{id}_exceptions"
digraph.waypoint("#{waypoint};")
digraph.edge("#{id}:exceptions -> #{waypoint};")
node.exceptions.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
else
table.field("exceptions", "[]")
end
# operator_loc
unless (operator_loc = node.operator_loc).nil?
table.field("operator_loc", location_inspect(operator_loc))
end
# reference
unless (reference = node.reference).nil?
table.field("reference", port: true)
digraph.edge("#{id}:reference -> #{node_id(reference)};")
end
# then_keyword_loc
unless (then_keyword_loc = node.then_keyword_loc).nil?
table.field("then_keyword_loc", location_inspect(then_keyword_loc))
end
# statements
unless (statements = node.statements).nil?
table.field("statements", port: true)
digraph.edge("#{id}:statements -> #{node_id(statements)};")
end
# subsequent
unless (subsequent = node.subsequent).nil?
table.field("subsequent", port: true)
digraph.edge("#{id}:subsequent -> #{node_id(subsequent)};")
end
digraph.nodes << <<~DOT
#{id} [
label=<#{table.to_dot.gsub(/\n/, "\n ")}>
];
DOT
super
end
Visit a RescueNode node.