Search in sources :

Example 1 with DataConstructorExp

use of abs.frontend.ast.DataConstructorExp in project abstools by abstools.

the class AnnotationTests method assertHasLocAnnotation.

private void assertHasLocAnnotation(Type t, String s) {
    List<TypeAnnotation> anns = t.getTypeAnnotations();
    TypeAnnotation a = anns.get(0);
    assertEquals("LocationType", a.getType().getSimpleName());
    assertEquals(s, ((DataConstructorExp) a.getValue()).getDecl().getName());
}
Also used : TypeAnnotation(abs.frontend.typechecker.TypeAnnotation) DataConstructorExp(abs.frontend.ast.DataConstructorExp)

Example 2 with DataConstructorExp

use of abs.frontend.ast.DataConstructorExp in project abstools by abstools.

the class PureExpressionBuilder method parseValue.

DataConstructorExp parseValue(String currentHeapReference, List<String> initialisationsOrders, String testName, Set<String> heap, ABSTerm term) {
    final DataConstructorExp result = new DataConstructorExp();
    String fn = getABSTermFunctor(term);
    result.setConstructor(fn);
    result.setParamList(new abs.frontend.ast.List<PureExp>());
    List<ABSData> vs = getABSTermArgs(term);
    for (int i = 0; i < vs.size(); i++) {
        result.setParam(createPureExpression(currentHeapReference, initialisationsOrders, testName, heap, vs.get(i)), i);
    }
    return result;
}
Also used : DataConstructorExp(abs.frontend.ast.DataConstructorExp) ABSData(apet.testCases.ABSData) PureExp(abs.frontend.ast.PureExp)

Example 3 with DataConstructorExp

use of abs.frontend.ast.DataConstructorExp in project abstools by abstools.

the class ASTBasedABSTestRunnerGenerator method generateMainBlockAST.

private MainBlock generateMainBlockAST(List<Import> list) {
    final MainBlock block = new MainBlock();
    DataConstructorExp empty = new DataConstructorExp("EmptySet", new List<>());
    VarDeclStmt futsStatement = getVarDecl(futs, getType("Set", getFutUnitType()), empty);
    block.addStmtNoTransform(futsStatement);
    VarDeclStmt futStatement = getVarDecl(fut, getFutUnitType(), null);
    block.addStmtNoTransform(futStatement);
    Set<TypeUse> use = new HashSet<>();
    for (InterfaceDecl key : tests.keySet()) {
        for (ClassDecl clazz : tests.get(key)) {
            use.addAll(generateTestClassImplAST(key, clazz, block));
        }
    }
    block.addStmtNoTransform(generateWaitSyncAST());
    return block;
}
Also used : DataConstructorExp(abs.frontend.ast.DataConstructorExp) TypeUse(abs.frontend.ast.TypeUse) ParametricDataTypeUse(abs.frontend.ast.ParametricDataTypeUse) DataTypeUse(abs.frontend.ast.DataTypeUse) ClassDecl(abs.frontend.ast.ClassDecl) VarDeclStmt(abs.frontend.ast.VarDeclStmt) InterfaceDecl(abs.frontend.ast.InterfaceDecl) MainBlock(abs.frontend.ast.MainBlock) HashSet(java.util.HashSet)

Example 4 with DataConstructorExp

use of abs.frontend.ast.DataConstructorExp in project abstools by abstools.

the class AnnotationHelper method getAnnotationsOfType.

public static java.util.List<Annotation> getAnnotationsOfType(List<Annotation> annos, String qualifiedName) {
    ArrayList<Annotation> res = new ArrayList<>();
    for (Annotation a : annos) {
        if (a.getType().getQualifiedName().equals(qualifiedName)) {
            DataConstructorExp de = (DataConstructorExp) a.getValue();
            res.add(a);
        }
    }
    return res;
}
Also used : DataConstructorExp(abs.frontend.ast.DataConstructorExp) ArrayList(java.util.ArrayList) Annotation(abs.frontend.ast.Annotation)

Aggregations

DataConstructorExp (abs.frontend.ast.DataConstructorExp)4 Annotation (abs.frontend.ast.Annotation)1 ClassDecl (abs.frontend.ast.ClassDecl)1 DataTypeUse (abs.frontend.ast.DataTypeUse)1 InterfaceDecl (abs.frontend.ast.InterfaceDecl)1 MainBlock (abs.frontend.ast.MainBlock)1 ParametricDataTypeUse (abs.frontend.ast.ParametricDataTypeUse)1 PureExp (abs.frontend.ast.PureExp)1 TypeUse (abs.frontend.ast.TypeUse)1 VarDeclStmt (abs.frontend.ast.VarDeclStmt)1 TypeAnnotation (abs.frontend.typechecker.TypeAnnotation)1 ABSData (apet.testCases.ABSData)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1