Program: 45406
Project: 45406
Buggy source:
static void compile(Context cx,ObjectValue global,InputStream in,String filename,String file_encoding,ObjectList<IncludeInfo> includes,String swf_options,String avmplus_exe,ObjectList<CompilerPlug> plugs,boolean emit_doc_info,boolean show_parsetrees,boolean show_bytes,boolean show_flow,boolean lint_mode,boolean emit_metadata,boolean save_comment_nodes,boolean emit_debug_info,ObjectList<String> import_filespecs){
  ProgramNode second=null;
  ObjectList<ImportNode> imports=new ObjectList<ImportNode>();
  for (  String filespec : import_filespecs) {
    Context cx2=new Context(cx.statics);
    BufferedInputStream import_in=null;
    try {
      if (filespec.endsWith("String_Node_Str")) {
        second=(new AbcParser(cx2,filespec)).parseAbc();
        if (second == null) {
          cx.error(-1,kError_InvalidAbcFile,filespec);
        }
      }
 else {
        import_in=new BufferedInputStream(new FileInputStream(filespec));
        cx2.setPath(new File(filespec).getAbsoluteFile().getParent());
        second=(new Parser(cx2,import_in,filespec,null,emit_doc_info,save_comment_nodes)).parseProgram();
      }
    }
 catch (    IOException ex) {
      cx.error(-1,kError_UnableToOpenFile,filespec);
    }
 finally {
      if (import_in != null) {
        try {
          import_in.close();
        }
 catch (        IOException ex) {
        }
      }
    }
    NodeFactory nodeFactory=cx2.getNodeFactory();
    imports.push_back(nodeFactory.Import(cx2,nodeFactory.literalString(filespec,0),second));
    cx2.getNodeFactory().pkg_defs.clear();
  }
  cx.setPath(new File(filename).getAbsoluteFile().getParent());
  ProgramNode node=(new Parser(cx,in,filename,file_encoding,emit_doc_info,save_comment_nodes)).parseProgram();
  node.imports=imports;
  ObjectList<ProgramNode> nodes=new ObjectList<ProgramNode>();
{
    ProgramNode node2;
{
      if (includes != null) {
        Iterator<IncludeInfo> in_it=includes.iterator();
        for (; in_it.hasNext(); ) {
          IncludeInfo iinfo=in_it.next();
          Context cx2=new Context(cx.statics);
          node2=(new Parser(cx2,iinfo.script,iinfo.name,iinfo.encoding,emit_doc_info,save_comment_nodes)).parseProgram();
          nodes.add(node2);
        }
      }
    }
  }
  cx.pushScope(global);
  if (includes != null && includes.size() > 0) {
    ObjectList<Node> stmts=node.statements.items;
    for (int i=nodes.size() - 1; i >= 0; --i) {
      Context cx2=nodes.get(i).cx;
      NodeFactory nodeFactory=cx2.getNodeFactory();
      String name=includes.get(i).name;
      LiteralStringNode first=nodeFactory.literalString(name,0);
      IncludeDirectiveNode idn=nodeFactory.includeDirective(cx2,first,nodes.get(i));
      StatementListNode istmts=nodeFactory.statementList(null,idn);
      ObjectList<Node> items=istmts.items;
      stmts.addAll(0,items);
    }
  }
  node.pkgdefs.clear();
  node.pkgdefs.addAll(cx.getNodeFactory().pkg_defs);
  if (show_parsetrees && cx.errorCount() == 0) {
    printParseTrees(cx.scriptName(),node,cx,"String_Node_Str");
    return;
  }
  if (cx.errorCount() == 0) {
    ConfigurationEvaluator ce=new ConfigurationEvaluator();
    node.evaluate(cx,ce);
  }
  if (cx.errorCount() == 0) {
    FlowGraphEmitter flowem=new FlowGraphEmitter(cx,filename,show_flow);
    FlowAnalyzer flower=new FlowAnalyzer(flowem);
    node.evaluate(cx,flower);
    node.evaluate(cx,flower);
  }
  if (cx.errorCount() == 0) {
    if (emit_metadata) {
      MetaDataEvaluator printer=new MetaDataEvaluator(emit_debug_info);
      node.evaluate(cx,printer);
    }
  }
  if (cx.errorCount() == 0) {
    ConstantEvaluator analyzer=new ConstantEvaluator(cx);
    node.evaluate(cx,analyzer);
  }
  if (cx.errorCount() == 0 && emit_doc_info) {
    MetaDataEvaluator printer=new MetaDataEvaluator();
    node.evaluate(cx,printer);
    StringBuilder out=new StringBuilder();
    out.append("String_Node_Str").append(newline);
    ObjectList<DocCommentNode> comments=printer.doccomments;
    int numComments=comments.size();
    for (int x=0; x < numComments; x++) {
      comments.get(x).emit(cx,out);
    }
    out.append(newline).append("String_Node_Str").append(newline);
    BufferedOutputStream warningOut=null;
    try {
      String outName=cx.scriptName() + "String_Node_Str";
      warningOut=new BufferedOutputStream(new FileOutputStream(new File(cx.path(),outName)));
      warningOut.write(out.toString().getBytes());
      warningOut.flush();
    }
 catch (    IOException ex) {
      ex.printStackTrace();
    }
 finally {
      if (warningOut != null) {
        try {
          warningOut.close();
          System.err.println("String_Node_Str" + cx.path() + "String_Node_Str"+ cx.scriptName()+ "String_Node_Str");
        }
 catch (        IOException ex) {
        }
      }
    }
    return;
  }
  if (lint_mode && cx.errorCount() == 0) {
    LintEvaluator evaluator=new LintEvaluator(cx,filename,(String)null);
    node.evaluate(cx,evaluator);
    evaluator.logWarnings(cx);
    evaluator.clear();
  }
  if (cx.errorCount() == 0) {
    Emitter emitter=cx.getEmitter();
    CodeGenerator generator=new CodeGenerator(emitter);
    node.evaluate(cx,generator);
  }
  cx.popScope();
}

Fixed version (ground truth):
static void compile(Context cx,ObjectValue global,InputStream in,String filename,String file_encoding,ObjectList<IncludeInfo> includes,String swf_options,String avmplus_exe,ObjectList<CompilerPlug> plugs,boolean emit_doc_info,boolean show_parsetrees,boolean show_bytes,boolean show_flow,boolean lint_mode,boolean emit_metadata,boolean save_comment_nodes,boolean emit_debug_info,ObjectList<String> import_filespecs){
  ProgramNode second=null;
  ObjectList<ImportNode> imports=new ObjectList<ImportNode>();
  for (  String filespec : import_filespecs) {
    Context cx2=new Context(cx.statics);
    BufferedInputStream import_in=null;
    try {
      if (filespec.endsWith("String_Node_Str")) {
        second=(new AbcParser(cx2,filespec)).parseAbc();
        if (second == null) {
          cx.error(-1,kError_InvalidAbcFile,filespec);
        }
      }
 else {
        import_in=new BufferedInputStream(new FileInputStream(filespec));
        cx2.setPath(new File(filespec).getAbsoluteFile().getParent());
        second=(new Parser(cx2,import_in,filespec,null,emit_doc_info,save_comment_nodes)).parseProgram();
      }
    }
 catch (    IOException ex) {
      cx.error(-1,kError_UnableToOpenFile,filespec);
    }
 finally {
      if (import_in != null) {
        try {
          import_in.close();
        }
 catch (        IOException ex) {
        }
      }
    }
    NodeFactory nodeFactory=cx2.getNodeFactory();
    imports.push_back(nodeFactory.Import(cx2,nodeFactory.literalString(filespec,0),second));
    cx2.getNodeFactory().pkg_defs.clear();
  }
  cx.setPath(new File(filename).getAbsoluteFile().getParent());
  ProgramNode node=(new Parser(cx,in,filename,file_encoding,emit_doc_info,save_comment_nodes)).parseProgram();
  node.imports=imports;
  ObjectList<ProgramNode> nodes=new ObjectList<ProgramNode>();
{
    ProgramNode node2;
{
      if (includes != null) {
        Iterator<IncludeInfo> in_it=includes.iterator();
        for (; in_it.hasNext(); ) {
          IncludeInfo iinfo=in_it.next();
          Context cx2=new Context(cx.statics);
          node2=(new Parser(cx2,iinfo.script,iinfo.name,iinfo.encoding,emit_doc_info,save_comment_nodes)).parseProgram();
          nodes.add(node2);
        }
      }
    }
  }
  cx.pushScope(global);
  if (includes != null && includes.size() > 0) {
    ObjectList<Node> stmts=node.statements.items;
    for (int i=nodes.size() - 1; i >= 0; --i) {
      Context cx2=nodes.get(i).cx;
      NodeFactory nodeFactory=cx2.getNodeFactory();
      String name=includes.get(i).name;
      LiteralStringNode first=nodeFactory.literalString(name,0);
      IncludeDirectiveNode idn=nodeFactory.includeDirective(cx2,first,nodes.get(i));
      StatementListNode istmts=nodeFactory.statementList(null,idn);
      ObjectList<Node> items=istmts.items;
      stmts.addAll(0,items);
    }
  }
  node.pkgdefs.clear();
  node.pkgdefs.addAll(cx.getNodeFactory().pkg_defs);
  if (show_parsetrees && cx.errorCount() == 0) {
    printParseTrees(cx.scriptName(),node,cx,"String_Node_Str");
    return;
  }
  if (cx.errorCount() == 0) {
    ConfigurationEvaluator ce=new ConfigurationEvaluator();
    node.evaluate(cx,ce);
  }
  if (cx.errorCount() == 0) {
    FlowGraphEmitter flowem=new FlowGraphEmitter(cx,filename,show_flow);
    FlowAnalyzer flower=new FlowAnalyzer(flowem);
    node.evaluate(cx,flower);
    node.evaluate(cx,flower);
  }
  if (cx.errorCount() == 0) {
    if (emit_metadata) {
      MetaDataEvaluator printer=new MetaDataEvaluator(emit_debug_info);
      node.evaluate(cx,printer);
    }
  }
  if (cx.errorCount() == 0) {
    ConstantEvaluator analyzer=new ConstantEvaluator(cx);
    node.evaluate(cx,analyzer);
  }
  if (cx.errorCount() == 0 && emit_doc_info) {
    MetaDataEvaluator printer=new MetaDataEvaluator();
    node.evaluate(cx,printer);
    StringBuilder out=new StringBuilder();
    out.append("String_Node_Str").append(newline);
    ObjectList<DocCommentNode> comments=printer.doccomments;
    int numComments=comments.size();
    Node prev=null;
    for (int x=0; x < numComments; x++) {
      DocCommentNode d=comments.get(x);
      if (d.def == prev && d.values == null && d.id == null)       continue;
      d.emit(cx,out);
      prev=d.def;
    }
    out.append(newline).append("String_Node_Str").append(newline);
    BufferedOutputStream warningOut=null;
    try {
      String outName=cx.scriptName() + "String_Node_Str";
      warningOut=new BufferedOutputStream(new FileOutputStream(new File(cx.path(),outName)));
      warningOut.write(out.toString().getBytes());
      warningOut.flush();
    }
 catch (    IOException ex) {
      ex.printStackTrace();
    }
 finally {
      if (warningOut != null) {
        try {
          warningOut.close();
          System.err.println("String_Node_Str" + cx.path() + "String_Node_Str"+ cx.scriptName()+ "String_Node_Str");
        }
 catch (        IOException ex) {
        }
      }
    }
    return;
  }
  if (lint_mode && cx.errorCount() == 0) {
    LintEvaluator evaluator=new LintEvaluator(cx,filename,(String)null);
    node.evaluate(cx,evaluator);
    evaluator.logWarnings(cx);
    evaluator.clear();
  }
  if (cx.errorCount() == 0) {
    Emitter emitter=cx.getEmitter();
    CodeGenerator generator=new CodeGenerator(emitter);
    node.evaluate(cx,generator);
  }
  cx.popScope();
}