diff options
author | Martin Baulig <martin@novell.com> | 2005-09-05 19:03:33 +0400 |
---|---|---|
committer | Martin Baulig <martin@novell.com> | 2005-09-05 19:03:33 +0400 |
commit | f5908bb29972ce75a4c59abce39b3082fdbd64d4 (patch) | |
tree | 5895bad756efbeae56776ffc942e2956ccd61dc8 | |
parent | 67882e23fafe4e75b9076320c9438f4abd90a95a (diff) |
Reflect latest generics API changes in the August CTP.
svn path=/trunk/mcs/; revision=49476
20 files changed, 48 insertions, 69 deletions
diff --git a/mcs/bmcs/ecore.cs b/mcs/bmcs/ecore.cs index 51ca97ab8f1..5557605ecfe 100644 --- a/mcs/bmcs/ecore.cs +++ b/mcs/bmcs/ecore.cs @@ -2992,7 +2992,7 @@ namespace Mono.CSharp { if (gen_params.Length != atypes.Length) continue; - list.Add (mi.BindGenericParameters (atypes)); + list.Add (mi.MakeGenericMethod (atypes)); } if (list.Count > 0) { diff --git a/mcs/bmcs/generic.cs b/mcs/bmcs/generic.cs index c737f85ac78..25a3a962c6c 100644 --- a/mcs/bmcs/generic.cs +++ b/mcs/bmcs/generic.cs @@ -33,7 +33,7 @@ namespace Mono.CSharp { } public bool HasValueTypeConstraint { - get { return (Attributes & GenericParameterAttributes.ValueTypeConstraint) != 0; } + get { return (Attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; } } public virtual bool HasClassConstraint { @@ -195,7 +195,7 @@ namespace Mono.CSharp { if (sc == SpecialConstraint.ReferenceType) attrs |= GenericParameterAttributes.ReferenceTypeConstraint; else - attrs |= GenericParameterAttributes.ValueTypeConstraint; + attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint; continue; } @@ -1733,7 +1733,7 @@ namespace Mono.CSharp { 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 @@ namespace Mono.CSharp { if (infered_types [i] == null) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } @@ -2241,7 +2241,7 @@ namespace Mono.CSharp { 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 @@ namespace Mono.CSharp { if (!InferTypeArguments (param_types, arg_types, infered_types)) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } diff --git a/mcs/class/Mono.C5/Builder.cs b/mcs/class/Mono.C5/Builder.cs index a4ad1080365..feb2981baed 100644 --- a/mcs/class/Mono.C5/Builder.cs +++ b/mcs/class/Mono.C5/Builder.cs @@ -161,7 +161,7 @@ namespace C5.HasherBuilder {
Type t = typeof(T);
- if (!t.HasGenericArguments)
+ if (!t.IsGenericType)
{
if (t.Equals(typeof(int)))
return (IHasher<T>)(new IntHasher());
diff --git a/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs index 0908c13d5fe..f315a06890c 100644 --- a/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs @@ -361,13 +361,6 @@ namespace System.Reflection.Emit { } [MonoTODO] - public override bool HasGenericArguments { - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] public override bool ContainsGenericParameters { get { throw new NotImplementedException (); diff --git a/mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs index 2ff5a516819..5b145956d58 100644 --- a/mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs @@ -316,10 +316,6 @@ namespace System.Reflection.Emit throw not_supported (); } - public override bool HasGenericArguments { - get { return false; } - } - public override bool ContainsGenericParameters { get { return true; } } diff --git a/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs index b2cd75262f2..adc42aef7fe 100644 --- a/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs @@ -461,7 +461,7 @@ namespace System.Reflection.Emit { #if NET_2_0 || BOOTSTRAP_NET_2_0 [MethodImplAttribute(MethodImplOptions.InternalCall)] - public override extern MethodInfo BindGenericParameters (Type [] types); + public override extern MethodInfo MakeGenericMethod (Type [] types); public override bool Mono_IsInflatedMethod { get { diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs index cef949a0f83..2ec16ac570c 100644 --- a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs @@ -1468,12 +1468,6 @@ namespace System.Reflection.Emit { return base.GetGenericTypeDefinition (); } - public override bool HasGenericArguments { - get { - return generic_params != null; - } - } - public override bool ContainsGenericParameters { get { return generic_params != null; diff --git a/mcs/class/corlib/System.Reflection/ChangeLog b/mcs/class/corlib/System.Reflection/ChangeLog index 7aca1630d8c..1b97d0325a5 100644 --- a/mcs/class/corlib/System.Reflection/ChangeLog +++ b/mcs/class/corlib/System.Reflection/ChangeLog @@ -1,5 +1,14 @@ 2005-09-05 Martin Baulig <martin@ximian.com> + Reflect latest API changes in the August CTP. + + * GenericParameterAttributes.cs: Here. + + * MethodBase.cs (MethodBase.BindGenericParameters): Renamed to + MakeGenericMethod(). + +2005-09-05 Martin Baulig <martin@ximian.com> + * Assembly.cs (MonoDebugger_GetMethodToken): Don't take an `Assembly' argument. diff --git a/mcs/class/corlib/System.Reflection/GenericParameterAttributes.cs b/mcs/class/corlib/System.Reflection/GenericParameterAttributes.cs index e8836f2e23d..ed092d585aa 100644 --- a/mcs/class/corlib/System.Reflection/GenericParameterAttributes.cs +++ b/mcs/class/corlib/System.Reflection/GenericParameterAttributes.cs @@ -37,19 +37,18 @@ namespace System.Reflection [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 diff --git a/mcs/class/corlib/System.Reflection/MethodBase.cs b/mcs/class/corlib/System.Reflection/MethodBase.cs index f7471107802..ab282a2b469 100644 --- a/mcs/class/corlib/System.Reflection/MethodBase.cs +++ b/mcs/class/corlib/System.Reflection/MethodBase.cs @@ -177,9 +177,9 @@ namespace System.Reflection { } #if NET_2_0 || BOOTSTRAP_NET_2_0 - public virtual MethodInfo BindGenericParameters (Type [] types) + public virtual MethodInfo MakeGenericMethod (Type [] types) { - throw new NotSupportedException (); + throw new NotSupportedException (this.GetType().ToString ()); } public virtual Type [] GetGenericArguments () diff --git a/mcs/class/corlib/System.Reflection/MonoMethod.cs b/mcs/class/corlib/System.Reflection/MonoMethod.cs index 263e4d16844..d8ae01301c1 100644 --- a/mcs/class/corlib/System.Reflection/MonoMethod.cs +++ b/mcs/class/corlib/System.Reflection/MonoMethod.cs @@ -253,7 +253,7 @@ namespace System.Reflection { #if NET_2_0 || BOOTSTRAP_NET_2_0 [MethodImplAttribute(MethodImplOptions.InternalCall)] - public override extern MethodInfo BindGenericParameters (Type [] types); + public override extern MethodInfo MakeGenericMethod (Type [] types); [MethodImplAttribute(MethodImplOptions.InternalCall)] public override extern Type [] GetGenericArguments (); diff --git a/mcs/class/corlib/System.Reflection/TypeDelegator.cs b/mcs/class/corlib/System.Reflection/TypeDelegator.cs index a2d644bbfa2..5dbb01d786e 100644 --- a/mcs/class/corlib/System.Reflection/TypeDelegator.cs +++ b/mcs/class/corlib/System.Reflection/TypeDelegator.cs @@ -260,11 +260,6 @@ namespace System.Reflection { throw new NotImplementedException (); } - public override bool HasGenericArguments { - get { - throw new NotImplementedException (); - } - } public override bool ContainsGenericParameters { get { diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog index 2b875036731..001c76450ad 100644 --- a/mcs/class/corlib/System/ChangeLog +++ b/mcs/class/corlib/System/ChangeLog @@ -1,3 +1,10 @@ +2005-09-05 Martin Baulig <martin@ximian.com> + + Reflect latest API changes in the August CTP. + + * Type.cs (Type.HasGenericArguments): Removed. + (Type.BindGenericParameters): Renamed to MakeGenericType(). + 2005-09-01 Atsushi Enomoto <atsushi@ximian.com> * DateTime.cs : another idiotic COM dependent format. diff --git a/mcs/class/corlib/System/MonoType.cs b/mcs/class/corlib/System/MonoType.cs index 7c145c730d7..ce5cb12358e 100644 --- a/mcs/class/corlib/System/MonoType.cs +++ b/mcs/class/corlib/System/MonoType.cs @@ -568,17 +568,12 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern override Type [] GetGenericArguments (); - public extern override bool HasGenericArguments { - [MethodImplAttribute(MethodImplOptions.InternalCall)] - get; - } - public override bool ContainsGenericParameters { get { if (IsGenericParameter) return true; - if (HasGenericArguments) { + if (IsGenericType) { foreach (Type arg in GetGenericArguments ()) if (arg.ContainsGenericParameters) return true; diff --git a/mcs/class/corlib/System/Type.cs b/mcs/class/corlib/System/Type.cs index 9a83f152b80..7aca1c950d2 100644 --- a/mcs/class/corlib/System/Type.cs +++ b/mcs/class/corlib/System/Type.cs @@ -1081,10 +1081,6 @@ namespace System { #if NET_2_0 || BOOTSTRAP_NET_2_0 public abstract Type[] GetGenericArguments (); - public abstract bool HasGenericArguments { - get; - } - public abstract bool ContainsGenericParameters { get; } @@ -1117,16 +1113,7 @@ namespace System { } [MethodImplAttribute(MethodImplOptions.InternalCall)] - static extern Type BindGenericParameters (Type gt, Type [] types); - -#if NET_2_0 - [ComVisible (true)] - [ObsoleteAttribute("BindGenericParameters() has been deprecated. Please use MakeGenericType() instead - this will be removed before Whidbey ships.")] -#endif - public Type BindGenericParameters (Type [] types) - { - return MakeGenericType (types); - } + static extern Type MakeGenericType (Type gt, Type [] types); public virtual Type MakeGenericType (params Type[] types) { @@ -1136,7 +1123,7 @@ namespace System { if (t == null) throw new ArgumentNullException ("types"); } - Type res = BindGenericParameters (this, types); + Type res = MakeGenericType (this, types); if (res == null) throw new TypeLoadException (); return res; diff --git a/mcs/gmcs/anonymous.cs b/mcs/gmcs/anonymous.cs index f998626c4e0..b0b3cce0d95 100644 --- a/mcs/gmcs/anonymous.cs +++ b/mcs/gmcs/anonymous.cs @@ -364,7 +364,7 @@ namespace Mono.CSharp { { MethodInfo builder = method.MethodData.MethodBuilder; if (TypeArguments != null) - return builder.BindGenericParameters (TypeArguments); + return builder.MakeGenericMethod (TypeArguments); else return builder; } diff --git a/mcs/gmcs/ecore.cs b/mcs/gmcs/ecore.cs index 28ce959dd72..3d4786437d3 100644 --- a/mcs/gmcs/ecore.cs +++ b/mcs/gmcs/ecore.cs @@ -2857,7 +2857,7 @@ namespace Mono.CSharp { if (gen_params.Length != atypes.Length) continue; - list.Add (mi.BindGenericParameters (atypes)); + list.Add (mi.MakeGenericMethod (atypes)); } if (list.Count > 0) { diff --git a/mcs/gmcs/generic.cs b/mcs/gmcs/generic.cs index 204733fe9be..fab459b36ed 100644 --- a/mcs/gmcs/generic.cs +++ b/mcs/gmcs/generic.cs @@ -33,7 +33,7 @@ namespace Mono.CSharp { } public bool HasValueTypeConstraint { - get { return (Attributes & GenericParameterAttributes.ValueTypeConstraint) != 0; } + get { return (Attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; } } public virtual bool HasClassConstraint { @@ -199,7 +199,7 @@ namespace Mono.CSharp { if (sc == SpecialConstraint.ReferenceType) attrs |= GenericParameterAttributes.ReferenceTypeConstraint; else - attrs |= GenericParameterAttributes.ValueTypeConstraint; + attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint; continue; } @@ -1691,7 +1691,7 @@ namespace Mono.CSharp { 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) @@ -2127,7 +2127,7 @@ namespace Mono.CSharp { if (infered_types [i] == null) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } @@ -2198,7 +2198,7 @@ namespace Mono.CSharp { if (!InferTypeArguments (param_types, arg_types, infered_types)) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } @@ -2226,7 +2226,7 @@ namespace Mono.CSharp { if (!InferTypeArguments (param_types, arg_types, infered_types)) return false; - method = method.BindGenericParameters (infered_types); + method = method.MakeGenericMethod (infered_types); return true; } diff --git a/mcs/tools/monop/ChangeLog b/mcs/tools/monop/ChangeLog index cfea4c0e9fe..fc91d4594b9 100644 --- a/mcs/tools/monop/ChangeLog +++ b/mcs/tools/monop/ChangeLog @@ -1,3 +1,7 @@ +2005-09-05 Michal Moskal <malekith@nemerle.org> + + * outline.cs: Use new names of the GenericParameterAttributes enum. + 2005-08-19 Ben Maurer <bmaurer@novell.com> * outline.cs: diff --git a/mcs/tools/monop/outline.cs b/mcs/tools/monop/outline.cs index 63c08b7e378..291fd239b15 100644 --- a/mcs/tools/monop/outline.cs +++ b/mcs/tools/monop/outline.cs @@ -700,7 +700,7 @@ public class Outline { GenericParameterAttributes attrs = t.GenericParameterAttributes & GenericParameterAttributes.SpecialConstraintMask; GenericParameterAttributes [] interesting = { GenericParameterAttributes.ReferenceTypeConstraint, - GenericParameterAttributes.ValueTypeConstraint, + GenericParameterAttributes.NotNullableValueTypeConstraint, GenericParameterAttributes.DefaultConstructorConstraint }; @@ -735,7 +735,7 @@ public class Outline { case GenericParameterAttributes.ReferenceTypeConstraint: o.Write ("class"); break; - case GenericParameterAttributes.ValueTypeConstraint: + case GenericParameterAttributes.NotNullableValueTypeConstraint: o.Write ("struct"); break; case GenericParameterAttributes.DefaultConstructorConstraint: |