mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Added '->' support to nullables and Result<T>
This commit is contained in:
parent
e4cac2ca24
commit
36a8c2c6ae
5 changed files with 93 additions and 8 deletions
|
@ -3409,14 +3409,17 @@ BeStoreInst* BeModule::CreateAlignedStore(BeValue* val, BeValue* ptr, int alignm
|
|||
|
||||
BeGEPInst* BeModule::CreateGEP(BeValue* ptr, BeValue* idx0, BeValue* idx1)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
BF_ASSERT(ptr->GetType()->IsPointer());
|
||||
#endif
|
||||
|
||||
auto inst = mAlloc.Alloc<BeGEPInst>();
|
||||
inst->mPtr = ptr;
|
||||
inst->mIdx0 = idx0;
|
||||
inst->mIdx1 = idx1;
|
||||
AddInst(inst);
|
||||
|
||||
#ifdef _DEBUG
|
||||
BF_ASSERT(ptr->GetType()->IsPointer());
|
||||
#ifdef _DEBUG
|
||||
inst->GetType();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -21939,9 +21939,9 @@ void BfExprEvaluator::PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr,
|
|||
|
||||
CheckResultForReading(mResult);
|
||||
|
||||
if ((unaryOp == BfUnaryOp_Mut) && (!mResult.mType->IsComposite()) && (!mResult.mType->IsGenericParam()))
|
||||
if ((unaryOp == BfUnaryOp_Mut) && (!mResult.mType->IsValueType()) && (!mResult.mType->IsGenericParam()))
|
||||
{
|
||||
// Non-composite types are already mutable, leave them alone...
|
||||
// Non-valuetypes types are already mutable, leave them alone...
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue