diff --git a/BeefLibs/corlib/src/Type.bf b/BeefLibs/corlib/src/Type.bf index 9483226a..6fb0ae59 100644 --- a/BeefLibs/corlib/src/Type.bf +++ b/BeefLibs/corlib/src/Type.bf @@ -400,6 +400,14 @@ namespace System } } + public virtual TypeInstance.InterfaceEnumerator Interfaces + { + get + { + return .(null); + } + } + public virtual TypeInstance OuterType { get @@ -675,6 +683,27 @@ namespace System.Reflection public int32 mStartVirtualIdx; } + public struct InterfaceEnumerator : IEnumerator + { + public TypeInstance mTypeInstance; + public int mIdx = -1; + + public this(TypeInstance typeInstance) + { + mTypeInstance = typeInstance; + } + + public Result GetNext() mut + { + if (mTypeInstance == null) + return .Err; + mIdx++; + if (mIdx >= mTypeInstance.mInterfaceCount) + return .Err; + return Type.[Friend]GetType(mTypeInstance.mInterfaceDataPtr[mIdx].mInterfaceType) as TypeInstance; + } + } + ClassVData* mTypeClassVData; String mName; String mNamespace; @@ -733,6 +762,14 @@ namespace System.Reflection } } + public override InterfaceEnumerator Interfaces + { + get + { + return .(this); + } + } + public override TypeInstance OuterType { get