1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fixed invalid enum const type finalization with non-enum-case const

This commit is contained in:
Brian Fiete 2020-11-30 06:23:52 -08:00
parent 2c00929751
commit 1efd403472

View file

@ -3800,12 +3800,13 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
for (auto& fieldInstanceRef : typeInstance->mFieldInstances) for (auto& fieldInstanceRef : typeInstance->mFieldInstances)
{ {
auto fieldInstance = &fieldInstanceRef; auto fieldInstance = &fieldInstanceRef;
if (fieldInstance->mConstIdx != -1) if (fieldInstance->mConstIdx == -1)
{ continue;
auto constant = typeInstance->mConstHolder->GetConstantById(fieldInstance->mConstIdx); if (!fieldInstance->GetFieldDef()->IsEnumCaseEntry())
BfIRValue newConstant = typeInstance->mConstHolder->CreateConst(typeCode, constant->mUInt64); continue;
fieldInstance->mConstIdx = newConstant.mId; auto constant = typeInstance->mConstHolder->GetConstantById(fieldInstance->mConstIdx);
} BfIRValue newConstant = typeInstance->mConstHolder->CreateConst(typeCode, constant->mUInt64);
fieldInstance->mConstIdx = newConstant.mId;
} }
} }