# class Prism::BasicVisitor

A class that knows how to walk down the tree. None of the individual visit methods are implemented on this visitor, so it forces the consumer to implement each one that they need. For a default implementation that continues walking the tree, see the `Visitor` class.

### Public Instance Methods

visit(node) click to toggle source

Calls ‘accept` on the given node if it is not `nil`, which in turn should call back into this visitor by calling the appropriate `visit_*` method.

    # File lib/prism/visitor.rb, line 16
    def visit(node)
      node&.accept(self)
    end

visit_all(nodes) click to toggle source

Visits each node in ‘nodes` by calling `accept` on each one.

    # File lib/prism/visitor.rb, line 21
    def visit_all(nodes)
      nodes.each { |node| node&.accept(self) }
    end

visit_child_nodes(node) click to toggle source

Visits the child nodes of ‘node` by calling `accept` on each one.

    # File lib/prism/visitor.rb, line 26
    def visit_child_nodes(node)
      node.compact_child_nodes.each { |node| node.accept(self) }
    end