Search in sources :

Example 21 with Sequential

use of ceylon.language.Sequential in project ceylon by eclipse.

the class Metamodel method getMetamodelSequential.

@SuppressWarnings({ "unchecked", "rawtypes" })
public static Sequential<? extends ceylon.language.meta.declaration.OpenType> getMetamodelSequential(List<Type> types) {
    if (types.isEmpty())
        return (Sequential<? extends ceylon.language.meta.declaration.OpenType>) (Sequential) empty_.get_();
    ceylon.language.meta.declaration.OpenType[] ret = new ceylon.language.meta.declaration.OpenType[types.size()];
    int i = 0;
    TypeDescriptor td = TypeDescriptor.NothingType;
    for (Type pt : types) {
        OpenType mm = Metamodel.getMetamodel(pt);
        td = TypeDescriptor.union(((ReifiedType) mm).$getType$());
        ret[i++] = mm;
    }
    return Util.sequentialWrapper(td, ret);
}
Also used : OpenType(ceylon.language.meta.declaration.OpenType) ReifiedType(org.eclipse.ceylon.compiler.java.runtime.model.ReifiedType) NothingType(org.eclipse.ceylon.model.typechecker.model.NothingType) OpenClassOrInterfaceType(ceylon.language.meta.declaration.OpenClassOrInterfaceType) OpenType(ceylon.language.meta.declaration.OpenType) DeclarationType(org.eclipse.ceylon.model.loader.ModelLoader.DeclarationType) Type(org.eclipse.ceylon.model.typechecker.model.Type) UnknownType(org.eclipse.ceylon.model.typechecker.model.UnknownType) Sequential(ceylon.language.Sequential) TypeDescriptor(org.eclipse.ceylon.compiler.java.runtime.model.TypeDescriptor) ReifiedType(org.eclipse.ceylon.compiler.java.runtime.model.ReifiedType)

Aggregations

Sequential (ceylon.language.Sequential)21 Metamodel (org.eclipse.ceylon.compiler.java.runtime.metamodel.Metamodel)16 ArrayList (java.util.ArrayList)12 ObjectArrayIterable (org.eclipse.ceylon.compiler.java.language.ObjectArrayIterable)12 TypeInfo (org.eclipse.ceylon.compiler.java.metadata.TypeInfo)12 TypeDescriptor (org.eclipse.ceylon.compiler.java.runtime.model.TypeDescriptor)12 TypeParameters (org.eclipse.ceylon.compiler.java.metadata.TypeParameters)10 ReifiedType (org.eclipse.ceylon.compiler.java.runtime.model.ReifiedType)9 ClassDeclaration (ceylon.language.meta.declaration.ClassDeclaration)6 ClassDeclarationImpl (org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.ClassDeclarationImpl)5 Declaration (org.eclipse.ceylon.model.typechecker.model.Declaration)5 Type (org.eclipse.ceylon.model.typechecker.model.Type)5 TypeDeclaration (org.eclipse.ceylon.model.typechecker.model.TypeDeclaration)4 AssertionError (ceylon.language.AssertionError)3 CallableConstructorDeclaration (ceylon.language.meta.declaration.CallableConstructorDeclaration)3 ClassOrInterfaceDeclaration (ceylon.language.meta.declaration.ClassOrInterfaceDeclaration)3 OpenType (ceylon.language.meta.declaration.OpenType)3 ValueConstructorDeclaration (ceylon.language.meta.declaration.ValueConstructorDeclaration)3 ValueDeclaration (ceylon.language.meta.declaration.ValueDeclaration)3 Attribute (ceylon.language.meta.model.Attribute)3