And the file goes here... 2005/9/2, Kamil Skalski <[EMAIL PROTECTED]>: > I attach the more complete and correct patch - MakeGenericMethod is > added to MethodBase instead of MethodInfo, I made necessary changes to > gmcs and mbas, also the change to GenericParameterAttributes is > included. > > One question I would like to ask is if I should also change the > runtime icalls from BindTypeParameters to MakeGenericType / > MakeGenericMethod, or should this be left for another patch. If this > patch is ok in its state, I will commit. > > 2005/8/30, Michal Moskal <[EMAIL PROTECTED]>: > > Hello, > > > > The MS Aug CTP release removes BindGenericParameters/Arguments methods > > from System.Type and MethodInfo. Instead MakeGenericType and > > MakeGenericMethod should be used. Mono has the first one implemneted. > > The attached patch implemnets the second one. > > > > 2005-08-30 Michal Moskal <[EMAIL PROTECTED]> > > > > * MethodInfo.cs: Add MakeGenericMethod to match Aug CTP API. > > > > -- > > Michal Moskal, > > http://nemerle.org/~malekith/ > > > > > > _______________________________________________ > > Mono-devel-list mailing list > > Mono-devel-list@lists.ximian.com > > http://lists.ximian.com/mailman/listinfo/mono-devel-list > > > > > > > > > > > -- > Kamil Skalski > http://nazgul.omega.pl >
-- Kamil Skalski http://nazgul.omega.pl
Index: bmcs/generic.cs =================================================================== --- bmcs/generic.cs (wersja 49356) +++ bmcs/generic.cs (kopia robocza) @@ -33,7 +33,7 @@ } public bool HasValueTypeConstraint { - get { return (Attributes & GenericParameterAttributes.ValueTypeConstraint) != 0; } + get { return (Attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; } } public virtual bool HasClassConstraint { @@ -195,7 +195,7 @@ if (sc == SpecialConstraint.ReferenceType) attrs |= GenericParameterAttributes.ReferenceTypeConstraint; else - attrs |= GenericParameterAttributes.ValueTypeConstraint; + attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint; continue; } @@ -1733,7 +1733,7 @@ if (tc != null) return tc.IsGeneric ? tc.CountTypeParameters : 0; else - return t.HasGenericArguments ? t.GetGenericArguments ().Length : 0; + return t.IsGenericType ? t.GetGenericArguments ().Length : 0; } public static Type[] GetTypeArguments (Type t) @@ -2171,7 +2171,7 @@ if (infered_types [i] == null) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } @@ -2241,7 +2241,7 @@ if (!InferTypeArguments (param_types, arg_types, infered_types)) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } @@ -2269,7 +2269,7 @@ if (!InferTypeArguments (param_types, arg_types, infered_types)) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } Index: bmcs/ecore.cs =================================================================== --- bmcs/ecore.cs (wersja 49356) +++ bmcs/ecore.cs (kopia robocza) @@ -2992,7 +2992,7 @@ if (gen_params.Length != atypes.Length) continue; - list.Add (mi.BindGenericParameters (atypes)); + list.Add (mi.MakeGenericMethod (atypes)); } if (list.Count > 0) { Index: gmcs/generic.cs =================================================================== --- gmcs/generic.cs (wersja 49356) +++ gmcs/generic.cs (kopia robocza) @@ -33,7 +33,7 @@ } public bool HasValueTypeConstraint { - get { return (Attributes & GenericParameterAttributes.ValueTypeConstraint) != 0; } + get { return (Attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; } } public virtual bool HasClassConstraint { @@ -199,7 +199,7 @@ if (sc == SpecialConstraint.ReferenceType) attrs |= GenericParameterAttributes.ReferenceTypeConstraint; else - attrs |= GenericParameterAttributes.ValueTypeConstraint; + attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint; continue; } @@ -1692,7 +1692,7 @@ if (tc != null) return tc.IsGeneric ? tc.CountTypeParameters : 0; else - return t.HasGenericArguments ? t.GetGenericArguments ().Length : 0; + return t.IsGenericType ? t.GetGenericArguments ().Length : 0; } public static Type[] GetTypeArguments (Type t) @@ -2128,7 +2128,7 @@ if (infered_types [i] == null) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } @@ -2199,7 +2199,7 @@ if (!InferTypeArguments (param_types, arg_types, infered_types)) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } @@ -2227,7 +2227,7 @@ if (!InferTypeArguments (param_types, arg_types, infered_types)) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } Index: gmcs/ecore.cs =================================================================== --- gmcs/ecore.cs (wersja 49356) +++ gmcs/ecore.cs (kopia robocza) @@ -3096,7 +3096,7 @@ if (gen_params.Length != atypes.Length) continue; - list.Add (mi.BindGenericParameters (atypes)); + list.Add (mi.MakeGenericMethod (atypes)); } if (list.Count > 0) { Index: gmcs/anonymous.cs =================================================================== --- gmcs/anonymous.cs (wersja 49356) +++ gmcs/anonymous.cs (kopia robocza) @@ -362,7 +362,7 @@ { MethodInfo builder = method.MethodData.MethodBuilder; if (TypeArguments != null) - return builder.BindGenericParameters (TypeArguments); + return builder.MakeGenericMethod (TypeArguments); else return builder; } Index: class/corlib/System/Type.cs =================================================================== --- class/corlib/System/Type.cs (wersja 49356) +++ class/corlib/System/Type.cs (kopia robocza) @@ -1081,6 +1081,7 @@ #if NET_2_0 || BOOTSTRAP_NET_2_0 public abstract Type[] GetGenericArguments (); + [ObsoleteAttribute("HasGenericArguments has been deprecated. Please use IsGenericType instead - this will be removed before Whidbey ships.")] public abstract bool HasGenericArguments { get; } Index: class/corlib/System/MonoType.cs =================================================================== --- class/corlib/System/MonoType.cs (wersja 49356) +++ class/corlib/System/MonoType.cs (kopia robocza) @@ -568,6 +568,7 @@ [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern override Type [] GetGenericArguments (); + [ObsoleteAttribute("HasGenericArguments has been deprecated. Please use IsGenericType instead - this will be removed before Whidbey ships.")] public extern override bool HasGenericArguments { [MethodImplAttribute(MethodImplOptions.InternalCall)] get; @@ -578,7 +579,7 @@ if (IsGenericParameter) return true; - if (HasGenericArguments) { + if (IsGenericType) { foreach (Type arg in GetGenericArguments ()) if (arg.ContainsGenericParameters) return true; Index: class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs =================================================================== --- class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs (wersja 49356) +++ class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs (kopia robocza) @@ -316,6 +316,7 @@ throw not_supported (); } + [ObsoleteAttribute("HasGenericArguments has been deprecated. Please use IsGenericType instead - this will be removed before Whidbey ships.")] public override bool HasGenericArguments { get { return false; } } Index: class/corlib/System.Reflection.Emit/EnumBuilder.cs =================================================================== --- class/corlib/System.Reflection.Emit/EnumBuilder.cs (wersja 49356) +++ class/corlib/System.Reflection.Emit/EnumBuilder.cs (kopia robocza) @@ -360,6 +360,7 @@ throw new NotImplementedException (); } + [ObsoleteAttribute("HasGenericArguments has been deprecated. Please use IsGenericType instead - this will be removed before Whidbey ships.")] [MonoTODO] public override bool HasGenericArguments { get { Index: class/corlib/System.Reflection.Emit/MethodBuilder.cs =================================================================== --- class/corlib/System.Reflection.Emit/MethodBuilder.cs (wersja 49356) +++ class/corlib/System.Reflection.Emit/MethodBuilder.cs (kopia robocza) @@ -460,9 +460,15 @@ } #if NET_2_0 || BOOTSTRAP_NET_2_0 + [ObsoleteAttribute("BindGenericParameters() has been deprecated. Please use MakeGenericMethod() instead - this will be removed before Whidbey ships.")] [MethodImplAttribute(MethodImplOptions.InternalCall)] public override extern MethodInfo BindGenericParameters (Type [] types); + public override MethodInfo MakeGenericMethod (Type [] types) + { + return BindGenericParameters (types); + } + public override bool Mono_IsInflatedMethod { get { return false; Index: class/corlib/System.Reflection.Emit/TypeBuilder.cs =================================================================== --- class/corlib/System.Reflection.Emit/TypeBuilder.cs (wersja 49356) +++ class/corlib/System.Reflection.Emit/TypeBuilder.cs (kopia robocza) @@ -1468,6 +1468,7 @@ return base.GetGenericTypeDefinition (); } + [ObsoleteAttribute("HasGenericArguments has been deprecated. Please use IsGenericType instead - this will be removed before Whidbey ships.")] public override bool HasGenericArguments { get { return generic_params != null; Index: class/corlib/System.Reflection/GenericParameterAttributes.cs =================================================================== --- class/corlib/System.Reflection/GenericParameterAttributes.cs (wersja 49356) +++ class/corlib/System.Reflection/GenericParameterAttributes.cs (kopia robocza) @@ -37,19 +37,18 @@ [Flags] public enum GenericParameterAttributes { - NonVariant = 0, Covariant = 1, Contravariant = 2, VarianceMask = Covariant | Contravariant, - NoSpecialConstraint = 0, + None = 0, ReferenceTypeConstraint = 4, - ValueTypeConstraint = 8, + NotNullableValueTypeConstraint = 8, DefaultConstructorConstraint = 16, SpecialConstraintMask = - ReferenceTypeConstraint | ValueTypeConstraint | DefaultConstructorConstraint + ReferenceTypeConstraint | NotNullableValueTypeConstraint | DefaultConstructorConstraint } } #endif Index: class/corlib/System.Reflection/MethodBase.cs =================================================================== --- class/corlib/System.Reflection/MethodBase.cs (wersja 49356) +++ class/corlib/System.Reflection/MethodBase.cs (kopia robocza) @@ -177,11 +177,17 @@ } #if NET_2_0 || BOOTSTRAP_NET_2_0 + [ObsoleteAttribute("BindGenericParameters() has been deprecated. Please use MakeGenericMethod() instead - this will be removed before Whidbey ships.")] public virtual MethodInfo BindGenericParameters (Type [] types) { throw new NotSupportedException (); } + public virtual MethodInfo MakeGenericMethod (Type [] types) + { + throw new NotSupportedException (this.GetType().ToString ()); + } + public virtual Type [] GetGenericArguments () { throw new NotSupportedException (); Index: class/corlib/System.Reflection/TypeDelegator.cs =================================================================== --- class/corlib/System.Reflection/TypeDelegator.cs (wersja 49356) +++ class/corlib/System.Reflection/TypeDelegator.cs (kopia robocza) @@ -260,6 +260,8 @@ throw new NotImplementedException (); } + + [ObsoleteAttribute("HasGenericArguments has been deprecated. Please use IsGenericType instead - this will be removed before Whidbey ships.")] public override bool HasGenericArguments { get { throw new NotImplementedException (); Index: class/corlib/System.Reflection/MonoMethod.cs =================================================================== --- class/corlib/System.Reflection/MonoMethod.cs (wersja 49356) +++ class/corlib/System.Reflection/MonoMethod.cs (kopia robocza) @@ -252,9 +252,15 @@ } #if NET_2_0 || BOOTSTRAP_NET_2_0 + [ObsoleteAttribute("BindGenericParameters() has been deprecated. Please use MakeGenericMethod() instead - this will be removed before Whidbey ships.")] [MethodImplAttribute(MethodImplOptions.InternalCall)] public override extern MethodInfo BindGenericParameters (Type [] types); + public override MethodInfo MakeGenericMethod (Type [] types) + { + return BindGenericParameters (types); + } + [MethodImplAttribute(MethodImplOptions.InternalCall)] public override extern Type [] GetGenericArguments ();
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list