code: private static void gatherLocalNames(Node n, Set<String> names) {
      if (n.isFunction()) {
        if (NodeUtil.isFunctionDeclaration(n)) {
          names.add(n.getFirstChild().getString());
        }
        // Don't traverse into inner function scopes;
        return;
      } else if (n.isName()) {
        switch (n.getParent().getToken()) {
          case VAR:
          case LET:
          case CONST:
          case CATCH:
            names.add(n.getString());
            break;
          default:
            break;
        }
      }
  
      for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
        gatherLocalNames(c, names);
      }
    }
docs: Gather any names declared in the local scope.