From b98f1ea6a46e267eabd880c92b6fd5a364bf022e Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 25 Dec 2023 07:07:32 -0500 Subject: [PATCH] Fixed reflecting Invoke for delegate/function --- IDEHelper/Compiler/BfModule.cpp | 3 +++ IDEHelper/Compiler/BfModuleTypeUtils.cpp | 3 +++ IDEHelper/Compiler/BfSystem.cpp | 2 ++ 3 files changed, 8 insertions(+) diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index aa6c37c0..39548cba 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -7299,6 +7299,9 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary& usedStrin bool includeMethod = reflectIncludeAllMethods; + if (typeInstance->IsDelegateOrFunction()) + includeMethod = true; + BfMethodCustomAttributes* methodCustomAttributes = NULL; if ((defaultMethod->mMethodInfoEx != NULL) && (defaultMethod->mMethodInfoEx->mMethodCustomAttributes != NULL) && (defaultMethod->mMethodInfoEx->mMethodCustomAttributes->mCustomAttributes != NULL)) { diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index 68ff329e..1c6abc24 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -4675,6 +4675,9 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy typeInstance->mInstSize = std::max(0, typeInstance->mInstSize); typeInstance->mInstAlign = std::max(0, typeInstance->mInstAlign); + if (typeInstance->IsDelegateOrFunction()) + typeInstance->mAlwaysIncludeFlags = (BfAlwaysIncludeFlags)(typeInstance->mAlwaysIncludeFlags | BfAlwaysIncludeFlag_IncludeAllMethods); + ProcessCustomAttributeData(); int packing = 0; bool isUnion = false; diff --git a/IDEHelper/Compiler/BfSystem.cpp b/IDEHelper/Compiler/BfSystem.cpp index 4a301b1d..61fd7933 100644 --- a/IDEHelper/Compiler/BfSystem.cpp +++ b/IDEHelper/Compiler/BfSystem.cpp @@ -690,6 +690,8 @@ bool BfMethodDef::CanReflect() return true; if (mMethodType == BfMethodType_Ctor) return true; + if ((mDeclaringType->mIsDelegate) || (mDeclaringType->mIsFunction)) + return mName == "Invoke"; return false; }