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

Added '->' support to nullables and Result<T>

This commit is contained in:
Brian Fiete 2022-06-22 12:06:40 -07:00
parent e4cac2ca24
commit 36a8c2c6ae
5 changed files with 93 additions and 8 deletions

View file

@ -1945,9 +1945,7 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
if (auto varRefTypeReference = BfNodeDynCast<BfVarRefTypeReference>(varDecl->mTypeRef))
{
BF_ASSERT(val.IsAddr());
isRef = true;
isLet = varRefTypeReference->mVarToken->GetToken() == BfToken_Let;
isVar = varRefTypeReference->mVarToken->GetToken() == BfToken_Var;
}
@ -2010,8 +2008,13 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
localDef->mAddr = AllocLocalVariable(localDef->mResolvedType, localDef->mName);
if ((val.mValue) && (!localDef->mResolvedType->IsValuelessType()) && (!localDef->mResolvedType->IsVar()))
{
if (localDef->mResolvedType->IsRef())
val = MakeAddressable(val, true, true);
if (val.IsSplat())
{
AggregateSplatIntoAddr(val, localDef->mAddr);
}
else
mBfIRBuilder->CreateAlignedStore(val.mValue, localDef->mAddr, localDef->mResolvedType->mAlign);
}