mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 12:02:21 +02:00
Better undef handling of values initialized from const generic param
This commit is contained in:
parent
56c250f251
commit
a99a23f79a
2 changed files with 1 additions and 6 deletions
|
@ -1467,11 +1467,6 @@ BfTypedValue BfModule::GetDefaultTypedValue(BfType* type, bool allowRef, BfDefau
|
||||||
|
|
||||||
if (defaultValueKind == BfDefaultValueKind_Undef)
|
if (defaultValueKind == BfDefaultValueKind_Undef)
|
||||||
{
|
{
|
||||||
// auto primType = type->ToPrimitiveType();
|
|
||||||
// if (primType != NULL)
|
|
||||||
// {
|
|
||||||
// return BfTypedValue(mBfIRBuilder->GetUndefConstValue( primType), type);
|
|
||||||
// }
|
|
||||||
return BfTypedValue(mBfIRBuilder->GetUndefConstValue(mBfIRBuilder->MapType(type)), type);
|
return BfTypedValue(mBfIRBuilder->GetUndefConstValue(mBfIRBuilder->MapType(type)), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10044,7 +10044,7 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
|
||||||
|
|
||||||
BfTypedValue fromTypedValue;
|
BfTypedValue fromTypedValue;
|
||||||
if (typedVal.mKind == BfTypedValueKind_GenericConstValue)
|
if (typedVal.mKind == BfTypedValueKind_GenericConstValue)
|
||||||
fromTypedValue = GetDefaultTypedValue(genericParamInst->mTypeConstraint);
|
fromTypedValue = GetDefaultTypedValue(genericParamInst->mTypeConstraint, false, BfDefaultValueKind_Undef);
|
||||||
else
|
else
|
||||||
fromTypedValue = BfTypedValue(mBfIRBuilder->GetFakeVal(), genericParamInst->mTypeConstraint, genericParamInst->mTypeConstraint->IsValueType());
|
fromTypedValue = BfTypedValue(mBfIRBuilder->GetFakeVal(), genericParamInst->mTypeConstraint, genericParamInst->mTypeConstraint->IsValueType());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue