code: @Override
    public void process(Node externs, Node root) {
      ReferenceCollectingCallback callback =
        new ReferenceCollectingCallback(compiler,
            ReferenceCollectingCallback.DO_NOTHING_BEHAVIOR, new Es6SyntacticScopeCreator(compiler));
  
      callback.process(root);
  
      for (Var variable : callback.getAllSymbols()) {
        ReferenceCollection referenceCollection =
            callback.getReferences(variable);
  
        VariableVisibility visibility;
  
        if (variableIsParameter(variable)) {
          visibility = VariableVisibility.PARAMETER;
        } else if (variable.isLocal()) {
          if (referenceCollection.isEscaped()) {
            visibility = VariableVisibility.CAPTURED_LOCAL;
          } else {
            visibility = VariableVisibility.LOCAL;
          }
        } else if (variable.isGlobal()) {
          visibility = VariableVisibility.GLOBAL;
        } else {
          throw new IllegalStateException("Un-handled variable visibility for " + variable);
        }
  
        visibilityByDeclaringNameNode.put(variable.getNameNode(), visibility);
      }
    }
docs: Determines the visibility class for each variable in root.