Search in sources :

Example 1 with ModuleImpl

use of org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.ModuleImpl in project ceylon by eclipse.

the class Metamodel method getModuleList.

public static Sequential<? extends ceylon.language.meta.declaration.Module> getModuleList() {
    // FIXME: this probably needs synchronisation to avoid new modules loaded during traversal
    Set<org.eclipse.ceylon.model.typechecker.model.Module> modules = moduleManager.getModules().getListOfModules();
    org.eclipse.ceylon.model.typechecker.model.Module[] view = new org.eclipse.ceylon.model.typechecker.model.Module[modules.size()];
    modules.toArray(view);
    ceylon.language.meta.declaration.Module[] array = new ceylon.language.meta.declaration.Module[view.length];
    int i = 0;
    for (org.eclipse.ceylon.model.typechecker.model.Module module : view) {
        // optional means don't throw if it's not available
        ModuleImpl mod = getOrCreateMetamodel(null, module, null, true);
        // skip unavailable modules
        if (mod != null)
            array[i++] = mod;
    }
    ObjectArrayIterable<ceylon.language.meta.declaration.Module> iterable = new ObjectArrayIterable<ceylon.language.meta.declaration.Module>(ceylon.language.meta.declaration.Module.$TypeDescriptor$, array);
    return iterable.take(i).sequence();
}
Also used : ModuleImpl(org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.ModuleImpl) ObjectArrayIterable(org.eclipse.ceylon.compiler.java.language.ObjectArrayIterable) Metamodel(org.eclipse.ceylon.compiler.java.runtime.metamodel.Metamodel) Module(ceylon.language.meta.declaration.Module)

Aggregations

Module (ceylon.language.meta.declaration.Module)1 ObjectArrayIterable (org.eclipse.ceylon.compiler.java.language.ObjectArrayIterable)1 Metamodel (org.eclipse.ceylon.compiler.java.runtime.metamodel.Metamodel)1 ModuleImpl (org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.ModuleImpl)1