// (C) 2001 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
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 {
+ [ComVisible (true)]
+ [ComDefaultInterface (typeof (_EnumBuilder))]
+ [ClassInterface (ClassInterfaceType.None)]
+ public sealed class EnumBuilder : Type, _EnumBuilder {
private TypeBuilder _tb;
private FieldBuilder _underlyingField;
private Type _underlyingType;
typeof(Enum), null, PackingSize.Unspecified, 0, null);
_underlyingType = underlyingType;
_underlyingField = _tb.DefineField ("value__", underlyingType,
- (FieldAttributes.SpecialName | FieldAttributes.Private));
+ (FieldAttributes.SpecialName | FieldAttributes.Private | FieldAttributes.RTSpecialName));
setup_enum_type (_tb);
}
return _tb;
}
+ internal override Type InternalResolve ()
+ {
+ return _tb.InternalResolve ();
+ }
+
+
public override Assembly Assembly {
get {
return _tb.Assembly;
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)
{
+ Type fieldType = this;
FieldBuilder fieldBuilder = _tb.DefineField (literalName,
- _underlyingType, (FieldAttributes.Literal |
+ fieldType, (FieldAttributes.Literal |
(FieldAttributes.Static | FieldAttributes.Public)));
fieldBuilder.SetConstant (literalValue);
return fieldBuilder;
}
protected override ConstructorInfo GetConstructorImpl (
- BindingFlags bindingAttr, Binder binder, CallingConventions cc,
+ BindingFlags bindingAttr, Binder binder, CallingConventions callConvention,
Type[] types, ParameterModifier[] modifiers)
{
- return _tb.GetConstructor (bindingAttr, binder, cc, types,
+ return _tb.GetConstructor (bindingAttr, binder, callConvention, types,
modifiers);
}
+ [ComVisible (true)]
public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
{
return _tb.GetConstructors (bindingAttr);
return _tb.GetInterface (name, ignoreCase);
}
+ [ComVisible (true)]
public override InterfaceMapping GetInterfaceMap (Type interfaceType)
{
return _tb.GetInterfaceMap (interfaceType);
return _tb.IsDefined (attributeType, inherit);
}
+ public override Type MakeArrayType ()
+ {
+ return new ArrayType (this, 0);
+ }
+
+ public override Type MakeArrayType (int rank)
+ {
+ if (rank < 1)
+ throw new IndexOutOfRangeException ();
+ return new ArrayType (this, rank);
+ }
+
+ public override Type MakeByRefType ()
+ {
+ return new ByRefType (this);
+ }
+
+ public override Type MakePointerType ()
+ {
+ return new PointerType (this);
+ }
+
public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
{
_tb.SetCustomAttribute (customBuilder);
}
+ [ComVisible (true)]
public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
{
SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
}
-#if NET_2_0 || BOOTSTRAP_NET_2_0
- [MonoTODO]
- public override Type[] GetGenericArguments ()
+ private Exception CreateNotSupportedException ()
{
- throw new NotImplementedException ();
+ return new NotSupportedException ("The invoked member is not supported in a dynamic module.");
}
- [MonoTODO]
- public override bool HasGenericArguments {
- get {
- throw new NotImplementedException ();
- }
+ void _EnumBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+ {
+ throw new NotImplementedException ();
}
- [MonoTODO]
- public override bool ContainsGenericParameters {
- get {
- throw new NotImplementedException ();
- }
+ void _EnumBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+ {
+ throw new NotImplementedException ();
}
- [MonoTODO]
- public override bool IsGenericParameter {
- get {
- throw new NotImplementedException ();
- }
+ void _EnumBuilder.GetTypeInfoCount (out uint pcTInfo)
+ {
+ throw new NotImplementedException ();
}
- [MonoTODO]
- public override int GenericParameterPosition {
- get {
- 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 ();
}
- [MonoTODO]
- public override MethodInfo DeclaringMethod {
+ internal override bool IsUserType {
get {
- throw new NotImplementedException ();
+ return false;
}
}
-#endif
-
- private Exception CreateNotSupportedException ()
- {
- return new NotSupportedException ("The invoked member is not supported in a dynamic module.");
- }
}
}
+#endif