Search in sources :

Example 1 with StarImport

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

the class ABSUnitTestCaseTranslator method addImports.

private void addImports(ModuleDecl module) {
    // export *;
    // import * from AbsUnit;
    // import * from AbsUnit.Hamcrest;
    // import * from AbsUnit.Hamcrest.Core;
    module.addExport(new StarExport());
    module.addImport(new StarImport("AbsUnit"));
    module.addImport(new StarImport("AbsUnit.Hamcrest"));
    module.addImport(new StarImport("AbsUnit.Hamcrest.Core"));
    for (String ip : importModules) {
        module.addImport(new StarImport(ip));
    }
}
Also used : StarImport(abs.frontend.ast.StarImport) StarExport(abs.frontend.ast.StarExport)

Example 2 with StarImport

use of abs.frontend.ast.StarImport 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

StarImport (abs.frontend.ast.StarImport)2 ClassDecl (abs.frontend.ast.ClassDecl)1 FromImport (abs.frontend.ast.FromImport)1 Import (abs.frontend.ast.Import)1 InterfaceDecl (abs.frontend.ast.InterfaceDecl)1 List (abs.frontend.ast.List)1 Name (abs.frontend.ast.Name)1 NamedImport (abs.frontend.ast.NamedImport)1 StarExport (abs.frontend.ast.StarExport)1 HashSet (java.util.HashSet)1