if (gen_params.Length != atypes.Length)
continue;
- list.Add (mi.BindGenericParameters (atypes));
+ list.Add (mi.MakeGenericMethod (atypes));
}
if (list.Count > 0) {
}
public bool HasValueTypeConstraint {
- get { return (Attributes & GenericParameterAttributes.ValueTypeConstraint) != 0; }
+ get { return (Attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
}
public virtual bool HasClassConstraint {
if (sc == SpecialConstraint.ReferenceType)
attrs |= GenericParameterAttributes.ReferenceTypeConstraint;
else
- attrs |= GenericParameterAttributes.ValueTypeConstraint;
+ attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint;
continue;
}
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)
if (infered_types [i] == null)
return false;
- method = method.BindGenericParameters (infered_types);
+ method = method.MakeGenericMethod (infered_types);
return true;
}
if (!InferTypeArguments (param_types, arg_types, infered_types))
return false;
- method = method.BindGenericParameters (infered_types);
+ method = method.MakeGenericMethod (infered_types);
return true;
}
if (!InferTypeArguments (param_types, arg_types, infered_types))
return false;
- method = method.BindGenericParameters (infered_types);
+ method = method.MakeGenericMethod (infered_types);
return true;
}
{\r
Type t = typeof(T);\r
\r
- if (!t.HasGenericArguments)\r
+ if (!t.IsGenericType)\r
{\r
if (t.Equals(typeof(int)))\r
return (IHasher<T>)(new IntHasher());\r
throw new NotImplementedException ();
}
- [MonoTODO]
- public override bool HasGenericArguments {
- get {
- throw new NotImplementedException ();
- }
- }
-
[MonoTODO]
public override bool ContainsGenericParameters {
get {
throw not_supported ();
}
- public override bool HasGenericArguments {
- get { return false; }
- }
-
public override bool ContainsGenericParameters {
get { return true; }
}
#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 {
return base.GetGenericTypeDefinition ();
}
- public override bool HasGenericArguments {
- get {
- return generic_params != null;
- }
- }
-
public override bool ContainsGenericParameters {
get {
return generic_params != null;
+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
[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
}
#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 ()
#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 ();
throw new NotImplementedException ();
}
- public override bool HasGenericArguments {
- get {
- throw new NotImplementedException ();
- }
- }
public override bool ContainsGenericParameters {
get {
+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.
[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;
#if NET_2_0 || BOOTSTRAP_NET_2_0
public abstract Type[] GetGenericArguments ();
- public abstract bool HasGenericArguments {
- get;
- }
-
public abstract bool ContainsGenericParameters {
get;
}
}
[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)
{
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;
{
MethodInfo builder = method.MethodData.MethodBuilder;
if (TypeArguments != null)
- return builder.BindGenericParameters (TypeArguments);
+ return builder.MakeGenericMethod (TypeArguments);
else
return builder;
}
if (gen_params.Length != atypes.Length)
continue;
- list.Add (mi.BindGenericParameters (atypes));
+ list.Add (mi.MakeGenericMethod (atypes));
}
if (list.Count > 0) {
}
public bool HasValueTypeConstraint {
- get { return (Attributes & GenericParameterAttributes.ValueTypeConstraint) != 0; }
+ get { return (Attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
}
public virtual bool HasClassConstraint {
if (sc == SpecialConstraint.ReferenceType)
attrs |= GenericParameterAttributes.ReferenceTypeConstraint;
else
- attrs |= GenericParameterAttributes.ValueTypeConstraint;
+ attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint;
continue;
}
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)
if (infered_types [i] == null)
return false;
- method = method.BindGenericParameters (infered_types);
+ method = method.MakeGenericMethod (infered_types);
return true;
}
if (!InferTypeArguments (param_types, arg_types, infered_types))
return false;
- method = method.BindGenericParameters (infered_types);
+ method = method.MakeGenericMethod (infered_types);
return true;
}
if (!InferTypeArguments (param_types, arg_types, infered_types))
return false;
- method = method.BindGenericParameters (infered_types);
+ method = method.MakeGenericMethod (infered_types);
return true;
}
+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:
GenericParameterAttributes attrs = t.GenericParameterAttributes & GenericParameterAttributes.SpecialConstraintMask;
GenericParameterAttributes [] interesting = {
GenericParameterAttributes.ReferenceTypeConstraint,
- GenericParameterAttributes.ValueTypeConstraint,
+ GenericParameterAttributes.NotNullableValueTypeConstraint,
GenericParameterAttributes.DefaultConstructorConstraint
};
case GenericParameterAttributes.ReferenceTypeConstraint:
o.Write ("class");
break;
- case GenericParameterAttributes.ValueTypeConstraint:
+ case GenericParameterAttributes.NotNullableValueTypeConstraint:
o.Write ("struct");
break;
case GenericParameterAttributes.DefaultConstructorConstraint: