Search in sources :

Example 6 with List

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

the class ASTBasedABSTestRunnerGenerator method generateAsyncTestCallAST.

private void generateAsyncTestCallAST(Block block, String objectRef, MethodSig method) {
    List<PureExp> args = new List<>();
    if (method.getNumParam() > 0) {
        args.add(new VarUse(dataValue));
    }
    block.addStmtNoTransform(getVAssign(fut, new AsyncCall(new VarUse(objectRef), method.getName(), args)));
    block.addStmtNoTransform(getVAssign(futs, getFnApp("Insert", new VarUse(fut), new VarUse(futs))));
}
Also used : List(abs.frontend.ast.List) PureExp(abs.frontend.ast.PureExp) AsyncCall(abs.frontend.ast.AsyncCall) VarUse(abs.frontend.ast.VarUse)

Example 7 with List

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

the class ASTBasedABSTestRunnerGenerator method generateImportsAST.

private List<Import> generateImportsAST() {
    List<Import> imports = new List<>();
    Set<String> mn = new HashSet<>();
    Set<String> qn = new HashSet<>();
    for (InterfaceDecl key : tests.keySet()) {
        getImportsFrom(mn, qn, key.getModuleDecl());
        for (ClassDecl clazz : tests.get(key)) {
            getImportsFrom(mn, qn, clazz.getModuleDecl());
        }
    }
    for (String m : mn) {
        imports.add(new StarImport(m));
    }
    if (!qn.isEmpty()) {
        List<Name> names = new List<>();
        for (String q : qn) {
            names.add(new Name(q));
        }
        imports.add(new NamedImport(names));
    }
    return imports;
}
Also used : NamedImport(abs.frontend.ast.NamedImport) StarImport(abs.frontend.ast.StarImport) FromImport(abs.frontend.ast.FromImport) Import(abs.frontend.ast.Import) ClassDecl(abs.frontend.ast.ClassDecl) StarImport(abs.frontend.ast.StarImport) List(abs.frontend.ast.List) InterfaceDecl(abs.frontend.ast.InterfaceDecl) HashSet(java.util.HashSet) Name(abs.frontend.ast.Name) NamedImport(abs.frontend.ast.NamedImport)

Aggregations

List (abs.frontend.ast.List)7 ClassDecl (abs.frontend.ast.ClassDecl)6 Test (org.junit.Test)5 CompilationUnit (abs.frontend.ast.CompilationUnit)3 DeltaAccess (abs.frontend.ast.DeltaAccess)3 DeltaDecl (abs.frontend.ast.DeltaDecl)3 InterfaceDecl (abs.frontend.ast.InterfaceDecl)3 MethodSig (abs.frontend.ast.MethodSig)3 Model (abs.frontend.ast.Model)3 ModifyClassModifier (abs.frontend.ast.ModifyClassModifier)3 Block (abs.frontend.ast.Block)2 Decl (abs.frontend.ast.Decl)2 MethodImpl (abs.frontend.ast.MethodImpl)2 ModuleDecl (abs.frontend.ast.ModuleDecl)2 SkipStmt (abs.frontend.ast.SkipStmt)2 AddMethodModifier (abs.frontend.ast.AddMethodModifier)1 AsyncCall (abs.frontend.ast.AsyncCall)1 FromImport (abs.frontend.ast.FromImport)1 Import (abs.frontend.ast.Import)1 ModifyMethodModifier (abs.frontend.ast.ModifyMethodModifier)1