Author: gert
Date: 2007-12-20 09:48:10 -0500 (Thu, 20 Dec 2007)
New Revision: 91711

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/icall.c
Log:
* icall.c (property_accessor_nonpublic): new function to determine
whether an accessor allows a property to be considered non-public.
Returns false for private accessor(s) from parent class, and internal
accessor(s) from parent on 2.0 profile (and higher).
(ves_icall_Type_GetPropertiesByName): Use newly introduced function
to determine whether property should be included if NonPublic flag
is set. Fixes bug #349078.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2007-12-20 14:33:02 UTC (rev 91710)
+++ trunk/mono/mono/metadata/ChangeLog  2007-12-20 14:48:10 UTC (rev 91711)
@@ -1,3 +1,13 @@
+2007-12-20  Gert Driesen  <[EMAIL PROTECTED]>
+
+       * icall.c (property_accessor_nonpublic): new function to determine
+       whether an accessor allows a property to be considered non-public.
+       Returns false for private accessor(s) from parent class, and internal
+       accessor(s) from parent on 2.0 profile (and higher).
+       (ves_icall_Type_GetPropertiesByName): Use newly introduced function
+       to determine whether property should be included if NonPublic flag
+       is set. Fixes bug #349078.
+
 2007-12-20  Rodrigo Kumpera  <[EMAIL PROTECTED]>
 
        * verify.c (init_stack_with_value): added

Modified: trunk/mono/mono/metadata/icall.c
===================================================================
--- trunk/mono/mono/metadata/icall.c    2007-12-20 14:33:02 UTC (rev 91710)
+++ trunk/mono/mono/metadata/icall.c    2007-12-20 14:48:10 UTC (rev 91711)
@@ -3581,6 +3581,25 @@
        return TRUE;
 }
 
+static gboolean
+property_accessor_nonpublic (MonoMethod* accessor, gboolean start_klass)
+{
+       if (!accessor)
+               return FALSE;
+
+       switch (accessor->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) {
+               case METHOD_ATTRIBUTE_ASSEM:
+                       return (start_klass || 
mono_defaults.generic_ilist_class);
+                       break;
+               case METHOD_ATTRIBUTE_PRIVATE:
+                       return start_klass;
+               case METHOD_ATTRIBUTE_PUBLIC:
+                       return FALSE;
+               default:
+                       return TRUE;
+       }
+}
+
 static MonoArray*
 ves_icall_Type_GetPropertiesByName (MonoReflectionType *type, MonoString 
*name, guint32 bflags, MonoBoolean ignore_case, MonoReflectionType *reftype)
 {
@@ -3642,9 +3661,11 @@
                        (prop->set && ((prop->set->flags & 
METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC))) {
                        if (bflags & BFLAGS_Public)
                                match++;
-               } else {
-                       if (bflags & BFLAGS_NonPublic)
+               } else if (bflags & BFLAGS_NonPublic) {
+                       if (property_accessor_nonpublic(prop->get, startklass 
== klass) ||
+                               property_accessor_nonpublic(prop->set, 
startklass == klass)) {
                                match++;
+                       }
                }
                if (!match)
                        continue;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to