nus-yam/ex-repair huggingface dataset:
Program: 38314
Project: 38314
Buggy source:
/** 
 * @throws FileNotFoundException
 */
public static File getFileFromClassLoader(String fileName,ClassLoader loader) throws FileNotFoundException {
  if (loader == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (fileName == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  URL url=loader.getResource(fileName);
  if (DEBUG_LEVEL > 0) {
    System.err.println(("String_Node_Str" + url + "String_Node_Str"+ fileName));
  }
  if (url == null) {
    File f=new File(fileName);
    if (f.exists()) {
      return f;
    }
    throw new FileNotFoundException(fileName);
  }
 else {
    return new File(filePathFromURL(url));
  }
}

Fixed version (ground truth):
/** 
 * @throws FileNotFoundException
 */
public static File getFileFromClassLoader(String fileName,ClassLoader loader) throws FileNotFoundException {
  if (loader == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (fileName == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  URL url=null;
  try {
    url=loader.getResource(fileName);
  }
 catch (  Exception e) {
  }
  if (DEBUG_LEVEL > 0) {
    System.err.println(("String_Node_Str" + url + "String_Node_Str"+ fileName));
  }
  if (url == null) {
    File f=new File(fileName);
    if (f.exists()) {
      return f;
    }
    throw new FileNotFoundException(fileName);
  }
 else {
    return new File(filePathFromURL(url));
  }
}
Program: 38317
Project: 38317
Buggy source:
protected Set<CGNode> getTargetsForCall(final CGNode caller,final CallSiteReference site,InstanceKey[][] invs){
  IntSet params=contextSelector.getRelevantParameters(caller,site);
  if (!site.isStatic() && !params.contains(0)) {
    params=IntSetUtil.makeMutableCopy(params);
    ((MutableIntSet)params).add(0);
  }
  final Set<CGNode> targets=HashSetFactory.make();
  VoidFunction<InstanceKey[]> f=new VoidFunction<InstanceKey[]>(){
    public void apply(    InstanceKey[] v){
      IClass recv=null;
      if (site.isDispatch()) {
        recv=v[0].getConcreteType();
      }
      CGNode target=getTargetForCall(caller,site,recv,v);
      if (target != null) {
        targets.add(target);
      }
    }
  }
;
  iterateCrossProduct(caller,site,params,invs,f);
  return targets;
}

Fixed version (ground truth):
protected Set<CGNode> getTargetsForCall(final CGNode caller,final SSAAbstractInvokeInstruction instruction,InstanceKey[][] invs){
  final CallSiteReference site=instruction.getCallSite();
  IntSet params=contextSelector.getRelevantParameters(caller,site);
  if (!site.isStatic() && !params.contains(0)) {
    params=IntSetUtil.makeMutableCopy(params);
    ((MutableIntSet)params).add(0);
  }
  final Set<CGNode> targets=HashSetFactory.make();
  VoidFunction<InstanceKey[]> f=new VoidFunction<InstanceKey[]>(){
    public void apply(    InstanceKey[] v){
      IClass recv=null;
      if (site.isDispatch()) {
        recv=v[0].getConcreteType();
      }
      CGNode target=getTargetForCall(caller,site,recv,v);
      if (target != null) {
        targets.add(target);
      }
    }
  }
;
  iterateCrossProduct(caller,instruction,params,invs,f);
  return targets;
}
Program: 38318
Project: 38318
Buggy source:
public IField getField(Atom name){
  if (declaredFields.containsKey(name)) {
    return declaredFields.get(name);
  }
 else   if (getSuperclass() != null) {
    return getSuperclass().getField(name);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public IField getField(Atom name,TypeName type){
  return getField(name);
}
Program: 38319
Project: 38319
Buggy source:
public IField getField(Atom name){
  return loader.lookupClass(superReference.getName()).getField(name);
}

Fixed version (ground truth):
public IField getField(Atom name,TypeName type){
  return loader.lookupClass(superReference.getName()).getField(name);
}
Program: 38320
Project: 38320
Buggy source:
private boolean isNamedVar(CAstNode n,String name){
  if (n.getKind() == CAstNode.VAR) {
    String nm=(String)n.getChild(0).getValue();
    return nm.equals(name);
  }
  return false;
}

Fixed version (ground truth):
private boolean isNamedVar(CAstNode n,Pattern namePattern){
  if (n.getKind() == CAstNode.VAR) {
    String nm=(String)n.getChild(0).getValue();
    return namePattern.matcher(nm).matches();
  }
  return false;
}
Program: 38321
Project: 38321
Buggy source:
@Override protected String[] getArgumentNames(CAstEntity f){
  if (super.getArgumentCount(f) >= v.getValue()) {
    return super.getArgumentNames(f);
  }
 else {
    String[] argNames=new String[v.getValue()];
    System.arraycopy(super.getArgumentNames(f),0,argNames,0,super.getArgumentCount(f));
    for (int i=super.getArgumentCount(f); i < argNames.length; i++) {
      argNames[i]="String_Node_Str" + (i + 1);
    }
    return argNames;
  }
}

Fixed version (ground truth):
@Override protected String[] getArgumentNames(CAstEntity f){
  if (super.getArgumentCount(f) >= v.getValue()) {
    return super.getArgumentNames(f);
  }
 else {
    String[] argNames=new String[v.getValue()];
    System.arraycopy(super.getArgumentNames(f),0,argNames,0,super.getArgumentCount(f));
    for (int i=super.getArgumentCount(f); i < argNames.length; i++) {
      argNames[i]="String_Node_Str" + i;
    }
    return argNames;
  }
}
Program: 38323
Project: 38323
Buggy source:
private CAstNode handleArgumentRef(CAstNode n){
  Object x=getStaticArgumentIndex(n);
  if (x != null) {
    if (x instanceof Number && ((Number)x).intValue() < v.getValue() - 2) {
      int arg=((Number)x).intValue() + 3;
      if (arg < e.getArgumentCount()) {
        return Ast.makeNode(CAstNode.VAR,Ast.makeConstant(e.getArgumentNames()[arg]));
      }
 else {
        return Ast.makeNode(CAstNode.VAR,Ast.makeConstant("String_Node_Str" + arg));
      }
    }
 else     if (x instanceof String && "String_Node_Str".equals(x)) {
      return Ast.makeConstant(v.getValue());
    }
  }
  return null;
}

Fixed version (ground truth):
private CAstNode handleArgumentRef(CAstNode n){
  Object x=getStaticArgumentIndex(n);
  if (x != null) {
    if (x instanceof Number && ((Number)x).intValue() < v.getValue() - 2) {
      int arg=((Number)x).intValue() + 2;
      if (arg < e.getArgumentCount()) {
        return Ast.makeNode(CAstNode.VAR,Ast.makeConstant(e.getArgumentNames()[arg]));
      }
 else {
        return Ast.makeNode(CAstNode.VAR,Ast.makeConstant("String_Node_Str" + arg));
      }
    }
 else     if (x instanceof String && "String_Node_Str".equals(x)) {
      return Ast.makeConstant(v.getValue());
    }
  }
  return null;
}
Program: 38324
Project: 38324
Buggy source:
private Object getIndexFromBaseVar(CAstNode n){
  if (n.getKind() == CAstNode.BLOCK_EXPR) {
    if (n.getChildCount() == 2) {
      CAstNode c1=n.getChild(0);
      if (c1.getKind() == CAstNode.ASSIGN) {
        if (isNamedVar(c1.getChild(0),"String_Node_Str")) {
          if (isNamedVar(c1.getChild(1),"String_Node_Str")) {
            CAstNode c2=n.getChild(1);
            if (c2.getKind() == CAstNode.OBJECT_REF || c2.getKind() == CAstNode.ARRAY_REF) {
              if (isNamedVar(c2.getChild(0),"String_Node_Str")) {
                return c2.getChild(1).getValue();
              }
            }
          }
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private Object getIndexFromBaseVar(CAstNode n){
  if (n.getKind() == CAstNode.BLOCK_EXPR) {
    if (n.getChildCount() == 2) {
      CAstNode c1=n.getChild(0);
      if (c1.getKind() == CAstNode.ASSIGN) {
        if (isNamedVar(c1.getChild(0),baseNameRegex)) {
          if (isNamedVar(c1.getChild(1),"String_Node_Str")) {
            CAstNode c2=n.getChild(1);
            if (c2.getKind() == CAstNode.OBJECT_REF || c2.getKind() == CAstNode.ARRAY_REF) {
              if (isNamedVar(c2.getChild(0),baseNameRegex)) {
                return c2.getChild(1).getValue();
              }
            }
          }
        }
      }
    }
  }
  return null;
}
Program: 38325
Project: 38325
Buggy source:
@Before public void setUp(){
  com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}

Fixed version (ground truth):
@Before public void setUp(){
  JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}
Program: 38326
Project: 38326
Buggy source:
@Before public void setUp(){
  com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}

Fixed version (ground truth):
@Before public void setUp(){
  JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}
Program: 38327
Project: 38327
Buggy source:
@Test public void testTranslateToCAstCrash3() throws IllegalArgumentException, IOException, CancelException {
  Util.makeScriptCG("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void testTranslateToCAstCrash3() throws IllegalArgumentException, IOException, CancelException {
  JSCallGraphBuilderUtil.makeScriptCG("String_Node_Str","String_Node_Str");
}
Program: 38328
Project: 38328
Buggy source:
@Test public void testArgs() throws IOException, IllegalArgumentException, CancelException, ClassHierarchyException {
  JavaScriptLoaderFactory loaders=Util.makeLoaders();
  AnalysisScope scope=Util.makeScriptScope("String_Node_Str","String_Node_Str",loaders);
  IClassHierarchy cha=Util.makeHierarchy(scope,loaders);
  com.ibm.wala.cast.js.util.Util.checkForFrontEndErrors(cha);
  Iterable<Entrypoint> roots=Util.makeScriptRoots(cha);
  JSAnalysisOptions options=Util.makeOptions(scope,cha,roots);
  AnalysisCache cache=Util.makeCache(new ArgumentSpecialization.ArgumentCountIRFactory(options.getSSAOptions()));
  JSCFABuilder builder=new JSZeroOrOneXCFABuilder(cha,options,cache,null,null,ZeroXInstanceKeys.ALLOCATIONS,false);
  builder.setContextSelector(new ArgumentSpecialization.ArgumentCountContextSelector(builder.getContextSelector()));
  builder.setContextInterpreter(new ArgumentSpecialization.ArgumentSpecializationContextIntepreter(options,cache));
  CallGraph CG=builder.makeCallGraph(options);
  Util.AVOID_DUMP=false;
  Util.dumpCG(builder.getPointerAnalysis(),CG);
  verifyGraphAssertions(CG,assertionsForArgs);
}

Fixed version (ground truth):
@Test public void testArgs() throws IOException, IllegalArgumentException, CancelException, ClassHierarchyException {
  JavaScriptLoaderFactory loaders=JSCallGraphBuilderUtil.makeLoaders();
  AnalysisScope scope=JSCallGraphBuilderUtil.makeScriptScope("String_Node_Str","String_Node_Str",loaders);
  IClassHierarchy cha=JSCallGraphBuilderUtil.makeHierarchy(scope,loaders);
  com.ibm.wala.cast.js.util.Util.checkForFrontEndErrors(cha);
  Iterable<Entrypoint> roots=JSCallGraphBuilderUtil.makeScriptRoots(cha);
  JSAnalysisOptions options=JSCallGraphBuilderUtil.makeOptions(scope,cha,roots);
  AnalysisCache cache=JSCallGraphBuilderUtil.makeCache(new ArgumentSpecialization.ArgumentCountIRFactory(options.getSSAOptions()));
  JSCFABuilder builder=new JSZeroOrOneXCFABuilder(cha,options,cache,null,null,ZeroXInstanceKeys.ALLOCATIONS,false);
  builder.setContextSelector(new ArgumentSpecialization.ArgumentCountContextSelector(builder.getContextSelector()));
  builder.setContextInterpreter(new ArgumentSpecialization.ArgumentSpecializationContextIntepreter(options,cache));
  CallGraph CG=builder.makeCallGraph(options);
  CAstCallGraphUtil.AVOID_DUMP=false;
  CAstCallGraphUtil.dumpCG(builder.getPointerAnalysis(),CG);
  verifyGraphAssertions(CG,assertionsForArgs);
}
Program: 38329
Project: 38329
Buggy source:
@Test public void testEx1() throws IOException, IllegalArgumentException, CancelException {
  URL url=getClass().getClassLoader().getResource("String_Node_Str");
  JSCFABuilder builder=Util.makeHTMLCGBuilder(url);
  CallGraph CG=builder.makeCallGraph(builder.getOptions());
  Util.dumpCG(builder.getPointerAnalysis(),CG);
}

Fixed version (ground truth):
@Test public void testEx1() throws IOException, IllegalArgumentException, CancelException {
  URL url=getClass().getClassLoader().getResource("String_Node_Str");
  JSCFABuilder builder=JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
  CallGraph CG=builder.makeCallGraph(builder.getOptions());
  CAstCallGraphUtil.dumpCG(builder.getPointerAnalysis(),CG);
}
Program: 38330
Project: 38330
Buggy source:
@Test public void testSwineFlu() throws IOException, IllegalArgumentException, CancelException {
  URL url=new URL("String_Node_Str");
  CallGraph CG=JSCallGraphBuilderUtil.makeHTMLCG(url);
  verifyGraphAssertions(CG,assertionsForSwineFlu);
}

Fixed version (ground truth):
@Ignore("String_Node_Str") @Test public void testSwineFlu() throws IOException, IllegalArgumentException, CancelException {
  URL url=new URL("String_Node_Str");
  CallGraph CG=JSCallGraphBuilderUtil.makeHTMLCG(url);
  verifyGraphAssertions(CG,assertionsForSwineFlu);
}
Program: 38331
Project: 38331
Buggy source:
@Test public void testArgs() throws IOException, IllegalArgumentException, CancelException {
  CallGraph CG=Util.makeScriptCG("String_Node_Str","String_Node_Str");
  verifyGraphAssertions(CG,assertionsForArgs);
}

Fixed version (ground truth):
@Test public void testArgs() throws IOException, IllegalArgumentException, CancelException {
  CallGraph CG=JSCallGraphBuilderUtil.makeScriptCG("String_Node_Str","String_Node_Str");
  verifyGraphAssertions(CG,assertionsForArgs);
}
Program: 38332
Project: 38332
Buggy source:
@Test public void testCrawlPage17() throws IOException, IllegalArgumentException, CancelException {
}

Fixed version (ground truth):
@Test public void testCrawlPage17() throws IOException, IllegalArgumentException, CancelException {
  URL url=getClass().getClassLoader().getResource("String_Node_Str");
  CallGraph CG=JSCallGraphBuilderUtil.makeHTMLCG(url);
  verifyGraphAssertions(CG,assertionsForPage17);
}
Program: 38333
Project: 38333
Buggy source:
@Test public void testCrawlPage12() throws IOException, IllegalArgumentException, CancelException {
}

Fixed version (ground truth):
@Test public void testCrawlPage12() throws IOException, IllegalArgumentException, CancelException {
  URL url=getClass().getClassLoader().getResource("String_Node_Str");
  CallGraph CG=JSCallGraphBuilderUtil.makeHTMLCG(url);
  verifyGraphAssertions(CG,assertionsForPage12);
}
Program: 38334
Project: 38334
Buggy source:
public void translate(final CAstEntity N,final WalkContext context){
  walkEntities(N,context);
}

Fixed version (ground truth):
public void translate(final CAstEntity N,final WalkContext context){
  final ExposedNamesCollector exposedNamesCollector=new ExposedNamesCollector();
  exposedNamesCollector.run(N);
  entity2ExposedNames=exposedNamesCollector.getEntity2ExposedNames();
  walkEntities(N,context);
}
Program: 38335
Project: 38335
Buggy source:
public Context getCalleeTarget(CGNode caller,CallSiteReference site,IMethod callee,InstanceKey[] receiver){
  IClass declaringClass=callee.getDeclaringClass();
  IMethod method=declaringClass.getMethod(AstMethodReference.fnSelector);
  Context baseCtxt=base.getCalleeTarget(caller,site,callee,receiver);
  if (method != null) {
    String s=method.getReference().getDeclaringClass().getName().toString();
    if (s.equals("String_Node_Str")) {
      boolean isNonNullArray=false;
      if (receiver.length >= 4) {
        InstanceKey argsList=receiver[3];
        if (argsList != null && argsList.getConcreteType().equals(caller.getClassHierarchy().lookupClass(JavaScriptTypes.Array))) {
          isNonNullArray=true;
        }
      }
      if (USE_ONE_LEVEL_CALLSTRING)       baseCtxt=new DelegatingContext(oneLevel.getCalleeTarget(caller,site,callee,receiver),baseCtxt);
      return new ApplyContext(baseCtxt,isNonNullArray);
    }
  }
  return baseCtxt;
}

Fixed version (ground truth):
public Context getCalleeTarget(CGNode caller,CallSiteReference site,IMethod callee,InstanceKey[] receiver){
  IClass declaringClass=callee.getDeclaringClass();
  IMethod method=declaringClass.getMethod(AstMethodReference.fnSelector);
  Context baseCtxt=base.getCalleeTarget(caller,site,callee,receiver);
  if (method != null) {
    String s=method.getReference().getDeclaringClass().getName().toString();
    if (s.equals("String_Node_Str")) {
      boolean isNonNullArray=false;
      if (receiver.length >= 4) {
        InstanceKey argsList=receiver[3];
        if (argsList != null && argsList.getConcreteType().equals(caller.getClassHierarchy().lookupClass(JavaScriptTypes.Array))) {
          isNonNullArray=true;
        }
      }
      if (USE_ONE_LEVEL)       baseCtxt=oneLevel.getCalleeTarget(caller,site,callee,receiver);
      return new ApplyContext(baseCtxt,isNonNullArray);
    }
  }
  return baseCtxt;
}
Program: 38336
Project: 38336
Buggy source:
@Override public IMethod getCalleeTarget(CGNode caller,CallSiteReference site,IClass receiver){
  IMethod method=receiver.getMethod(AstMethodReference.fnSelector);
  if (method != null) {
    String s=method.getReference().getDeclaringClass().getName().toString();
    if (s.equals("String_Node_Str")) {
      final MethodReference ref=genSyntheticMethodRef(receiver);
      JavaScriptSummary S=new JavaScriptSummary(ref,1);
      return new JavaScriptSummarizedFunction(ref,S,receiver);
    }
  }
  return base.getCalleeTarget(caller,site,receiver);
}

Fixed version (ground truth):
@Override public IMethod getCalleeTarget(CGNode caller,CallSiteReference site,IClass receiver){
  IMethod method=receiver.getMethod(AstMethodReference.fnSelector);
  if (method != null) {
    String s=method.getReference().getDeclaringClass().getName().toString();
    if (s.equals("String_Node_Str")) {
      if (applyMethod == null) {
        applyMethod=createApplyDummyMethod(receiver);
      }
      return applyMethod;
    }
  }
  return base.getCalleeTarget(caller,site,receiver);
}
Program: 38337
Project: 38337
Buggy source:
@SuppressWarnings("String_Node_Str") public static void dumpCG(PointerAnalysis PA,CallGraph CG){
  if (AVOID_DUMP)   return;
  for (Iterator x=CG.iterator(); x.hasNext(); ) {
    CGNode N=(CGNode)x.next();
    System.err.print("String_Node_Str" + getShortName(N) + "String_Node_Str");
    boolean fst=true;
    for (Iterator<? extends CGNode> ns=CG.getSuccNodes(N); ns.hasNext(); ) {
      if (fst)       fst=false;
 else       System.err.print("String_Node_Str");
      System.err.print(getShortName(ns.next()));
    }
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str" + N.getGraphNodeId());
    IR ir=N.getIR();
    if (ir != null) {
      System.err.println(ir);
    }
 else {
      System.err.println("String_Node_Str");
    }
  }
  System.err.println("String_Node_Str");
  for (Iterator x=PA.getPointerKeys().iterator(); x.hasNext(); ) {
    PointerKey n=(PointerKey)x.next();
    try {
      System.err.println((n + "String_Node_Str" + PA.getPointsToSet(n)));
    }
 catch (    Throwable e) {
      System.err.println(("String_Node_Str" + n));
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static void dumpCG(PointerAnalysis PA,CallGraph CG){
  if (AVOID_DUMP)   return;
  for (Iterator x=CG.iterator(); x.hasNext(); ) {
    CGNode N=(CGNode)x.next();
    System.err.print("String_Node_Str" + getShortName(N) + "String_Node_Str");
    boolean fst=true;
    for (Iterator<? extends CGNode> ns=CG.getSuccNodes(N); ns.hasNext(); ) {
      if (fst)       fst=false;
 else       System.err.print("String_Node_Str");
      System.err.print(getShortName(ns.next()));
    }
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str" + N.getGraphNodeId() + "String_Node_Str"+ N.getContext());
    IR ir=N.getIR();
    if (ir != null) {
      System.err.println(ir);
    }
 else {
      System.err.println("String_Node_Str");
    }
  }
  System.err.println("String_Node_Str");
  for (Iterator x=PA.getPointerKeys().iterator(); x.hasNext(); ) {
    PointerKey n=(PointerKey)x.next();
    try {
      System.err.println((n + "String_Node_Str" + PA.getPointsToSet(n)));
    }
 catch (    Throwable e) {
      System.err.println(("String_Node_Str" + n));
    }
  }
}
Program: 38338
Project: 38338
Buggy source:
private boolean forInOnFirstArg(IMethod method){
  MethodReference mref=method.getReference();
  if (method.getNumberOfParameters() < index)   return false;
  Boolean b=forInOnFirstArg_cache.get(mref);
  if (b != null)   return b;
  DefUse du=getDefUse(method);
  for (  SSAInstruction use : Iterator2Iterable.make(du.getUses(3))) {
    if (use instanceof EachElementGetInstruction) {
      forInOnFirstArg_cache.put(mref,true);
      return true;
    }
  }
  forInOnFirstArg_cache.put(mref,false);
  return false;
}

Fixed version (ground truth):
private boolean forInOnFirstArg(IMethod method){
  MethodReference mref=method.getReference();
  if (method.getNumberOfParameters() < index)   return false;
  Boolean b=forInOnFirstArg_cache.get(mref);
  if (b != null)   return b;
  DefUse du=getDefUse(method);
  for (  SSAInstruction use : Iterator2Iterable.make(du.getUses(index + 1))) {
    if (use instanceof EachElementGetInstruction) {
      forInOnFirstArg_cache.put(mref,true);
      return true;
    }
  }
  forInOnFirstArg_cache.put(mref,false);
  return false;
}
Program: 38339
Project: 38339
Buggy source:
private Frequency usesFirstArgAsPropertyName(IMethod method){
  MethodReference mref=method.getReference();
  if (method.getNumberOfParameters() < index)   return Frequency.NEVER;
  Frequency f=usesFirstArgAsPropertyName_cache.get(mref);
  if (f != null)   return f;
  boolean usedAsPropertyName=false, usedAsSomethingElse=false;
  DefUse du=getDefUse(method);
  for (  SSAInstruction use : Iterator2Iterable.make(du.getUses(3))) {
    if (use instanceof ReflectiveMemberAccess) {
      ReflectiveMemberAccess rma=(ReflectiveMemberAccess)use;
      if (rma.getMemberRef() == 3) {
        usedAsPropertyName=true;
        continue;
      }
    }
 else     if (use instanceof AstIsDefinedInstruction) {
      AstIsDefinedInstruction aidi=(AstIsDefinedInstruction)use;
      if (aidi.getNumberOfUses() > 1 && aidi.getUse(1) == 3) {
        usedAsPropertyName=true;
        continue;
      }
    }
    usedAsSomethingElse=true;
  }
  if (!usedAsPropertyName)   f=Frequency.NEVER;
 else   if (usedAsSomethingElse)   f=Frequency.SOMETIMES;
 else   f=Frequency.ALWAYS;
  usesFirstArgAsPropertyName_cache.put(mref,f);
  return f;
}

Fixed version (ground truth):
private Frequency usesFirstArgAsPropertyName(IMethod method){
  MethodReference mref=method.getReference();
  if (method.getNumberOfParameters() < index)   return Frequency.NEVER;
  Frequency f=usesFirstArgAsPropertyName_cache.get(mref);
  if (f != null)   return f;
  boolean usedAsPropertyName=false, usedAsSomethingElse=false;
  DefUse du=getDefUse(method);
  for (  SSAInstruction use : Iterator2Iterable.make(du.getUses(index + 1))) {
    if (use instanceof ReflectiveMemberAccess) {
      ReflectiveMemberAccess rma=(ReflectiveMemberAccess)use;
      if (rma.getMemberRef() == index + 1) {
        usedAsPropertyName=true;
        continue;
      }
    }
 else     if (use instanceof AstIsDefinedInstruction) {
      AstIsDefinedInstruction aidi=(AstIsDefinedInstruction)use;
      if (aidi.getNumberOfUses() > 1 && aidi.getUse(1) == index + 1) {
        usedAsPropertyName=true;
        continue;
      }
    }
    usedAsSomethingElse=true;
  }
  if (!usedAsPropertyName)   f=Frequency.NEVER;
 else   if (usedAsSomethingElse)   f=Frequency.SOMETIMES;
 else   f=Frequency.ALWAYS;
  usesFirstArgAsPropertyName_cache.put(mref,f);
  return f;
}
Program: 38341
Project: 38341
Buggy source:
protected boolean useLexicalAccessesForExposedVars(){
  return false;
}

Fixed version (ground truth):
protected boolean useLexicalAccessesForExposedVars(){
  return NEW_LEXICAL;
}
Program: 38342
Project: 38342
Buggy source:
protected boolean useLocalValuesForLexicalVars(){
  return true;
}

Fixed version (ground truth):
protected boolean useLocalValuesForLexicalVars(){
  return !NEW_LEXICAL;
}
Program: 38343
Project: 38343
Buggy source:
/** 
 * generate instructions for a write of a global
 */
protected void doGlobalWrite(WalkContext context,String name,int rval){
  Symbol S=context.currentScope().lookup(name);
  if (treatGlobalsAsLexicallyScoped()) {
    if (useLocalValuesForLexicalVars()) {
      int vn=S.valueNumber();
      Access A=new Access(name,null,vn);
      addExposedName(context.top(),null,name,vn,true,context);
      addAccess(context,context.top(),A);
      context.cfg().addInstruction(new AssignInstruction(vn,rval));
      context.cfg().addInstruction(new AstLexicalWrite(A));
    }
 else {
      Access A=new Access(name,null,rval);
      context.cfg().addInstruction(new AstLexicalWrite(A));
    }
  }
 else {
    FieldReference global=makeGlobalRef(name);
    context.cfg().addInstruction(new AstGlobalWrite(global,rval));
  }
}

Fixed version (ground truth):
/** 
 * generate instructions for a write of a global
 */
protected void doGlobalWrite(WalkContext context,String name,int rval){
  Symbol S=context.currentScope().lookup(name);
  if (treatGlobalsAsLexicallyScoped()) {
    if (useLocalValuesForLexicalVars()) {
      int vn=S.valueNumber();
      Access A=new Access(name,null,vn);
      addExposedName(context.top(),null,name,vn,true,context);
      addAccess(context,context.top(),A);
      context.cfg().addInstruction(new AssignInstruction(vn,rval));
      context.cfg().addInstruction(new AstLexicalWrite(A));
    }
 else {
      Access A=new Access(name,null,rval);
      context.cfg().addInstruction(new AstLexicalWrite(A));
      addAccess(context,context.top(),A);
    }
  }
 else {
    FieldReference global=makeGlobalRef(name);
    context.cfg().addInstruction(new AstGlobalWrite(global,rval));
  }
}
Program: 38344
Project: 38344
Buggy source:
/** 
 * Note that the caller is responsible for ensuring that name is defined in a lexical scope.
 */
protected void doLexicallyScopedWrite(WalkContext context,String name,int rval){
  Symbol S=context.currentScope().lookup(name);
  Scope definingScope=S.getDefiningScope();
  CAstEntity E=definingScope.getEntity();
  addExposedName(E,E,name,definingScope.lookup(name).valueNumber(),true,context);
  if (useLocalValuesForLexicalVars()) {
    markExposedInEnclosingEntities(context,name,definingScope,E,context.getEntityName(E),true);
    context.cfg().addInstruction(new AssignInstruction(S.valueNumber(),rval));
    Access A=new Access(name,context.getEntityName(E),rval);
    context.cfg().addInstruction(new AstLexicalWrite(A));
  }
 else {
    Access A=new Access(name,context.getEntityName(E),rval);
    context.cfg().addInstruction(new AstLexicalWrite(A));
  }
}

Fixed version (ground truth):
/** 
 * Note that the caller is responsible for ensuring that name is defined in a lexical scope.
 */
protected void doLexicallyScopedWrite(WalkContext context,String name,int rval){
  Symbol S=context.currentScope().lookup(name);
  Scope definingScope=S.getDefiningScope();
  CAstEntity E=definingScope.getEntity();
  addExposedName(E,E,name,definingScope.lookup(name).valueNumber(),true,context);
  if (useLocalValuesForLexicalVars()) {
    markExposedInEnclosingEntities(context,name,definingScope,E,context.getEntityName(E),true);
    context.cfg().addInstruction(new AssignInstruction(S.valueNumber(),rval));
    Access A=new Access(name,context.getEntityName(E),rval);
    context.cfg().addInstruction(new AstLexicalWrite(A));
  }
 else {
    Access A=new Access(name,context.getEntityName(E),rval);
    context.cfg().addInstruction(new AstLexicalWrite(A));
    addAccess(context,context.top(),A);
  }
}
Program: 38345
Project: 38345
Buggy source:
/** 
 * generate instructions for a read of a global
 */
protected int doGlobalRead(CAstNode node,WalkContext context,String name){
  Symbol S=context.currentScope().lookup(name);
  if (treatGlobalsAsLexicallyScoped()) {
    if (useLocalValuesForLexicalVars()) {
      int vn=S.valueNumber();
      Access A=new Access(name,null,vn);
      addExposedName(context.top(),null,name,vn,false,context);
      addAccess(context,context.top(),A);
      return vn;
    }
 else {
      int result=context.currentScope().allocateTempValue();
      Access A=new Access(name,null,result);
      context.cfg().addInstruction(new AstLexicalRead(A));
      return result;
    }
  }
 else {
    int result=context.currentScope().allocateTempValue();
    FieldReference global=makeGlobalRef(name);
    context.cfg().addInstruction(new AstGlobalRead(result,global));
    return result;
  }
}

Fixed version (ground truth):
/** 
 * generate instructions for a read of a global
 */
protected int doGlobalRead(CAstNode node,WalkContext context,String name){
  Symbol S=context.currentScope().lookup(name);
  if (treatGlobalsAsLexicallyScoped()) {
    if (useLocalValuesForLexicalVars()) {
      int vn=S.valueNumber();
      Access A=new Access(name,null,vn);
      addExposedName(context.top(),null,name,vn,false,context);
      addAccess(context,context.top(),A);
      return vn;
    }
 else {
      int result=context.currentScope().allocateTempValue();
      Access A=new Access(name,null,result);
      context.cfg().addInstruction(new AstLexicalRead(A));
      addAccess(context,context.top(),A);
      return result;
    }
  }
 else {
    int result=context.currentScope().allocateTempValue();
    FieldReference global=makeGlobalRef(name);
    context.cfg().addInstruction(new AstGlobalRead(result,global));
    return result;
  }
}
Program: 38346
Project: 38346
Buggy source:
/** 
 * we only have this method to avoid having to pass a node parameter at other call sites, as would be required for  {@link #doLexicallyScopedRead(CAstNode,WalkContext,String)}
 */
private int doLexReadHelper(WalkContext context,final String name){
  Symbol S=context.currentScope().lookup(name);
  Scope definingScope=S.getDefiningScope();
  CAstEntity E=definingScope.getEntity();
  addExposedName(E,E,name,definingScope.lookup(name).valueNumber(),false,context);
  final String entityName=context.getEntityName(E);
  if (useLocalValuesForLexicalVars()) {
    markExposedInEnclosingEntities(context,name,definingScope,E,entityName,false);
    return S.valueNumber();
  }
 else {
    int result=context.currentScope().allocateTempValue();
    Access A=new Access(name,entityName,result);
    context.cfg().addInstruction(new AstLexicalRead(A));
    return result;
  }
}

Fixed version (ground truth):
/** 
 * we only have this method to avoid having to pass a node parameter at other call sites, as would be required for  {@link #doLexicallyScopedRead(CAstNode,WalkContext,String)}
 */
private int doLexReadHelper(WalkContext context,final String name){
  Symbol S=context.currentScope().lookup(name);
  Scope definingScope=S.getDefiningScope();
  CAstEntity E=definingScope.getEntity();
  addExposedName(E,E,name,definingScope.lookup(name).valueNumber(),false,context);
  final String entityName=context.getEntityName(E);
  if (useLocalValuesForLexicalVars()) {
    markExposedInEnclosingEntities(context,name,definingScope,E,entityName,false);
    return S.valueNumber();
  }
 else {
    int result=context.currentScope().allocateTempValue();
    Access A=new Access(name,entityName,result);
    context.cfg().addInstruction(new AstLexicalRead(A));
    addAccess(context,context.top(),A);
    return result;
  }
}
Program: 38347
Project: 38347
Buggy source:
/** 
 * record that in entity e, the access is performed using a local variable. in  {@link #patchLexicalAccesses(SSAInstruction[],Set)}, this information is used to update an instruction that performs all the accesses at the beginning of the method and defines the locals.
 */
private void addAccess(WalkContext context,CAstEntity e,Access access){
}

Fixed version (ground truth):
/** 
 * record that in entity e, the access is performed. If   {@link #useLocalValuesForLexicalVars()} is true, the access is performedusing a local variable. in {@link #patchLexicalAccesses(SSAInstruction[],Set)}, this information is used to update an instruction that performs all the accesses at the beginning of the method and defines the locals.
 */
private void addAccess(WalkContext context,CAstEntity e,Access access){
  context.getAccesses(e).add(access);
}
Program: 38348
Project: 38348
Buggy source:
private Set<CGNode> getLexicalDefiners(final CGNode opNode,final Pair<String,String> definer){
  if (definer == null) {
    return Collections.singleton(getBuilder().getCallGraph().getFakeRootNode());
  }
 else {
    final Set<CGNode> result=HashSetFactory.make();
    PointerKey F=getBuilder().getPointerKeyForLocal(opNode,1);
    IR ir=getBuilder().getCFAContextInterpreter().getIR(opNode);
    SymbolTable symtab=ir.getSymbolTable();
    DefUse du=getAnalysisCache().getSSACache().findOrCreateDU(ir,opNode.getContext());
    if (contentsAreInvariant(symtab,du,1)) {
      system.recordImplicitPointsToSet(F);
      final InstanceKey[] functionKeys=getInvariantContents(symtab,du,opNode,1);
      for (int f=0; f < functionKeys.length; f++) {
        system.findOrCreateIndexForInstanceKey(functionKeys[f]);
        ScopeMappingInstanceKey K=(ScopeMappingInstanceKey)functionKeys[f];
        Iterator<CGNode> x=K.getFunargNodes(definer);
        while (x.hasNext()) {
          result.add(x.next());
        }
      }
    }
 else {
      PointsToSetVariable FV=system.findOrCreatePointsToSet(F);
      if (FV.getValue() != null) {
        FV.getValue().foreach(new IntSetAction(){
          public void act(          int ptr){
            InstanceKey iKey=system.getInstanceKey(ptr);
            if (iKey instanceof ScopeMappingInstanceKey) {
              ScopeMappingInstanceKey K=(ScopeMappingInstanceKey)iKey;
              Iterator<CGNode> x=K.getFunargNodes(definer);
              while (x.hasNext()) {
                result.add(x.next());
              }
            }
 else {
              Assertions.UNREACHABLE("String_Node_Str" + iKey);
            }
          }
        }
);
      }
    }
    return result;
  }
}

Fixed version (ground truth):
private Set<CGNode> getLexicalDefiners(final CGNode opNode,final Pair<String,String> definer){
}
Program: 38349
Project: 38349
Buggy source:
@Override public CAstNode visitVariableDeclaration(VariableDeclaration node,WalkContext arg){
  List<VariableInitializer> inits=node.getVariables();
  CAstNode[] children=new CAstNode[inits.size()];
  int i=0;
  for (  VariableInitializer init : inits) {
    arg.addNameDecl(noteSourcePosition(arg,Ast.makeNode(CAstNode.DECL_STMT,Ast.makeConstant(new CAstSymbolImpl(init.getTarget().getString())),readName(arg,"String_Node_Str")),node));
    children[i++]=Ast.makeNode(CAstNode.ASSIGN,Ast.makeNode(CAstNode.VAR,Ast.makeConstant(init.getTarget().getString())),visit(init,arg));
  }
  return Ast.makeNode(CAstNode.BLOCK_STMT,children);
}

Fixed version (ground truth):
@Override public CAstNode visitVariableDeclaration(VariableDeclaration node,WalkContext arg){
  List<VariableInitializer> inits=node.getVariables();
  CAstNode[] children=new CAstNode[inits.size()];
  int i=0;
  for (  VariableInitializer init : inits) {
    arg.addNameDecl(noteSourcePosition(arg,Ast.makeNode(CAstNode.DECL_STMT,Ast.makeConstant(new CAstSymbolImpl(init.getTarget().getString())),readName(arg,"String_Node_Str")),node));
    if (init.getInitializer() == null) {
      children[i++]=Ast.makeNode(CAstNode.EMPTY);
    }
 else {
      children[i++]=Ast.makeNode(CAstNode.ASSIGN,Ast.makeNode(CAstNode.VAR,Ast.makeConstant(init.getTarget().getString())),visit(init,arg));
    }
  }
  return Ast.makeNode(CAstNode.BLOCK_STMT,children);
}
Program: 38350
Project: 38350
Buggy source:
@Override public CAstNode visitBreakStatement(BreakStatement node,WalkContext arg){
  CAstNode breakStmt;
  if (node.getBreakLabel() != null) {
    breakStmt=Ast.makeNode(CAstNode.GOTO,Ast.makeConstant(node.getBreakLabel().getIdentifier()));
  }
 else {
    breakStmt=Ast.makeNode(CAstNode.GOTO);
  }
  arg.cfg().map(node,breakStmt);
  Node target=node.getBreakTarget();
  arg.cfg().add(node,target,null);
  return breakStmt;
}

Fixed version (ground truth):
@Override public CAstNode visitBreakStatement(BreakStatement node,WalkContext arg){
  CAstNode breakStmt;
  Node target;
  if (node.getBreakLabel() != null) {
    breakStmt=Ast.makeNode(CAstNode.GOTO,Ast.makeConstant(node.getBreakLabel().getIdentifier()));
    target=arg.getBreakFor(node.getBreakLabel().getIdentifier());
  }
 else {
    breakStmt=Ast.makeNode(CAstNode.GOTO);
    target=arg.getBreakFor(null);
  }
  arg.cfg().map(node,breakStmt);
  arg.cfg().add(node,target,null);
  return breakStmt;
}
Program: 38351
Project: 38351
Buggy source:
@Override public CAstNode visitSwitchStatement(SwitchStatement node,WalkContext context){
  int i=0;
  CAstNode[] children=new CAstNode[node.getCases().size() * 2];
  for (  SwitchCase sc : node.getCases()) {
    CAstNode label=Ast.makeNode(CAstNode.LABEL_STMT,Ast.makeConstant(String.valueOf(i / 2)),Ast.makeNode(CAstNode.EMPTY));
    context.cfg().map(label,label);
    children[i++]=label;
    if (sc.isDefault()) {
      context.cfg().add(node,label,CAstControlFlowMap.SWITCH_DEFAULT);
    }
 else {
      CAstNode labelCAst=visit(sc.getExpression(),context);
      context.cfg().add(node,label,labelCAst);
    }
    children[i++]=visit(sc,context);
  }
  CAstNode s=Ast.makeNode(CAstNode.SWITCH,visit(node.getExpression(),context),Ast.makeNode(CAstNode.BLOCK_STMT,children));
  context.cfg().map(node,s);
  return s;
}

Fixed version (ground truth):
@Override public CAstNode visitSwitchStatement(SwitchStatement node,WalkContext context){
  AstNode breakStmt=makeEmptyLabelStmt("String_Node_Str");
  CAstNode breakLabel=visit(breakStmt,context);
  WalkContext switchBodyContext=makeBreakContext(node,context,breakStmt);
  int i=0;
  CAstNode[] children=new CAstNode[node.getCases().size() * 2];
  for (  SwitchCase sc : node.getCases()) {
    CAstNode label=Ast.makeNode(CAstNode.LABEL_STMT,Ast.makeConstant(String.valueOf(i / 2)),Ast.makeNode(CAstNode.EMPTY));
    context.cfg().map(label,label);
    children[i++]=label;
    if (sc.isDefault()) {
      context.cfg().add(node,label,CAstControlFlowMap.SWITCH_DEFAULT);
    }
 else {
      CAstNode labelCAst=visit(sc.getExpression(),context);
      context.cfg().add(node,label,labelCAst);
    }
    children[i++]=visit(sc,switchBodyContext);
  }
  CAstNode s=Ast.makeNode(CAstNode.SWITCH,visit(node.getExpression(),context),Ast.makeNode(CAstNode.BLOCK_STMT,children));
  context.cfg().map(node,s);
  return Ast.makeNode(CAstNode.BLOCK_STMT,s,breakLabel);
}
Program: 38352
Project: 38352
Buggy source:
@Override public CAstNode visitFunctionCall(FunctionCall n,WalkContext context){
  if (!isPrimitiveCall(context,n)) {
    CAstNode base=Ast.makeNode(CAstNode.VAR,Ast.makeConstant("String_Node_Str"));
    AstNode callee=n.getTarget();
    WalkContext child=new BaseCollectingContext(context,callee,base);
    CAstNode fun=visit(callee,child);
    CAstNode[] args=gatherCallArguments(n,context);
    if (child.foundBase(callee))     return Ast.makeNode(CAstNode.LOCAL_SCOPE,Ast.makeNode(CAstNode.BLOCK_EXPR,Ast.makeNode(CAstNode.DECL_STMT,Ast.makeConstant(new CAstSymbolImpl("String_Node_Str")),Ast.makeConstant(null)),makeCall(fun,base,args,context)));
 else     return makeCall(fun,makeVarRef(JSSSAPropagationCallGraphBuilder.GLOBAL_OBJ_VAR_NAME),args,context);
  }
 else {
    return Ast.makeNode(CAstNode.PRIMITIVE,gatherCallArguments(n,context));
  }
}

Fixed version (ground truth):
@Override public CAstNode visitFunctionCall(FunctionCall n,WalkContext context){
  if (!isPrimitiveCall(context,n)) {
    CAstNode base=Ast.makeNode(CAstNode.VAR,Ast.makeConstant(baseVarName));
    AstNode callee=n.getTarget();
    WalkContext child=new BaseCollectingContext(context,callee,base);
    CAstNode fun=visit(callee,child);
    CAstNode[] args=gatherCallArguments(n,context);
    if (child.foundBase(callee))     return Ast.makeNode(CAstNode.LOCAL_SCOPE,Ast.makeNode(CAstNode.BLOCK_EXPR,Ast.makeNode(CAstNode.DECL_STMT,Ast.makeConstant(new CAstSymbolImpl(baseVarName)),Ast.makeConstant(null)),makeCall(fun,base,args,context)));
 else     return makeCall(fun,makeVarRef(JSSSAPropagationCallGraphBuilder.GLOBAL_OBJ_VAR_NAME),args,context);
  }
 else {
    return Ast.makeNode(CAstNode.PRIMITIVE,gatherCallArguments(n,context));
  }
}
Program: 38353
Project: 38353
Buggy source:
@Override public CAstNode visitLabeledStatement(LabeledStatement node,WalkContext arg){
  CAstNode result=visit(node.getStatement(),arg);
  for (  Label label : node.getLabels()) {
    result=Ast.makeNode(CAstNode.LABEL_STMT,visit(label,arg),result);
    arg.cfg().map(label,result);
  }
  return result;
}

Fixed version (ground truth):
@Override public CAstNode visitLabeledStatement(LabeledStatement node,WalkContext arg){
  CAstNode result=visit(node.getStatement(),arg);
  AstNode prev=node;
  for (  Label label : node.getLabels()) {
    result=Ast.makeNode(CAstNode.LABEL_STMT,visit(label,arg),result);
    arg.cfg().map(prev,result);
    prev=label;
  }
  return result;
}
Program: 38354
Project: 38354
Buggy source:
private AbstractScope makeScriptScope(final CAstEntity s,Scope parent){
  return new AbstractScope(parent){
    SymbolTable scriptGlobalSymtab=new SymbolTable(s.getArgumentCount());
    public SymbolTable getUnderlyingSymtab(){
      return scriptGlobalSymtab;
    }
    protected AbstractScope getEntityScope(){
      return this;
    }
    public boolean isLexicallyScoped(    Symbol s){
      if (isGlobal(s))       return false;
 else       return ((AbstractScope)s.getDefiningScope()).getEntityScope() != this;
    }
    public CAstEntity getEntity(){
      return s;
    }
    public ScopeType type(){
      return ScopeType.SCRIPT;
    }
    protected Symbol makeSymbol(    final String nm,    final boolean isFinal,    final boolean isInternalName,    final Object defaultInitValue,    int vn,    Scope definer){
      final int v=vn == -1 ? getUnderlyingSymtab().newSymbol() : vn;
      if (useDefaultInitValues() && defaultInitValue != null) {
        if (getUnderlyingSymtab().getValue(v) == null) {
          setDefaultValue(getUnderlyingSymtab(),v,defaultInitValue);
        }
      }
      return new AbstractSymbol(definer,isFinal,defaultInitValue){
        public String toString(){
          return nm + "String_Node_Str" + System.identityHashCode(this);
        }
        public int valueNumber(){
          return v;
        }
        public boolean isInternalName(){
          return isInternalName;
        }
        public boolean isParameter(){
          return false;
        }
      }
;
    }
  }
;
}

Fixed version (ground truth):
private AbstractScope makeScriptScope(final CAstEntity s,Scope parent){
  return new AbstractScope(parent){
    SymbolTable scriptGlobalSymtab=new SymbolTable(s.getArgumentCount());
    public SymbolTable getUnderlyingSymtab(){
      return scriptGlobalSymtab;
    }
    protected AbstractScope getEntityScope(){
      return this;
    }
    public boolean isLexicallyScoped(    Symbol s){
      if (isGlobal(s))       return false;
 else       return ((AbstractScope)s.getDefiningScope()).getEntity() != getEntity();
    }
    public CAstEntity getEntity(){
      return s;
    }
    public ScopeType type(){
      return ScopeType.SCRIPT;
    }
    protected Symbol makeSymbol(    final String nm,    final boolean isFinal,    final boolean isInternalName,    final Object defaultInitValue,    int vn,    Scope definer){
      final int v=vn == -1 ? getUnderlyingSymtab().newSymbol() : vn;
      if (useDefaultInitValues() && defaultInitValue != null) {
        if (getUnderlyingSymtab().getValue(v) == null) {
          setDefaultValue(getUnderlyingSymtab(),v,defaultInitValue);
        }
      }
      return new AbstractSymbol(definer,isFinal,defaultInitValue){
        public String toString(){
          return nm + "String_Node_Str" + System.identityHashCode(this);
        }
        public int valueNumber(){
          return v;
        }
        public boolean isInternalName(){
          return isInternalName;
        }
        public boolean isParameter(){
          return false;
        }
      }
;
    }
  }
;
}
Program: 38355
Project: 38355
Buggy source:
/** 
 * record name as exposed for the current entity and for all enclosing entities up to that of the defining scope, since if the name is updated via a call to a nested function, SSA for these entities may need to be updated with the new definition
 * @param context
 * @param name
 * @param definingScope
 * @param E
 * @param entityName
 * @param isWrite
 */
private void markExposedInEnclosingEntities(WalkContext context,final String name,Scope definingScope,CAstEntity E,final String entityName,boolean isWrite){
  Scope curScope=context.currentScope();
  while (!curScope.equals(definingScope)) {
    final Symbol curSymbol=curScope.lookup(name);
    final int vn=curSymbol.valueNumber();
    final Access A=new Access(name,entityName,vn);
    final CAstEntity entity=curScope.getEntity();
    addExposedName(entity,E,name,vn,isWrite);
    addAccess(entity,A);
    curScope=curScope.getParent();
  }
}

Fixed version (ground truth):
/** 
 * record name as exposed for the current entity and for all enclosing entities up to that of the defining scope, since if the name is updated via a call to a nested function, SSA for these entities may need to be updated with the new definition
 * @param context
 * @param name
 * @param definingScope
 * @param E
 * @param entityName
 * @param isWrite
 */
private void markExposedInEnclosingEntities(WalkContext context,final String name,Scope definingScope,CAstEntity E,final String entityName,boolean isWrite){
  Scope curScope=context.currentScope();
  while (!curScope.equals(definingScope)) {
    final Symbol curSymbol=curScope.lookup(name);
    final int vn=curSymbol.valueNumber();
    final Access A=new Access(name,entityName,vn);
    final CAstEntity entity=curScope.getEntity();
    if (entity != definingScope.getEntity()) {
      addExposedName(entity,E,name,vn,isWrite);
      addAccess(entity,A);
    }
    curScope=curScope.getParent();
  }
}