| 1680 | } |
| 1681 | |
| 1682 | void 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 | |
| 1723 | BfIRValue BfModule::CreateStringObjectValue(const StringImpl& str, int stringId, bool define) |
| 1724 | { |
nothing calls this directly
no test coverage detected