* NotImplementedException for many of the methods but we can't do that as gmcs
* depends on them.
*/
- internal class MonoGenericClass : MonoType
+ internal class MonoGenericClass : Type
{
#region Keep in sync with object-internals.h
#pragma warning disable 649
+ /*Hack do keep layout equals as of extending MonoType FIXME: remove this on the corlib version bump. */
+ object mono_type_placeholder;
internal TypeBuilder generic_type;
Type[] type_arguments;
bool initialized;
int event_count;
internal MonoGenericClass ()
- : base (null)
{
// this should not be used
throw new InvalidOperationException ();
}
- internal MonoGenericClass (TypeBuilder tb, Type[] args) : base (null)
+ internal MonoGenericClass (TypeBuilder tb, Type[] args)
{
this.generic_type = tb;
this.type_arguments = args;
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern void initialize (MethodInfo[] methods, ConstructorInfo[] ctors, FieldInfo[] fields, PropertyInfo[] properties, EventInfo[] events);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern Type GetElementType (Type type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern bool IsByRefImpl (Type type);
+
private const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
get { return this; }
}
+ public override Assembly Assembly {
+ get { return generic_type.Assembly; }
+ }
+
+ public override Module Module {
+ get { return generic_type.Module; }
+ }
+
public override string Name {
get { return generic_type.Name; }
}
return format_name (false, false);
}
+ public override Type GetGenericTypeDefinition ()
+ {
+ return generic_type;
+ }
+
+ public override Type[] GetGenericArguments ()
+ {
+ Type[] ret = new Type [type_arguments.Length];
+ type_arguments.CopyTo (ret, 0);
+ return ret;
+ }
+
+ public override bool ContainsGenericParameters {
+ get {
+ /*FIXME remove this once compound types are not instantiated using MGC*/
+ if (HasElementType)
+ return GetElementType ().ContainsGenericParameters;
+
+ foreach (Type t in type_arguments) {
+ if (t.ContainsGenericParameters)
+ return true;
+ }
+ return false;
+ }
+ }
+
+ public override bool IsGenericTypeDefinition {
+ get { return false; }
+ }
+
+ public override bool IsGenericType {
+ get { return !HasElementType; }
+ }
+
+ public override Type DeclaringType {
+ get { return InflateType (generic_type.DeclaringType); }
+ }
+
+ public override RuntimeTypeHandle TypeHandle {
+ get {
+ if (!IsCompilerContext)
+ throw new NotSupportedException ();
+ return _impl;
+ }
+ }
+
public override Type MakeArrayType ()
{
return new ArrayType (this, 0);
return new PointerType (this);
}
- /*public override Type GetElementType ()
+ public override Type GetElementType ()
{
- throw new NotSupportedException ();
- }*/
+ if (!HasElementType)
+ throw new NotSupportedException ();
+ return GetElementType (this);
+ }
+
+ protected override bool HasElementTypeImpl ()
+ {
+ return IsByRefImpl ();
+ }
protected override bool IsCOMObjectImpl ()
{
return false;
}
- /*
protected override bool IsArrayImpl ()
{
return false;
protected override bool IsByRefImpl ()
{
- return false;
+ return IsByRefImpl (this);
}
protected override bool IsPointerImpl ()
{
return false;
- }*/
+ }
protected override TypeAttributes GetAttributeFlagsImpl ()
{