MCPcopy Create free account
hub / github.com/beefytech/Beef / FixConstValueParams

Method FixConstValueParams

IDEHelper/Compiler/BfModule.cpp:1682–1721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1680}
1681
1682void BfModule::FixConstValueParams(BfTypeInstance* typeInst, SizedArrayImpl<BfIRValue>& valueParams, bool fillInPadding)
1683{
1684 if ((!typeInst->mTypeDef->mIsCombinedPartial) && (!fillInPadding))
1685 return;
1686
1687 int prevDataIdx = -1;
1688 int usedDataIdx = 0;
1689 int valueParamIdx = 0;
1690
1691 if (typeInst->mBaseType != NULL)
1692 {
1693 usedDataIdx++;
1694 valueParamIdx++;
1695 prevDataIdx++;
1696 }
1697
1698 int startingParamsSize = (int)valueParams.mSize;
1699 for (int fieldIdx = 0; fieldIdx < (int)typeInst->mFieldInstances.size(); fieldIdx++)
1700 {
1701 auto fieldInstance = &typeInst->mFieldInstances[fieldIdx];
1702 if (fieldInstance->mDataIdx < 0)
1703 continue;
1704
1705 BF_ASSERT(fieldInstance->mDataIdx > prevDataIdx);
1706 if (fillInPadding)
1707 {
1708 for (int i = prevDataIdx + 1; i < fieldInstance->mDataIdx; i++)
1709 valueParams.Insert(valueParamIdx++, mBfIRBuilder->CreateConstArrayZero(0));
1710 }
1711
1712 valueParamIdx++;
1713 prevDataIdx = fieldInstance->mDataIdx;
1714
1715 usedDataIdx++;
1716 if (usedDataIdx <= valueParams.mSize)
1717 continue;
1718
1719 valueParams.Add(GetDefaultValue(fieldInstance->mResolvedType));
1720 }
1721}
1722
1723BfIRValue BfModule::CreateStringObjectValue(const StringImpl& str, int stringId, bool define)
1724{

Callers

nothing calls this directly

Calls 4

CreateConstArrayZeroMethod · 0.80
sizeMethod · 0.45
InsertMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected