From d9e97c7dc0e4c209944034c664aa6e5ad3e08b0c Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 13 Jun 2022 09:57:23 -0700 Subject: [PATCH] Prevent comptime from setting mHasBeenInstantiated --- IDEHelper/Compiler/BfCompiler.cpp | 7 ++++--- IDEHelper/Compiler/BfModule.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/IDEHelper/Compiler/BfCompiler.cpp b/IDEHelper/Compiler/BfCompiler.cpp index 03f9801b..87c26499 100644 --- a/IDEHelper/Compiler/BfCompiler.cpp +++ b/IDEHelper/Compiler/BfCompiler.cpp @@ -5800,13 +5800,14 @@ void BfCompiler::PopulateReified() } } } - + // Only check virtual stuff if we have been instantiated if ((typeInst->HasBeenInstantiated()) && (!mCanceling)) { - // If we have any virtual methods overrides that are unreified but the declaring virtual method is reified then we also need to reify - for (auto&& vEntry : typeInst->mVirtualMethodTable) + // If we have any virtual methods overrides that are unreified but the declaring virtual method is reified then we also need to reify + for (int virtIdx = 0; virtIdx < typeInst->mVirtualMethodTable.mSize; virtIdx++) { + auto& vEntry = typeInst->mVirtualMethodTable[virtIdx]; if ((vEntry.mDeclaringMethod.mTypeInstance == NULL) || (vEntry.mDeclaringMethod.mTypeInstance->IsIncomplete()) || (vEntry.mImplementingMethod.mTypeInstance == NULL) || diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index b500318c..955ef3ea 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -9177,7 +9177,7 @@ BfIRValue BfModule::AllocFromType(BfType* type, const BfAllocTarget& allocTarget int allocAlign = type->mAlign; if (typeInstance != NULL) { - if (!mBfIRBuilder->mIgnoreWrites) + if ((!mBfIRBuilder->mIgnoreWrites) && (!mIsComptimeModule)) typeInstance->mHasBeenInstantiated = true; allocSize = typeInstance->mInstSize; allocAlign = typeInstance->mInstAlign;