Program: 61608
Project: 61608
Buggy source:
public ScriptInfo generateScriptInfo(SourceGeneratorLocalData localData,List<GraphTargetItem> commands,int classPos) throws AVM2ParseException, CompilationException {
  Reference<Integer> class_index=new Reference<>(classPos);
  ScriptInfo si=new ScriptInfo();
  localData.currentScript=si;
  Trait[] traitArr=generateTraitsPhase1(null,null,false,localData,commands,si.traits,class_index);
  generateTraitsPhase2(new ArrayList<String>(),null,commands,traitArr,new ArrayList<Integer>(),localData);
  MethodInfo mi=new MethodInfo(new int[0],0,0,0,new ValueKind[0],new int[0]);
  MethodBody mb=new MethodBody();
  mb.method_info=abc.addMethodInfo(mi);
  mb.setCode(new AVM2Code());
  List<AVM2Instruction> mbCode=mb.getCode().code;
  mbCode.add(ins(new GetLocal0Ins()));
  mbCode.add(ins(new PushScopeIns()));
  int traitScope=2;
  Map<Trait,Integer> initScopes=new HashMap<>();
  for (  Trait t : si.traits.traits) {
    if (t instanceof TraitClass) {
      TraitClass tc=(TraitClass)t;
      List<Integer> parents=new ArrayList<>();
      if (localData.documentClass) {
        mbCode.add(ins(new GetScopeObjectIns(),0));
        traitScope++;
      }
 else {
        NamespaceSet nsset=new NamespaceSet(new int[]{abc.constants.constant_multiname.get(tc.name_index).namespace_index});
        mbCode.add(ins(new FindPropertyStrictIns(),abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME,abc.constants.constant_multiname.get(tc.name_index).name_index,0,abc.constants.getNamespaceSetId(nsset,true),0,new ArrayList<Integer>()),true)));
      }
      if (abc.instance_info.get(tc.class_info).isInterface()) {
        mbCode.add(ins(new PushNullIns()));
      }
 else {
        parentNamesAddNames(abc,allABCs,abc.instance_info.get(tc.class_info).name_index,parents,new ArrayList<String>(),new ArrayList<String>());
        for (int i=parents.size() - 1; i >= 1; i--) {
          mbCode.add(ins(new GetLexIns(),parents.get(i)));
          mbCode.add(ins(new PushScopeIns()));
          traitScope++;
        }
        mbCode.add(ins(new GetLexIns(),parents.get(1)));
      }
      mbCode.add(ins(new NewClassIns(),tc.class_info));
      if (!abc.instance_info.get(tc.class_info).isInterface()) {
        for (int i=parents.size() - 1; i >= 1; i--) {
          mbCode.add(ins(new PopScopeIns()));
        }
      }
      mbCode.add(ins(new InitPropertyIns(),tc.name_index));
      initScopes.put(t,traitScope);
      traitScope=1;
    }
  }
  mbCode.add(ins(new ReturnVoidIns()));
  mb.autoFillStats(abc,1,false);
  abc.addMethodBody(mb);
  si.init_index=mb.method_info;
  localData.pkg=null;
  generateTraitsPhase3(1,false,null,null,false,localData,commands,si.traits,traitArr,initScopes,class_index);
  return si;
}

Fixed version (ground truth):
public ScriptInfo generateScriptInfo(SourceGeneratorLocalData localData,List<GraphTargetItem> commands,int classPos) throws AVM2ParseException, CompilationException {
  Reference<Integer> class_index=new Reference<>(classPos);
  ScriptInfo si=new ScriptInfo();
  localData.currentScript=si;
  Trait[] traitArr=generateTraitsPhase1(null,null,true,localData,commands,si.traits,class_index);
  generateTraitsPhase2(new ArrayList<String>(),null,commands,traitArr,new ArrayList<Integer>(),localData);
  MethodInfo mi=new MethodInfo(new int[0],0,0,0,new ValueKind[0],new int[0]);
  MethodBody mb=new MethodBody();
  mb.method_info=abc.addMethodInfo(mi);
  mb.setCode(new AVM2Code());
  List<AVM2Instruction> mbCode=mb.getCode().code;
  mbCode.add(ins(new GetLocal0Ins()));
  mbCode.add(ins(new PushScopeIns()));
  int traitScope=2;
  Map<Trait,Integer> initScopes=new HashMap<>();
  for (  Trait t : si.traits.traits) {
    if (t instanceof TraitClass) {
      TraitClass tc=(TraitClass)t;
      List<Integer> parents=new ArrayList<>();
      if (localData.documentClass) {
        mbCode.add(ins(new GetScopeObjectIns(),0));
        traitScope++;
      }
 else {
        NamespaceSet nsset=new NamespaceSet(new int[]{abc.constants.constant_multiname.get(tc.name_index).namespace_index});
        mbCode.add(ins(new FindPropertyStrictIns(),abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME,abc.constants.constant_multiname.get(tc.name_index).name_index,0,abc.constants.getNamespaceSetId(nsset,true),0,new ArrayList<Integer>()),true)));
      }
      if (abc.instance_info.get(tc.class_info).isInterface()) {
        mbCode.add(ins(new PushNullIns()));
      }
 else {
        parentNamesAddNames(abc,allABCs,abc.instance_info.get(tc.class_info).name_index,parents,new ArrayList<String>(),new ArrayList<String>());
        for (int i=parents.size() - 1; i >= 1; i--) {
          mbCode.add(ins(new GetLexIns(),parents.get(i)));
          mbCode.add(ins(new PushScopeIns()));
          traitScope++;
        }
        mbCode.add(ins(new GetLexIns(),parents.get(1)));
      }
      mbCode.add(ins(new NewClassIns(),tc.class_info));
      if (!abc.instance_info.get(tc.class_info).isInterface()) {
        for (int i=parents.size() - 1; i >= 1; i--) {
          mbCode.add(ins(new PopScopeIns()));
        }
      }
      mbCode.add(ins(new InitPropertyIns(),tc.name_index));
      initScopes.put(t,traitScope);
      traitScope=1;
    }
  }
  mbCode.add(ins(new ReturnVoidIns()));
  mb.autoFillStats(abc,1,false);
  abc.addMethodBody(mb);
  si.init_index=mb.method_info;
  localData.pkg=null;
  generateTraitsPhase3(1,false,null,null,true,localData,commands,si.traits,traitArr,initScopes,class_index);
  return si;
}