Type declaredType = typeOf(__eval.getCurrentEnvt(), true, __eval);
if (!__eval.getCurrentEnvt().declareVariable(declaredType,
var.getName())) {
throw new RedeclaredVariable(varAsString, var);
}
if (v.getType().isSubtypeOf(declaredType)) {
// TODO: do we actually want to instantiate the locally
// bound type parameters?
Map<Type, Type> bindings = new HashMap<Type, Type>();
declaredType.match(v.getType(), bindings);
declaredType = declaredType.instantiate(bindings);
// Was: r = makeResult(declaredType,
// applyRules(v.getValue()));
r = org.rascalmpl.interpreter.result.ResultFactory
.makeResult(declaredType, v.getValue(), __eval);
__eval.getCurrentEnvt().storeVariable(var.getName(), r);
} else {
throw new UnexpectedType(declaredType,
v.getType(), var);
}
} else {
Type declaredType = typeOf(__eval.getCurrentEnvt(), true, __eval);
if (!__eval.getCurrentEnvt().declareVariable(declaredType,
var.getName())) {
throw new RedeclaredVariable(varAsString, var);
}
}
}
return r;