nus-yam/ex-repair huggingface dataset:
Program: 27904
Project: 27904
Buggy source:
@Override public void hotSwapScript(Node root,Node originalRoot){
  Traversal traversal=new Traversal();
  NodeTraversal.traverse(compiler,root,traversal);
  if (!traversal.hasErrors()) {
    for (    AliasUsage aliasUsage : traversal.getAliasUsages()) {
      aliasUsage.applyAlias();
    }
    for (    Node aliasDefinition : traversal.getAliasDefinitionsInOrder()) {
      if (aliasDefinition.getParent().isVar() && aliasDefinition.getParent().hasOneChild()) {
        aliasDefinition.getParent().detachFromParent();
      }
 else {
        aliasDefinition.detachFromParent();
      }
    }
    for (    Node scopeCall : traversal.getScopeCalls()) {
      Node expressionWithScopeCall=scopeCall.getParent();
      Node scopeClosureBlock=scopeCall.getLastChild().getLastChild();
      scopeClosureBlock.detachFromParent();
      expressionWithScopeCall.getParent().replaceChild(expressionWithScopeCall,scopeClosureBlock);
      NodeUtil.tryMergeBlock(scopeClosureBlock);
    }
    if (traversal.getAliasUsages().size() > 0 || traversal.getAliasDefinitionsInOrder().size() > 0 || traversal.getScopeCalls().size() > 0) {
      compiler.reportCodeChange();
    }
  }
}

Fixed version (ground truth):
@Override public void hotSwapScript(Node root,Node originalRoot){
  Traversal traversal=new Traversal();
  NodeTraversal.traverse(compiler,root,traversal);
  if (!traversal.hasErrors()) {
    List<AliasUsage> aliasWorkQueue=Lists.newArrayList(traversal.getAliasUsages());
    while (!aliasWorkQueue.isEmpty()) {
      List<AliasUsage> newQueue=Lists.newArrayList();
      for (      AliasUsage aliasUsage : aliasWorkQueue) {
        if (aliasUsage.referencesOtherAlias()) {
          newQueue.add(aliasUsage);
        }
 else {
          aliasUsage.applyAlias();
        }
      }
      if (newQueue.size() == aliasWorkQueue.size()) {
        Var cycleVar=newQueue.get(0).aliasVar;
        compiler.report(JSError.make(cycleVar.getNode(),GOOG_SCOPE_ALIAS_CYCLE,cycleVar.getName()));
        break;
      }
 else {
        aliasWorkQueue=newQueue;
      }
    }
    for (    Node aliasDefinition : traversal.getAliasDefinitionsInOrder()) {
      if (aliasDefinition.getParent().isVar() && aliasDefinition.getParent().hasOneChild()) {
        aliasDefinition.getParent().detachFromParent();
      }
 else {
        aliasDefinition.detachFromParent();
      }
    }
    for (    Node scopeCall : traversal.getScopeCalls()) {
      Node expressionWithScopeCall=scopeCall.getParent();
      Node scopeClosureBlock=scopeCall.getLastChild().getLastChild();
      scopeClosureBlock.detachFromParent();
      expressionWithScopeCall.getParent().replaceChild(expressionWithScopeCall,scopeClosureBlock);
      NodeUtil.tryMergeBlock(scopeClosureBlock);
    }
    if (traversal.getAliasUsages().size() > 0 || traversal.getAliasDefinitionsInOrder().size() > 0 || traversal.getScopeCalls().size() > 0) {
      compiler.reportCodeChange();
    }
  }
}
Program: 27905
Project: 27905
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (isCallToScopeMethod(n)) {
    validateScopeCall(t,n,n.getParent());
  }
  if (t.getScopeDepth() < 2) {
    return;
  }
  int type=n.getType();
  Var aliasVar=null;
  if (type == Token.NAME) {
    String name=n.getString();
    Var lexicalVar=t.getScope().getVar(n.getString());
    if (lexicalVar != null && lexicalVar == aliases.get(name)) {
      aliasVar=lexicalVar;
    }
  }
  if (t.getScopeDepth() == 2) {
    if (aliasVar != null && NodeUtil.isLValue(n)) {
      if (aliasVar.getNode() == n) {
        aliasDefinitionsInOrder.add(n);
        return;
      }
 else {
        report(t,n,GOOG_SCOPE_ALIAS_REDEFINED,n.getString());
      }
    }
    if (type == Token.RETURN) {
      report(t,n,GOOG_SCOPE_USES_RETURN);
    }
 else     if (type == Token.THIS) {
      report(t,n,GOOG_SCOPE_REFERENCES_THIS);
    }
 else     if (type == Token.THROW) {
      report(t,n,GOOG_SCOPE_USES_THROW);
    }
  }
  if (t.getScopeDepth() >= 2) {
    if (aliasVar != null) {
      Node aliasedNode=aliasVar.getInitialValue();
      aliasUsages.add(new AliasedNode(n,aliasedNode));
    }
    JSDocInfo info=n.getJSDocInfo();
    if (info != null) {
      for (      Node node : info.getTypeNodes()) {
        fixTypeNode(node);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (isCallToScopeMethod(n)) {
    validateScopeCall(t,n,n.getParent());
  }
  if (t.getScopeDepth() < 2) {
    return;
  }
  int type=n.getType();
  Var aliasVar=null;
  if (type == Token.NAME) {
    String name=n.getString();
    Var lexicalVar=t.getScope().getVar(n.getString());
    if (lexicalVar != null && lexicalVar == aliases.get(name)) {
      aliasVar=lexicalVar;
    }
  }
  if (t.getScopeDepth() == 2) {
    if (aliasVar != null && NodeUtil.isLValue(n)) {
      if (aliasVar.getNode() == n) {
        aliasDefinitionsInOrder.add(n);
        return;
      }
 else {
        report(t,n,GOOG_SCOPE_ALIAS_REDEFINED,n.getString());
      }
    }
    if (type == Token.RETURN) {
      report(t,n,GOOG_SCOPE_USES_RETURN);
    }
 else     if (type == Token.THIS) {
      report(t,n,GOOG_SCOPE_REFERENCES_THIS);
    }
 else     if (type == Token.THROW) {
      report(t,n,GOOG_SCOPE_USES_THROW);
    }
  }
  if (t.getScopeDepth() >= 2) {
    if (aliasVar != null) {
      aliasUsages.add(new AliasedNode(aliasVar,n));
    }
    JSDocInfo info=n.getJSDocInfo();
    if (info != null) {
      for (      Node node : info.getTypeNodes()) {
        fixTypeNode(node);
      }
    }
  }
}
Program: 27906
Project: 27906
Buggy source:
/** 
 * Computes the number of uses of the variable varName and store it in numUseWithinUseCfgNode.
 */
private void getNumUseInUseCfgNode(Node n){
  AbstractCfgNodeTraversalCallback gatherCb=new AbstractCfgNodeTraversalCallback(){
    @Override public void visit(    NodeTraversal t,    Node n,    Node parent){
      if (n.isName() && n.getString().equals(varName) && !(parent.isAssign() && (parent.getFirstChild() == n))) {
        numUseWithinUseCfgNode++;
      }
    }
  }
;
  NodeTraversal.traverse(compiler,n,gatherCb);
}

Fixed version (ground truth):
/** 
 * Computes the number of uses of the variable varName and store it in numUseWithinUseCfgNode.
 */
private void getNumUseInUseCfgNode(final Node cfgNode){
  numUsesWithinCfgNode=0;
  AbstractCfgNodeTraversalCallback gatherCb=new AbstractCfgNodeTraversalCallback(){
    @Override public void visit(    NodeTraversal t,    Node n,    Node parent){
      if (n.isName() && n.getString().equals(varName)) {
        if (parent.isAssign() && (parent.getFirstChild() == n) && isAssignChain(parent,cfgNode)) {
          return;
        }
 else {
          numUsesWithinCfgNode++;
        }
      }
    }
    private boolean isAssignChain(    Node child,    Node ancestor){
      for (Node n=child; n != ancestor; n=n.getParent()) {
        if (!n.isAssign()) {
          return false;
        }
      }
      return true;
    }
  }
;
  NodeTraversal.traverse(compiler,cfgNode,gatherCb);
}
Program: 27908
Project: 27908
Buggy source:
/** 
 * Given an expression by its root and sub-expression n, return true if there the predicate is true for some expression on the left of n. Example: Checked(), Checked(), n, NotChecked(), NotChecked();
 */
private static boolean checkLeftOf(Node n,Node expressionRoot,Predicate<Node> predicate){
  for (Node p=n.getParent(); p != expressionRoot; p=p.getParent()) {
    for (Node cur=p.getParent().getFirstChild(); cur != p; cur=cur.getNext()) {
      if (predicate.apply(cur)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Given an expression by its root and sub-expression n, return true if there the predicate is true for some expression on the left of n. Example: Checked(), Checked(), n, NotChecked(), NotChecked();
 */
private static boolean checkLeftOf(Node n,Node expressionRoot,Predicate<Node> predicate){
  for (Node p=n; p != expressionRoot; p=p.getParent()) {
    for (Node cur=p.getParent().getFirstChild(); cur != p; cur=cur.getNext()) {
      if (predicate.apply(cur)) {
        return true;
      }
    }
  }
  return false;
}
Program: 27909
Project: 27909
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isName() && n.getString().equals(varName) && !(parent.isAssign() && (parent.getFirstChild() == n))) {
    numUseWithinUseCfgNode++;
  }
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isName() && n.getString().equals(varName)) {
    if (parent.isAssign() && (parent.getFirstChild() == n) && isAssignChain(parent,cfgNode)) {
      return;
    }
 else {
      numUsesWithinCfgNode++;
    }
  }
}
Program: 27910
Project: 27910
Buggy source:
/** 
 * After a struct object is created, we can't add new properties to it, with one exception. We allow creation of "static" properties like Foo.prototype.bar = baz; where Foo.prototype is a struct, if the assignment happens at the top level and the constructor Foo is defined in the same file.
 */
private void checkPropCreation(NodeTraversal t,Node lvalue){
  if (lvalue.isGetProp()) {
    Node obj=lvalue.getFirstChild();
    Node prop=lvalue.getLastChild();
    JSType objType=getJSType(obj);
    String pname=prop.getString();
    if (!objType.isStruct() || objType.hasProperty(pname)) {
      return;
    }
    Scope s=t.getScope();
    if (obj.isThis() && getJSType(s.getRootNode()).isConstructor()) {
      return;
    }
    Node assgnStm=lvalue.getParent().getParent();
    if (objType instanceof ObjectType && s.isGlobal() && NodeUtil.isPrototypePropertyDeclaration(assgnStm)) {
      ObjectType instance=objType.toObjectType().getOwnerFunction().getInstanceType();
      String file=lvalue.getSourceFileName();
      Node ctor=instance.getConstructor().getSource();
      if (ctor != null && ctor.getSourceFileName().equals(file)) {
        return;
      }
    }
    report(t,prop,ILLEGAL_PROPERTY_CREATION);
  }
}

Fixed version (ground truth):
/** 
 * After a struct object is created, we can't add new properties to it, with one exception. We allow creation of "static" properties like Foo.prototype.bar = baz; where Foo.prototype is a struct, if the assignment happens at the top level and the constructor Foo is defined in the same file.
 */
private void checkPropCreation(NodeTraversal t,Node lvalue){
  if (lvalue.isGetProp()) {
    Node obj=lvalue.getFirstChild();
    Node prop=lvalue.getLastChild();
    JSType objType=getJSType(obj);
    String pname=prop.getString();
    if (!objType.isStruct() || objType.hasProperty(pname)) {
      return;
    }
    Scope s=t.getScope();
    if (obj.isThis() && getJSType(s.getRootNode()).isConstructor()) {
      return;
    }
    Node assgnExp=lvalue.getParent();
    Node assgnStm=assgnExp.getParent();
    if (objType instanceof ObjectType && s.isGlobal() && NodeUtil.isPrototypePropertyDeclaration(assgnStm)) {
      ObjectType instance=objType.toObjectType().getOwnerFunction().getInstanceType();
      String file=lvalue.getSourceFileName();
      Node ctor=instance.getConstructor().getSource();
      if (ctor != null && ctor.getSourceFileName().equals(file)) {
        JSType rvalueType=assgnExp.getLastChild().getJSType();
        instance.defineInferredProperty(pname,rvalueType,lvalue);
        return;
      }
    }
    report(t,prop,ILLEGAL_PROPERTY_CREATION);
  }
}
Program: 27911
Project: 27911
Buggy source:
@Override public void remove(){
  map.removeChild(key);
}

Fixed version (ground truth):
@Override public void remove(AbstractCompiler compiler){
  compiler.reportChangeToEnclosingScope(key);
  map.removeChild(key);
}
Program: 27912
Project: 27912
Buggy source:
/** 
 * Inline a function into the call site.
 */
private void inlineFunction(NodeTraversal t,Node callNode,FunctionState fs,InliningMode mode){
  Function fn=fs.getFn();
  String fnName=fn.getName();
  Node fnNode=fs.getSafeFnNode();
  injector.inline(callNode,fnName,fnNode,mode);
  t.getCompiler().reportCodeChange();
  t.getCompiler().addToDebugLog("String_Node_Str" + fn.getName());
}

Fixed version (ground truth):
/** 
 * Inline a function into the call site.
 */
private void inlineFunction(NodeTraversal t,Node callNode,FunctionState fs,InliningMode mode){
  Function fn=fs.getFn();
  String fnName=fn.getName();
  Node fnNode=fs.getSafeFnNode();
  t.getCompiler().reportChangeToEnclosingScope(callNode);
  injector.inline(callNode,fnName,fnNode,mode);
  t.getCompiler().addToDebugLog("String_Node_Str" + fn.getName());
}
Program: 27914
Project: 27914
Buggy source:
/** 
 * Do the actual work of inlining a single declaration into a single reference.
 */
private void inline(Var v,Reference decl,Reference init,Reference ref){
  Node value=init.getAssignedValue();
  Preconditions.checkState(value != null);
  boolean isFunctionDeclaration=NodeUtil.isFunctionDeclaration(value);
  compiler.reportChangeToEnclosingScope(decl.getNode());
  compiler.reportChangeToEnclosingScope(ref.getNode());
  inlineValue(v,ref,value.detachFromParent());
  if (decl != init) {
    Node expressRoot=init.getGrandparent();
    Preconditions.checkState(expressRoot.isExprResult());
    NodeUtil.removeChild(expressRoot.getParent(),expressRoot);
  }
  if (!isFunctionDeclaration) {
    removeDeclaration(decl);
  }
}

Fixed version (ground truth):
/** 
 * Do the actual work of inlining a single declaration into a single reference.
 */
private void inline(Var v,Reference decl,Reference init,Reference ref){
  Node value=init.getAssignedValue();
  Preconditions.checkState(value != null);
  boolean isFunctionDeclaration=NodeUtil.isFunctionDeclaration(value);
  compiler.reportChangeToEnclosingScope(ref.getNode());
  inlineValue(v,ref,value.detachFromParent());
  if (decl != init) {
    Node expressRoot=init.getGrandparent();
    Preconditions.checkState(expressRoot.isExprResult());
    NodeUtil.removeChild(expressRoot.getParent(),expressRoot);
  }
  if (!isFunctionDeclaration) {
    compiler.reportChangeToEnclosingScope(decl.getNode());
    removeDeclaration(decl);
  }
}
Program: 27915
Project: 27915
Buggy source:
/** 
 * Look for exits (returns, breaks, or continues, depending on the context) at the end of a block and removes them by moving the if node's siblings, if any, into the opposite condition block.
 * @param srcBlock The block to inspect.
 * @param destBlock The block to move sibling nodes into.
 * @param ifNode The if node to work with.
 * @param exitType The type of exit to look for.
 * @param labelName The name associated with the exit, if any.
 * @nullable labelName null for anything excepted for named-break associatedwith a label.
 */
private void tryMinimizeIfBlockExits(Node srcBlock,Node destBlock,Node ifNode,int exitType,String labelName){
  Node exitNodeParent=null;
  Node exitNode=null;
  if (srcBlock.isBlock()) {
    if (!srcBlock.hasChildren()) {
      return;
    }
    exitNodeParent=srcBlock;
    exitNode=exitNodeParent.getLastChild();
  }
 else {
    exitNodeParent=ifNode;
    exitNode=srcBlock;
  }
  if (!matchingExitNode(exitNode,exitType,labelName)) {
    return;
  }
  if (ifNode.getNext() != null) {
    Node newDestBlock=IR.block().srcref(ifNode);
    if (destBlock == null) {
      ifNode.addChildToBack(newDestBlock);
    }
 else     if (destBlock.isEmpty()) {
      ifNode.replaceChild(destBlock,newDestBlock);
    }
 else     if (destBlock.isBlock()) {
      newDestBlock=destBlock;
    }
 else {
      ifNode.replaceChild(destBlock,newDestBlock);
      newDestBlock.addChildToBack(destBlock);
    }
    moveAllFollowing(ifNode,ifNode.getParent(),newDestBlock);
    compiler.reportCodeChange();
  }
}

Fixed version (ground truth):
/** 
 * Look for exits (returns, breaks, or continues, depending on the context) at the end of a block and removes them by moving the if node's siblings, if any, into the opposite condition block.
 * @param srcBlock The block to inspect.
 * @param destBlock The block to move sibling nodes into.
 * @param ifNode The if node to work with.
 * @param exitType The type of exit to look for.
 * @param labelName The name associated with the exit, if any.
 * @nullable labelName null for anything excepted for named-break associatedwith a label.
 */
private void tryMinimizeIfBlockExits(Node srcBlock,Node destBlock,Node ifNode,int exitType,String labelName){
  Node exitNodeParent=null;
  Node exitNode=null;
  if (srcBlock.isBlock()) {
    if (!srcBlock.hasChildren()) {
      return;
    }
    exitNodeParent=srcBlock;
    exitNode=exitNodeParent.getLastChild();
  }
 else {
    exitNodeParent=ifNode;
    exitNode=srcBlock;
  }
  if (!matchingExitNode(exitNode,exitType,labelName)) {
    return;
  }
  if (ifNode.getNext() != null) {
    Node newDestBlock=IR.block().srcref(ifNode);
    if (destBlock == null) {
      ifNode.addChildToBack(newDestBlock);
    }
 else     if (destBlock.isEmpty()) {
      ifNode.replaceChild(destBlock,newDestBlock);
    }
 else     if (destBlock.isBlock()) {
      newDestBlock=destBlock;
    }
 else {
      ifNode.replaceChild(destBlock,newDestBlock);
      newDestBlock.addChildToBack(destBlock);
    }
    moveAllFollowing(ifNode,ifNode.getParent(),newDestBlock);
    compiler.reportChangeToEnclosingScope(ifNode);
  }
}
Program: 27917
Project: 27917
Buggy source:
/** 
 * Traversal for passes that work only on changed functions. Suppose a loopable pass P1 uses this traversal. Then, if a function doesn't change between two runs of P1, it won't look at the function the second time. (We're assuming that P1 runs to a fixpoint, o/w we may miss optimizations.)
 */
public static void traverseChangedFunctions(AbstractCompiler compiler,FunctionCallback callback){
  final AbstractCompiler comp=compiler;
  final FunctionCallback cb=callback;
  final Node jsRoot=comp.getJsRoot();
  if (comp.hasScopeChanged(jsRoot)) {
    cb.visit(comp,jsRoot);
  }
  traverse(comp,jsRoot,new AbstractPreOrderCallback(){
    @Override public final boolean shouldTraverse(    NodeTraversal t,    Node n,    Node p){
      if (n.isFunction() && comp.hasScopeChanged(n)) {
        cb.visit(comp,n);
      }
      return true;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Traversal for passes that work only on changed functions. Suppose a loopable pass P1 uses this traversal. Then, if a function doesn't change between two runs of P1, it won't look at the function the second time. (We're assuming that P1 runs to a fixpoint, o/w we may miss optimizations.) Most changes are reported with calls to Compiler.reportCodeChange(), which doesn't know which scope changed. We keep track of the current scope by calling Compiler.setScope inside pushScope and popScope. The automatic tracking can be wrong in rare cases when a pass changes scope w/out causing a call to pushScope or popScope. It's very hard to find the places where this happens unless a bug is triggered. Passes that do cross-scope modifications call Compiler.reportChangeToEnclosingScope(Node n).
 */
public static void traverseChangedFunctions(AbstractCompiler compiler,FunctionCallback callback){
  final AbstractCompiler comp=compiler;
  final FunctionCallback cb=callback;
  final Node jsRoot=comp.getJsRoot();
  NodeTraversal t=new NodeTraversal(comp,new AbstractPreOrderCallback(){
    @Override public final boolean shouldTraverse(    NodeTraversal t,    Node n,    Node p){
      if ((n == jsRoot || n.isFunction()) && comp.hasScopeChanged(n)) {
        cb.visit(comp,n);
      }
      return true;
    }
  }
);
  t.traverse(jsRoot);
}
Program: 27918
Project: 27918
Buggy source:
/** 
 * Pops back to the previous scope (e.g. when leaving a function). 
 */
private void popScope(){
  if (scopeCallback != null) {
    scopeCallback.exitScope(this);
  }
  if (scopeRoots.isEmpty()) {
    scopes.pop();
  }
 else {
    scopeRoots.pop();
  }
  cfgs.pop();
  if (!scopes.isEmpty()) {
    compiler.setScope(scopes.peek().getRootNode());
  }
}

Fixed version (ground truth):
/** 
 * Pops back to the previous scope (e.g. when leaving a function). 
 */
private void popScope(){
  if (scopeCallback != null) {
    scopeCallback.exitScope(this);
  }
  if (scopeRoots.isEmpty()) {
    scopes.pop();
  }
 else {
    scopeRoots.pop();
  }
  cfgs.pop();
  if (hasScope()) {
    compiler.setScope(getScopeRoot());
  }
}
Program: 27919
Project: 27919
Buggy source:
@Override public final boolean shouldTraverse(NodeTraversal t,Node n,Node p){
  if (n.isFunction() && comp.hasScopeChanged(n)) {
    cb.visit(comp,n);
  }
  return true;
}

Fixed version (ground truth):
@Override public final boolean shouldTraverse(NodeTraversal t,Node n,Node p){
  if ((n == jsRoot || n.isFunction()) && comp.hasScopeChanged(n)) {
    cb.visit(comp,n);
  }
  return true;
}
Program: 27920
Project: 27920
Buggy source:
/** 
 * Checks that the scope roots marked as changed have indeed changed 
 */
public static void verifyScopeChanges(Map<Node,Node> map,Node main,boolean verifyUnchangedNodes){
  final Map<Node,Node> mtoc=map;
  final boolean checkUnchanged=verifyUnchangedNodes;
  Node clone=mtoc.get(main);
  if (main.getChangeTime() > clone.getChangeTime()) {
    Preconditions.checkState(!main.isEquivalentToShallow(clone));
  }
 else   if (checkUnchanged) {
    Preconditions.checkState(main.isEquivalentToShallow(clone));
  }
  visitPreOrder(main,new Visitor(){
    @Override public void visit(    Node n){
      if (n.isFunction() && mtoc.containsKey(n)) {
        Node clone=mtoc.get(n);
        if (n.getChangeTime() > clone.getChangeTime()) {
          Preconditions.checkState(!n.isEquivalentToShallow(clone));
        }
 else         if (checkUnchanged) {
          Preconditions.checkState(n.isEquivalentToShallow(clone));
        }
      }
    }
  }
,Predicates.<Node>alwaysTrue());
}

Fixed version (ground truth):
/** 
 * Checks that the scope roots marked as changed have indeed changed 
 */
public static void verifyScopeChanges(Map<Node,Node> map,Node main,boolean verifyUnchangedNodes,AbstractCompiler compiler){
  final Map<Node,Node> mtoc=map;
  final boolean checkUnchanged=verifyUnchangedNodes;
  Node clone=mtoc.get(main);
  if (main.getChangeTime() > clone.getChangeTime()) {
    Preconditions.checkState(!main.isEquivalentToShallow(clone));
  }
 else   if (checkUnchanged) {
    Preconditions.checkState(main.isEquivalentToShallow(clone));
  }
  visitPreOrder(main,new Visitor(){
    @Override public void visit(    Node n){
      if (n.isFunction() && mtoc.containsKey(n)) {
        Node clone=mtoc.get(n);
        if (n.getChangeTime() > clone.getChangeTime()) {
          Preconditions.checkState(!n.isEquivalentToShallow(clone));
        }
 else         if (checkUnchanged) {
          Preconditions.checkState(n.isEquivalentToShallow(clone));
        }
      }
    }
  }
,Predicates.<Node>alwaysTrue());
}
Program: 27921
Project: 27921
Buggy source:
/** 
 * Runs the sanity check if it is available.
 */
private void maybeSanityCheck(Node externs,Node root){
  if (sanityCheck != null) {
    sanityCheck.create(compiler).process(externs,root);
    if (inLoop) {
      NodeUtil.verifyScopeChanges(mtoc,jsRoot,true);
      setSanityCheckState();
    }
  }
}

Fixed version (ground truth):
/** 
 * Runs the sanity check if it is available.
 */
private void maybeSanityCheck(Node externs,Node root){
  if (sanityCheck != null) {
    sanityCheck.create(compiler).process(externs,root);
    if (inLoop) {
      NodeUtil.verifyScopeChanges(mtoc,jsRoot,true,compiler);
      setSanityCheckState();
    }
  }
}
Program: 27922
Project: 27922
Buggy source:
private void removeUnused(){
  for (  Node n : candidates) {
    Preconditions.checkState(n.isGetProp());
    if (!used.contains(n.getLastChild().getString())) {
      Node parent=n.getParent();
      if (NodeUtil.isAssignmentOp(parent)) {
        Node assign=parent;
        Preconditions.checkState(assign != null && NodeUtil.isAssignmentOp(assign) && assign.getFirstChild() == n);
        assign.getParent().replaceChild(assign,assign.getLastChild().detachFromParent());
      }
 else       if (parent.isInc() || parent.isDec()) {
        parent.getParent().replaceChild(parent,IR.number(0));
      }
 else {
        throw new IllegalStateException("String_Node_Str" + parent);
      }
      compiler.reportCodeChange();
    }
  }
}

Fixed version (ground truth):
private void removeUnused(){
  for (  Node n : candidates) {
    Preconditions.checkState(n.isGetProp());
    if (!used.contains(n.getLastChild().getString())) {
      Node parent=n.getParent();
      if (NodeUtil.isAssignmentOp(parent)) {
        Node assign=parent;
        Preconditions.checkState(assign != null && NodeUtil.isAssignmentOp(assign) && assign.getFirstChild() == n);
        compiler.reportChangeToEnclosingScope(assign);
        assign.getParent().replaceChild(assign,assign.getLastChild().detachFromParent());
      }
 else       if (parent.isInc() || parent.isDec()) {
        compiler.reportChangeToEnclosingScope(parent);
        parent.getParent().replaceChild(parent,IR.number(0));
      }
 else {
        throw new IllegalStateException("String_Node_Str" + parent);
      }
    }
  }
}
Program: 27923
Project: 27923
Buggy source:
/** 
 * Remove all properties under a given name if the property name is never referenced.
 */
private void removeUnusedSymbols(Collection<NameInfo> allNameInfo){
  boolean changed=false;
  for (  NameInfo nameInfo : allNameInfo) {
    if (!nameInfo.isReferenced()) {
      for (      Symbol declaration : nameInfo.getDeclarations()) {
        boolean canRemove=false;
        if (specializationState == null) {
          canRemove=true;
        }
 else {
          Node specializableFunction=getSpecializableFunctionFromSymbol(declaration);
          if (specializableFunction != null) {
            specializationState.reportRemovedFunction(specializableFunction,null);
            canRemove=true;
          }
        }
        if (canRemove) {
          declaration.remove();
          changed=true;
        }
      }
      logger.fine("String_Node_Str" + nameInfo.name);
    }
  }
  if (changed) {
    compiler.reportCodeChange();
  }
}

Fixed version (ground truth):
/** 
 * Remove all properties under a given name if the property name is never referenced.
 */
private void removeUnusedSymbols(Collection<NameInfo> allNameInfo){
  for (  NameInfo nameInfo : allNameInfo) {
    if (!nameInfo.isReferenced()) {
      for (      Symbol declaration : nameInfo.getDeclarations()) {
        boolean canRemove=false;
        if (specializationState == null) {
          canRemove=true;
        }
 else {
          Node specializableFunction=getSpecializableFunctionFromSymbol(declaration);
          if (specializableFunction != null) {
            specializationState.reportRemovedFunction(specializableFunction,null);
            canRemove=true;
          }
        }
        if (canRemove) {
          declaration.remove(compiler);
        }
      }
      logger.fine("String_Node_Str" + nameInfo.name);
    }
  }
}
Program: 27925
Project: 27925
Buggy source:
/** 
 * Applies optimizations to all previously marked nodes.
 */
public void applyChanges(){
  for (  Node n : toRemove) {
    n.getParent().removeChild(n);
    compiler.reportCodeChange();
  }
  for (  Node n : toReplaceWithZero) {
    n.getParent().replaceChild(n,IR.number(0).srcref(n));
    compiler.reportCodeChange();
  }
}

Fixed version (ground truth):
/** 
 * Applies optimizations to all previously marked nodes.
 */
public void applyChanges(){
  for (  Node n : toRemove) {
    compiler.reportChangeToEnclosingScope(n);
    n.getParent().removeChild(n);
  }
  for (  Node n : toReplaceWithZero) {
    compiler.reportChangeToEnclosingScope(n);
    n.getParent().replaceChild(n,IR.number(0).srcref(n));
  }
}
Program: 27926
Project: 27926
Buggy source:
/** 
 * Remove all assigns to a var.
 */
private void removeAllAssigns(Var var){
  for (  Assign assign : assignsByVar.get(var)) {
    assign.remove();
    compiler.reportCodeChange();
  }
}

Fixed version (ground truth):
/** 
 * Remove all assigns to a var.
 */
private void removeAllAssigns(Var var){
  for (  Assign assign : assignsByVar.get(var)) {
    compiler.reportChangeToEnclosingScope(assign.assignNode);
    assign.remove();
  }
}
Program: 27927
Project: 27927
Buggy source:
/** 
 * Removes unreferenced arguments from a function declaration and when possible the function's callSites.
 * @param fnScope The scope inside the function
 */
private void removeUnreferencedFunctionArgs(Scope fnScope){
  if (!removeGlobals) {
    return;
  }
  Node function=fnScope.getRootNode();
  Preconditions.checkState(function.isFunction());
  if (NodeUtil.isGetOrSetKey(function.getParent())) {
    return;
  }
  Node argList=getFunctionArgList(function);
  boolean modifyCallers=modifyCallSites && callSiteOptimizer.canModifyCallers(function);
  if (!modifyCallers) {
    Node lastArg;
    while ((lastArg=argList.getLastChild()) != null) {
      Var var=fnScope.getVar(lastArg.getString());
      if (!referenced.contains(var)) {
        argList.removeChild(lastArg);
        compiler.reportCodeChange();
      }
 else {
        break;
      }
    }
  }
 else {
    callSiteOptimizer.optimize(fnScope,referenced);
  }
}

Fixed version (ground truth):
/** 
 * Removes unreferenced arguments from a function declaration and when possible the function's callSites.
 * @param fnScope The scope inside the function
 */
private void removeUnreferencedFunctionArgs(Scope fnScope){
  if (!removeGlobals) {
    return;
  }
  Node function=fnScope.getRootNode();
  Preconditions.checkState(function.isFunction());
  if (NodeUtil.isGetOrSetKey(function.getParent())) {
    return;
  }
  Node argList=getFunctionArgList(function);
  boolean modifyCallers=modifyCallSites && callSiteOptimizer.canModifyCallers(function);
  if (!modifyCallers) {
    Node lastArg;
    while ((lastArg=argList.getLastChild()) != null) {
      Var var=fnScope.getVar(lastArg.getString());
      if (!referenced.contains(var)) {
        compiler.reportChangeToEnclosingScope(lastArg);
        argList.removeChild(lastArg);
      }
 else {
        break;
      }
    }
  }
 else {
    callSiteOptimizer.optimize(fnScope,referenced);
  }
}
Program: 27928
Project: 27928
Buggy source:
private void removeNode(Node n){
  codeChanged=true;
  NodeUtil.redeclareVarsInsideBranch(n);
  compiler.reportCodeChange();
  if (logger.isLoggable(Level.FINE)) {
    logger.fine("String_Node_Str" + n.toString());
  }
  NodeUtil.removeChild(n.getParent(),n);
}

Fixed version (ground truth):
private void removeNode(Node n){
  codeChanged=true;
  NodeUtil.redeclareVarsInsideBranch(n);
  compiler.reportChangeToEnclosingScope(n);
  if (logger.isLoggable(Level.FINE)) {
    logger.fine("String_Node_Str" + n.toString());
  }
  NodeUtil.removeChild(n.getParent(),n);
}
Program: 27931
Project: 27931
Buggy source:
public void testFunctionReturnOptimization() throws Exception {
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  foldSame("String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  foldSame("String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testFunctionReturnOptimization() throws Exception {
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  foldSame("String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  foldSame("String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  foldSame("String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
}
Program: 27932
Project: 27932
Buggy source:
/** 
 * Report code changes.
 */
public abstract void reportCodeChange();

Fixed version (ground truth):
/** 
 * Report code changes. Passes should call reportCodeChange when they alter the JS tree. This is verified by CompilerTestCase. This allows us to optimize to a fixed point.
 */
public abstract void reportCodeChange();
Program: 27933
Project: 27933
Buggy source:
/** 
 * All passes should call reportCodeChange() when they alter the JS tree structure. This is verified by CompilerTestCase. This allows us to optimize to a fixed point.
 */
@Override public void reportCodeChange(){
  for (  CodeChangeHandler handler : codeChangeHandlers) {
    handler.reportChange();
  }
}

Fixed version (ground truth):
@Override public void reportCodeChange(){
  for (  CodeChangeHandler handler : codeChangeHandlers) {
    handler.reportChange();
  }
}
Program: 27934
Project: 27934
Buggy source:
@Override boolean hasScopeChanged(Node n){
  if (phaseOptimizer != null) {
    return phaseOptimizer.hasScopeChanged(n);
  }
  return true;
}

Fixed version (ground truth):
@Override boolean hasScopeChanged(Node n){
  if (!analyzeChangedScopesOnly || phaseOptimizer == null) {
    return true;
  }
  return phaseOptimizer.hasScopeChanged(n);
}
Program: 27935
Project: 27935
Buggy source:
/** 
 * Remove the given VAR declaration.
 */
private void removeDeclaration(Reference decl){
  Node varNode=decl.getParent();
  Node grandparent=decl.getGrandparent();
  compiler.reportChangeToScope(compiler.getEnclosingScope(decl.getNode()));
  varNode.removeChild(decl.getNode());
  if (!varNode.hasChildren()) {
    Preconditions.checkState(varNode.isVar());
    NodeUtil.removeChild(grandparent,varNode);
  }
}

Fixed version (ground truth):
/** 
 * Remove the given VAR declaration.
 */
private void removeDeclaration(Reference decl){
  Node varNode=decl.getParent();
  Node grandparent=decl.getGrandparent();
  compiler.reportChangeToEnclosingScope(decl.getNode());
  varNode.removeChild(decl.getNode());
  if (!varNode.hasChildren()) {
    Preconditions.checkState(varNode.isVar());
    NodeUtil.removeChild(grandparent,varNode);
  }
}
Program: 27936
Project: 27936
Buggy source:
/** 
 * Replace the given reference with the given value node.
 * @param v The variable that's referenced.
 * @param ref The reference to replace.
 * @param value The node tree to replace it with. This tree should be safeto re-parent.
 */
private void inlineValue(Var v,Reference ref,Node value){
  compiler.reportChangeToScope(compiler.getEnclosingScope(ref.getNode()));
  if (ref.isSimpleAssignmentToName()) {
    ref.getGrandparent().replaceChild(ref.getParent(),value);
  }
 else {
    ref.getParent().replaceChild(ref.getNode(),value);
  }
  blacklistVarReferencesInTree(value,v.scope);
}

Fixed version (ground truth):
/** 
 * Replace the given reference with the given value node.
 * @param v The variable that's referenced.
 * @param ref The reference to replace.
 * @param value The node tree to replace it with. This tree should be safeto re-parent.
 */
private void inlineValue(Var v,Reference ref,Node value){
  compiler.reportChangeToEnclosingScope(ref.getNode());
  if (ref.isSimpleAssignmentToName()) {
    ref.getGrandparent().replaceChild(ref.getParent(),value);
  }
 else {
    ref.getParent().replaceChild(ref.getNode(),value);
  }
  blacklistVarReferencesInTree(value,v.scope);
}
Program: 27937
Project: 27937
Buggy source:
/** 
 * Do the actual work of inlining a single declaration into a single reference.
 */
private void inline(Var v,Reference decl,Reference init,Reference ref){
  Node value=init.getAssignedValue();
  Preconditions.checkState(value != null);
  boolean isFunctionDeclaration=NodeUtil.isFunctionDeclaration(value);
  compiler.reportChangeToScope(compiler.getEnclosingScope(decl.getNode()));
  compiler.reportChangeToScope(compiler.getEnclosingScope(ref.getNode()));
  inlineValue(v,ref,value.detachFromParent());
  if (decl != init) {
    Node expressRoot=init.getGrandparent();
    Preconditions.checkState(expressRoot.isExprResult());
    NodeUtil.removeChild(expressRoot.getParent(),expressRoot);
  }
  if (!isFunctionDeclaration) {
    removeDeclaration(decl);
  }
}

Fixed version (ground truth):
/** 
 * Do the actual work of inlining a single declaration into a single reference.
 */
private void inline(Var v,Reference decl,Reference init,Reference ref){
  Node value=init.getAssignedValue();
  Preconditions.checkState(value != null);
  boolean isFunctionDeclaration=NodeUtil.isFunctionDeclaration(value);
  compiler.reportChangeToEnclosingScope(decl.getNode());
  compiler.reportChangeToEnclosingScope(ref.getNode());
  inlineValue(v,ref,value.detachFromParent());
  if (decl != init) {
    Node expressRoot=init.getGrandparent();
    Preconditions.checkState(expressRoot.isExprResult());
    NodeUtil.removeChild(expressRoot.getParent(),expressRoot);
  }
  if (!isFunctionDeclaration) {
    removeDeclaration(decl);
  }
}
Program: 27938
Project: 27938
Buggy source:
/** 
 * Add the pass generated by the given factory to the compile sequence. This pass will be run once.
 */
void addOneTimePass(PassFactory factory){
  passes.add(new NamedPass(factory));
}

Fixed version (ground truth):
/** 
 * Add the pass generated by the given factory to the compile sequence. This pass will be run once.
 */
@VisibleForTesting void addOneTimePass(PassFactory factory){
  passes.add(new NamedPass(factory));
}
Program: 27939
Project: 27939
Buggy source:
/** 
 * Runs the sanity check if it is available.
 */
private void maybeSanityCheck(Node externs,Node root){
  if (sanityCheck != null) {
    sanityCheck.create(compiler).process(externs,root);
    NodeUtil.verifyScopeChanges(mtoc,jsRoot,true);
    setSanityCheckState();
  }
}

Fixed version (ground truth):
/** 
 * Runs the sanity check if it is available.
 */
private void maybeSanityCheck(Node externs,Node root){
  if (sanityCheck != null) {
    sanityCheck.create(compiler).process(externs,root);
    if (inLoop) {
      NodeUtil.verifyScopeChanges(mtoc,jsRoot,true);
      setSanityCheckState();
    }
  }
}
Program: 27940
Project: 27940
Buggy source:
/** 
 * {@code n} is either a function or the top-level node of the AST 
 */
void setScope(Node n){
  if (inLoop) {
    currentScope=n.isFunction() ? n : compiler.getEnclosingScope(n);
  }
}

Fixed version (ground truth):
/** 
 * {@code n} is either a function or the top-level node of the AST 
 */
void setScope(Node n){
  if (inLoop) {
    currentScope=n.isFunction() ? n : getEnclosingScope(n);
  }
}
Program: 27941
Project: 27941
Buggy source:
public MultiPassTest(){
}

Fixed version (ground truth):
public MultiPassTest(){
  enableNormalize();
}
Program: 27942
Project: 27942
Buggy source:
/** 
 * Extracts the text found on the current line starting at token. Note that token = token.info; should be called after this method is used to update the token properly in the parser.
 * @return The extraction information.
 */
private ExtractionInfo extractSingleLineBlock(){
  stream.update();
  int lineno=stream.getLineno();
  int charno=stream.getCharno() + 1;
  String line=stream.getRemainingJSDocLine().trim();
  if (line.length() > 0) {
    jsdocBuilder.markText(line,lineno,charno,lineno,charno + line.length());
  }
  return new ExtractionInfo(line,next());
}

Fixed version (ground truth):
/** 
 * Extracts the text found on the current line starting at token. Note that token = token.info; should be called after this method is used to update the token properly in the parser.
 * @return The extraction information.
 */
private ExtractionInfo extractSingleLineBlock(){
  stream.update();
  int lineno=stream.getLineno();
  int charno=stream.getCharno() + 1;
  String line=getRemainingJSDocLine().trim();
  if (line.length() > 0) {
    jsdocBuilder.markText(line,lineno,charno,lineno,charno + line.length());
  }
  return new ExtractionInfo(line,next());
}
Program: 27944
Project: 27944
Buggy source:
/** 
 * Extracts the top-level block comment from the JsDoc comment, if any. This method differs from the extractMultilineTextualBlock in that it terminates under different conditions (it doesn't have the same prechecks), it does not first read in the remaining of the current line and its conditions for ignoring the "*" (STAR) are different.
 * @param token The starting token.
 * @return The extraction information.
 */
private ExtractionInfo extractBlockComment(JsDocToken token){
  StringBuilder builder=new StringBuilder();
  boolean ignoreStar=true;
  do {
switch (token) {
case ANNOTATION:
case EOC:
case EOF:
      return new ExtractionInfo(builder.toString().trim(),token);
case STAR:
    if (!ignoreStar) {
      if (builder.length() > 0) {
        builder.append(' ');
      }
      builder.append('*');
    }
  token=next();
continue;
case EOL:
ignoreStar=true;
builder.append('\n');
token=next();
continue;
default :
if (!ignoreStar && builder.length() > 0) {
builder.append(' ');
}
ignoreStar=false;
builder.append(toString(token));
String line=stream.getRemainingJSDocLine();
line=trimEnd(line);
builder.append(line);
token=next();
}
}
 while (true);
}

Fixed version (ground truth):
/** 
 * Extracts the top-level block comment from the JsDoc comment, if any. This method differs from the extractMultilineTextualBlock in that it terminates under different conditions (it doesn't have the same prechecks), it does not first read in the remaining of the current line and its conditions for ignoring the "*" (STAR) are different.
 * @param token The starting token.
 * @return The extraction information.
 */
private ExtractionInfo extractBlockComment(JsDocToken token){
  StringBuilder builder=new StringBuilder();
  boolean ignoreStar=true;
  do {
switch (token) {
case ANNOTATION:
case EOC:
case EOF:
      return new ExtractionInfo(builder.toString().trim(),token);
case STAR:
    if (!ignoreStar) {
      if (builder.length() > 0) {
        builder.append(' ');
      }
      builder.append('*');
    }
  token=next();
continue;
case EOL:
ignoreStar=true;
builder.append('\n');
token=next();
continue;
default :
if (!ignoreStar && builder.length() > 0) {
builder.append(' ');
}
ignoreStar=false;
builder.append(toString(token));
String line=getRemainingJSDocLine();
line=trimEnd(line);
builder.append(line);
token=next();
}
}
 while (true);
}
Program: 27945
Project: 27945
Buggy source:
/** 
 * Two union types are equal if they have the same number of alternates and all alternates are equal.
 */
boolean checkUnionEquivalenceHelper(UnionType that,EquivalenceMethod eqMethod){
  if (eqMethod == EquivalenceMethod.IDENTITY && alternates.size() != that.alternates.size()) {
    return false;
  }
  for (  JSType alternate : that.alternates) {
    if (!hasAlternate(alternate,eqMethod)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Two union types are equal if, after flattening nested union types, they have the same number of alternates and all alternates are equal.
 */
boolean checkUnionEquivalenceHelper(UnionType that,EquivalenceMethod eqMethod){
  Collection<JSType> thatAlternates=that.getAlternates();
  if (eqMethod == EquivalenceMethod.IDENTITY && getAlternates().size() != thatAlternates.size()) {
    return false;
  }
  for (  JSType alternate : thatAlternates) {
    if (!hasAlternate(alternate,eqMethod)) {
      return false;
    }
  }
  return true;
}
Program: 27946
Project: 27946
Buggy source:
private boolean hasAlternate(JSType type,EquivalenceMethod eqMethod){
  for (  JSType alternate : alternates) {
    if (alternate.checkEquivalenceHelper(type,eqMethod)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean hasAlternate(JSType type,EquivalenceMethod eqMethod){
  for (  JSType alternate : getAlternates()) {
    if (alternate.checkEquivalenceHelper(type,eqMethod)) {
      return true;
    }
  }
  return false;
}
Program: 27947
Project: 27947
Buggy source:
/** 
 * Gets the alternate types of this union type.
 * @return The alternate types of this union type. The returned set isimmutable.
 */
public Iterable<JSType> getAlternates(){
  return alternates;
}

Fixed version (ground truth):
/** 
 * Gets the alternate types of this union type.
 * @return The alternate types of this union type. The returned set isimmutable.
 */
public Collection<JSType> getAlternates(){
  for (  JSType t : alternates) {
    if (t.isUnionType()) {
      rebuildAlternates();
      break;
    }
  }
  return alternates;
}
Program: 27948
Project: 27948
Buggy source:
Iterable<JSType> getAlternates(){
  JSType specialCaseType=reduceAlternatesWithoutUnion();
  if (specialCaseType != null) {
    return ImmutableList.of(specialCaseType);
  }
  return Collections.unmodifiableList(alternates);
}

Fixed version (ground truth):
Collection<JSType> getAlternates(){
  JSType specialCaseType=reduceAlternatesWithoutUnion();
  if (specialCaseType != null) {
    return ImmutableList.of(specialCaseType);
  }
  return Collections.unmodifiableList(alternates);
}
Program: 27950
Project: 27950
Buggy source:
@Override protected void setUp() throws Exception {
  super.setUp();
  previouslyUsedMap=new VariableMap(ImmutableMap.<String,String>of());
  prefix=DEFAULT_PREFIX;
  withClosurePass=false;
  localRenamingOnly=false;
  preserveFunctionExpressionNames=false;
  generatePseudoNames=false;
  shouldShadow=false;
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  previouslyUsedMap=new VariableMap(ImmutableMap.<String,String>of());
  prefix=DEFAULT_PREFIX;
  withClosurePass=false;
  withNormalize=false;
  localRenamingOnly=false;
  preserveFunctionExpressionNames=false;
  generatePseudoNames=false;
  shouldShadow=false;
}
Program: 27951
Project: 27951
Buggy source:
public void testDollarSignSuperExport2(){
  boolean normalizedExpectedJs=false;
  super.enableNormalize(false);
  useGoogleCodingConvention=false;
  test("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  localRenamingOnly=false;
  test("String_Node_Str","String_Node_Str");
  useGoogleCodingConvention=true;
  test("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  super.disableNormalize();
}

Fixed version (ground truth):
public void testDollarSignSuperExport2(){
  withNormalize=true;
  useGoogleCodingConvention=false;
  test("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  localRenamingOnly=false;
  test("String_Node_Str","String_Node_Str");
  useGoogleCodingConvention=true;
  test("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
}
Program: 27952
Project: 27952
Buggy source:
@Override public void process(Node externs,Node root){
  ProcessClosurePrimitives closurePass=new ProcessClosurePrimitives(compiler,null,CheckLevel.WARNING);
  closurePass.process(externs,root);
  renameVars=new RenameVars(compiler,prefix,false,false,false,false,previouslyUsedMap,null,closurePass.getExportedVariableNames());
  renameVars.process(externs,root);
}

Fixed version (ground truth):
@Override public void process(Node externs,Node root){
  Normalize normalize=new Normalize(compiler,false);
  normalize.process(externs,root);
  wrappedPass.process(externs,root);
}