(GenericTypeParameterBuilder): New. An abominable repugnant hack.
svn path=/trunk/mcs/; revision=65770
2006-09-21 Raja R Harinath <rharinath@novell.com>
+ * generic.cs (TypeParameter): Implement IMemberContainer.
+ (GenericTypeParameterBuilder): New. An abominable repugnant hack.
+
* rootcontext.cs: Unify with gmcs version.
* report.cs: Unify with gmcs version.
Fields = new FieldInfo [Count];
public_fields.CopyTo (Fields, 0);
non_public_fields.CopyTo (Fields, CountPublic);
-#if GMCS_SOURCE
} else if (type is GenericTypeParameterBuilder) {
CountPublic = CountNonPublic = Count = 0;
Fields = new FieldInfo [0];
-#endif
} else {
FieldInfo[] public_fields = type.GetFields (
BindingFlags.Instance|BindingFlags.Public);
// (C) 2006 Novell, Inc.
//
using System;
+using System.Reflection;
using System.Collections;
namespace Mono.CSharp {
}
}
- public abstract class TypeParameter : MemberCore {
+ public abstract class TypeParameter : MemberCore, IMemberContainer {
private TypeParameter ()
: base (null, null, null)
{
{
throw new InternalErrorException ("cannot be called");
}
+
+#region IMemberContainer
+ public Type Type {
+ get { throw new InternalErrorException ("cannot be called"); }
+ }
+
+ public MemberCache BaseCache {
+ get { throw new InternalErrorException ("cannot be called"); }
+ }
+
+ public bool IsInterface {
+ get { throw new InternalErrorException ("cannot be called"); }
+ }
+
+ public MemberList GetMembers (MemberTypes mt, BindingFlags bf)
+ {
+ return FindMembers (mt, bf, null, null);
+ }
+
+ public MemberCache MemberCache {
+ get { throw new InternalErrorException ("cannot be called"); }
+ }
+#endregion
+
+ public MemberList FindMembers (MemberTypes mt, BindingFlags bf,
+ MemberFilter filter, object criteria)
+ {
+ throw new InternalErrorException ("cannot be called");
+ }
+ }
+}
+
+namespace System.Reflection.Emit {
+ // GRIEVOUS HACK
+ abstract class GenericTypeParameterBuilder : Type {
}
}
return container.MemberCache;
}
-#if GMCS_SOURCE
if (t is GenericTypeParameterBuilder) {
IMemberContainer container = builder_to_type_param [t] as IMemberContainer;
if (container != null)
return container.MemberCache;
}
-#endif
return TypeHandle.GetMemberCache (t);
}
t.IsSubclassOf (TypeManager.array_type))
return new MemberList (TypeManager.array_type.FindMembers (mt, bf, filter, criteria));
-#if GMCS_SOURCE
if (t is GenericTypeParameterBuilder) {
TypeParameter tparam = (TypeParameter) builder_to_type_param [t];
Timer.StopTimer (TimerType.FindMembers);
return list;
}
-#endif
//
// Since FindMembers will not lookup both static and instance
mt, bf, name, FilterWithClosure_delegate, null);
}
-#if GMCS_SOURCE
if (t is GenericTypeParameterBuilder) {
TypeParameter tparam = (TypeParameter) builder_to_type_param [t];
return (MemberInfo []) list;
}
- if (t.IsGenericType && (mt == MemberTypes.NestedType)) {
+ if (IsGenericType (t) && (mt == MemberTypes.NestedType)) {
//
// This happens if we're resolving a class'es base class and interfaces
// in TypeContainer.DefineType(). At this time, the types aren't
used_cache = false;
return info;
}
-#endif
//
// This call will always succeed. There is exactly one TypeHandle instance per
iface_cache [t] = result;
return result;
-#if GMCS_SOURCE
} else if (t is GenericTypeParameterBuilder){
Type[] type_ifaces = (Type []) builder_to_ifaces [t];
if (type_ifaces == null || type_ifaces.Length == 0)
iface_cache [t] = type_ifaces;
return type_ifaces;
-#endif
} else {
Type[] ifaces = t.GetInterfaces ();
iface_cache [t] = ifaces;
public MemberList GetMembers (MemberTypes mt, BindingFlags bf)
{
MemberInfo [] members;
-#if GMCS_SOURCE
+
if (type is GenericTypeParameterBuilder)
return MemberList.Empty;
-#endif
+
if (mt == MemberTypes.Event)
members = type.GetEvents (bf | BindingFlags.DeclaredOnly);
else