Browse Source

Prevent comptime from setting mHasBeenInstantiated

Brian Fiete 3 years ago
parent
commit
d9e97c7dc0
2 changed files with 5 additions and 4 deletions
  1. 4 3
      IDEHelper/Compiler/BfCompiler.cpp
  2. 1 1
      IDEHelper/Compiler/BfModule.cpp

+ 4 - 3
IDEHelper/Compiler/BfCompiler.cpp

@@ -5800,13 +5800,14 @@ void BfCompiler::PopulateReified()
 						}
 						}
 					}
 					}
 				}
 				}
-
+				
 				// Only check virtual stuff if we have been instantiated
 				// Only check virtual stuff if we have been instantiated
 				if ((typeInst->HasBeenInstantiated()) && (!mCanceling))
 				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) ||
 						if ((vEntry.mDeclaringMethod.mTypeInstance == NULL) ||
 							(vEntry.mDeclaringMethod.mTypeInstance->IsIncomplete()) ||
 							(vEntry.mDeclaringMethod.mTypeInstance->IsIncomplete()) ||
 							(vEntry.mImplementingMethod.mTypeInstance == NULL) ||
 							(vEntry.mImplementingMethod.mTypeInstance == NULL) ||

+ 1 - 1
IDEHelper/Compiler/BfModule.cpp

@@ -9177,7 +9177,7 @@ BfIRValue BfModule::AllocFromType(BfType* type, const BfAllocTarget& allocTarget
 	int allocAlign = type->mAlign;
 	int allocAlign = type->mAlign;
 	if (typeInstance != NULL)
 	if (typeInstance != NULL)
 	{	
 	{	
-		if (!mBfIRBuilder->mIgnoreWrites)
+		if ((!mBfIRBuilder->mIgnoreWrites) && (!mIsComptimeModule))
 			typeInstance->mHasBeenInstantiated = true;
 			typeInstance->mHasBeenInstantiated = true;
 		allocSize = typeInstance->mInstSize;
 		allocSize = typeInstance->mInstSize;
 		allocAlign = typeInstance->mInstAlign;
 		allocAlign = typeInstance->mInstAlign;