* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / corlib / System.Reflection.Emit / EnumBuilder.cs
old mode 100755 (executable)
new mode 100644 (file)
index 597931f..206085c
@@ -36,10 +36,15 @@ using System.Reflection;
 using System.Reflection.Emit;
 using System.Globalization;
 using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
-       public sealed class EnumBuilder : Type {
-               private CustomAttributeBuilder[] cattrs;
+#if NET_2_0
+       [ComVisible (true)]
+       [ComDefaultInterface (typeof (_EnumBuilder))]
+#endif
+       [ClassInterface (ClassInterfaceType.None)]
+       public sealed class EnumBuilder : Type, _EnumBuilder {
                private TypeBuilder _tb;
                private FieldBuilder _underlyingField;
                private Type _underlyingType;
@@ -51,6 +56,12 @@ namespace System.Reflection.Emit {
                        _underlyingType = underlyingType;
                        _underlyingField = _tb.DefineField ("value__", underlyingType,
                                (FieldAttributes.SpecialName | FieldAttributes.Private));
+                       setup_enum_type (_tb);
+               }
+
+               internal TypeBuilder GetTypeBuilder ()
+               {
+                       return _tb;
                }
 
                public override Assembly Assembly {
@@ -139,9 +150,13 @@ namespace System.Reflection.Emit {
 
                public Type CreateType ()
                {
-                       return _tb.CreateType ();
+                       Type res = _tb.CreateType ();
+                       return res;
                }
 
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               private extern void setup_enum_type (Type t);
+
                public FieldBuilder DefineLiteral (string literalName, object literalValue)
                {
                        FieldBuilder fieldBuilder = _tb.DefineField (literalName, 
@@ -327,17 +342,12 @@ namespace System.Reflection.Emit {
 
                public void SetCustomAttribute (CustomAttributeBuilder 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;
-                       }
+                       _tb.SetCustomAttribute (customBuilder);
                }
 
+#if NET_2_0
+               [ComVisible (true)]
+#endif
                public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
                {
                        SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
@@ -350,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 {
@@ -377,18 +380,31 @@ namespace System.Reflection.Emit {
                                throw new NotImplementedException ();
                        }
                }
-
-               [MonoTODO]
-               public override MethodInfo DeclaringMethod {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
 #endif
 
                private Exception CreateNotSupportedException ()
                {
                        return new NotSupportedException ("The invoked member is not supported in a dynamic module.");
                }
+
+               void _EnumBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               void _EnumBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               void _EnumBuilder.GetTypeInfoCount (out uint pcTInfo)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               void _EnumBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+               {
+                       throw new NotImplementedException ();
+               }
        }
 }