-
-#if !BROKEN_RUNTIME
- new_bf = (member.DeclaringType == container.Type) ?
- bf | BindingFlags.DeclaredOnly : bf;
-#endif
-
- list.Add (new CacheEntry (container, member, mt, new_bf));
- }
- }
-
- protected static EntryType GetEntryType (MemberTypes mt, BindingFlags bf)
- {
- EntryType type = EntryType.None;
-
- 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;
- if ((mt & MemberTypes.NestedType) != 0)
- type |= EntryType.NestedType;
-
- if ((bf & BindingFlags.Instance) != 0)
- type |= EntryType.Instance;
- if ((bf & BindingFlags.Static) != 0)
- type |= EntryType.Static;
- if ((bf & BindingFlags.Public) != 0)
- type |= EntryType.Public;
- if ((bf & BindingFlags.NonPublic) != 0)
- type |= EntryType.NonPublic;
- if ((bf & BindingFlags.DeclaredOnly) != 0)
- type |= EntryType.Declared;
-
- return type;
- }
-
- public static bool IsSingleMemberType (MemberTypes mt)
- {
- switch (mt) {
- case MemberTypes.Constructor:
- case MemberTypes.Event:
- case MemberTypes.Field:
- case MemberTypes.Method:
- case MemberTypes.Property:
- case MemberTypes.NestedType:
- return true;
-
- default:
- return false;
- }
- }
-
- [Flags]
- protected enum EntryType {
- None = 0x000,
-
- Instance = 0x001,
- Static = 0x002,
- MaskStatic = Instance|Static,
-
- Public = 0x004,
- NonPublic = 0x008,
- MaskProtection = Public|NonPublic,
-
- Declared = 0x010,
-
- Constructor = 0x020,
- Event = 0x040,
- Field = 0x080,
- Method = 0x100,
- Property = 0x200,
- NestedType = 0x400,
-
- MaskType = Constructor|Event|Field|Method|Property|NestedType
- }
-
- protected struct CacheEntry {
-#if BROKEN_RUNTIME
- // FIXME: This field is a temporary hack until the Mono runtime is fixed
- // and distinguishes between ReflectedType and DeclaringType.
- public readonly IMemberContainer Container;
-#endif
- public readonly EntryType EntryType;
- public readonly MemberInfo Member;
-
- public CacheEntry (IMemberContainer container, MemberInfo member, MemberTypes mt,
- BindingFlags bf)
- {
-#if BROKEN_RUNTIME
- this.Container = container;
-#endif
- this.Member = member;
- this.EntryType = GetEntryType (mt, bf);