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

Commit 1a491fc

Browse files
authored
Merge pull request #32 from Morriar/at-visit-nil
Allow passing `nil` to `visit`
2 parents b5b94ba + d224dc2 commit 1a491fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/syntax_tree/visitor.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ def visit_methods
5454
end
5555

5656
def visit(node)
57-
node.accept(self)
57+
node&.accept(self)
5858
end
5959

6060
def visit_child_nodes(node)
61-
node.child_nodes.each { |child_node| visit(child_node) if child_node }
61+
node.child_nodes.each { |child_node| visit(child_node) }
6262
end
6363

6464
# Visit an ARef node.

0 commit comments

Comments
 (0)