Merge pull request #498 from Unroll-Me/master
[mono.git] / mcs / class / corlib / System.Reflection.Emit / EnumBuilder.cs
index 4f873b911973319deae7d4343930649b0bbb4d88..50a674473779299209f339f4915230de6f31272a 100644 (file)
@@ -31,6 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -39,10 +40,8 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
-#if NET_2_0
        [ComVisible (true)]
        [ComDefaultInterface (typeof (_EnumBuilder))]
-#endif
        [ClassInterface (ClassInterfaceType.None)]
        public sealed class EnumBuilder : Type, _EnumBuilder {
                private TypeBuilder _tb;
@@ -64,6 +63,12 @@ namespace System.Reflection.Emit {
                        return _tb;
                }
 
+               internal override Type InternalResolve ()
+               {
+                       return _tb.InternalResolve (); 
+               }
+
+
                public override Assembly Assembly {
                        get {
                                return _tb.Assembly;
@@ -154,16 +159,19 @@ namespace System.Reflection.Emit {
                        return res;
                }
 
+#if NET_4_0
+               public override Type GetEnumUnderlyingType ()
+               {
+                       return _underlyingType;
+               }
+#endif
+
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern void setup_enum_type (Type t);
 
                public FieldBuilder DefineLiteral (string literalName, object literalValue)
                {
-#if NET_2_0
                        Type fieldType = this;
-#else
-                       Type fieldType = _underlyingType;
-#endif
                        FieldBuilder fieldBuilder = _tb.DefineField (literalName, 
                                fieldType, (FieldAttributes.Literal | 
                                (FieldAttributes.Static | FieldAttributes.Public)));
@@ -184,9 +192,7 @@ namespace System.Reflection.Emit {
                                modifiers);
                }
 
-#if NET_2_0
                [ComVisible (true)]
-#endif
                public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
                {
                        return _tb.GetConstructors (bindingAttr);
@@ -237,9 +243,7 @@ namespace System.Reflection.Emit {
                        return _tb.GetInterface (name, ignoreCase);
                }
 
-#if NET_2_0
                [ComVisible (true)]
-#endif
                public override InterfaceMapping GetInterfaceMap (Type interfaceType)
                {
                        return _tb.GetInterfaceMap (interfaceType);
@@ -351,7 +355,6 @@ namespace System.Reflection.Emit {
                        return _tb.IsDefined (attributeType, inherit);
                }
 
-#if NET_2_0
                public override Type MakeArrayType ()
                {
                        return  new ArrayType (this, 0);
@@ -373,16 +376,13 @@ namespace System.Reflection.Emit {
                {
                        return new PointerType (this);
                }
-#endif
 
                public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
                {
                        _tb.SetCustomAttribute (customBuilder);
                }
 
-#if NET_2_0
                [ComVisible (true)]
-#endif
                public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
                {
                        SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
@@ -412,5 +412,12 @@ namespace System.Reflection.Emit {
                {
                        throw new NotImplementedException ();
                }
+
+               internal override bool IsUserType {
+                       get {
+                               return false;
+                       }
+               }
        }
 }
+#endif