public IType Resolve(ITypeResolveContext context)
 {
     if (ownerType == SymbolKind.Method)
     {
         IMethod method = context.CurrentMember as IMethod;
         if (method != null && index < method.TypeParameters.Count)
         {
             return(method.TypeParameters[index]);
         }
         return(DummyTypeParameter.GetMethodTypeParameter(index));
     }
     else if (ownerType == SymbolKind.TypeDefinition)
     {
         ITypeDefinition typeDef = context.CurrentTypeDefinition;
         if (typeDef != null && index < typeDef.TypeParameters.Count)
         {
             return(typeDef.TypeParameters[index]);
         }
         return(DummyTypeParameter.GetClassTypeParameter(index));
     }
     else
     {
         return(SpecialType.UnknownType);
     }
 }
示例#2
0
 public override IType VisitTypeParameter(ITypeParameter type)
 {
     if (type.OwnerType == EntityType.TypeDefinition)
     {
         return(DummyTypeParameter.GetClassTypeParameter(type.Index));
     }
     else
     {
         return(base.VisitTypeParameter(type));
     }
 }