this.iterIndex = iterIndex;
this.itemIndex = itemIndex;
}
public Object execute(final Context context) {
Iter iter = CollectionUtil.toIter(collectionExpr.execute(context), this);
if (iter != null && functionDeclareExpr != null) {
iter = new IterMethodFilter(context, functionDeclareExpr.execute(context), iter);
}
if (iter != null
&& iter.hasNext()) {
final int preIndex = context.indexer;
context.indexer = indexer;
final Statement[] stats = this.statements;
final int myLabel = this.label;
final int index = this.itemIndex;
final Object[] vars = context.vars;
vars[iterIndex] = iter;
label:
do {
vars[index] = iter.next();
StatementUtil.executeInvertedAndCheckLoops(stats, context);
if (context.hasLoop()) {
if (context.matchLabel(myLabel)) {
switch (context.getLoopType()) {
case LoopInfo.BREAK:
context.resetLoop();
break label; // while
case LoopInfo.RETURN:
//can't deal
break label; //while
case LoopInfo.CONTINUE:
context.resetLoop();
break; //switch
default:
break label; //while
}
} else {
break;
}
}
} while (iter.hasNext());
context.indexer = preIndex;
return null;
} else if (elseStatement != null) {
elseStatement.execute(context);
}