1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Better handling of undef const expressions

This commit is contained in:
Brian Fiete 2022-04-18 07:57:15 -07:00
parent 071dfa8e09
commit 1a93660416
4 changed files with 42 additions and 1 deletions

View file

@ -3801,6 +3801,14 @@ void BfExprEvaluator::GetLiteral(BfAstNode* refNode, const BfVariant& variant)
case BfTypeCode_StringId:
mResult = BfTypedValue(mModule->mBfIRBuilder->CreateConst(variant.mTypeCode, variant.mUInt64), mModule->ResolveTypeDef(mModule->mCompiler->mStringTypeDef));
break;
case BfTypeCode_Let:
if (mExpectingType != NULL)
{
mResult = BfTypedValue(mModule->mBfIRBuilder->CreateUndefValue(mModule->mBfIRBuilder->MapType(mExpectingType)), mExpectingType);
break;
}
mModule->Fail("Invalid undef literal", refNode);
break;
default:
mModule->Fail("Invalid literal", refNode);
break;