Program: 27810
Project: 27810
Buggy source:
/** 
 * Declares global variables to serve as aliases for the values in an object literal, optionally removing all of the object literal's keys and values.
 * @param alias The object literal's flattened name (e.g. "a$b$c")
 * @param objlit The OBJLIT node
 * @param varNode The VAR node to which new global variables should be addedas children
 * @param nameToAddAfter The child of {@code varNode} after which newvariables should be added (may be null)
 * @param varParent {@code varNode}'s parent
 * @return The number of variables added
 */
private int declareVarsForObjLitValues(Name objlitName,String alias,Node objlit,Node varNode,Node nameToAddAfter,Node varParent){
  int numVars=0;
  int arbitraryNameCounter=0;
  boolean discardKeys=!objlitName.shouldKeepKeys();
  for (Node key=objlit.getFirstChild(), nextKey; key != null; key=nextKey) {
    Node value=key.getFirstChild();
    nextKey=key.getNext();
    if (!NodeUtil.isOptimizableObjectLitKey(key)) {
      continue;
    }
    boolean isJsIdentifier=!key.isNumber() && TokenStream.isJSIdentifier(key.getString());
    String propName=isJsIdentifier ? key.getString() : String.valueOf(++arbitraryNameCounter);
    String qName=objlitName.getFullName() + '.' + propName;
    Name p=nameMap.get(qName);
    if (p != null && !p.canCollapse()) {
      continue;
    }
    String propAlias=appendPropForAlias(alias,propName);
    Node refNode=null;
    if (discardKeys) {
      objlit.removeChild(key);
      value.detachFromParent();
    }
 else {
      refNode=IR.name(propAlias);
      if (key.getBooleanProp(Node.IS_CONSTANT_NAME)) {
        refNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
      }
      key.replaceChild(value,refNode);
    }
    Node nameNode=IR.name(propAlias);
    nameNode.addChildToFront(value);
    if (key.getBooleanProp(Node.IS_CONSTANT_NAME)) {
      nameNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
    }
    Node newVar=IR.var(nameNode).copyInformationFromForTree(key);
    if (nameToAddAfter != null) {
      varParent.addChildAfter(newVar,nameToAddAfter);
    }
 else {
      varParent.addChildBefore(newVar,varNode);
    }
    compiler.reportCodeChange();
    nameToAddAfter=newVar;
    if (isJsIdentifier && p != null) {
      if (!discardKeys) {
        Ref newAlias=p.getDeclaration().cloneAndReclassify(Ref.Type.ALIASING_GET);
        newAlias.node=refNode;
        p.addRef(newAlias);
      }
      p.getDeclaration().node=nameNode;
      if (value.isFunction()) {
        checkForHosedThisReferences(value,value.getJSDocInfo(),p);
      }
    }
    numVars++;
  }
  return numVars;
}

Fixed version (ground truth):
/** 
 * Declares global variables to serve as aliases for the values in an object literal, optionally removing all of the object literal's keys and values.
 * @param alias The object literal's flattened name (e.g. "a$b$c")
 * @param objlit The OBJLIT node
 * @param varNode The VAR node to which new global variables should be addedas children
 * @param nameToAddAfter The child of {@code varNode} after which newvariables should be added (may be null)
 * @param varParent {@code varNode}'s parent
 * @return The number of variables added
 */
private int declareVarsForObjLitValues(Name objlitName,String alias,Node objlit,Node varNode,Node nameToAddAfter,Node varParent){
  int numVars=0;
  int arbitraryNameCounter=0;
  boolean discardKeys=!objlitName.shouldKeepKeys();
  for (Node key=objlit.getFirstChild(), nextKey; key != null; key=nextKey) {
    Node value=key.getFirstChild();
    nextKey=key.getNext();
    if (key.isGetterDef() || key.isSetterDef()) {
      continue;
    }
    boolean isJsIdentifier=!key.isNumber() && TokenStream.isJSIdentifier(key.getString());
    String propName=isJsIdentifier ? key.getString() : String.valueOf(++arbitraryNameCounter);
    String qName=objlitName.getFullName() + '.' + propName;
    Name p=nameMap.get(qName);
    if (p != null && !p.canCollapse()) {
      continue;
    }
    String propAlias=appendPropForAlias(alias,propName);
    Node refNode=null;
    if (discardKeys) {
      objlit.removeChild(key);
      value.detachFromParent();
    }
 else {
      refNode=IR.name(propAlias);
      if (key.getBooleanProp(Node.IS_CONSTANT_NAME)) {
        refNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
      }
      key.replaceChild(value,refNode);
    }
    Node nameNode=IR.name(propAlias);
    nameNode.addChildToFront(value);
    if (key.getBooleanProp(Node.IS_CONSTANT_NAME)) {
      nameNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
    }
    Node newVar=IR.var(nameNode).copyInformationFromForTree(key);
    if (nameToAddAfter != null) {
      varParent.addChildAfter(newVar,nameToAddAfter);
    }
 else {
      varParent.addChildBefore(newVar,varNode);
    }
    compiler.reportCodeChange();
    nameToAddAfter=newVar;
    if (isJsIdentifier && p != null) {
      if (!discardKeys) {
        Ref newAlias=p.getDeclaration().cloneAndReclassify(Ref.Type.ALIASING_GET);
        newAlias.node=refNode;
        p.addRef(newAlias);
      }
      p.getDeclaration().node=nameNode;
      if (value.isFunction()) {
        checkForHosedThisReferences(value,value.getJSDocInfo(),p);
      }
    }
    numVars++;
  }
  return numVars;
}