2002-09-11 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Thu, 12 Sep 2002 02:11:42 +0000 (02:11 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Thu, 12 Sep 2002 02:11:42 +0000 (02:11 -0000)
* pending.cs (PendingImplementation): pass the container pointer.

* interface.cs (GetMethods): Allow for recursive definition.  Long
term, I would like to move every type to support recursive
definitions, not the current ordering mechanism that we have right
now.

The situation is this: Attributes are handled before interfaces,
so we can apply attributes to interfaces.  But some attributes
implement interfaces, we will now handle the simple cases
(recursive definitions will just get an error).

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

mcs/mcs/ChangeLog
mcs/mcs/class.cs
mcs/mcs/interface.cs
mcs/mcs/pending.cs

index 00fbc7cdc9a84a19a7b82211c6da08524f34754d..049f6afa87e704f1f1a6d9fe29251a150b2d55bd 100755 (executable)
@@ -1,5 +1,17 @@
 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
 
+       * pending.cs (PendingImplementation): pass the container pointer. 
+
+       * interface.cs (GetMethods): Allow for recursive definition.  Long
+       term, I would like to move every type to support recursive
+       definitions, not the current ordering mechanism that we have right
+       now.
+
+       The situation is this: Attributes are handled before interfaces,
+       so we can apply attributes to interfaces.  But some attributes
+       implement interfaces, we will now handle the simple cases
+       (recursive definitions will just get an error).  
+
        * parameter.cs: Only invalidate types at the end if we fail to
        lookup all types.  
 
index 92a2c2a6ea04a186623247bb92bc1c5d6cdcdd92..4559b6f8a1854e46bf43dbb183a0016ae37396f4 100755 (executable)
@@ -2803,7 +2803,7 @@ namespace Mono.CSharp {
                                //
                                if (implementing.DeclaringType.IsInterface)
                                        flags |= MethodAttributes.NewSlot;
-                               
+
                                flags |=
                                        MethodAttributes.Virtual |
                                        MethodAttributes.HideBySig;
index 61636f399945348c02b3fce36e8e09f10a18e588..2aa91d11b9519fafb4733df751aa29f638caff7e 100755 (executable)
@@ -53,6 +53,8 @@ namespace Mono.CSharp {
                IMemberContainer parent_container;
                MemberCache member_cache;
 
+               bool members_defined;
+
                // These will happen after the semantic analysis
                
                // Hashtable defined_indexers;
@@ -228,9 +230,22 @@ namespace Mono.CSharp {
                        return true;
                }
 
-               public MethodInfo [] GetMethods ()
+               //
+               // This might trigger a definition of the methods.  This happens only
+               // with Attributes, as Attribute classes are processed before interfaces.
+               // Ideally, we should make everything just define recursively in terms
+               // of its dependencies.
+               //
+               public MethodInfo [] GetMethods (TypeContainer container)
                {
-                       int n = method_builders.Count;
+                       int n = 0;
+                       
+                       if (!members_defined){
+                               if (DefineMembers (container))
+                                       n = method_builders.Count;
+                       } else
+                               n = method_builders.Count;
+                       
                        MethodInfo [] mi = new MethodInfo [n];
                        
                        method_builders.CopyTo (mi, 0);
@@ -835,7 +850,7 @@ namespace Mono.CSharp {
 
                        member_cache = new MemberCache (this);
 #endif
-
+                       members_defined = true;
                        return true;
                }
 
index 251bfd54a5a4307bedd5af72cc8192cfd6c18344..82f8e3b84f67a9cc5961adf62d069ebbd656b50e 100755 (executable)
@@ -139,7 +139,7 @@ namespace Mono.CSharp {
 
                                                iface = TypeManager.LookupInterface (t);
                                                
-                                               mi = iface.GetMethods ();
+                                               mi = iface.GetMethods (container);
                                        } else
                                                mi = t.GetMethods ();