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:
parent
21e2269d43
commit
1bb6a2c0e5
1 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue