2
0
Эх сурвалжийг харах

Reflect latest generics API changes in the August CTP.

svn path=/trunk/mcs/; revision=49476
Martin Baulig 20 жил өмнө
parent
commit
f5908bb299

+ 1 - 1
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) {

+ 6 - 6
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;
 		}
 

+ 1 - 1
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());

+ 0 - 7
mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs

@@ -360,13 +360,6 @@ namespace System.Reflection.Emit {
 			throw new NotImplementedException ();
 		}
 
-		[MonoTODO]
-		public override bool HasGenericArguments {
-			get {
-				throw new NotImplementedException ();
-			}
-		}
-
 		[MonoTODO]
 		public override bool ContainsGenericParameters {
 			get {

+ 0 - 4
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; }
 		}

+ 1 - 1
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 {

+ 0 - 6
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;

+ 9 - 0
mcs/class/corlib/System.Reflection/ChangeLog

@@ -1,3 +1,12 @@
+2005-09-05  Martin Baulig  <[email protected]>
+
+	Reflect latest API changes in the August CTP.
+
+	* GenericParameterAttributes.cs: Here.
+
+	* MethodBase.cs (MethodBase.BindGenericParameters): Renamed to
+	MakeGenericMethod().	
+
 2005-09-05  Martin Baulig  <[email protected]>
 
 	* Assembly.cs (MonoDebugger_GetMethodToken): Don't take an

+ 3 - 4
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

+ 2 - 2
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 ()

+ 1 - 1
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 ();

+ 0 - 5
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 {

+ 7 - 0
mcs/class/corlib/System/ChangeLog

@@ -1,3 +1,10 @@
+2005-09-05  Martin Baulig  <[email protected]>
+
+	Reflect latest API changes in the August CTP.
+
+	* Type.cs (Type.HasGenericArguments): Removed.
+	(Type.BindGenericParameters): Renamed to MakeGenericType().
+
 2005-09-01  Atsushi Enomoto  <[email protected]>
 
 	* DateTime.cs : another idiotic COM dependent format.

+ 1 - 6
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;

+ 2 - 15
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;

+ 1 - 1
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;
 		}

+ 1 - 1
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) {

+ 6 - 6
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;
 		}
 

+ 4 - 0
mcs/tools/monop/ChangeLog

@@ -1,3 +1,7 @@
+2005-09-05  Michal Moskal  <[email protected]>
+	
+	* outline.cs: Use new names of the GenericParameterAttributes enum.
+
 2005-08-19  Ben Maurer  <[email protected]>
 
 	* outline.cs:

+ 2 - 2
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: