use of com.rockwellcollins.atc.agree.agree.IndicesExpr in project AGREE by loonwerks.
the class AgreeASTBuilder method caseIndicesExpr.
@Override
public Expr caseIndicesExpr(IndicesExpr expr) {
AgreeTypeSystem.TypeDef arrayTypeDef = AgreeTypeSystem.infer(expr.getArray());
if (arrayTypeDef instanceof AgreeTypeSystem.ArrayTypeDef) {
int size = ((AgreeTypeSystem.ArrayTypeDef) arrayTypeDef).size;
List<Expr> elems = new ArrayList<>();
for (int i = 0; i < size; i++) {
elems.add(new IntExpr(i + 1));
}
return new ArrayExpr(elems);
}
throw new RuntimeException("Error caseIndicesExpr");
}
Aggregations