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