using System.Reflection.Emit;
using System.Collections;
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
using System.Globalization;
using System.Runtime.Serialization;
#if NET_2_0 || BOOTSTRAP_NET_2_0
namespace System.Reflection.Emit
{
+ [ComVisible (true)]
public sealed class GenericTypeParameterBuilder : Type
{
#region Sync with reflection.h
private int index;
private Type base_type;
private Type[] iface_constraints;
+ private CustomAttributeBuilder[] cattrs;
private GenericParameterAttributes attrs;
#endregion
this.base_type = base_type_constraint;
}
- public void SetInterfaceConstraints (Type[] iface_constraints)
+ [ComVisible (true)]
+ public void SetInterfaceConstraints (params Type[] iface_constraints)
{
this.iface_constraints = iface_constraints;
}
protected override bool IsValueTypeImpl ()
{
-#warning "FIXME"
- return false;
- // return base_type != null ? base_type.IsValueType : false;
+ return base_type != null ? base_type.IsValueType : false;
}
public override object InvokeMember (string name, BindingFlags invokeAttr,
public override Type UnderlyingSystemType {
get {
- return null;
+ return this;
}
}
}
public override Type DeclaringType {
- get { return mbuilder != null ? null : tbuilder; }
+ get { return mbuilder != null ? mbuilder.DeclaringType : tbuilder; }
}
public override Type ReflectedType {
- get {
- return DeclaringType;
- }
+ get { return DeclaringType; }
}
public override RuntimeTypeHandle TypeHandle {
throw not_supported ();
}
- public override bool HasGenericArguments {
- get { return false; }
- }
-
public override bool ContainsGenericParameters {
get { return true; }
}
if (iface_constraints != null)
return iface_constraints;
- return new Type[] { typeof (object) };
+ return Type.EmptyTypes;
}
if (iface_constraints == null)
return ret;
}
- public override MethodInfo DeclaringMethod {
+ public override MethodBase DeclaringMethod {
get { return mbuilder; }
}
+ public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+ {
+ if (customBuilder == null)
+ throw new ArgumentNullException ("customBuilder");
+
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+
private Exception not_supported ()
{
return new NotSupportedException ();