public override EventInfo[] GetEvents(BindingFlags bf) { ArrayList l = new ArrayList(); Type current_type = this; do { MonoGenericClass gi = current_type as MonoGenericClass; if (gi != null) { l.AddRange(gi.GetEvents_impl(bf, this)); } else if (current_type is TypeBuilder) { l.AddRange(current_type.GetEvents(bf)); } else { MonoType mt = (MonoType)current_type; l.AddRange(mt.GetEvents(bf)); break; } if ((bf & BindingFlags.DeclaredOnly) != 0) { break; } current_type = current_type.BaseType; } while (current_type != null); EventInfo[] result = new EventInfo [l.Count]; l.CopyTo(result); return(result); }
internal MethodOnTypeBuilderInst (MethodOnTypeBuilderInst gmd, Type[] typeArguments) { this.instantiation = gmd.instantiation; this.mb = gmd.mb; this.method_arguments = new Type [typeArguments.Length]; typeArguments.CopyTo (this.method_arguments, 0); this.generic_method_definition = gmd; }
private EventInfo[] GetEventsInternal(BindingFlags bf, MonoGenericClass reftype) { if (this.generic_type.events == null) { return(new EventInfo[0]); } this.initialize(); ArrayList arrayList = new ArrayList(); for (int i = 0; i < this.event_count; i++) { EventBuilder eventBuilder = this.generic_type.events[i]; bool flag = false; MethodInfo methodInfo = eventBuilder.add_method; if (methodInfo == null) { methodInfo = eventBuilder.remove_method; } if (methodInfo != null) { MethodAttributes attributes = methodInfo.Attributes; if ((attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != BindingFlags.Default) { flag = true; } } else if ((bf & BindingFlags.NonPublic) != BindingFlags.Default) { flag = true; } if (flag) { flag = false; if ((attributes & MethodAttributes.Static) != MethodAttributes.PrivateScope) { if ((bf & BindingFlags.Static) != BindingFlags.Default) { flag = true; } } else if ((bf & BindingFlags.Instance) != BindingFlags.Default) { flag = true; } if (flag) { arrayList.Add(new EventOnTypeBuilderInst(this, eventBuilder)); } } } } EventInfo[] array = new EventInfo[arrayList.Count]; arrayList.CopyTo(array); return(array); }
private PropertyInfo[] GetPropertiesInternal(BindingFlags bf, MonoGenericClass reftype) { if (this.generic_type.properties == null) { return(new PropertyInfo[0]); } ArrayList arrayList = new ArrayList(); this.initialize(); foreach (PropertyBuilder propertyInfo in this.generic_type.properties) { bool flag = false; MethodInfo methodInfo = propertyInfo.GetGetMethod(true); if (methodInfo == null) { methodInfo = propertyInfo.GetSetMethod(true); } if (methodInfo != null) { MethodAttributes attributes = methodInfo.Attributes; if ((attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != BindingFlags.Default) { flag = true; } } else if ((bf & BindingFlags.NonPublic) != BindingFlags.Default) { flag = true; } if (flag) { flag = false; if ((attributes & MethodAttributes.Static) != MethodAttributes.PrivateScope) { if ((bf & BindingFlags.Static) != BindingFlags.Default) { flag = true; } } else if ((bf & BindingFlags.Instance) != BindingFlags.Default) { flag = true; } if (flag) { arrayList.Add(new PropertyOnTypeBuilderInst(reftype, propertyInfo)); } } } } PropertyInfo[] array = new PropertyInfo[arrayList.Count]; arrayList.CopyTo(array); return(array); }
private MethodInfo[] GetMethodsInternal(BindingFlags bf, MonoGenericClass reftype) { if (this.generic_type.num_methods == 0) { return(new MethodInfo[0]); } ArrayList arrayList = new ArrayList(); this.initialize(); for (int i = 0; i < this.generic_type.num_methods; i++) { MethodInfo methodInfo = this.generic_type.methods[i]; bool flag = false; MethodAttributes attributes = methodInfo.Attributes; if ((attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != BindingFlags.Default) { flag = true; } } else if ((bf & BindingFlags.NonPublic) != BindingFlags.Default) { flag = true; } if (flag) { flag = false; if ((attributes & MethodAttributes.Static) != MethodAttributes.PrivateScope) { if ((bf & BindingFlags.Static) != BindingFlags.Default) { flag = true; } } else if ((bf & BindingFlags.Instance) != BindingFlags.Default) { flag = true; } if (flag) { methodInfo = TypeBuilder.GetMethod(this, methodInfo); arrayList.Add(methodInfo); } } } MethodInfo[] array = new MethodInfo[arrayList.Count]; arrayList.CopyTo(array); return(array); }
private FieldInfo[] GetFieldsInternal(BindingFlags bf, MonoGenericClass reftype) { if (this.generic_type.num_fields == 0) { return(new FieldInfo[0]); } ArrayList arrayList = new ArrayList(); this.initialize(); for (int i = 0; i < this.generic_type.num_fields; i++) { FieldInfo fieldInfo = this.generic_type.fields[i]; bool flag = false; FieldAttributes attributes = fieldInfo.Attributes; if ((attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) { if ((bf & BindingFlags.Public) != BindingFlags.Default) { flag = true; } } else if ((bf & BindingFlags.NonPublic) != BindingFlags.Default) { flag = true; } if (flag) { flag = false; if ((attributes & FieldAttributes.Static) != FieldAttributes.PrivateScope) { if ((bf & BindingFlags.Static) != BindingFlags.Default) { flag = true; } } else if ((bf & BindingFlags.Instance) != BindingFlags.Default) { flag = true; } if (flag) { arrayList.Add(TypeBuilder.GetField(this, fieldInfo)); } } } FieldInfo[] array = new FieldInfo[arrayList.Count]; arrayList.CopyTo(array); return(array); }
private ConstructorInfo[] GetConstructorsInternal(BindingFlags bf, MonoGenericClass reftype) { if (this.generic_type.ctors == null) { return(new ConstructorInfo[0]); } ArrayList arrayList = new ArrayList(); this.initialize(); for (int i = 0; i < this.generic_type.ctors.Length; i++) { ConstructorInfo constructorInfo = this.generic_type.ctors[i]; bool flag = false; MethodAttributes attributes = constructorInfo.Attributes; if ((attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != BindingFlags.Default) { flag = true; } } else if ((bf & BindingFlags.NonPublic) != BindingFlags.Default) { flag = true; } if (flag) { flag = false; if ((attributes & MethodAttributes.Static) != MethodAttributes.PrivateScope) { if ((bf & BindingFlags.Static) != BindingFlags.Default) { flag = true; } } else if ((bf & BindingFlags.Instance) != BindingFlags.Default) { flag = true; } if (flag) { arrayList.Add(TypeBuilder.GetConstructor(this, constructorInfo)); } } } ConstructorInfo[] array = new ConstructorInfo[arrayList.Count]; arrayList.CopyTo(array); return(array); }
public override MethodInfo[] GetMethods(BindingFlags bf) { if (!generic_type.IsCompilerContext) { throw new NotSupportedException(); } ArrayList l = new ArrayList(); // // Walk up our class hierarchy and retrieve methods from our // parent classes. // Type current_type = this; do { MonoGenericClass gi = current_type as MonoGenericClass; if (gi != null) { l.AddRange(gi.GetMethodsInternal(bf, this)); } else if (current_type is TypeBuilder) { l.AddRange(current_type.GetMethods(bf)); } else { // If we encounter a `MonoType', its // GetMethodsByName() will return all the methods // from its parent type(s), so we can stop here. MonoType mt = (MonoType)current_type; l.AddRange(mt.GetMethodsByName(null, bf, false, this)); break; } if ((bf & BindingFlags.DeclaredOnly) != 0) { break; } current_type = current_type.BaseType; } while (current_type != null); MethodInfo[] result = new MethodInfo [l.Count]; l.CopyTo(result); return(result); }
private void initialize() { if (this.initialized) { return; } MonoGenericClass monoGenericClass = this.GetParentType() as MonoGenericClass; if (monoGenericClass != null) { monoGenericClass.initialize(); } EventInfo[] events_internal = this.generic_type.GetEvents_internal(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); this.event_count = events_internal.Length; this.initialize(this.generic_type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), this.generic_type.GetConstructorsInternal(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), this.generic_type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), this.generic_type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), events_internal); this.initialized = true; }
void initialize() { if (initialized) { return; } MonoGenericClass parent = GetParentType() as MonoGenericClass; if (parent != null) { parent.initialize(); } initialize(generic_type.GetFields(flags)); initialized = true; }
public override EventInfo[] GetEvents(BindingFlags bf) { if (!this.generic_type.IsCompilerContext) { throw new NotSupportedException(); } ArrayList arrayList = new ArrayList(); Type type = this; for (;;) { MonoGenericClass monoGenericClass = type as MonoGenericClass; if (monoGenericClass != null) { arrayList.AddRange(monoGenericClass.GetEventsInternal(bf, this)); } else { if (!(type is TypeBuilder)) { break; } arrayList.AddRange(type.GetEvents(bf)); } if ((bf & BindingFlags.DeclaredOnly) != BindingFlags.Default) { goto Block_4; } type = type.BaseType; if (type == null) { goto IL_8E; } } MonoType monoType = (MonoType)type; arrayList.AddRange(monoType.GetEvents(bf)); Block_4: IL_8E: EventInfo[] array = new EventInfo[arrayList.Count]; arrayList.CopyTo(array); return(array); }
public override EventInfo[] GetEvents(BindingFlags bf) { if (!generic_type.IsCompilerContext) { throw new NotSupportedException(); } ArrayList l = new ArrayList(); Type current_type = this; do { MonoGenericClass gi = current_type as MonoGenericClass; if (gi != null) { l.AddRange(gi.GetEventsInternal(bf, this)); } else if (current_type is TypeBuilder) { l.AddRange(current_type.GetEvents(bf)); } else { MonoType mt = (MonoType)current_type; l.AddRange(mt.GetEvents(bf)); break; } if ((bf & BindingFlags.DeclaredOnly) != 0) { break; } current_type = current_type.BaseType; } while (current_type != null); EventInfo[] result = new EventInfo [l.Count]; l.CopyTo(result); return(result); }
void initialize() { if (initialized) { return; } MonoGenericClass parent = GetParentType() as MonoGenericClass; if (parent != null) { parent.initialize(); } initialize(generic_type.GetMethods(flags), generic_type.GetConstructors(flags), generic_type.GetFields(flags), generic_type.GetProperties(flags), get_event_info()); initialized = true; }
void initialize() { if (initialized) { return; } MonoGenericClass parent = GetParentType() as MonoGenericClass; if (parent != null) { parent.initialize(); } EventInfo[] events = generic_type.GetEvents_internal(flags); event_count = events.Length; initialize(generic_type.GetMethods(flags), generic_type.GetConstructorsInternal(flags), generic_type.GetFields(flags), generic_type.GetProperties(flags), events); initialized = true; }
PropertyInfo[] GetPropertiesInternal(BindingFlags bf, MonoGenericClass reftype) { if (generic_type.properties == null) { return(new PropertyInfo [0]); } ArrayList l = new ArrayList(); bool match; MethodAttributes mattrs; MethodInfo accessor; initialize(); foreach (PropertyInfo pinfo in generic_type.properties) { match = false; accessor = pinfo.GetGetMethod(true); if (accessor == null) { accessor = pinfo.GetSetMethod(true); } if (accessor == null) { continue; } mattrs = accessor.Attributes; if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != 0) { match = true; } } else { if ((bf & BindingFlags.NonPublic) != 0) { match = true; } } if (!match) { continue; } match = false; if ((mattrs & MethodAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) { match = true; } } else { if ((bf & BindingFlags.Instance) != 0) { match = true; } } if (!match) { continue; } l.Add(new PropertyOnTypeBuilderInst(reftype, pinfo)); } PropertyInfo[] result = new PropertyInfo [l.Count]; l.CopyTo(result); return(result); }
internal EventOnTypeBuilderInst (MonoGenericClass instantiation, EventInfo evt) { this.instantiation = instantiation; this.event_info = evt; }
ConstructorInfo[] GetConstructorsInternal(BindingFlags bf, MonoGenericClass reftype) { if (generic_type.ctors == null) { return(new ConstructorInfo [0]); } ArrayList l = new ArrayList(); bool match; MethodAttributes mattrs; initialize(); for (int i = 0; i < generic_type.ctors.Length; i++) { ConstructorInfo c = generic_type.ctors [i]; match = false; mattrs = c.Attributes; if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != 0) { match = true; } } else { if ((bf & BindingFlags.NonPublic) != 0) { match = true; } } if (!match) { continue; } match = false; if ((mattrs & MethodAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) { match = true; } } else { if ((bf & BindingFlags.Instance) != 0) { match = true; } } if (!match) { continue; } l.Add(TypeBuilder.GetConstructor(this, c)); } ConstructorInfo[] result = new ConstructorInfo [l.Count]; l.CopyTo(result); return(result); }
FieldInfo[] GetFieldsInternal(BindingFlags bf, MonoGenericClass reftype) { if (generic_type.num_fields == 0) { return(new FieldInfo [0]); } ArrayList l = new ArrayList(); bool match; FieldAttributes fattrs; initialize(); for (int i = 0; i < generic_type.num_fields; i++) { FieldInfo c = generic_type.fields [i]; match = false; fattrs = c.Attributes; if ((fattrs & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) { if ((bf & BindingFlags.Public) != 0) { match = true; } } else { if ((bf & BindingFlags.NonPublic) != 0) { match = true; } } if (!match) { continue; } match = false; if ((fattrs & FieldAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) { match = true; } } else { if ((bf & BindingFlags.Instance) != 0) { match = true; } } if (!match) { continue; } l.Add(TypeBuilder.GetField(this, c)); } FieldInfo[] result = new FieldInfo [l.Count]; l.CopyTo(result); return(result); }
MethodInfo[] GetMethodsInternal(BindingFlags bf, MonoGenericClass reftype) { if (generic_type.num_methods == 0) { return(new MethodInfo [0]); } ArrayList l = new ArrayList(); bool match; MethodAttributes mattrs; MethodInfo accessor; initialize(); for (int i = 0; i < generic_type.num_methods; ++i) { MethodInfo c = generic_type.methods [i]; match = false; mattrs = c.Attributes; if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != 0) { match = true; } } else { if ((bf & BindingFlags.NonPublic) != 0) { match = true; } } if (!match) { continue; } match = false; if ((mattrs & MethodAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) { match = true; } } else { if ((bf & BindingFlags.Instance) != 0) { match = true; } } if (!match) { continue; } c = TypeBuilder.GetMethod(this, c); l.Add(c); } MethodInfo[] result = new MethodInfo [l.Count]; l.CopyTo(result); return(result); }
public FieldOnTypeBuilderInst (MonoGenericClass instantiation, FieldInfo fb) { this.instantiation = instantiation; this.fb = fb; }
EventInfo[] GetEventsInternal(BindingFlags bf, MonoGenericClass reftype) { if (generic_type.events == null) { return(new EventInfo [0]); } initialize(); ArrayList l = new ArrayList(); bool match; MethodAttributes mattrs; MethodInfo accessor; for (int i = 0; i < event_count; ++i) { EventBuilder ev = generic_type.events [i]; match = false; accessor = ev.add_method; if (accessor == null) { accessor = ev.remove_method; } if (accessor == null) { continue; } mattrs = accessor.Attributes; if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != 0) { match = true; } } else { if ((bf & BindingFlags.NonPublic) != 0) { match = true; } } if (!match) { continue; } match = false; if ((mattrs & MethodAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) { match = true; } } else { if ((bf & BindingFlags.Instance) != 0) { match = true; } } if (!match) { continue; } l.Add(new EventOnTypeBuilderInst(this, ev)); } EventInfo[] result = new EventInfo [l.Count]; l.CopyTo(result); return(result); }
PropertyInfo[] GetPropertiesInternal (BindingFlags bf, MonoGenericClass reftype) { PropertyInfo[] props = GetPropertiesInternal (generic_type, bf); if (props == null || props.Length == 0) return new PropertyInfo [0]; ArrayList l = new ArrayList (); bool match; MethodAttributes mattrs; MethodInfo accessor; initialize (); foreach (PropertyInfo pinfo in props) { match = false; accessor = pinfo.GetGetMethod (true); if (accessor == null) accessor = pinfo.GetSetMethod (true); if (accessor == null) continue; mattrs = accessor.Attributes; if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != 0) match = true; } else { if ((bf & BindingFlags.NonPublic) != 0) match = true; } if (!match) continue; match = false; if ((mattrs & MethodAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) match = true; } else { if ((bf & BindingFlags.Instance) != 0) match = true; } if (!match) continue; l.Add (new PropertyOnTypeBuilderInst (reftype, pinfo)); } PropertyInfo[] result = new PropertyInfo [l.Count]; l.CopyTo (result); return result; }
ConstructorInfo[] GetConstructorsInternal (BindingFlags bf, MonoGenericClass reftype) { ConstructorInfo[] ctors = GetConstructorsFromGTDWithHint (bf); if (ctors == null || ctors.Length == 0) return new ConstructorInfo [0]; ArrayList l = new ArrayList (); bool match; MethodAttributes mattrs; initialize (); for (int i = 0; i < ctors.Length; i++) { ConstructorInfo c = ctors [i]; match = false; mattrs = c.Attributes; if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != 0) match = true; } else { if ((bf & BindingFlags.NonPublic) != 0) match = true; } if (!match) continue; match = false; if ((mattrs & MethodAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) match = true; } else { if ((bf & BindingFlags.Instance) != 0) match = true; } if (!match) continue; l.Add (TypeBuilder.GetConstructor (this, c)); } ConstructorInfo[] result = new ConstructorInfo [l.Count]; l.CopyTo (result); return result; }
public MethodOnTypeBuilderInst (MonoGenericClass instantiation, MethodInfo base_method) { this.instantiation = instantiation; this.base_method = base_method; }
MethodInfo[] GetMethodsInternal(BindingFlags bf, MonoGenericClass reftype) { if (reftype != this) { bf |= BindingFlags.DeclaredOnly; /*To avoid duplicates*/ } MethodInfo[] methods = GetMethodsFromGTDWithHint(bf); if (methods.Length == 0) { return(new MethodInfo [0]); } ArrayList l = new ArrayList(); bool match; MethodAttributes mattrs; initialize(); for (int i = 0; i < methods.Length; ++i) { MethodInfo c = methods [i]; match = false; mattrs = c.Attributes; if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != 0) { match = true; } } else { if ((bf & BindingFlags.NonPublic) != 0) { match = true; } } if (!match) { continue; } match = false; if ((mattrs & MethodAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) { match = true; } } else { if ((bf & BindingFlags.Instance) != 0) { match = true; } } if (!match) { continue; } if (c.DeclaringType.IsGenericTypeDefinition) { c = TypeBuilder.GetMethod(this, c); } l.Add(c); } MethodInfo[] result = new MethodInfo [l.Count]; l.CopyTo(result); return(result); }
public MethodOnTypeBuilderInst (MonoGenericClass instantiation, MethodBuilder mb) { this.instantiation = instantiation; this.mb = mb; }
/*Warning, @typeArguments must be a mscorlib internal array. So make a copy before passing it in*/ internal Type MakeGenericType (Type gtd, Type[] typeArguments) { if (!IsCompilerContext) return new MonoGenericClass (gtd, typeArguments); GenericInstanceKey key = new GenericInstanceKey (gtd, typeArguments); MonoGenericClass res = (MonoGenericClass)generic_instances [key]; if (res == null) { res = new MonoGenericClass (gtd, typeArguments); generic_instances [key] = res; } return res; }
MethodInfo[] GetMethodsInternal (BindingFlags bf, MonoGenericClass reftype) { if (reftype != this) bf |= BindingFlags.DeclaredOnly; /*To avoid duplicates*/ MethodInfo[] methods = GetMethodsFromGTDWithHint (bf); if (methods.Length == 0) return new MethodInfo [0]; ArrayList l = new ArrayList (); bool match; MethodAttributes mattrs; initialize (); for (int i = 0; i < methods.Length; ++i) { MethodInfo c = methods [i]; match = false; mattrs = c.Attributes; if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != 0) match = true; } else { if ((bf & BindingFlags.NonPublic) != 0) match = true; } if (!match) continue; match = false; if ((mattrs & MethodAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) match = true; } else { if ((bf & BindingFlags.Instance) != 0) match = true; } if (!match) continue; if (c.DeclaringType.IsGenericTypeDefinition) c = TypeBuilder.GetMethod (this, c); l.Add (c); } MethodInfo[] result = new MethodInfo [l.Count]; l.CopyTo (result); return result; }
public ConstructorOnTypeBuilderInst (MonoGenericClass instantiation, ConstructorInfo cb) { this.instantiation = instantiation; this.cb = cb; }
FieldInfo[] GetFieldsInternal (BindingFlags bf, MonoGenericClass reftype) { FieldInfo[] fields = GetFieldsFromGTD (bf); if (fields.Length == 0) return new FieldInfo [0]; ArrayList l = new ArrayList (); bool match; FieldAttributes fattrs; initialize (); for (int i = 0; i < fields.Length; i++) { FieldInfo c = fields [i]; match = false; fattrs = c.Attributes; if ((fattrs & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) { if ((bf & BindingFlags.Public) != 0) match = true; } else { if ((bf & BindingFlags.NonPublic) != 0) match = true; } if (!match) continue; match = false; if ((fattrs & FieldAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) match = true; } else { if ((bf & BindingFlags.Instance) != 0) match = true; } if (!match) continue; l.Add (TypeBuilder.GetField (this, c)); } FieldInfo[] result = new FieldInfo [l.Count]; l.CopyTo (result); return result; }
internal PropertyOnTypeBuilderInst (MonoGenericClass instantiation, PropertyInfo prop) { this.instantiation = instantiation; this.prop = prop; }
EventInfo[] GetEventsInternal (BindingFlags bf, MonoGenericClass reftype) { TypeBuilder tb = generic_type as TypeBuilder; if (tb == null) { EventInfo[] res = generic_type.GetEvents (bf); for (int i = 0; i < res.Length; ++i) res [i] = new EventOnTypeBuilderInst (this, res [i]); return res; } EventBuilder[] events = tb.events; if (events == null || events.Length == 0) return new EventInfo [0]; initialize (); ArrayList l = new ArrayList (); bool match; MethodAttributes mattrs; MethodInfo accessor; for (int i = 0; i < event_count; ++i) { EventBuilder ev = events [i]; match = false; accessor = ev.add_method; if (accessor == null) accessor = ev.remove_method; if (accessor == null) continue; mattrs = accessor.Attributes; if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != 0) match = true; } else { if ((bf & BindingFlags.NonPublic) != 0) match = true; } if (!match) continue; match = false; if ((mattrs & MethodAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) match = true; } else { if ((bf & BindingFlags.Instance) != 0) match = true; } if (!match) continue; l.Add (new EventOnTypeBuilderInst (this, ev)); } EventInfo[] result = new EventInfo [l.Count]; l.CopyTo (result); return result; }
MethodInfo[] GetMethodsInternal (BindingFlags bf, MonoGenericClass reftype) { if (generic_type.num_methods == 0) return new MethodInfo [0]; ArrayList l = new ArrayList (); bool match; MethodAttributes mattrs; MethodInfo accessor; initialize (); for (int i = 0; i < generic_type.num_methods; ++i) { MethodInfo c = generic_type.methods [i]; match = false; mattrs = c.Attributes; if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) { if ((bf & BindingFlags.Public) != 0) match = true; } else { if ((bf & BindingFlags.NonPublic) != 0) match = true; } if (!match) continue; match = false; if ((mattrs & MethodAttributes.Static) != 0) { if ((bf & BindingFlags.Static) != 0) match = true; } else { if ((bf & BindingFlags.Instance) != 0) match = true; } if (!match) continue; c = TypeBuilder.GetMethod (this, c); l.Add (c); } MethodInfo[] result = new MethodInfo [l.Count]; l.CopyTo (result); return result; }