Search in sources :

Example 1 with MethodImpl

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

the class FunctionDeclarationImpl method getAppliedMethod.

<Container, Type, Arguments extends ceylon.language.Sequential<? extends Object>> ceylon.language.meta.model.Method<Container, Type, Arguments> getAppliedMethod(@Ignore TypeDescriptor $reifiedContainer, @Ignore TypeDescriptor $reifiedType, @Ignore TypeDescriptor $reifiedArguments, Sequential<? extends ceylon.language.meta.model.Type<?>> typeArguments, ceylon.language.meta.model.Type<? extends Object> container) {
    List<org.eclipse.ceylon.model.typechecker.model.Type> producedTypes = Metamodel.getProducedTypes(typeArguments);
    org.eclipse.ceylon.model.typechecker.model.Type containerType = Metamodel.getModel(container);
    Metamodel.checkQualifyingType(containerType, declaration);
    Metamodel.checkTypeArguments(containerType, declaration, producedTypes);
    // find the proper qualifying type
    org.eclipse.ceylon.model.typechecker.model.Type memberQualifyingType = containerType.getSupertype((TypeDeclaration) declaration.getContainer());
    final TypedReference appliedFunction = ((org.eclipse.ceylon.model.typechecker.model.TypedDeclaration) declaration).appliedTypedReference(memberQualifyingType, producedTypes);
    TypeDescriptor reifiedType = Metamodel.getTypeDescriptorForFunction(appliedFunction);
    TypeDescriptor reifiedArguments = Metamodel.getTypeDescriptorForArguments(declaration.getUnit(), (Functional) declaration, appliedFunction);
    TypeDescriptor reifiedContainer = Metamodel.getTypeDescriptorForProducedType(containerType);
    if (getStatic()) {
        producedTypes.addAll(0, containerType.getTypeArgumentList());
    }
    Metamodel.checkReifiedTypeArgument("memberApply", "Method<$1,$2,$3>", Variance.IN, containerType, $reifiedContainer, Variance.OUT, appliedFunction.getType(), $reifiedType, Variance.IN, Metamodel.getProducedTypeForArguments(declaration.getUnit(), (Functional) declaration, appliedFunction), $reifiedArguments);
    return new MethodImpl<Container, Type, Arguments>(reifiedContainer, reifiedType, reifiedArguments, appliedFunction, this, container);
}
Also used : TypedReference(org.eclipse.ceylon.model.typechecker.model.TypedReference) Functional(org.eclipse.ceylon.model.typechecker.model.Functional) OpenType(ceylon.language.meta.declaration.OpenType) TypeDescriptor(org.eclipse.ceylon.compiler.java.runtime.model.TypeDescriptor) MethodImpl(org.eclipse.ceylon.compiler.java.runtime.metamodel.meta.MethodImpl) 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 MethodImpl (org.eclipse.ceylon.compiler.java.runtime.metamodel.meta.MethodImpl)1 TypeDescriptor (org.eclipse.ceylon.compiler.java.runtime.model.TypeDescriptor)1 Functional (org.eclipse.ceylon.model.typechecker.model.Functional)1 TypedReference (org.eclipse.ceylon.model.typechecker.model.TypedReference)1