private IType checkItemIterator(IType elemType, Context context) throws SyntaxError { Context child = context.newChildContext(); Identifier itemName = v2 == null ? v1 : v2; context.registerValue(new Variable(itemName, elemType)); if (v2 != null) context.registerValue(new Variable(v1, IntegerType.instance())); return instructions.check(child); }
private IValue evaluateItemIteratorWithIndex(IType elemType, Context context) throws PromptoError { IValue src = source.interpret(context); Iterator<IValue> iterator = getIterator(context, src); long index = 0L; while (iterator.hasNext()) { Context child = context.newChildContext(); child.registerValue(new Variable(v2, elemType)); child.setValue(v2, iterator.next()); child.registerValue(new Variable(v1, IntegerType.instance())); child.setValue(v1, new Integer(++index)); IValue value = instructions.interpret(child); if (value != null) return value; } return null; }