1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Soften splat error in BfModule::Cast

This commit is contained in:
Brian Fiete 2023-06-22 06:30:50 -04:00
parent a5a7e6efe0
commit 0c6bf2d6b5
3 changed files with 37 additions and 5 deletions

View file

@ -14857,6 +14857,12 @@ BfTypedValue BfModule::Cast(BfAstNode* srcNode, const BfTypedValue& typedVal, Bf
{
if (typedVal.IsSplat())
{
if ((!toStructTypeInstance->IsSplattable()) && (toStructTypeInstance->mInstSize != 0))
{
InternalError("typedVal.IsSplat(), but !toStructTypeInstance->IsSplattable() && toStructTypeInstance->mInstSize != 0", srcNode);
return GetDefaultTypedValue(toType, true, BfDefaultValueKind_Addr);
}
BF_ASSERT(toStructTypeInstance->IsSplattable() || (toStructTypeInstance->mInstSize == 0));
return BfTypedValue(typedVal.mValue, toStructTypeInstance, typedVal.IsThis() ? BfTypedValueKind_ThisSplatHead : BfTypedValueKind_SplatHead);
}