2003-05-11 Miguel de Icaza <miguel@ximian.com>
+ * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
+ want to pull the DeclSpace out of the builder_to_declspace instead
+ of the TypeBuilder (like in TypeContainer.FindMembers).
+
+ * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
+ instead of LookupTypeContainer. Fixes the crash on .NET for
+ looking up interface members.
+
* const.cs: Create our own emit context during the Definition
stage, so that constants are evaluated in the proper context, when
a recursive definition happens.
public static MemberList FindMembers (Type t, MemberTypes mt, BindingFlags bf,
MemberFilter filter, object criteria)
{
- TypeContainer tc = TypeManager.LookupTypeContainer (t);
+ DeclSpace ds = TypeManager.LookupDeclSpace (t);
- if (tc != null)
- return tc.FindMembers (mt, bf, filter, criteria);
+ if (ds != null)
+ return ds.FindMembers (mt, bf, filter, criteria);
else
return new MemberList (t.FindMembers (mt, bf, filter, criteria));
}
builder_to_attr.Add (t, tc);
}
+ /// <summary>
+ /// Returns the DeclSpace whose Type is `t' or null if there is no
+ /// DeclSpace for `t' (ie, the Type comes from a library)
+ /// </summary>
+ public static DeclSpace LookupDeclSpace (Type t)
+ {
+ return builder_to_declspace [t] as DeclSpace;
+ }
+
/// <summary>
/// Returns the TypeContainer whose Type is `t' or null if there is no
/// TypeContainer for `t' (ie, the Type comes from a library)
{
return builder_to_declspace [t] as TypeContainer;
}
-
+
public static IMemberContainer LookupMemberContainer (Type t)
{
if (t is TypeBuilder) {