Search in sources :

Example 1 with ValueImpl

use of org.eclipse.ceylon.compiler.java.runtime.metamodel.meta.ValueImpl in project ceylon by eclipse.

the class ValueDeclarationImpl method applyInternal.

protected <Get, Set> ceylon.language.meta.model.Value<Get, Set> applyInternal(TypeDescriptor $reifiedGet, TypeDescriptor $reifiedSet, ceylon.language.meta.model.Type<?> container) {
    org.eclipse.ceylon.model.typechecker.model.Value modelDecl = (org.eclipse.ceylon.model.typechecker.model.Value) declaration;
    Type qType;
    if (getStatic()) {
        qType = ((ClassImpl) container).producedType;
    } else {
        qType = null;
    }
    org.eclipse.ceylon.model.typechecker.model.TypedReference typedReference = modelDecl.appliedTypedReference(qType, Collections.<Type>emptyList());
    org.eclipse.ceylon.model.typechecker.model.Type getType = typedReference.getType();
    TypeDescriptor reifiedGet = Metamodel.getTypeDescriptorForProducedType(getType);
    // immutable values have Set=Nothing
    org.eclipse.ceylon.model.typechecker.model.Type setType = getVariable() ? getType : modelDecl.getUnit().getNothingType();
    TypeDescriptor reifiedSet = getVariable() ? reifiedGet : TypeDescriptor.NothingType;
    Metamodel.checkReifiedTypeArgument("apply", "Value<$1,$2>", Variance.OUT, getType, $reifiedGet, Variance.IN, setType, $reifiedSet);
    return new ValueImpl<Get, Set>(reifiedGet, reifiedSet, this, typedReference, container, null);
}
Also used : Type(org.eclipse.ceylon.model.typechecker.model.Type) OpenType(ceylon.language.meta.declaration.OpenType) TypeDescriptor(org.eclipse.ceylon.compiler.java.runtime.model.TypeDescriptor) Value(org.eclipse.ceylon.model.typechecker.model.Value) Type(org.eclipse.ceylon.model.typechecker.model.Type) ValueImpl(org.eclipse.ceylon.compiler.java.runtime.metamodel.meta.ValueImpl) Value(org.eclipse.ceylon.model.typechecker.model.Value) Metamodel(org.eclipse.ceylon.compiler.java.runtime.metamodel.Metamodel)

Aggregations

OpenType (ceylon.language.meta.declaration.OpenType)1 Metamodel (org.eclipse.ceylon.compiler.java.runtime.metamodel.Metamodel)1 ValueImpl (org.eclipse.ceylon.compiler.java.runtime.metamodel.meta.ValueImpl)1 TypeDescriptor (org.eclipse.ceylon.compiler.java.runtime.model.TypeDescriptor)1 Type (org.eclipse.ceylon.model.typechecker.model.Type)1 Value (org.eclipse.ceylon.model.typechecker.model.Value)1