code: @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);
      }
    }
docs: For each node, update the block stack and reference collection
  as appropriate.