Search in sources :

Example 6 with TypeUse

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

the class ASTBasedABSTestRunnerGenerator method generateDataPointsAST.

private TypeUse generateDataPointsAST(InterfaceDecl key, ClassDecl clazz, Set<TypeUse> use, MainBlock block) {
    MethodSig dataPoint = findDataPoints(key);
    if (dataPoint == null) {
        return null;
    }
    Access rt = dataPoint.getReturnType();
    if (!(rt instanceof ParametricDataTypeUse)) {
        return null;
    }
    ParametricDataTypeUse prt = (ParametricDataTypeUse) rt;
    if (!prt.getName().equals("Set")) {
        return null;
    }
    // Set has only one type parameter
    TypeUse u = (TypeUse) prt.getParam(0).copy();
    use.add(u);
    String objName = uncap(clazz.getName()) + "dataPoint";
    String dataSet = dataPointSetName(clazz);
    block.addStmtNoTransform(newObj(key, clazz, objName, true));
    block.addStmtNoTransform(getVarDecl(dataSet, prt.copy(), new SyncCall(new VarUse(objName), dataPoint.getName(), new List<>())));
    return u;
}
Also used : MethodSig(abs.frontend.ast.MethodSig) TypeUse(abs.frontend.ast.TypeUse) ParametricDataTypeUse(abs.frontend.ast.ParametricDataTypeUse) DataTypeUse(abs.frontend.ast.DataTypeUse) SyncCall(abs.frontend.ast.SyncCall) Access(abs.frontend.ast.Access) VarUse(abs.frontend.ast.VarUse) ParametricDataTypeUse(abs.frontend.ast.ParametricDataTypeUse)

Aggregations

DataTypeUse (abs.frontend.ast.DataTypeUse)6 TypeUse (abs.frontend.ast.TypeUse)6 ParametricDataTypeUse (abs.frontend.ast.ParametricDataTypeUse)5 HashSet (java.util.HashSet)3 InterfaceDecl (abs.frontend.ast.InterfaceDecl)2 InterfaceTypeUse (abs.frontend.ast.InterfaceTypeUse)2 MainBlock (abs.frontend.ast.MainBlock)2 MethodSig (abs.frontend.ast.MethodSig)2 VarUse (abs.frontend.ast.VarUse)2 AbsASTBuilderUtil.getDecl (abs.backend.tests.AbsASTBuilderUtil.getDecl)1 Access (abs.frontend.ast.Access)1 Block (abs.frontend.ast.Block)1 ClassDecl (abs.frontend.ast.ClassDecl)1 DataConstructorExp (abs.frontend.ast.DataConstructorExp)1 DataTypeDecl (abs.frontend.ast.DataTypeDecl)1 Decl (abs.frontend.ast.Decl)1 FromImport (abs.frontend.ast.FromImport)1 Import (abs.frontend.ast.Import)1 ParametricDataTypeDecl (abs.frontend.ast.ParametricDataTypeDecl)1 SyncCall (abs.frontend.ast.SyncCall)1