Search in sources :

Example 1 with NamedImport

use of org.abs_models.frontend.ast.NamedImport 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 : Import(org.abs_models.frontend.ast.Import) NamedImport(org.abs_models.frontend.ast.NamedImport) StarImport(org.abs_models.frontend.ast.StarImport) FromImport(org.abs_models.frontend.ast.FromImport) ClassDecl(org.abs_models.frontend.ast.ClassDecl) StarImport(org.abs_models.frontend.ast.StarImport) List(org.abs_models.frontend.ast.List) InterfaceDecl(org.abs_models.frontend.ast.InterfaceDecl) HashSet(java.util.HashSet) Name(org.abs_models.frontend.ast.Name) NamedImport(org.abs_models.frontend.ast.NamedImport)

Aggregations

HashSet (java.util.HashSet)1 ClassDecl (org.abs_models.frontend.ast.ClassDecl)1 FromImport (org.abs_models.frontend.ast.FromImport)1 Import (org.abs_models.frontend.ast.Import)1 InterfaceDecl (org.abs_models.frontend.ast.InterfaceDecl)1 List (org.abs_models.frontend.ast.List)1 Name (org.abs_models.frontend.ast.Name)1 NamedImport (org.abs_models.frontend.ast.NamedImport)1 StarImport (org.abs_models.frontend.ast.StarImport)1