From 186462e0ac40d6ab0125737ea90793a9c58b6e45 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 14 Sep 2020 11:00:34 -0700 Subject: [PATCH] Added interface dispatch for structs --- BeefLibs/corlib/src/Reflection/MethodInfo.bf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BeefLibs/corlib/src/Reflection/MethodInfo.bf b/BeefLibs/corlib/src/Reflection/MethodInfo.bf index 28274ae0..68af1f6e 100644 --- a/BeefLibs/corlib/src/Reflection/MethodInfo.bf +++ b/BeefLibs/corlib/src/Reflection/MethodInfo.bf @@ -275,6 +275,11 @@ namespace System.Reflection else { TypeInstance.InterfaceData* interfaceData = null; + var variantType = target.VariantType; + if (variantType.IsPointer) + thisType = variantType.UnderlyingType as TypeInstance; + else + thisType = variantType as TypeInstance; var checkType = thisType; CheckLoop: while (checkType != null) { @@ -293,7 +298,7 @@ namespace System.Reflection if (interfaceData == null) return .Err(.InvalidTarget); - //funcPtr = *(thisType.[Friend]mInterfaceMethodTable + mMethodData.mVirtualIdx); + funcPtr = *(thisType.[Friend]mInterfaceMethodTable + interfaceData.mStartInterfaceTableIdx + mMethodData.mMethodIdx); } ifaceOffset = mTypeInstance.[Friend]mMemberDataOffset;