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

Fixed ability to add data members to string

This commit is contained in:
Brian Fiete 2020-05-13 15:07:26 -07:00
parent 21e2269d43
commit 1bb6a2c0e5

View file

@ -1495,6 +1495,16 @@ BfIRValue BfModule::CreateStringObjectValue(const StringImpl& str, int stringId,
} }
typeValueParams.push_back(stringCharsVal); // mPtr typeValueParams.push_back(stringCharsVal); // mPtr
for (int fieldIdx = 0; fieldIdx < (int)stringTypeInst->mFieldInstances.size(); fieldIdx++)
{
auto fieldInstance = &stringTypeInst->mFieldInstances[fieldIdx];
if (fieldInstance->mDataIdx < 4)
continue;
while (fieldInstance->mDataIdx >= typeValueParams.size())
typeValueParams.Add(BfIRValue());
typeValueParams[fieldInstance->mDataIdx] = GetDefaultValue(fieldInstance->mResolvedType);
}
stringValData = mBfIRBuilder->CreateConstStruct(mBfIRBuilder->MapTypeInst(stringTypeInst, BfIRPopulateType_Full), typeValueParams); stringValData = mBfIRBuilder->CreateConstStruct(mBfIRBuilder->MapTypeInst(stringTypeInst, BfIRPopulateType_Full), typeValueParams);
} }