[ruby/prism] A couple of small dot enhancements

https://github.com/ruby/prism/commit/5642a57f39
This commit is contained in:
Kevin Newton 2023-12-08 09:40:26 -05:00 committed by git
parent 0166040939
commit a54eb9c6f9

View File

@ -122,13 +122,17 @@ module Prism
digraph.edge("#{id}:<%= field.name %> -> #{node_id(<%= field.name %>)};")
end
<%- when Prism::NodeListField -%>
table.field("<%= field.name %>", port: true)
if node.<%= field.name %>.any?
table.field("<%= field.name %>", port: true)
waypoint = "#{id}_<%= field.name %>"
digraph.waypoint("#{waypoint};")
waypoint = "#{id}_<%= field.name %>"
digraph.waypoint("#{waypoint};")
digraph.edge("#{id}:<%= field.name %> -> #{waypoint};")
node.<%= field.name %>.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
digraph.edge("#{id}:<%= field.name %> -> #{waypoint};")
node.<%= field.name %>.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
else
table.field("<%= field.name %>", "[]")
end
<%- when Prism::StringField, Prism::ConstantField, Prism::OptionalConstantField, Prism::UInt8Field, Prism::UInt32Field, Prism::ConstantListField -%>
table.field("<%= field.name %>", node.<%= field.name %>.inspect)
<%- when Prism::LocationField -%>