public override MethodInfo[] GetMethods (BindingFlags bf)
{
if (!IsCompilerContext)
throw new NotSupportedException ();
ArrayList l = new ArrayList ();
//
// Walk up our class hierarchy and retrieve methods from our
// parent classes.
//
if (!(generic_type is TypeBuilder)) {
foreach (var method in generic_type.GetMethods (bf)) {
var m = method;
if (m.DeclaringType.IsGenericTypeDefinition)
m = TypeBuilder.GetMethod (this, m);
l.Add (m);
}
} else {
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;
}