code: private void updateGlobalNameDeclarationAtVariableNode(
        Name n, boolean canCollapseChildNames) {
      if (!canCollapseChildNames) {
        return;
      }
  
      Ref ref = n.getDeclaration();
      String name = ref.getNode().getString();
      Node rvalue = ref.getNode().getFirstChild();
      Node variableNode = ref.getNode().getParent();
      Node grandparent = variableNode.getParent();
  
      boolean isObjLit = rvalue.isObjectLit();
  
      if (isObjLit) {
        declareVariablesForObjLitValues(
            n, name, rvalue, variableNode, variableNode.getPrevious(), grandparent);
      }
  
      addStubsForUndeclaredProperties(n, name, grandparent, variableNode);
  
      if (isObjLit && canEliminate(n)) {
        variableNode.removeChild(ref.getNode());
        compiler.reportChangeToEnclosingScope(variableNode);
        if (!variableNode.hasChildren()) {
          grandparent.removeChild(variableNode);
        }
  
        // Clear out the object reference, since we've eliminated it from the
        // parse tree.
        n.updateRefNode(ref, null);
      }
    }
docs: Updates the first initialization (a.k.a "declaration") of a global name that occurs at a VAR
  node. See comment for {@link #updateGlobalNameDeclaration}.
  
  @param n An object representing a global name (e.g. "a")