instance method
Prism::DotVisitor#visit_while_node
visit_while_node(node)
lib/prism/dot_visitor.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/dot_visitor.rb, line 4505
def visit_while_node(node)
table = Table.new("WhileNode")
id = node_id(node)
# flags
table.field("flags", loop_flags_inspect(node))
# keyword_loc
table.field("keyword_loc", location_inspect(node.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
# closing_loc
unless (closing_loc = node.closing_loc).nil?
table.field("closing_loc", location_inspect(closing_loc))
end
# predicate
table.field("predicate", port: true)
digraph.edge("#{id}:predicate -> #{node_id(node.predicate)};")
# statements
unless (statements = node.statements).nil?
table.field("statements", port: true)
digraph.edge("#{id}:statements -> #{node_id(statements)};")
end
digraph.nodes << <<~DOT
#{id} [
label=<#{table.to_dot.gsub(/\n/, "\n ")}>
];
DOT
super
end
Visit a WhileNode node.