2003-05-11 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Sun, 11 May 2003 21:38:54 +0000 (21:38 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Sun, 11 May 2003 21:38:54 +0000 (21:38 -0000)
* 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.

svn path=/trunk/mcs/; revision=14499

mcs/mcs/ChangeLog
mcs/mcs/class.cs
mcs/mcs/typemanager.cs

index 9959ebcc7f8dcf54496a928fabcf1b54e2e95b18..e21ac191ed8a5d34c6db3f674d9b57aa79c0acf3 100755 (executable)
@@ -1,5 +1,13 @@
 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.
index 676cc82526624b6dc2e0a9e80aef23b566c3ab6b..ccb0f6f4a50241acdd9c27363824ff9f69fc5e1e 100755 (executable)
@@ -1385,10 +1385,10 @@ namespace Mono.CSharp {
                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));
                }
index d43deba4dad5478ab0fdf39af7e75a062b859b3e..096b088f5102a5ba8cc35b11ccecc126a1ff2b0f 100755 (executable)
@@ -428,6 +428,15 @@ public class TypeManager {
                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)
@@ -436,7 +445,7 @@ public class TypeManager {
        {
                return builder_to_declspace [t] as TypeContainer;
        }
-
+       
        public static IMemberContainer LookupMemberContainer (Type t)
        {
                if (t is TypeBuilder) {