コード例 #1
0
  protected void init() {
    com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface decl =
        (com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface)
            producedType.getDeclaration();
    this.declaration = (FreeClassOrInterface) Metamodel.getOrCreateMetamodel(decl);
    java.util.Map<
            ceylon.language.meta.declaration.TypeParameter,
            ceylon.language.meta.declaration.OpenType>
        typeArguments =
            new LinkedHashMap<
                ceylon.language.meta.declaration.TypeParameter,
                ceylon.language.meta.declaration.OpenType>();
    Iterator<? extends ceylon.language.meta.declaration.TypeParameter> typeParameters =
        declaration.getTypeParameterDeclarations().iterator();
    Object it;
    java.util.Map<
            com.redhat.ceylon.compiler.typechecker.model.TypeParameter,
            com.redhat.ceylon.compiler.typechecker.model.ProducedType>
        ptArguments = producedType.getTypeArguments();
    while ((it = typeParameters.next()) != finished_.$get()) {
      com.redhat.ceylon.compiler.java.runtime.metamodel.FreeTypeParameter tp =
          (com.redhat.ceylon.compiler.java.runtime.metamodel.FreeTypeParameter) it;
      com.redhat.ceylon.compiler.typechecker.model.TypeParameter tpDecl =
          (com.redhat.ceylon.compiler.typechecker.model.TypeParameter) tp.declaration;
      com.redhat.ceylon.compiler.typechecker.model.ProducedType ptArg = ptArguments.get(tpDecl);
      OpenType ptArgWrapped = Metamodel.getMetamodel(ptArg);
      typeArguments.put(tp, ptArgWrapped);
    }
    this.typeArguments =
        new InternalMap<
            ceylon.language.meta.declaration.TypeParameter,
            ceylon.language.meta.declaration.OpenType>(
            ceylon.language.meta.declaration.TypeParameter.$TypeDescriptor,
            ceylon.language.meta.declaration.OpenType.$TypeDescriptor,
            typeArguments);

    com.redhat.ceylon.compiler.typechecker.model.ProducedType superType = decl.getExtendedType();
    if (superType != null) {
      com.redhat.ceylon.compiler.typechecker.model.ProducedType superTypeResolved =
          superType.substitute(producedType.getTypeArguments());
      this.superclass =
          (ceylon.language.meta.declaration.OpenClassType)
              Metamodel.getMetamodel(superTypeResolved);
    }

    List<com.redhat.ceylon.compiler.typechecker.model.ProducedType> satisfiedTypes =
        decl.getSatisfiedTypes();
    ceylon.language.meta.declaration.OpenInterfaceType[] interfaces =
        new ceylon.language.meta.declaration.OpenInterfaceType[satisfiedTypes.size()];
    int i = 0;
    for (com.redhat.ceylon.compiler.typechecker.model.ProducedType pt : satisfiedTypes) {
      com.redhat.ceylon.compiler.typechecker.model.ProducedType resolvedPt =
          pt.substitute(producedType.getTypeArguments());
      interfaces[i++] =
          (ceylon.language.meta.declaration.OpenInterfaceType) Metamodel.getMetamodel(resolvedPt);
    }
    this.interfaces =
        Util.sequentialInstance(
            ceylon.language.meta.declaration.OpenInterfaceType.$TypeDescriptor, interfaces);
  }
コード例 #2
0
 private List<ProducedType> getSatisfiedTypes() {
   List<ProducedType> satisfiedTypes = new ArrayList<ProducedType>();
   for (ProducedType st : getDeclaration().getSatisfiedTypes()) {
     satisfiedTypes.add(st.substitute(getTypeArguments()));
   }
   return satisfiedTypes;
 }
コード例 #3
0
 private List<ProducedType> getCaseTypes() {
   if (getDeclaration().getCaseTypes() == null) {
     return null;
   } else {
     List<ProducedType> caseTypes = new ArrayList<ProducedType>();
     for (ProducedType ct : getDeclaration().getCaseTypes()) {
       caseTypes.add(ct.substitute(getTypeArguments()));
     }
     return caseTypes;
   }
 }
コード例 #4
0
 private ProducedType getExtendedType() {
   ProducedType extendedType = getDeclaration().getExtendedType();
   return extendedType == null ? null : extendedType.substitute(getTypeArguments());
 }
コード例 #5
0
 private ProducedType getSelfType() {
   ProducedType selfType = getDeclaration().getSelfType();
   return selfType == null ? null : selfType.substitute(getTypeArguments());
 }