Example #1
0
 private static RppGenericParameter CreateGenericParameter(string name, int genericArgumentPosition, RType declaringType, RppMethodInfo declaringMethod)
 {
     RppGenericParameter genericParameter = new RppGenericParameter(name);
     RType type = new RType(name, RTypeAttributes.None, null, declaringType)
     {
         IsGenericParameter = true,
         GenericParameterPosition = genericArgumentPosition,
         GenericParameterDeclaringMethod = declaringMethod
     };
     genericParameter.Type = type;
     genericParameter.Position = genericArgumentPosition;
     return genericParameter;
 }
Example #2
0
 private static GenericParameterAttributes GetAttributes(RppGenericParameter parameter)
 {
     switch (parameter.Variance)
     {
         case RppGenericParameterVariance.Covariant:
             return GenericParameterAttributes.Covariant;
         case RppGenericParameterVariance.Contravariant:
             return GenericParameterAttributes.Contravariant;
         default:
             return GenericParameterAttributes.None;
     }
 }
Example #3
0
 private static void UpdateGenericParameterContraints(RppGenericParameter genericParameter, GenericTypeParameterBuilder nativeGenericParameter)
 {
     if (genericParameter.Constraint != null)
     {
         if (genericParameter.Constraint.IsClass)
         {
             nativeGenericParameter.SetBaseTypeConstraint(genericParameter.Constraint.NativeType);
         }
         else
         {
             nativeGenericParameter.SetInterfaceConstraints(genericParameter.Constraint.NativeType);
         }
     }
 }
Example #4
0
 private static void UpdateGenericParameter(RppGenericParameter genericParameter, GenericTypeParameterBuilder nativeGenericParameter)
 {
     genericParameter.SetGenericTypeParameterBuilder(nativeGenericParameter);
     UpdateGenericParameterContraints(genericParameter, nativeGenericParameter);
 }