Program: 28112
Project: 28112
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 (key.getType() == Token.GET || key.getType() == Token.SET) {
      continue;
    }
    boolean isJsIdentifier=key.getType() != Token.NUMBER && TokenStream.isJSIdentifier(key.getString());
    String propName=isJsIdentifier ? key.getString() : String.valueOf(++arbitraryNameCounter);
    String qName=objlitName.fullName() + '.' + 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=Node.newString(Token.NAME,propAlias);
      if (key.getBooleanProp(Node.IS_CONSTANT_NAME)) {
        refNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
      }
      key.replaceChild(value,refNode);
    }
    Node nameNode=Node.newString(Token.NAME,propAlias);
    nameNode.addChildToFront(value);
    if (key.getBooleanProp(Node.IS_CONSTANT_NAME)) {
      nameNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
    }
    Node newVar=new Node(Token.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.getType() == Token.FUNCTION) {
        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.getType() == Token.GET || key.getType() == Token.SET) {
      continue;
    }
    boolean isJsIdentifier=key.getType() != Token.NUMBER && 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=Node.newString(Token.NAME,propAlias);
      if (key.getBooleanProp(Node.IS_CONSTANT_NAME)) {
        refNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
      }
      key.replaceChild(value,refNode);
    }
    Node nameNode=Node.newString(Token.NAME,propAlias);
    nameNode.addChildToFront(value);
    if (key.getBooleanProp(Node.IS_CONSTANT_NAME)) {
      nameNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
    }
    Node newVar=new Node(Token.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.getType() == Token.FUNCTION) {
        checkForHosedThisReferences(value,value.getJSDocInfo(),p);
      }
    }
    numVars++;
  }
  return numVars;
}