try {
IList list = (IList) rec.getValue();
IValue repl = __eval.__getValue().getValue();
if(!repl.getType().isList()){
throw new UnexpectedType(rec.getType(), repl.getType(), __eval.__getEval().getCurrentAST());
}
__eval.__setValue(__eval.newResult(list, __eval.__getValue()));
list = list.replace(firstIndex, secondIndex, endIndex, (IList) repl);
result = org.rascalmpl.interpreter.result.ResultFactory
.makeResult(rec.hasInferredType() ? rec.getType()
.lub(list.getType()) : rec.getType(), list,
__eval.__getEval());
} catch (IndexOutOfBoundsException e) { // include last in message
throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
.indexOutOfBounds((IInteger) first.getValue(),
__eval.__getEval().getCurrentAST(), __eval
.__getEval().getStackTrace());
}
} else if (rec.getType().isString()) {
try {
IString str = (IString) rec.getValue();
IValue repl = __eval.__getValue().getValue();
if(!repl.getType().isString()){
throw new UnexpectedType(rec.getType(), repl.getType(), __eval.__getEval().getCurrentAST());
}
__eval.__setValue(__eval.newResult(str, __eval.__getValue()));
str = str.replace(firstIndex, secondIndex, endIndex, (IString) repl);
result = org.rascalmpl.interpreter.result.ResultFactory
.makeResult(rec.hasInferredType() ? rec.getType()
.lub(str.getType()) : rec.getType(), str,
__eval.__getEval());
} catch (IndexOutOfBoundsException e) { // include last in message
throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
.indexOutOfBounds((IInteger) first.getValue(),
__eval.__getEval().getCurrentAST(), __eval
.__getEval().getStackTrace());
}
} else if (rec.getType().isNode()) {
try {
INode node = (INode) rec.getValue();
IValue repl = __eval.__getValue().getValue();
if(!repl.getType().isList()){
throw new UnexpectedType(rec.getType(), repl.getType(), __eval.__getEval().getCurrentAST());
}
__eval.__setValue(__eval.newResult(node, __eval.__getValue()));
node = node.replace(firstIndex, secondIndex, endIndex, (IList) repl);