instance method
Prism::DotVisitor#visit_begin_node
visit_begin_node(node)
lib/prism/dot_visitor.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/dot_visitor.rb, line 419
def visit_begin_node(node)
table = Table.new("BeginNode")
id = node_id(node)
# begin_keyword_loc
unless (begin_keyword_loc = node.begin_keyword_loc).nil?
table.field("begin_keyword_loc", location_inspect(begin_keyword_loc))
end
# statements
unless (statements = node.statements).nil?
table.field("statements", port: true)
digraph.edge("#{id}:statements -> #{node_id(statements)};")
end
# rescue_clause
unless (rescue_clause = node.rescue_clause).nil?
table.field("rescue_clause", port: true)
digraph.edge("#{id}:rescue_clause -> #{node_id(rescue_clause)};")
end
# else_clause
unless (else_clause = node.else_clause).nil?
table.field("else_clause", port: true)
digraph.edge("#{id}:else_clause -> #{node_id(else_clause)};")
end
# ensure_clause
unless (ensure_clause = node.ensure_clause).nil?
table.field("ensure_clause", port: true)
digraph.edge("#{id}:ensure_clause -> #{node_id(ensure_clause)};")
end
# end_keyword_loc
unless (end_keyword_loc = node.end_keyword_loc).nil?
table.field("end_keyword_loc", location_inspect(end_keyword_loc))
end
digraph.nodes << <<~DOT
#{id} [
label=<#{table.to_dot.gsub(/\n/, "\n ")}>
];
DOT
super
end
Visit a BeginNode node.