use of org.btrplace.safeplace.spec.type.ListType in project scheduler by btrplace.
the class MyCstrSpecVisitor method visitArrayTerm.
@Override
public Term<?> visitArrayTerm(@NotNull CstrSpecParser.ArrayTermContext ctx) {
String lbl = ctx.ID().getText();
Var v = symbols.getVar(lbl);
if (v == null) {
throw SpecException.unknownSymbol(filename, ctx.ID().getSymbol());
}
// Type check
if (!(v.type() instanceof ListType)) {
throw new SpecException(filename, ctx.ID().getSymbol().getCharPositionInLine(), "List expected. Got '" + v.type() + "')");
}
Term idx = (Term<?>) visit(ctx.term());
assertEqualsTypes(ctx.term().getStart(), IntType.getInstance(), idx.type());
return new ValueAt(v, idx);
}
Aggregations