From 29755fddcf6b77bf7de96c7bb94af1422111a169 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sat, 18 Jan 2025 10:04:55 -0800 Subject: [PATCH] Fixed generated method calling in comptime --- IDEHelper/Compiler/CeMachine.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/IDEHelper/Compiler/CeMachine.cpp b/IDEHelper/Compiler/CeMachine.cpp index 6e9ef87a..df4bb088 100644 --- a/IDEHelper/Compiler/CeMachine.cpp +++ b/IDEHelper/Compiler/CeMachine.cpp @@ -8516,6 +8516,18 @@ bool CeContext::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8* if ((callEntry.mFunctionInfo->mCeFunction == NULL) && (!callEntry.mFunctionInfo->mMethodRef.IsNull())) { auto methodRef = callEntry.mFunctionInfo->mMethodRef; + if (methodRef.mMethodNum >= methodRef.mTypeInstance->mTypeDef->mMethods.mSize) + { + // Must be a comptime-generated method + ceModule->PopulateType(methodRef.mTypeInstance); + } + + if (methodRef.mMethodNum >= methodRef.mTypeInstance->mTypeDef->mMethods.mSize) + { + _Fail("OOB method reference"); + return false; + } + auto methodDef = methodRef.mTypeInstance->mTypeDef->mMethods[methodRef.mMethodNum]; auto moduleMethodInstance = ceModule->GetMethodInstance(methodRef.mTypeInstance, methodDef, methodRef.mMethodGenericArguments);