Search in sources :

Example 11 with ReifiedType

use of org.eclipse.ceylon.compiler.java.runtime.model.ReifiedType in project ceylon by eclipse.

the class Metamodel method getProducedType.

public static Type getProducedType(TypeDescriptor reifiedType) {
    Type producedType;
    synchronized (getLock()) {
        producedType = typeDescriptorToProducedType.get(reifiedType);
        if (producedType == null) {
            producedType = reifiedType.toType(moduleManager);
            typeDescriptorToProducedType.put(reifiedType, producedType);
        }
    }
    return producedType;
}
Also used : 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)

Example 12 with ReifiedType

use of org.eclipse.ceylon.compiler.java.runtime.model.ReifiedType 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

ReifiedType (org.eclipse.ceylon.compiler.java.runtime.model.ReifiedType)12 Metamodel (org.eclipse.ceylon.compiler.java.runtime.metamodel.Metamodel)9 TypeDescriptor (org.eclipse.ceylon.compiler.java.runtime.model.TypeDescriptor)9 Sequential (ceylon.language.Sequential)8 TypeInfo (org.eclipse.ceylon.compiler.java.metadata.TypeInfo)8 TypeParameters (org.eclipse.ceylon.compiler.java.metadata.TypeParameters)7 ArrayList (java.util.ArrayList)6 ObjectArrayIterable (org.eclipse.ceylon.compiler.java.language.ObjectArrayIterable)6 ClassDeclaration (ceylon.language.meta.declaration.ClassDeclaration)3 ClassOrInterfaceDeclaration (ceylon.language.meta.declaration.ClassOrInterfaceDeclaration)3 OpenClassOrInterfaceType (ceylon.language.meta.declaration.OpenClassOrInterfaceType)3 OpenType (ceylon.language.meta.declaration.OpenType)3 ClassOrInterfaceDeclarationImpl (org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.ClassOrInterfaceDeclarationImpl)3 InterfaceDeclarationImpl (org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.InterfaceDeclarationImpl)3 DeclarationType (org.eclipse.ceylon.model.loader.ModelLoader.DeclarationType)3 NothingType (org.eclipse.ceylon.model.typechecker.model.NothingType)3 Type (org.eclipse.ceylon.model.typechecker.model.Type)3 FunctionDeclaration (ceylon.language.meta.declaration.FunctionDeclaration)2 InterfaceDeclaration (ceylon.language.meta.declaration.InterfaceDeclaration)2 ClassDeclarationImpl (org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.ClassDeclarationImpl)2