Program: 45373
Project: 45373
Buggy source:
public Node forInStatement(boolean is_each,Node expr1,Node expr2,Node stmt,int pos){
  if (!cx.scriptAssistParsing) {
    if (stmt != null && !stmt.isStatementList()) {
      stmt=statementList(null,stmt);
    }
    VariableDefinitionNode vard=null;
    if (expr1.isDefinition()) {
      vard=(VariableDefinitionNode)expr1;
      VariableBindingNode varb=(VariableBindingNode)vard.list.items.back();
      TypedIdentifierNode var=varb.variable;
      expr1=var.identifier;
    }
 else {
      ListNode list=(ListNode)expr1;
      expr1=list.items.back();
    }
    RegisterNode ndx_reg=register(pos);
    RegisterNode obj_reg=register(pos);
    Node init;
    Node test;
    Node untypedExpr=coerce(expr2,null,cx.noType().getDefaultTypeInfo(),true,pos);
    init=list(list(null,storeRegister(ndx_reg,literalNumber("String_Node_Str",pos),cx.intType(),pos)),storeRegister(obj_reg,untypedExpr,cx.noType(),pos));
    test=hasNext(obj_reg,ndx_reg,pos);
    Node incr;
    if (is_each) {
      incr=expressionStatement(assignmentExpression(expr1,ASSIGN_TOKEN,memberExpression(loadRegister(obj_reg,cx.noType(),pos),invoke("String_Node_Str",argumentList(null,loadRegister(ndx_reg,cx.intType(),pos)),pos))));
    }
 else {
      incr=expressionStatement(assignmentExpression(expr1,ASSIGN_TOKEN,memberExpression(loadRegister(obj_reg,cx.noType(),pos),invoke("String_Node_Str",argumentList(null,loadRegister(ndx_reg,cx.intType(),pos)),expr1.pos()))));
    }
    stmt=statementList(statementList(null,incr),stmt);
    Node node=forStatement(init,test,null,stmt,true,(pos == -1) ? expr1.pos() : pos);
    if (vard != null) {
      StatementListNode stmtlist=this.statementList(this.statementList(null,vard),node);
      node=stmtlist;
    }
    return node;
  }
 else {
    if (stmt != null && !stmt.isStatementList()) {
      stmt=this.statementList(null,stmt);
    }
    VariableDefinitionNode vard=null;
    if (expr1 != null && expr1.isDefinition()) {
      vard=(VariableDefinitionNode)expr1;
      expr1=null;
    }
    if (expr1 != null)     pos=expr1.pos();
 else     if (expr2 != null)     pos=expr2.pos();
    Node node=new ForStatementNode(expr1,expr2,null,stmt,true);
    node.setPositionNonterminal(expr1,pos);
    if (vard != null) {
      StatementListNode stmtlist=this.statementList(this.statementList(null,vard),node);
      node=stmtlist;
      stmtlist.is_loop=true;
    }
 else {
      StatementListNode stmtlist=(stmt instanceof StatementListNode) ? (StatementListNode)stmt : null;
      if (stmtlist != null) {
        stmtlist.is_loop=true;
      }
    }
    return node;
  }
}

Fixed version (ground truth):
public Node forInStatement(boolean is_each,Node expr1,Node expr2,Node stmt,int pos){
  if (!cx.scriptAssistParsing) {
    if (stmt != null && !stmt.isStatementList()) {
      stmt=statementList(null,stmt);
    }
    VariableDefinitionNode vard=null;
    if (expr1.isDefinition()) {
      vard=(VariableDefinitionNode)expr1;
      VariableBindingNode varb=(VariableBindingNode)vard.list.items.back();
      TypedIdentifierNode var=varb.variable;
      expr1=var.identifier;
    }
 else {
      ListNode list=(ListNode)expr1;
      expr1=list.items.back();
    }
    RegisterNode ndx_reg=register(pos);
    RegisterNode obj_reg=register(pos);
    Node init;
    Node test;
    Node untypedExpr=coerce(expr2,null,cx.noType().getDefaultTypeInfo(),true,pos);
    init=list(list(null,storeRegister(ndx_reg,literalNumber("String_Node_Str",pos),cx.intType(),pos)),storeRegister(obj_reg,untypedExpr,cx.noType(),pos));
    test=hasNext(obj_reg,ndx_reg,pos);
    Node incr;
    if (is_each) {
      incr=expressionStatement(assignmentExpression(expr1,ASSIGN_TOKEN,memberExpression(loadRegister(obj_reg,cx.noType(),pos),invoke("String_Node_Str",argumentList(null,loadRegister(ndx_reg,cx.intType(),pos)),pos))));
    }
 else {
      incr=expressionStatement(assignmentExpression(expr1,ASSIGN_TOKEN,memberExpression(loadRegister(obj_reg,cx.noType(),pos),invoke("String_Node_Str",argumentList(null,loadRegister(ndx_reg,cx.intType(),pos)),expr1.pos()))));
    }
    stmt=statementList(statementList(null,incr),stmt);
    Node node=forStatement(init,test,null,stmt,true,(pos == -1) ? expr1.pos() : pos);
    if (vard != null) {
      StatementListNode stmtlist=this.statementList(this.statementList(null,vard),node);
      if (stmtlist != null)       stmtlist.is_loop=true;
      node=stmtlist;
    }
    return node;
  }
 else {
    if (stmt != null && !stmt.isStatementList()) {
      stmt=this.statementList(null,stmt);
    }
    VariableDefinitionNode vard=null;
    if (expr1 != null && expr1.isDefinition()) {
      vard=(VariableDefinitionNode)expr1;
      expr1=null;
    }
    if (expr1 != null)     pos=expr1.pos();
 else     if (expr2 != null)     pos=expr2.pos();
    Node node=new ForStatementNode(expr1,expr2,null,stmt,true);
    node.setPositionNonterminal(expr1,pos);
    if (vard != null) {
      StatementListNode stmtlist=this.statementList(this.statementList(null,vard),node);
      node=stmtlist;
      stmtlist.is_loop=true;
    }
 else {
      StatementListNode stmtlist=(stmt instanceof StatementListNode) ? (StatementListNode)stmt : null;
      if (stmtlist != null) {
        stmtlist.is_loop=true;
      }
    }
    return node;
  }
}