int nFields = selectedFields.length;
int fieldIndices[] = new int[nFields];
Type baseType = this.getType();
for (int i = 0; i < nFields; i++) {
Field f = selectedFields[i];
if (f.isIndex()) {
fieldIndices[i] = ((IInteger) f.getFieldIndex()
.interpret(this.ctx.getEvaluator()).getValue()).intValue();
} else {
String fieldName = org.rascalmpl.interpreter.utils.Names
.name(f.getFieldName());
try {
fieldIndices[i] = baseType.getFieldIndex(fieldName);
} catch (UndeclaredFieldException e) {
throw new UndeclaredField(fieldName, baseType,
ctx.getCurrentAST());