diff options
author | Kevin Newton <[email protected]> | 2023-09-26 11:33:05 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2023-09-27 12:10:23 -0400 |
commit | 0517ca3aac2c834a07dff981a4888f631d6330c6 (patch) | |
tree | 5041cb32b452fe671f9305136a1e1161fd351246 | |
parent | 2a4a55f896c44896e10ad1e905c9e8a6a0f4ae92 (diff) |
Delete mutation visitor manually so sync can run
-rw-r--r-- | yarp/templates/lib/yarp/mutation_visitor.rb.erb | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/yarp/templates/lib/yarp/mutation_visitor.rb.erb b/yarp/templates/lib/yarp/mutation_visitor.rb.erb deleted file mode 100644 index 3bb2dfb4b2..0000000000 --- a/yarp/templates/lib/yarp/mutation_visitor.rb.erb +++ /dev/null @@ -1,19 +0,0 @@ -module YARP - # This visitor walks through the tree and copies each node as it is being - # visited. This is useful for consumers that want to mutate the tree, as you - # can change subtrees in place without effecting the rest of the tree. - class MutationVisitor < BasicVisitor - <%- nodes.each_with_index do |node, index| -%> -<%= "\n" if index != 0 -%> - # Copy a <%= node.name %> node - def visit_<%= node.human %>(node) - <%- fields = node.fields.select { |field| [YARP::NodeField, YARP::OptionalNodeField, YARP::NodeListField].include?(field.class) } -%> - <%- if fields.any? -%> - node.copy(<%= fields.map { |field| "#{field.name}: #{field.is_a?(YARP::NodeListField) ? "visit_all" : "visit"}(node.#{field.name})" }.join(", ") %>) - <%- else -%> - node.copy - <%- end -%> - end - <%- end -%> - end -end |