class Prism::DotVisitor
def visit_array_pattern_node(node)
def visit_array_pattern_node(node) table = Table.new("ArrayPatternNode") id = node_id(node) # constant unless (constant = node.constant).nil? table.field("constant", port: true) digraph.edge("#{id}:constant -> #{node_id(constant)};") end # requireds if node.requireds.any? table.field("requireds", port: true) waypoint = "#{id}_requireds" digraph.waypoint("#{waypoint};") digraph.edge("#{id}:requireds -> #{waypoint};") node.requireds.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") } else table.field("requireds", "[]") end # rest unless (rest = node.rest).nil? table.field("rest", port: true) digraph.edge("#{id}:rest -> #{node_id(rest)};") end # posts if node.posts.any? table.field("posts", port: true) waypoint = "#{id}_posts" digraph.waypoint("#{waypoint};") digraph.edge("#{id}:posts -> #{waypoint};") node.posts.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") } else table.field("posts", "[]") end # opening_loc unless (opening_loc = node.opening_loc).nil? table.field("opening_loc", location_inspect(opening_loc)) end # closing_loc unless (closing_loc = node.closing_loc).nil? table.field("closing_loc", location_inspect(closing_loc)) end digraph.nodes << <<~DOT #{id} [ label=<#{table.to_dot.gsub(/\n/, "\n ")}> ]; DOT super end