2006-02-15 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / class / corlib / System.Reflection.Emit / ConstructorBuilder.cs
index dd3927cb019d6ecf75eb952b3e521a481fcc1849..bd35c08908cfe15f9aabaeba709102258006a0ca 100644 (file)
@@ -43,10 +43,10 @@ namespace System.Reflection.Emit {
 
 #if NET_2_0
        [ComVisible (true)]
-       [ClassInterfaceAttribute (ClassInterfaceType.None)]
-       [ComDefaultInterfaceAttribute (typeof (_ConstructorBuilder))]
+       [ComDefaultInterface (typeof (_ConstructorBuilder))]
 #endif
-       public sealed class ConstructorBuilder : ConstructorInfo {
+       [ClassInterface (ClassInterfaceType.None)]
+       public sealed class ConstructorBuilder : ConstructorInfo, _ConstructorBuilder {
                private RuntimeMethodHandle mhandle;
                private ILGenerator ilgen;
                private Type[] parameters;
@@ -183,11 +183,22 @@ namespace System.Reflection.Emit {
                }
 
                public override object [] GetCustomAttributes (bool inherit) {
-                       throw not_supported ();
+                       /*
+                        * On MS.NET, this always returns not_supported, but we can't do this
+                        * since there would be no way to obtain custom attributes of 
+                        * dynamically created ctors.
+                        */
+                       if (type.is_created)
+                               return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+                       else
+                               throw not_supported ();
                }
 
-               public override object [] GetCustomAttributes (Type attribute_type, bool inherit) {
-                       throw not_supported ();
+               public override object [] GetCustomAttributes (Type attributeType, bool inherit) {
+                       if (type.is_created)
+                               return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+                       else
+                               throw not_supported ();
                }
 
                public ILGenerator GetILGenerator () {
@@ -259,18 +270,19 @@ namespace System.Reflection.Emit {
                }
 
 #if NET_2_0 || BOOTSTRAP_NET_2_0
-               public override bool Mono_IsInflatedMethod {
+               public override bool IsGenericMethodDefinition {
                        get {
                                return false;
                        }
                }
 
-               public override bool HasGenericParameters {
+               public override bool IsGenericMethod {
                        get {
                                return false;
                        }
                }
 
+
                public override Module Module {
                        get {
                                return base.Module;
@@ -318,5 +330,25 @@ namespace System.Reflection.Emit {
                private Exception not_after_created () {
                        return new InvalidOperationException ("Unable to change after type has been created.");
                }
+
+               void _ConstructorBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               void _ConstructorBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               void _ConstructorBuilder.GetTypeInfoCount (out uint pcTInfo)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               void _ConstructorBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+               {
+                       throw new NotImplementedException ();
+               }
        }
 }