1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixes to "valueless" crepr structs

This commit is contained in:
Brian Fiete 2025-03-28 09:33:06 -04:00
parent eb41a9c1de
commit 5c11c2271e
4 changed files with 29 additions and 5 deletions

View file

@ -4492,10 +4492,11 @@ bool CeContext::WriteConstant(BfModule* module, addr_ce addr, BfConstant* consta
auto typeInst = type->ToTypeInstance();
int idx = 0;
if (typeInst->mBaseType != NULL)
auto baseType = typeInst->GetBaseType(true);
if (baseType != NULL)
{
auto baseConstant = module->mBfIRBuilder->GetConstant(aggConstant->mValues[0]);
if (!WriteConstant(module, addr, baseConstant, typeInst->mBaseType))
if (!WriteConstant(module, addr, baseConstant, baseType))
return false;
}
@ -5034,9 +5035,10 @@ BfIRValue CeContext::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType
return irBuilder->CreateConstNull(irBuilder->MapType(typeInst));
}
if (typeInst->mBaseType != NULL)
auto baseType = typeInst->GetBaseType(true);
if (baseType != NULL)
{
auto result = CreateConstant(module, instData, typeInst->mBaseType);
auto result = CreateConstant(module, instData, baseType);
if (!result)
return BfIRValue();
fieldVals.Add(result);