this.valueIndex = valueIndex;
}
@SuppressWarnings("unchecked")
public Object execute(final Context context) {
KeyIter iter = CollectionUtil.toKeyIter(mapExpr.execute(context), this);
if (iter != null && functionDeclareExpr != null) {
iter = new KeyIterMethodFilter(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 indexOfKey = this.keyIndex;
final int indexOfValue = this.valueIndex;
final Object[] vars = context.vars;
vars[iterIndex] = iter;
label:
do {
vars[indexOfKey] = iter.next();
vars[indexOfValue] = iter.value();
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
}
}
} while (iter.hasNext());
context.indexer = preIndex;
return null;
} else if (elseStatement != null) {
elseStatement.execute(context);
}