Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Allow passing nil to visit
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
  • Loading branch information
Morriar committed Apr 1, 2022
commit d224dc22ccd2535564635449d63d44a2af8d3aee
4 changes: 2 additions & 2 deletions lib/syntax_tree/visitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def visit_methods
end

def visit(node)
node.accept(self)
node&.accept(self)
end

def visit_child_nodes(node)
node.child_nodes.each { |child_node| visit(child_node) if child_node }
node.child_nodes.each { |child_node| visit(child_node) }
end

# Visit an ARef node.
Expand Down