__eval.setCurrentAST(this);
__eval.notifyAboutSuspension(this);
int size = this.getVariables().size();
QualifiedName vars[] = new QualifiedName[size];
IValue currentValue[] = new IValue[size];
Environment old = __eval.getCurrentEnvt();
try {
List<QualifiedName> varList = this.getVariables();
for (int i = 0; i < size; i++) {
QualifiedName var = varList.get(i);
vars[i] = var;
Result<IValue> tmp = __eval.getCurrentEnvt().getSimpleVariable(var);
if (tmp == null) {
throw new UndeclaredVariable(Names.fullName(var), var);
}
if (tmp.getValue() == null) {
throw new UninitializedVariable(Names.fullName(var),
var);
}
currentValue[i] = tmp.getValue();
}
__eval.pushEnv();
org.rascalmpl.ast.Statement body = this.getBody();
int max = -1;
Bound bound = this.getBound();
if (bound.isDefault()) {
Result<IValue> res = bound.getExpression()
.interpret(__eval);
if (!res.getType().isInteger()) {
throw new UnexpectedType(
org.rascalmpl.interpreter.Evaluator.__getTf()
.integerType(), res.getType(), this);
}
max = ((IInteger) res.getValue()).intValue();
if (max <= 0) {
throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
.indexOutOfBounds((IInteger) res.getValue(),
__eval.getCurrentAST(), __eval
.getStackTrace());
}
}
Result<IValue> bodyResult = null;
boolean change = true;
int iterations = 0;
while (change && (max == -1 || iterations < max)) {
change = false;
iterations++;
if (__eval.isInterrupted()) {
throw new InterruptException(__eval.getStackTrace(), __eval.getCurrentAST().getLocation());
}
bodyResult = body.interpret(__eval);
for (int i = 0; i < size; i++) {
QualifiedName var = vars[i];
Result<IValue> v = __eval.getCurrentEnvt().getVariable(
var);
if (currentValue[i] == null
|| !v.getValue().isEqual(currentValue[i])) {
change = true;