Program: 61750
Project: 61750
Buggy source:
public int method(List<MethodBody> callStack,String pkg,boolean needsActivation,List<AssignableAVM2Item> subvariables,int initScope,boolean hasRest,int line,String className,String superType,boolean constructor,SourceGeneratorLocalData localData,List<GraphTargetItem> paramTypes,List<String> paramNames,List<GraphTargetItem> paramValues,List<GraphTargetItem> body,GraphTargetItem retType) throws CompilationException {
  SourceGeneratorLocalData newlocalData=new SourceGeneratorLocalData(new HashMap<String,Integer>(),1,true,0);
  newlocalData.currentClass=className;
  newlocalData.pkg=localData.pkg;
  newlocalData.callStack.addAll(localData.callStack);
  newlocalData.traitUsages=localData.traitUsages;
  newlocalData.currentScript=localData.currentScript;
  newlocalData.documentClass=localData.documentClass;
  localData=newlocalData;
  localData.activationReg=0;
  for (int i=0; i < subvariables.size(); i++) {
    AssignableAVM2Item an=subvariables.get(i);
    if (an instanceof UnresolvedAVM2Item) {
      UnresolvedAVM2Item n=(UnresolvedAVM2Item)an;
      if (n.resolved == null) {
        GraphTargetItem res=n.resolve(paramTypes,paramNames,abc,allABCs,callStack,subvariables);
        if (res instanceof AssignableAVM2Item) {
          subvariables.set(i,(AssignableAVM2Item)res);
        }
 else {
          subvariables.remove(i);
          i--;
        }
      }
    }
  }
  boolean hasArguments=false;
  List<String> slotNames=new ArrayList<>();
  List<String> slotTypes=new ArrayList<>();
  slotNames.add("String_Node_Str");
  slotTypes.add("String_Node_Str");
  List<String> registerNames=new ArrayList<>();
  List<String> registerTypes=new ArrayList<>();
  if (className != null) {
    String fullClassName=pkg.isEmpty() ? className : pkg + "String_Node_Str" + className;
    registerTypes.add(fullClassName);
    localData.scopeStack.add(new LocalRegAVM2Item(null,registerNames.size(),null));
    registerNames.add("String_Node_Str");
  }
 else {
    registerTypes.add("String_Node_Str");
    registerNames.add("String_Node_Str");
  }
  for (  GraphTargetItem t : paramTypes) {
    registerTypes.add(t.toString());
    slotTypes.add(t.toString());
  }
  registerNames.addAll(paramNames);
  slotNames.addAll(paramNames);
  localData.registerVars.clear();
  for (  AssignableAVM2Item an : subvariables) {
    if (an instanceof NameAVM2Item) {
      NameAVM2Item n=(NameAVM2Item)an;
      if (n.getVariableName().equals("String_Node_Str") & !n.isDefinition()) {
        registerNames.add("String_Node_Str");
        registerTypes.add("String_Node_Str");
        hasArguments=true;
        break;
      }
    }
  }
  int paramRegCount=registerNames.size();
  if (needsActivation) {
    registerNames.add("String_Node_Str");
    localData.activationReg=registerNames.size() - 1;
    registerTypes.add("String_Node_Str");
    localData.scopeStack.add(new LocalRegAVM2Item(null,localData.activationReg,null));
  }
  for (  AssignableAVM2Item an : subvariables) {
    if (an instanceof NameAVM2Item) {
      NameAVM2Item n=(NameAVM2Item)an;
      if (n.isDefinition()) {
        if (!needsActivation || (n.getSlotScope() <= 0)) {
          registerNames.add(n.getVariableName());
          registerTypes.add(n.type.toString());
          slotNames.add(n.getVariableName());
          slotTypes.add(n.type.toString());
        }
      }
    }
  }
  int slotScope=className == null ? 0 : 1;
  for (  AssignableAVM2Item an : subvariables) {
    if (an instanceof NameAVM2Item) {
      NameAVM2Item n=(NameAVM2Item)an;
      if (n.getVariableName() != null) {
        if (needsActivation) {
          if (n.getSlotNumber() <= 0) {
            n.setSlotNumber(slotNames.indexOf(n.getVariableName()));
            n.setSlotScope(slotScope);
          }
        }
 else {
          n.setRegNumber(registerNames.indexOf(n.getVariableName()));
        }
      }
    }
  }
  for (int i=0; i < registerNames.size(); i++) {
    if (needsActivation && i > localData.activationReg) {
      break;
    }
    localData.registerVars.put(registerNames.get(i),i);
  }
  List<NameAVM2Item> declarations=new ArrayList<>();
  loopn:   for (  AssignableAVM2Item an : subvariables) {
    if (an instanceof NameAVM2Item) {
      NameAVM2Item n=(NameAVM2Item)an;
      if (needsActivation) {
        if (n.getSlotScope() != slotScope) {
          continue;
        }
 else {
          if (n.getSlotNumber() < paramRegCount) {
            continue;
          }
        }
      }
      for (      NameAVM2Item d : declarations) {
        if (n.getVariableName() != null && n.getVariableName().equals(d.getVariableName())) {
          continue loopn;
        }
      }
      for (      GraphTargetItem it : body) {
        if (it instanceof NameAVM2Item) {
          NameAVM2Item n2=(NameAVM2Item)it;
          if (n2.isDefinition() && n2.getAssignedValue() != null && n2.getVariableName().equals(n.getVariableName())) {
            continue loopn;
          }
          if (!n2.isDefinition() && n2.getVariableName() != null && n2.getVariableName().equals(n.getVariableName())) {
            break;
          }
        }
      }
      if (n.unresolved) {
        continue;
      }
      if (n.redirect != null) {
        continue;
      }
      if (n.getNs() != null) {
        continue;
      }
      NameAVM2Item d=new NameAVM2Item(n.type,n.line,n.getVariableName(),NameAVM2Item.getDefaultValue("String_Node_Str" + n.type),true,n.openedNamespaces);
      if (needsActivation) {
        if (d.getSlotNumber() <= 0) {
          d.setSlotNumber(n.getSlotNumber());
          d.setSlotScope(n.getSlotScope());
        }
      }
 else {
        d.setRegNumber(n.getRegNumber());
      }
      declarations.add(d);
    }
  }
  int param_types[]=new int[paramTypes.size()];
  ValueKind optional[]=new ValueKind[paramValues.size()];
  for (int i=0; i < paramTypes.size(); i++) {
    param_types[i]=typeName(localData,paramTypes.get(i));
  }
  for (int i=0; i < paramValues.size(); i++) {
    optional[i]=getValueKind(Namespace.KIND_NAMESPACE,paramTypes.get(paramTypes.size() - paramValues.size() + i),paramTypes.get(i));
  }
  MethodInfo mi=new MethodInfo(param_types,constructor ? 0 : typeName(localData,retType),0,0,optional,new int[0]);
  if (hasArguments) {
    mi.setFlagNeed_Arguments();
  }
  if (!paramValues.isEmpty()) {
    mi.setFlagHas_optional();
  }
  if (hasRest) {
    mi.setFlagNeed_rest();
  }
  MethodBody mbody=new MethodBody();
  if (needsActivation) {
    mbody.traits=new Traits();
    int slotId=1;
    for (int i=1; i < slotNames.size(); i++) {
      TraitSlotConst tsc=new TraitSlotConst();
      tsc.slot_id=slotId++;
      tsc.name_index=abc.constants.getMultinameId(new Multiname(Multiname.QNAME,abc.constants.getStringId(slotNames.get(i),true),abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE_INTERNAL,abc.constants.getStringId(pkg,true)),0,true),0,0,new ArrayList<Integer>()),true);
      tsc.type_index=typeName(localData,new TypeItem(slotTypes.get(i)));
      mbody.traits.traits.add(tsc);
    }
    for (int i=1; i < paramRegCount; i++) {
      NameAVM2Item param=new NameAVM2Item(new TypeItem(registerTypes.get(i)),0,registerNames.get(i),null,false,new ArrayList<Integer>());
      param.setRegNumber(i);
      NameAVM2Item d=new NameAVM2Item(new TypeItem(registerTypes.get(i)),0,registerNames.get(i),param,true,new ArrayList<Integer>());
      d.setSlotScope(slotScope);
      d.setSlotNumber(slotNames.indexOf(registerNames.get(i)));
      declarations.add(d);
    }
  }
  body.addAll(0,declarations);
  localData.exceptions=new ArrayList<>();
  localData.callStack.add(mbody);
  List<GraphSourceItem> src=generate(localData,body);
  mbody.method_info=abc.addMethodInfo(mi);
  mi.setBody(mbody);
  mbody.code=new AVM2Code();
  mbody.code.code=toInsList(src);
  if (needsActivation) {
    if (localData.traitUsages.containsKey(mbody)) {
      List<Integer> usages=localData.traitUsages.get(mbody);
      for (int i=0; i < mbody.traits.traits.size(); i++) {
        if (usages.contains(i)) {
          TraitSlotConst tsc=(TraitSlotConst)mbody.traits.traits.get(i);
          GraphTargetItem type=TypeItem.UNBOUNDED;
          if (tsc.type_index > 0) {
            type=new TypeItem(abc.constants.constant_multiname.get(tsc.type_index).getNameWithNamespace(abc.constants));
          }
          NameAVM2Item d=new NameAVM2Item(type,0,tsc.getName(abc).getName(abc.constants,new ArrayList<String>()),NameAVM2Item.getDefaultValue("String_Node_Str" + type),true,new ArrayList<Integer>());
          d.setSlotNumber(tsc.slot_id);
          d.setSlotScope(slotScope);
          mbody.code.code.addAll(0,toInsList(d.toSourceIgnoreReturnValue(localData,this)));
        }
      }
    }
    List<AVM2Instruction> acts=new ArrayList<>();
    acts.add(ins(new NewActivationIns()));
    acts.add(ins(new DupIns()));
    acts.add(AssignableAVM2Item.generateSetLoc(localData.activationReg));
    acts.add(ins(new PushScopeIns()));
    mbody.code.code.addAll(0,acts);
  }
  if (constructor) {
    List<ABC> abcs=new ArrayList<>();
    abcs.add(abc);
    abcs.addAll(allABCs);
    int parentConsAC=0;
    for (    ABC a : abcs) {
      int ci=a.findClassByName(superType);
      if (ci > -1) {
        MethodInfo pmi=a.method_info.get(a.instance_info.get(ci).iinit_index);
        parentConsAC=pmi.param_types.length;
      }
    }
    int ac=-1;
    for (    AVM2Instruction ins : mbody.code.code) {
      if (ins.definition instanceof ConstructSuperIns) {
        ac=ins.operands[0];
        if (parentConsAC != ac) {
          throw new CompilationException("String_Node_Str",line);
        }
      }
    }
    if (ac == -1) {
      if (parentConsAC == 0) {
        mbody.code.code.add(0,new AVM2Instruction(0,new GetLocal0Ins(),new int[]{},new byte[0]));
        mbody.code.code.add(1,new AVM2Instruction(0,new ConstructSuperIns(),new int[]{0},new byte[0]));
      }
 else {
        throw new CompilationException("String_Node_Str",line);
      }
    }
  }
  if (className != null) {
    mbody.code.code.add(0,new AVM2Instruction(0,new GetLocal0Ins(),new int[]{},new byte[0]));
    mbody.code.code.add(1,new AVM2Instruction(0,new PushScopeIns(),new int[]{},new byte[0]));
  }
  if (!mbody.code.code.isEmpty()) {
    InstructionDefinition lastDef=mbody.code.code.get(mbody.code.code.size() - 1).definition;
    if (!((lastDef instanceof ReturnVoidIns) || (lastDef instanceof ReturnValueIns))) {
      if (retType.toString().equals("String_Node_Str") || retType.toString().equals("String_Node_Str") || constructor) {
        mbody.code.code.add(new AVM2Instruction(0,new ReturnVoidIns(),new int[]{},new byte[0]));
      }
 else {
        mbody.code.code.add(new AVM2Instruction(0,new PushUndefinedIns(),new int[]{},new byte[0]));
        mbody.code.code.add(new AVM2Instruction(0,new ReturnValueIns(),new int[]{},new byte[0]));
      }
    }
  }
  mbody.exceptions=localData.exceptions.toArray(new ABCException[localData.exceptions.size()]);
  int offset=0;
  for (int i=0; i < mbody.code.code.size(); i++) {
    AVM2Instruction ins=mbody.code.code.get(i);
    if (ins instanceof ExceptionMarkAVM2Instruction) {
      ExceptionMarkAVM2Instruction m=(ExceptionMarkAVM2Instruction)ins;
switch (m.markType) {
case MARK_E_START:
        mbody.exceptions[m.exceptionId].start=offset;
      break;
case MARK_E_END:
    mbody.exceptions[m.exceptionId].end=offset;
  break;
case MARK_E_TARGET:
mbody.exceptions[m.exceptionId].target=offset;
break;
}
mbody.code.code.remove(i);
i--;
continue;
}
offset+=ins.getBytes().length;
}
mbody.autoFillStats(abc,initScope);
abc.addMethodBody(mbody);
return mbody.method_info;
}

Fixed version (ground truth):
public int method(List<MethodBody> callStack,String pkg,boolean needsActivation,List<AssignableAVM2Item> subvariables,int initScope,boolean hasRest,int line,String className,String superType,boolean constructor,SourceGeneratorLocalData localData,List<GraphTargetItem> paramTypes,List<String> paramNames,List<GraphTargetItem> paramValues,List<GraphTargetItem> body,GraphTargetItem retType) throws CompilationException {
  SourceGeneratorLocalData newlocalData=new SourceGeneratorLocalData(new HashMap<String,Integer>(),1,true,0);
  newlocalData.currentClass=className;
  newlocalData.pkg=localData.pkg;
  newlocalData.callStack.addAll(localData.callStack);
  newlocalData.traitUsages=localData.traitUsages;
  newlocalData.currentScript=localData.currentScript;
  newlocalData.documentClass=localData.documentClass;
  localData=newlocalData;
  localData.activationReg=0;
  for (int i=0; i < subvariables.size(); i++) {
    AssignableAVM2Item an=subvariables.get(i);
    if (an instanceof UnresolvedAVM2Item) {
      UnresolvedAVM2Item n=(UnresolvedAVM2Item)an;
      if (n.resolved == null) {
        GraphTargetItem res=n.resolve(paramTypes,paramNames,abc,allABCs,callStack,subvariables);
        if (res instanceof AssignableAVM2Item) {
          subvariables.set(i,(AssignableAVM2Item)res);
        }
 else {
          subvariables.remove(i);
          i--;
        }
      }
    }
  }
  boolean hasArguments=false;
  List<String> slotNames=new ArrayList<>();
  List<String> slotTypes=new ArrayList<>();
  slotNames.add("String_Node_Str");
  slotTypes.add("String_Node_Str");
  List<String> registerNames=new ArrayList<>();
  List<String> registerTypes=new ArrayList<>();
  if (className != null) {
    String fullClassName=pkg.isEmpty() ? className : pkg + "String_Node_Str" + className;
    registerTypes.add(fullClassName);
    localData.scopeStack.add(new LocalRegAVM2Item(null,registerNames.size(),null));
    registerNames.add("String_Node_Str");
  }
 else {
    registerTypes.add("String_Node_Str");
    registerNames.add("String_Node_Str");
  }
  for (  GraphTargetItem t : paramTypes) {
    registerTypes.add(t.toString());
    slotTypes.add(t.toString());
  }
  registerNames.addAll(paramNames);
  slotNames.addAll(paramNames);
  localData.registerVars.clear();
  for (  AssignableAVM2Item an : subvariables) {
    if (an instanceof NameAVM2Item) {
      NameAVM2Item n=(NameAVM2Item)an;
      if (n.getVariableName().equals("String_Node_Str") & !n.isDefinition()) {
        registerNames.add("String_Node_Str");
        registerTypes.add("String_Node_Str");
        hasArguments=true;
        break;
      }
    }
  }
  int paramRegCount=registerNames.size();
  if (needsActivation) {
    registerNames.add("String_Node_Str");
    localData.activationReg=registerNames.size() - 1;
    registerTypes.add("String_Node_Str");
    localData.scopeStack.add(new LocalRegAVM2Item(null,localData.activationReg,null));
  }
  for (  AssignableAVM2Item an : subvariables) {
    if (an instanceof NameAVM2Item) {
      NameAVM2Item n=(NameAVM2Item)an;
      if (n.isDefinition()) {
        if (!needsActivation || (n.getSlotScope() <= 0)) {
          registerNames.add(n.getVariableName());
          registerTypes.add(n.type.toString());
          slotNames.add(n.getVariableName());
          slotTypes.add(n.type.toString());
        }
      }
    }
  }
  int slotScope=className == null ? 0 : 1;
  for (  AssignableAVM2Item an : subvariables) {
    if (an instanceof NameAVM2Item) {
      NameAVM2Item n=(NameAVM2Item)an;
      if (n.getVariableName() != null) {
        if (needsActivation) {
          if (n.getSlotNumber() <= 0) {
            n.setSlotNumber(slotNames.indexOf(n.getVariableName()));
            n.setSlotScope(slotScope);
          }
        }
 else {
          n.setRegNumber(registerNames.indexOf(n.getVariableName()));
        }
      }
    }
  }
  for (int i=0; i < registerNames.size(); i++) {
    if (needsActivation && i > localData.activationReg) {
      break;
    }
    localData.registerVars.put(registerNames.get(i),i);
  }
  List<NameAVM2Item> declarations=new ArrayList<>();
  loopn:   for (  AssignableAVM2Item an : subvariables) {
    if (an instanceof NameAVM2Item) {
      NameAVM2Item n=(NameAVM2Item)an;
      if (needsActivation) {
        if (n.getSlotScope() != slotScope) {
          continue;
        }
 else {
          if (n.getSlotNumber() < paramRegCount) {
            continue;
          }
        }
      }
      for (      NameAVM2Item d : declarations) {
        if (n.getVariableName() != null && n.getVariableName().equals(d.getVariableName())) {
          continue loopn;
        }
      }
      for (      GraphTargetItem it : body) {
        if (it instanceof NameAVM2Item) {
          NameAVM2Item n2=(NameAVM2Item)it;
          if (n2.isDefinition() && n2.getAssignedValue() != null && n2.getVariableName().equals(n.getVariableName())) {
            continue loopn;
          }
          if (!n2.isDefinition() && n2.getVariableName() != null && n2.getVariableName().equals(n.getVariableName())) {
            break;
          }
        }
      }
      if (n.unresolved) {
        continue;
      }
      if (n.redirect != null) {
        continue;
      }
      if (n.getNs() != null) {
        continue;
      }
      NameAVM2Item d=new NameAVM2Item(n.type,n.line,n.getVariableName(),NameAVM2Item.getDefaultValue("String_Node_Str" + n.type),true,n.openedNamespaces);
      if (needsActivation) {
        if (d.getSlotNumber() <= 0) {
          d.setSlotNumber(n.getSlotNumber());
          d.setSlotScope(n.getSlotScope());
        }
      }
 else {
        d.setRegNumber(n.getRegNumber());
      }
      declarations.add(d);
    }
  }
  int param_types[]=new int[paramTypes.size()];
  ValueKind optional[]=new ValueKind[paramValues.size()];
  for (int i=0; i < paramTypes.size(); i++) {
    param_types[i]=typeName(localData,paramTypes.get(i));
  }
  for (int i=0; i < paramValues.size(); i++) {
    optional[i]=getValueKind(Namespace.KIND_NAMESPACE,paramTypes.get(paramTypes.size() - paramValues.size() + i),paramTypes.get(i));
  }
  MethodInfo mi=new MethodInfo(param_types,constructor ? 0 : typeName(localData,retType),0,0,optional,new int[0]);
  if (hasArguments) {
    mi.setFlagNeed_Arguments();
  }
  if (!paramValues.isEmpty()) {
    mi.setFlagHas_optional();
  }
  if (hasRest) {
    mi.setFlagNeed_rest();
  }
  MethodBody mbody=new MethodBody();
  if (needsActivation) {
    mbody.traits=new Traits();
    int slotId=1;
    for (int i=1; i < slotNames.size(); i++) {
      TraitSlotConst tsc=new TraitSlotConst();
      tsc.slot_id=slotId++;
      tsc.name_index=abc.constants.getMultinameId(new Multiname(Multiname.QNAME,abc.constants.getStringId(slotNames.get(i),true),abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE_INTERNAL,abc.constants.getStringId(pkg,true)),0,true),0,0,new ArrayList<Integer>()),true);
      tsc.type_index=typeName(localData,new TypeItem(slotTypes.get(i)));
      mbody.traits.traits.add(tsc);
    }
    for (int i=1; i < paramRegCount; i++) {
      NameAVM2Item param=new NameAVM2Item(new TypeItem(registerTypes.get(i)),0,registerNames.get(i),null,false,new ArrayList<Integer>());
      param.setRegNumber(i);
      NameAVM2Item d=new NameAVM2Item(new TypeItem(registerTypes.get(i)),0,registerNames.get(i),param,true,new ArrayList<Integer>());
      d.setSlotScope(slotScope);
      d.setSlotNumber(slotNames.indexOf(registerNames.get(i)));
      declarations.add(d);
    }
  }
  body.addAll(0,declarations);
  localData.exceptions=new ArrayList<>();
  localData.callStack.add(mbody);
  List<GraphSourceItem> src=generate(localData,body);
  mbody.method_info=abc.addMethodInfo(mi);
  mi.setBody(mbody);
  mbody.code=new AVM2Code();
  mbody.code.code=toInsList(src);
  if (needsActivation) {
    if (localData.traitUsages.containsKey(mbody)) {
      List<Integer> usages=localData.traitUsages.get(mbody);
      for (int i=0; i < mbody.traits.traits.size(); i++) {
        if (usages.contains(i)) {
          TraitSlotConst tsc=(TraitSlotConst)mbody.traits.traits.get(i);
          GraphTargetItem type=TypeItem.UNBOUNDED;
          if (tsc.type_index > 0) {
            type=new TypeItem(abc.constants.constant_multiname.get(tsc.type_index).getNameWithNamespace(abc.constants));
          }
          NameAVM2Item d=new NameAVM2Item(type,0,tsc.getName(abc).getName(abc.constants,new ArrayList<String>()),NameAVM2Item.getDefaultValue("String_Node_Str" + type),true,new ArrayList<Integer>());
          d.setSlotNumber(tsc.slot_id);
          d.setSlotScope(slotScope);
          mbody.code.code.addAll(0,toInsList(d.toSourceIgnoreReturnValue(localData,this)));
        }
      }
    }
    List<AVM2Instruction> acts=new ArrayList<>();
    acts.add(ins(new NewActivationIns()));
    acts.add(ins(new DupIns()));
    acts.add(AssignableAVM2Item.generateSetLoc(localData.activationReg));
    acts.add(ins(new PushScopeIns()));
    mbody.code.code.addAll(0,acts);
  }
  if (constructor) {
    List<ABC> abcs=new ArrayList<>();
    abcs.add(abc);
    abcs.addAll(allABCs);
    int parentConsAC=0;
    for (    ABC a : abcs) {
      int ci=a.findClassByName(superType);
      if (ci > -1) {
        MethodInfo pmi=a.method_info.get(a.instance_info.get(ci).iinit_index);
        parentConsAC=pmi.param_types.length;
      }
    }
    int ac=-1;
    for (    AVM2Instruction ins : mbody.code.code) {
      if (ins.definition instanceof ConstructSuperIns) {
        ac=ins.operands[0];
        if (parentConsAC != ac) {
          throw new CompilationException("String_Node_Str",line);
        }
      }
    }
    if (ac == -1) {
      if (parentConsAC == 0) {
        mbody.code.code.add(0,new AVM2Instruction(0,new GetLocal0Ins(),new int[]{},new byte[0]));
        mbody.code.code.add(1,new AVM2Instruction(0,new ConstructSuperIns(),new int[]{0},new byte[0]));
      }
 else {
        throw new CompilationException("String_Node_Str",line);
      }
    }
  }
  if (className != null) {
    mbody.code.code.add(0,new AVM2Instruction(0,new GetLocal0Ins(),new int[]{},new byte[0]));
    mbody.code.code.add(1,new AVM2Instruction(0,new PushScopeIns(),new int[]{},new byte[0]));
  }
  if (!mbody.code.code.isEmpty()) {
    InstructionDefinition lastDef=mbody.code.code.get(mbody.code.code.size() - 1).definition;
    if (!((lastDef instanceof ReturnVoidIns) || (lastDef instanceof ReturnValueIns))) {
      if (retType.toString().equals("String_Node_Str") || retType.toString().equals("String_Node_Str") || constructor) {
        mbody.code.code.add(new AVM2Instruction(0,new ReturnVoidIns(),new int[]{},new byte[0]));
      }
 else {
        mbody.code.code.add(new AVM2Instruction(0,new PushUndefinedIns(),new int[]{},new byte[0]));
        mbody.code.code.add(new AVM2Instruction(0,new ReturnValueIns(),new int[]{},new byte[0]));
      }
    }
  }
  mbody.exceptions=localData.exceptions.toArray(new ABCException[localData.exceptions.size()]);
  int offset=0;
  for (int i=0; i < mbody.code.code.size(); i++) {
    AVM2Instruction ins=mbody.code.code.get(i);
    if (ins instanceof ExceptionMarkAVM2Instruction) {
      ExceptionMarkAVM2Instruction m=(ExceptionMarkAVM2Instruction)ins;
switch (m.markType) {
case MARK_E_START:
        mbody.exceptions[m.exceptionId].start=offset;
      break;
case MARK_E_END:
    mbody.exceptions[m.exceptionId].end=offset;
  break;
case MARK_E_TARGET:
mbody.exceptions[m.exceptionId].target=offset;
break;
}
mbody.code.code.remove(i);
i--;
continue;
}
offset+=ins.getBytes().length;
}
mbody.markOffsets();
mbody.autoFillStats(abc,initScope);
abc.addMethodBody(mbody);
return mbody.method_info;
}