Search in sources :

Example 1 with SyncCall

use of org.abs_models.frontend.ast.SyncCall 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;
    }
    TypeIdUse 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(org.abs_models.frontend.ast.MethodSig) DataTypeUse(org.abs_models.frontend.ast.DataTypeUse) TypeUse(org.abs_models.frontend.ast.TypeUse) ParametricDataTypeUse(org.abs_models.frontend.ast.ParametricDataTypeUse) SyncCall(org.abs_models.frontend.ast.SyncCall) TypeIdUse(org.abs_models.frontend.ast.TypeIdUse) VarUse(org.abs_models.frontend.ast.VarUse) ParametricDataTypeUse(org.abs_models.frontend.ast.ParametricDataTypeUse)

Example 2 with SyncCall

use of org.abs_models.frontend.ast.SyncCall in project abstools by abstools.

the class AbsASTBuilderUtil method getCall.

public static final Call getCall(PureExp who, String method, boolean sync, PureExp... exps) {
    Call call;
    if (sync) {
        call = new SyncCall();
    } else {
        call = new AsyncCall();
    }
    call.setCallee(who);
    call.setMethod(method);
    for (int i = 0; i < exps.length; i++) {
        call.setParam(exps[i], i);
    }
    return call;
}
Also used : SyncCall(org.abs_models.frontend.ast.SyncCall) Call(org.abs_models.frontend.ast.Call) AsyncCall(org.abs_models.frontend.ast.AsyncCall) SyncCall(org.abs_models.frontend.ast.SyncCall) AsyncCall(org.abs_models.frontend.ast.AsyncCall)

Aggregations

SyncCall (org.abs_models.frontend.ast.SyncCall)2 AsyncCall (org.abs_models.frontend.ast.AsyncCall)1 Call (org.abs_models.frontend.ast.Call)1 DataTypeUse (org.abs_models.frontend.ast.DataTypeUse)1 MethodSig (org.abs_models.frontend.ast.MethodSig)1 ParametricDataTypeUse (org.abs_models.frontend.ast.ParametricDataTypeUse)1 TypeIdUse (org.abs_models.frontend.ast.TypeIdUse)1 TypeUse (org.abs_models.frontend.ast.TypeUse)1 VarUse (org.abs_models.frontend.ast.VarUse)1