Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
2002-08-20 Martin Baulig <martin@gnome.org>
	* class.cs (TypeContainer.FindMembers): Always return public events,
	even if only queried for non-public ones.

	* decl.cs (MemberCache.GetEntryType): Set the flags correctly for
	nested types and events.

svn path=/trunk/mcs/; revision=6830
  • Loading branch information
Martin Baulig committed Aug 20, 2002
1 parent dd7e30e commit 32d7586
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
9 changes: 7 additions & 2 deletions mcs/mcs/class.cs
Expand Up @@ -1249,15 +1249,20 @@ static TypeContainer ()
}

if ((mt & MemberTypes.Event) != 0) {
if (events != null)
if (events != null) {
foreach (Event e in events) {
if ((e.ModFlags & modflags) == 0)
// Always return public events, even if only queried
// for non-public ones. This is broken, but that's how
// it works in the MS runtime.
if (((bf & BindingFlags.NonPublic) == 0) &&
((e.ModFlags & Modifiers.PUBLIC) == 0))
continue;

MemberInfo eb = e.EventBuilder;
if (eb != null && filter (eb, criteria) == true)
members.Add (e.EventBuilder);
}
}
}

if ((mt & MemberTypes.Property) != 0){
Expand Down
24 changes: 15 additions & 9 deletions mcs/mcs/decl.cs
Expand Up @@ -894,10 +894,14 @@ void AddMembers (IMemberContainer container)
AddMembers (MemberTypes.Property, container);
// Nested types and events are returned by both Static and Instance
// searches.
AddMembers (MemberTypes.NestedType | MemberTypes.Event,
BindingFlags.Public, container);
AddMembers (MemberTypes.NestedType | MemberTypes.Event,
BindingFlags.NonPublic, container);
AddMembers (MemberTypes.NestedType,
BindingFlags.Static | BindingFlags.Public, container);
AddMembers (MemberTypes.NestedType,
BindingFlags.Static | BindingFlags.NonPublic, container);
// Type.GetEvents() doesn't distinguish between BindingFlags.Public and
// BindingFlags.NonPublic.
AddMembers (MemberTypes.Event,
BindingFlags.Static | BindingFlags.NonPublic, container);
}

void AddMembers (MemberTypes mt, IMemberContainer container)
Expand Down Expand Up @@ -983,23 +987,25 @@ protected static EntryType GetEntryType (MemberTypes mt, BindingFlags bf)

if ((mt & MemberTypes.Constructor) != 0)
type |= EntryType.Constructor;
if ((mt & MemberTypes.Event) != 0)
type |= EntryType.Event;
if ((mt & MemberTypes.Field) != 0)
type |= EntryType.Field;
if ((mt & MemberTypes.Method) != 0)
type |= EntryType.Method;
if ((mt & MemberTypes.Property) != 0)
type |= EntryType.Property;
// Nested types are returned by static and instance searches.
if ((mt & MemberTypes.NestedType) != 0)
type |= EntryType.NestedType;
type |= EntryType.NestedType | EntryType.Static | EntryType.Instance;
// Events are returned by static and instance searches and we don't make
// a difference between public/non-public.
if ((mt & MemberTypes.Event) != 0)
type |= EntryType.Event | EntryType.Static | EntryType.Instance |
EntryType.Public | EntryType.NonPublic;

if ((bf & BindingFlags.Instance) != 0)
type |= EntryType.Instance;
if ((bf & BindingFlags.Static) != 0)
type |= EntryType.Static;
if ((bf & (BindingFlags.Instance | BindingFlags.Static)) == 0)
type |= EntryType.Instance | EntryType.Static;
if ((bf & BindingFlags.Public) != 0)
type |= EntryType.Public;
if ((bf & BindingFlags.NonPublic) != 0)
Expand Down

0 comments on commit 32d7586

Please sign in to comment.