Like traverse, but visitor returning false just stops that subtree analysis, not the rest of tree visiting.
974448
function traverseBroad(object, visitor) {
        var child;

        if (!object) {
            return;
        }

        if (visitor.call(null, object) === false) {
            return false;
        }
        for (var i = 0, keys = Object.keys(object); i < keys.length; i++) {
            child = object[key];
            if (typeof child === 'object' && child !== null) {
                traverseBroad(child, visitor);
            }
        }
    }
1143231
private final static void traverse(Element element, ElementVisitor visitor) {

		visitor.visit(element);

		NodeList children = element.getChildNodes();

		for (int i = 0; i < children.getLength(); i++) {
			Node node = children.item(i);

			if (node.getNodeType() != Node.ELEMENT_NODE)
				continue;

			traverse((Element) node, visitor);
		}
	}
785281
private static boolean ignore(MethodTree method, VisitorState state) {
    return firstNonNull(
        new TreeScanner<Boolean, Void>() {
          @Override
          public Boolean visitBlock(BlockTree tree, Void unused) {
            switch (tree.getStatements().size()) {
              case 0:
                return true;
              case 1:
                return scan(getOnlyElement(tree.getStatements()), null);
              default:
                return false;
            }
          }

          @Override
          public Boolean visitReturn(ReturnTree tree, Void unused) {
            return scan(tree.getExpression(), null);
          }

          @Override
          public Boolean visitExpressionStatement(ExpressionStatementTree tree, Void unused) {
            return scan(tree.getExpression(), null);
          }

          @Override
          public Boolean visitTypeCast(TypeCastTree tree, Void unused) {
            return scan(tree.getExpression(), null);
          }

          @Override
          public Boolean visitMethodInvocation(MethodInvocationTree node, Void aVoid) {
            ExpressionTree receiver = ASTHelpers.getReceiver(node);
            return receiver instanceof IdentifierTree
                && ((IdentifierTree) receiver).getName().contentEquals("super")
                && overrides(ASTHelpers.getSymbol(method), ASTHelpers.getSymbol(node));
          }

          private boolean overrides(MethodSymbol sym, MethodSymbol other) {
            return !sym.isStatic()
                && !other.isStatic()
                && (((sym.flags() | other.flags()) & Flags.SYNTHETIC) == 0)
                && sym.name.contentEquals(other.name)
                && sym.overrides(
                    other, sym.owner.enclClass(), state.getTypes(), /* checkResult= */ false);
          }
        }.scan(method.getBody(), null),
        false);
  }
715998
def _traverse_parent(node, objtypes):
    
    curr_node = node.parent
    while curr_node is not None:
        if isinstance(curr_node, objtypes):
            return curr_node
        curr_node = curr_node.parent
    return None
143726
function readFullTree() {
                        // Return null if the contextTree is not correctly closed
                        if (root !== currentContext) {
                            return null;
                        }

                        function recusiveRead(node) {
                            if (node.children.length === 0) {
                                delete node.children;
                            } else {
                                for (var i=0, max=node.children.length ; i<max ; i++) {
                                    recusiveRead(node.children[i]);
                                }
                            }
                            delete node.parent;
                        }
                        recusiveRead(root);

                        return root;
                    }
272031
private void traverse(GroovySourceAST t) {
        if (t == null) { return; }
        if (unvisitedNodes != null) {
           unvisitedNodes.add(t);
        }
        GroovySourceAST child = (GroovySourceAST)t.getFirstChild();
        if (child != null) {
            traverse(child);
        }
        GroovySourceAST sibling = (GroovySourceAST)t.getNextSibling();
        if (sibling != null) {
            traverse(sibling);
        }
    }
346144
@Override
    public R scan(Tree tree, P p) {
        if (tree == null)
            return null;

        TreePath prev = path;
        path = new TreePath(path, tree);
        try {
            return tree.accept(this, p);
        } finally {
            path = prev;
        }
    }
545558
function visitReturnInFactory(traverse, node, path, state) {
        utils.catchup(node.range[0], state);
        utils.move(node.argument.range[0], state);
        utils.append('module.exports = ', state);
        utils.catchup(node.range[1] - 1, state);
        return false;
    }
1349615
void traverseWithScope(Node root, AbstractScope<?, ?> s) {
    checkState(s.isGlobal() || s.isModuleScope(), s);
    try {
      initTraversal(root);
      curNode = root;
      pushScope(s);
      traverseBranch(root, null);
      popScope();
    } catch (Error | Exception unexpectedException) {
      throwUnexpectedException(unexpectedException);
    }
  }
78151
public void visitApply(JCMethodInvocation tree) {
            if (TreeInfo.name(tree.meth) == names._super) {
                Symbol constructor = TreeInfo.symbol(tree.meth);
                ClassSymbol c = (ClassSymbol)constructor.owner;
                if (c.hasOuterInstance() &&
                    !tree.meth.hasTag(SELECT) &&
                    outerThisStack.head != null)
                    visitSymbol(outerThisStack.head);
            }
            super.visitApply(tree);
        }
1080678
private boolean isDangling(Node node)
	{
		if (!result.contains(node)) return false;
		if (ST.contains(node)) return false;

		boolean hasIncoming = false;

		for (Edge edge : node.getUpstream())
		{
			if (result.contains(edge))
			{
				hasIncoming = true;
				break;
			}
		}

		boolean hasOutgoing = false;

		for (Edge edge : node.getDownstream())
		{
			if (result.contains(edge))
			{
				hasOutgoing = true;
				break;
			}
		}

		if (hasIncoming && hasOutgoing) return false;

		boolean hasParent = false;

		for (Node parent : node.getUpperEquivalent())
		{
			if (result.contains(parent))
			{
				hasParent = true;
				break;
			}
		}

		if (hasParent && (hasIncoming || hasOutgoing)) return false;

		boolean hasChild = false;

		for (Node child : node.getLowerEquivalent())
		{
			if (result.contains(child))
			{
				hasChild = true;
				break;
			}
		}

		return !(hasChild && (hasIncoming || hasOutgoing || hasParent));
	}
127277
def visit_root(node, &operator)
      clear
      # Exclude cycles if the prune cycles flag is set. 
      @exclude.merge!(cyclic_nodes(node)) if @prune_cycle_flag 
      # Visit the root node.
      result = visit_recursive(node, &operator)
      # Reset the exclusions if the prune cycles flag is set.
      @exclude.clear if @prune_cycle_flag 
      result
    end
101379
function visit() {
  if (this.isBlacklisted()) return false;
  if (this.opts.shouldSkip && this.opts.shouldSkip(this)) return false;

  this.call("enter");

  if (this.shouldSkip) {
    return this.shouldStop;
  }

  var node = this.node;
  var opts = this.opts;

  if (node) {
    if (Array.isArray(node)) {
      // traverse over these replacement nodes we purposely don't call exitNode
      // as the original node has been destroyed
      for (var i = 0; i < node.length; i++) {
        _index2["default"].node(node[i], opts, this.scope, this.state, this, this.skipKeys);
      }
    } else {
      _index2["default"].node(node, opts, this.scope, this.state, this, this.skipKeys);
      this.call("exit");
    }
  }

  return this.shouldStop;
}
532436
def visit(self, node):
        """"""

        try:
            # Get the "visit_%s" method, using the lower case version of the rule.
            method = getattr(self, 'visit_%s' % node.expr_name.lower())
        except AttributeError:
            # If the method is not defined, we do nothing for this node.
            return

        # Below is untouched code from the original ``visit`` method.

        # Call that method, and show where in the tree it failed if it blows up.
        try:
            return method(node, [self.visit(n) for n in node])
        except (VisitationError, UndefinedLabel):
            # Don't catch and re-wrap already-wrapped exceptions.
            raise
        except self.unwrapped_exceptions:
            raise
        except Exception:
            # Catch any exception, and tack on a parse tree so it's easier to
            # see where it went wrong.
            exc_class, exc, trace = sys.exc_info()
            raise VisitationError(exc, exc_class, node).with_traceback(trace)
1192530
@Override
  public void visit(NodeTraversal t, Node n, Node parent) {
    if (n.isName() || n.isImportStar() || (n.isStringKey() && !n.hasChildren())) {
      if ((parent.isImportSpec() && n != parent.getLastChild())
          || (parent.isExportSpec() && n != parent.getFirstChild())) {
        // The n in `import {n as x}` or `export {x as n}` are not references, even though
        // they are represented in the AST as NAME nodes.
        return;
      }

      Var v = t.getScope().getVar(n.getString());

      if (v != null) {
        if (varFilter.apply(v)) {
          addReference(v, new Reference(n, t, peek(blockStack)));
        }

        if (v.getParentNode() != null
            && NodeUtil.isHoistedFunctionDeclaration(v.getParentNode())
            // If we're only traversing a narrow scope, do not try to climb outside.
            && (narrowScope == null || narrowScope.getDepth() <= v.getScope().getDepth())) {
          outOfBandTraversal(v);
        }
      }
    }

    if (isBlockBoundary(n, parent)) {
      pop(blockStack);
    }
  }
596456
function traverseChildren(tw, type) {
  var child, node, parent, result, sibling;
  node = tw._currentNode[mapChild[type]];
  while (node !== null) {
    result = tw._internalFilter(node);
    if (result === NodeFilter.FILTER_ACCEPT) {
      tw._currentNode = node;
      return node;
    }
    if (result === NodeFilter.FILTER_SKIP) {
      child = node[mapChild[type]];
      if (child !== null) {
        node = child;
        continue;
      }
    }
    while (node !== null) {
      sibling = node[mapSibling[type]];
      if (sibling !== null) {
        node = sibling;
        break;
      }
      parent = node.parentNode;
      if (parent === null || parent === tw.root || parent === tw._currentNode) {
        return null;
      } else {
        node = parent;
      }
    }
  }
  return null;
}
738672
function traverse(ast) {
    var visitors = flatten(slice.call(arguments, 1));

    estraverse.traverse(ast, {
        enter: function(node) {
            var type = node.type;
            var methodName = type + 'Enter';
            visitorsCall('enter', this, arguments);
            visitorsCall(methodName, this, arguments);
        },
        leave: function(node) {
            var type = node.type;
            var methodName = type + 'Leave';
            visitorsCall('leave', this, arguments);
            visitorsCall(methodName, this, arguments);
        }
    });


    function visitorsCall(methodName, context, args) {
        var callArgs = slice.call(args);
        var callBreak;
        var visitorContext = Object.assign(
            Object.create(context),
            {
                skip: function() {
                    callBreak = true;
                    context.skip();
                },
                break: function() {
                    callBreak = true;
                    context.break();
                }
            }
        );
        visitors.some(function(visitor) {
            var method = visitor[methodName];
            if (method) {
                method.apply(visitorContext, callArgs);
            }
            return callBreak;
        });
    }
}