// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection;
using System.Reflection.Emit;
using System.Collections;
namespace System.Reflection.Emit
{
[ComVisible (true)]
- public sealed class GenericTypeParameterBuilder : Type
+ [StructLayout (LayoutKind.Sequential)]
+ public sealed class GenericTypeParameterBuilder :
+ TypeInfo
{
#region Sync with reflection.h
private TypeBuilder tbuilder;
private string name;
private int index;
private Type base_type;
+#pragma warning disable 414
private Type[] iface_constraints;
private CustomAttributeBuilder[] cattrs;
private GenericParameterAttributes attrs;
+#pragma warning restore
#endregion
public void SetBaseTypeConstraint (Type baseTypeConstraint)
this.mbuilder = mbuilder;
this.name = name;
this.index = index;
-
- initialize ();
- }
-
-
- internal override bool IsCompilerContext {
- get {
- return tbuilder.IsCompilerContext;
- }
}
internal override Type InternalResolve ()
{
- return tbuilder.InternalResolve ().GetGenericArguments () [index];
+ if (mbuilder != null)
+ return MethodBase.GetMethodFromHandle (mbuilder.MethodHandleInternal, mbuilder.TypeBuilder.InternalResolve ().TypeHandle).GetGenericArguments () [index];
+ return tbuilder.InternalResolve ().GetGenericArguments () [index];
}
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern void initialize ();
+ internal override Type RuntimeResolve ()
+ {
+ if (mbuilder != null)
+ return MethodBase.GetMethodFromHandle (mbuilder.MethodHandleInternal, mbuilder.TypeBuilder.RuntimeResolve ().TypeHandle).GetGenericArguments () [index];
+ return tbuilder.RuntimeResolve ().GetGenericArguments () [index];
+ }
[ComVisible (true)]
public override bool IsSubclassOf (Type c)
{
- if (!IsCompilerContext)
- throw not_supported ();
- if (BaseType == null)
- return false;
- else
- return BaseType == c || BaseType.IsSubclassOf (c);
+ throw not_supported ();
}
protected override TypeAttributes GetAttributeFlagsImpl ()
{
-#if NET_4_0
return TypeAttributes.Public;
-#else
- if (IsCompilerContext)
- return TypeAttributes.Public;
- throw not_supported ();
-#endif
}
protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
throw not_supported ();
}
+ public override bool IsAssignableFrom (TypeInfo typeInfo)
+ {
+ if (typeInfo == null)
+ return false;
+
+ return IsAssignableFrom (typeInfo.AsType ());
+ }
+
public override bool IsInstanceOfType (object o)
{
throw not_supported ();
public override GenericParameterAttributes GenericParameterAttributes {
get {
- if (IsCompilerContext)
- return attrs;
throw new NotSupportedException ();
}
}
public override Type[] GetGenericParameterConstraints ()
{
- if (!IsCompilerContext)
- throw new InvalidOperationException ();
- if (base_type == null) {
- if (iface_constraints != null)
- return iface_constraints;
-
- return Type.EmptyTypes;
- }
-
- if (iface_constraints == null)
- return new Type[] { base_type };
-
- Type[] ret = new Type [iface_constraints.Length + 1];
- ret [0] = base_type;
- iface_constraints.CopyTo (ret, 1);
- return ret;
+ throw new InvalidOperationException ();
}
public override MethodBase DeclaringMethod {
return new ByRefType (this);
}
- [MonoTODO]
- public override Type MakeGenericType (params Type [] typeArguments)
+ public override Type MakeGenericType (params Type[] typeArguments)
{
- return base.MakeGenericType (typeArguments);
+ throw new InvalidOperationException (Environment.GetResourceString ("Arg_NotGenericTypeDefinition"));
}
public override Type MakePointerType ()
{
return new PointerType (this);
}
+
+ internal override bool IsUserType {
+ get {
+ return false;
+ }
+ }
}
}
+#endif