Esempio n. 1
0
 public void SetGenericParameterCount(int parameterCount)
 {
     if (!_instantiation.HasValue)
     {
         if (parameterCount == 0)
         {
             _instantiation = Instantiation.Empty;
         }
         else
         {
             TypeDesc[] instantiationArgs = new TypeDesc[parameterCount];
             for (int i = 0; i < parameterCount; i++)
             {
                 instantiationArgs[i] = new TypeRefTypeSystemGenericParameter(this, i);
             }
             _instantiation = new Instantiation(instantiationArgs);
         }
     }
     else
     {
         if (_instantiation.Value.Length != parameterCount)
         {
             throw new Exception($"Same type `{ToString()}` expected to have both {_instantiation.Value.Length} and {parameterCount} generic arguments");
         }
     }
 }
Esempio n. 2
0
 public TypeRefTypeSystemMethod(TypeRefTypeSystemType type, string name, MethodSignature signature)
 {
     _type      = type;
     _name      = name;
     _signature = signature;
     if (signature.GenericParameterCount == 0)
     {
         _instantiation = Instantiation.Empty;
     }
     else
     {
         TypeDesc[] instantiationArgs = new TypeDesc[signature.GenericParameterCount];
         for (int i = 0; i < signature.GenericParameterCount; i++)
         {
             instantiationArgs[i] = new TypeRefTypeSystemGenericParameter(this, i);
         }
         _instantiation = new Instantiation(instantiationArgs);
     }
 }