Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a33e675

Browse files
committed
Introduce visit_all to visit multiple nodes
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
1 parent 1a491fc commit a33e675

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/syntax_tree/visitor.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ def visit(node)
5757
node&.accept(self)
5858
end
5959

60+
def visit_all(nodes)
61+
nodes.each { |node| visit(node) }
62+
end
63+
6064
def visit_child_nodes(node)
61-
node.child_nodes.each { |child_node| visit(child_node) }
65+
visit_all(node.child_nodes)
6266
end
6367

6468
# Visit an ARef node.

0 commit comments

Comments
 (0)