Program: 28116
Project: 28116
Buggy source:
/** 
 * Updates the first initialization (a.k.a "declaration") of a global name that occurs at an ASSIGN node. See comment for  {@link #updateObjLitOrFunctionDeclaration}.
 * @param n An object representing a global name (e.g. "a", "a.b.c")
 * @param alias The flattened name for {@code n} (e.g. "a", "a$b$c")
 */
private void updateObjLitOrFunctionDeclarationAtAssignNode(Name n,String alias,boolean canCollapseChildNames){
  Ref ref=n.getDeclaration();
  Node rvalue=ref.node.getNext();
  Node varNode=new Node(Token.VAR);
  Node varParent=ref.node.getAncestor(3);
  Node gramps=ref.node.getAncestor(2);
  boolean isObjLit=rvalue.getType() == Token.OBJECTLIT;
  boolean insertedVarNode=false;
  if (isObjLit && n.canEliminate()) {
    varParent.replaceChild(gramps,varNode);
    ref.node=null;
    insertedVarNode=true;
  }
 else   if (!n.isSimpleName()) {
    if (rvalue.getType() == Token.FUNCTION) {
      checkForHosedThisReferences(rvalue,n.docInfo,n);
    }
    ref.node.getParent().removeChild(rvalue);
    Node nameNode=NodeUtil.newName(compiler.getCodingConvention(),alias,ref.node.getAncestor(2),n.fullName());
    JSDocInfo info=ref.node.getParent().getJSDocInfo();
    if (ref.node.getLastChild().getBooleanProp(Node.IS_CONSTANT_NAME) || (info != null && info.isConstant())) {
      nameNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
    }
    varNode.addChildToBack(nameNode);
    nameNode.addChildToFront(rvalue);
    varParent.replaceChild(gramps,varNode);
    ref.node=nameNode;
    insertedVarNode=true;
  }
  if (canCollapseChildNames) {
    if (isObjLit) {
      declareVarsForObjLitValues(n,alias,rvalue,varNode,varParent.getChildBefore(varNode),varParent);
    }
    addStubsForUndeclaredProperties(n,alias,varParent,varNode);
  }
  if (insertedVarNode) {
    if (!varNode.hasChildren()) {
      varParent.removeChild(varNode);
    }
    compiler.reportCodeChange();
  }
}

Fixed version (ground truth):
/** 
 * Updates the first initialization (a.k.a "declaration") of a global name that occurs at an ASSIGN node. See comment for  {@link #updateObjLitOrFunctionDeclaration}.
 * @param n An object representing a global name (e.g. "a", "a.b.c")
 * @param alias The flattened name for {@code n} (e.g. "a", "a$b$c")
 */
private void updateObjLitOrFunctionDeclarationAtAssignNode(Name n,String alias,boolean canCollapseChildNames){
  Ref ref=n.getDeclaration();
  Node rvalue=ref.node.getNext();
  Node varNode=new Node(Token.VAR);
  Node varParent=ref.node.getAncestor(3);
  Node gramps=ref.node.getAncestor(2);
  boolean isObjLit=rvalue.getType() == Token.OBJECTLIT;
  boolean insertedVarNode=false;
  if (isObjLit && n.canEliminate()) {
    varParent.replaceChild(gramps,varNode);
    ref.node=null;
    insertedVarNode=true;
  }
 else   if (!n.isSimpleName()) {
    if (rvalue.getType() == Token.FUNCTION) {
      checkForHosedThisReferences(rvalue,n.docInfo,n);
    }
    ref.node.getParent().removeChild(rvalue);
    Node nameNode=NodeUtil.newName(compiler.getCodingConvention(),alias,ref.node.getAncestor(2),n.getFullName());
    JSDocInfo info=ref.node.getParent().getJSDocInfo();
    if (ref.node.getLastChild().getBooleanProp(Node.IS_CONSTANT_NAME) || (info != null && info.isConstant())) {
      nameNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
    }
    varNode.addChildToBack(nameNode);
    nameNode.addChildToFront(rvalue);
    varParent.replaceChild(gramps,varNode);
    ref.node=nameNode;
    insertedVarNode=true;
  }
  if (canCollapseChildNames) {
    if (isObjLit) {
      declareVarsForObjLitValues(n,alias,rvalue,varNode,varParent.getChildBefore(varNode),varParent);
    }
    addStubsForUndeclaredProperties(n,alias,varParent,varNode);
  }
  if (insertedVarNode) {
    if (!varNode.hasChildren()) {
      varParent.removeChild(varNode);
    }
    compiler.reportCodeChange();
  }
}