1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

Fixed rebuild on comptime file content changes

This commit is contained in:
Brian Fiete 2022-06-28 08:09:53 -07:00
parent 05ef084a53
commit b98503fab7
3 changed files with 16 additions and 11 deletions

View file

@ -2238,7 +2238,8 @@ void BfContext::UpdateRevisedTypes()
if (changed) if (changed)
{ {
RebuildType(typeInst); TypeDataChanged(typeInst, true);
TypeMethodSignaturesChanged(typeInst);
} }
} }
@ -2312,7 +2313,7 @@ void BfContext::UpdateRevisedTypes()
if (isSignatureChange) if (isSignatureChange)
{ {
TypeDataChanged(typeInst, true); TypeDataChanged(typeInst, true);
TypeMethodSignaturesChanged(typeInst); TypeMethodSignaturesChanged(typeInst);
} }
/*if (!mCompiler->mIsResolveOnly) /*if (!mCompiler->mIsResolveOnly)

View file

@ -2712,6 +2712,11 @@ public:
void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine) void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
{ {
auto populateModule = mModule->mContext->mUnreifiedModule;
auto typeInstance = type->ToTypeInstance();
if (typeInstance != NULL)
populateModule = typeInstance->mModule;
bool wantDIData = DbgHasInfo() && (!type->IsUnspecializedType()); bool wantDIData = DbgHasInfo() && (!type->IsUnspecializedType());
// Types that don't have a proper 'defining module' need to be defined in every module they are used // Types that don't have a proper 'defining module' need to be defined in every module they are used
@ -2736,7 +2741,7 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
bool isPrimEnum = (type->IsEnum()) && (type->IsTypedPrimitive()); bool isPrimEnum = (type->IsEnum()) && (type->IsTypedPrimitive());
if (!type->IsDeclared()) if (!type->IsDeclared())
mModule->PopulateType(type, BfPopulateType_Declaration); populateModule->PopulateType(type, BfPopulateType_Declaration);
BF_ASSERT(type->IsDeclared()); BF_ASSERT(type->IsDeclared());
@ -2747,8 +2752,7 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
BfIRType irType; BfIRType irType;
BfIRMDNode diType; BfIRMDNode diType;
bool trackDIType = false; bool trackDIType = false;
BfTypeInstance* typeInstance = type->ToTypeInstance();
BfType* underlyingArrayType = NULL; BfType* underlyingArrayType = NULL;
int underlyingArraySize = -1; int underlyingArraySize = -1;
bool underlyingArrayIsVector = false; bool underlyingArrayIsVector = false;
@ -2758,7 +2762,7 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
if (type->IsPointer()) if (type->IsPointer())
{ {
BfPointerType* pointerType = (BfPointerType*)type; BfPointerType* pointerType = (BfPointerType*)type;
mModule->PopulateType(pointerType->mElementType, BfPopulateType_Data); populateModule->PopulateType(pointerType->mElementType, BfPopulateType_Data);
if (pointerType->mElementType->IsValuelessType()) if (pointerType->mElementType->IsValuelessType())
{ {
irType = GetPrimitiveType(BfTypeCode_NullPtr); irType = GetPrimitiveType(BfTypeCode_NullPtr);
@ -3069,7 +3073,7 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
} }
else if (type->IsTypedPrimitive()) else if (type->IsTypedPrimitive())
{ {
mModule->PopulateType(type); populateModule->PopulateType(type);
auto underlyingType = type->GetUnderlyingType(); auto underlyingType = type->GetUnderlyingType();
irType = MapType(underlyingType); irType = MapType(underlyingType);
SetType(type, irType); SetType(type, irType);

View file

@ -3553,13 +3553,13 @@ bool CeContext::AddRebuild(const CeRebuildKey& key, const CeRebuildValue& value)
{ {
if (mCurModule == NULL) if (mCurModule == NULL)
return false; return false;
if (mCurModule->mCurTypeInstance == NULL) if (mCallerTypeInstance == NULL)
return false; return false;
if ((mCurEvalFlags & CeEvalFlags_NoRebuild) != 0) if ((mCurEvalFlags & CeEvalFlags_NoRebuild) != 0)
return false; return false;
if (mCurModule->mCurTypeInstance->mCeTypeInfo == NULL) if (mCallerTypeInstance->mCeTypeInfo == NULL)
mCurModule->mCurTypeInstance->mCeTypeInfo = new BfCeTypeInfo(); mCallerTypeInstance->mCeTypeInfo = new BfCeTypeInfo();
mCurModule->mCurTypeInstance->mCeTypeInfo->mRebuildMap[key] = value; mCallerTypeInstance->mCeTypeInfo->mRebuildMap[key] = value;
mCurModule->mCompiler->mHasComptimeRebuilds = true; mCurModule->mCompiler->mHasComptimeRebuilds = true;
return true; return true;
} }