2004-01-25 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Sun, 25 Jan 2004 11:09:40 +0000 (11:09 -0000)
committerMartin Baulig <martin@novell.com>
Sun, 25 Jan 2004 11:09:40 +0000 (11:09 -0000)
* MonoGenericInst.cs: Honor BindingFlags.DeclaredOnly.

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

mcs/class/corlib/System.Reflection/ChangeLog
mcs/class/corlib/System.Reflection/MonoGenericInst.cs

index 0d59a3204e174a39cf1756a59991ebd9b1113603..95010084722b73bcd2b24d677cebef924cd135bd 100644 (file)
@@ -1,3 +1,7 @@
+2004-01-25  Martin Baulig  <martin@ximian.com>
+
+       * MonoGenericInst.cs: Honor BindingFlags.DeclaredOnly.
+
 2004-01-19  Zoltan Varga  <vargaz@freemail.hu>
 
        * Assembly.cs (GetManifestResourceStream): Make the IntPtrStream keep
index 7eb7345b5bdec26fa05530d53e6a883010f7eb7e..39fa613befb831363f843e56b8d254cb8ee83c53 100644 (file)
@@ -25,6 +25,9 @@ namespace System.Reflection
                private MethodInfo[] methods;
                private ConstructorInfo[] ctors;
                private FieldInfo[] fields;
+               private int first_method;
+               private int first_ctor;
+               private int first_field;
 
                [MonoTODO]
                internal MonoGenericInst ()
@@ -62,6 +65,10 @@ namespace System.Reflection
                                }
                        }
 
+                       first_method = mlist.Count;
+                       first_ctor = clist.Count;
+                       first_field = flist.Count;
+
                        foreach (MethodInfo m in generic_type.GetMethods (flags))
                                mlist.Add (inflate_method (this, reflected, m));
                        foreach (ConstructorInfo c in generic_type.GetConstructors (flags))
@@ -116,7 +123,15 @@ namespace System.Reflection
                        bool match;
                        MethodAttributes mattrs;
 
-                       foreach (MethodInfo c in methods) {
+                       int start;
+                       if ((bindingAttr & BindingFlags.DeclaredOnly) != 0)
+                               start = first_method;
+                       else
+                               start = 0;
+
+                       for (int i = start; i < methods.Length; i++) {
+                               MethodInfo c = methods [i];
+
                                match = false;
                                mattrs = c.Attributes;
                                if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
@@ -159,7 +174,15 @@ namespace System.Reflection
                        bool match;
                        MethodAttributes mattrs;
 
-                       foreach (ConstructorInfo c in ctors) {
+                       int start;
+                       if ((bindingAttr & BindingFlags.DeclaredOnly) != 0)
+                               start = first_ctor;
+                       else
+                               start = 0;
+
+                       for (int i = start; i < ctors.Length; i++) {
+                               ConstructorInfo c = ctors [i];
+
                                match = false;
                                mattrs = c.Attributes;
                                if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
@@ -202,7 +225,15 @@ namespace System.Reflection
                        bool match;
                        FieldAttributes fattrs;
 
-                       foreach (FieldInfo c in fields) {
+                       int start;
+                       if ((bindingAttr & BindingFlags.DeclaredOnly) != 0)
+                               start = first_field;
+                       else
+                               start = 0;
+
+                       for (int i = start; i < fields.Length; i++) {
+                               FieldInfo c = fields [i];
+
                                match = false;
                                fattrs = c.Attributes;
                                if ((fattrs & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) {