From 4fb7a0f53f5a9017f140484dafd6c97c7ad708fe Mon Sep 17 00:00:00 2001 From: EinBurgbauer Date: Tue, 18 May 2021 19:42:28 +0200 Subject: [PATCH] fix explicit thiscall crash --- IDEHelper/Compiler/BfResolvedTypeUtils.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/IDEHelper/Compiler/BfResolvedTypeUtils.cpp b/IDEHelper/Compiler/BfResolvedTypeUtils.cpp index b8253306..f97a86b7 100644 --- a/IDEHelper/Compiler/BfResolvedTypeUtils.cpp +++ b/IDEHelper/Compiler/BfResolvedTypeUtils.cpp @@ -1208,7 +1208,8 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType, { returnType = module->mBfIRBuilder->MapType(mReturnType); } - + + bool hasExplicitThis = false; for (int paramIdx = -1; paramIdx < GetParamCount(); paramIdx++) { BfType* checkType = NULL; @@ -1223,13 +1224,23 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType, else { if (HasExplicitThis()) + { checkType = GetParamType(0); + hasExplicitThis = true; + } else checkType = GetOwner(); } } else { + if (hasExplicitThis) + { + // We already looked at this + hasExplicitThis = false; + continue; + } + checkType = GetParamType(paramIdx); }