Search in sources :

Example 1 with ImportImpl

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

the class ModuleImpl method getDependencies.

@Override
@TypeInfo("ceylon.language::Sequential<ceylon.language.meta.declaration::Import>")
public Sequential<? extends Import> getDependencies() {
    // no need to synchronise as concurrent invocations should get the same array back
    if (this.dependencies == null) {
        List<org.eclipse.ceylon.model.typechecker.model.ModuleImport> modelImports = declaration.getImports();
        // FreeImport[] imports = new FreeImport[modelImports.size()];
        ArrayList<ImportImpl> sb = new ArrayList<ImportImpl>(modelImports.size());
        for (org.eclipse.ceylon.model.typechecker.model.ModuleImport moduleImport : modelImports) {
            sb.add(new ImportImpl(this, moduleImport));
        }
        ImportImpl[] array = sb.toArray(new ImportImpl[0]);
        this.dependencies = new ObjectArrayIterable<ImportImpl>(Import.$TypeDescriptor$, array).sequence();
    }
    return this.dependencies;
}
Also used : ArrayList(java.util.ArrayList) ObjectArrayIterable(org.eclipse.ceylon.compiler.java.language.ObjectArrayIterable) Metamodel(org.eclipse.ceylon.compiler.java.runtime.metamodel.Metamodel) ImportImpl(org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.ImportImpl) TypeInfo(org.eclipse.ceylon.compiler.java.metadata.TypeInfo)

Aggregations

ArrayList (java.util.ArrayList)1 ObjectArrayIterable (org.eclipse.ceylon.compiler.java.language.ObjectArrayIterable)1 TypeInfo (org.eclipse.ceylon.compiler.java.metadata.TypeInfo)1 Metamodel (org.eclipse.ceylon.compiler.java.runtime.metamodel.Metamodel)1 ImportImpl (org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.ImportImpl)1