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

Fixes for increment/decrement operators

This commit is contained in:
Brian Fiete 2020-11-05 08:51:20 -08:00
parent 37576d389c
commit bb87ca7b52
2 changed files with 45 additions and 5 deletions

View file

@ -18295,14 +18295,28 @@ BfTypedValue BfExprEvaluator::PerformUnaryOperation_TryOperator(const BfTypedVal
result = mModule->GetDefaultTypedValue(methodMatcher.mSelfType);
}
if ((methodMatcher.mBestMethodInstance) && (methodMatcher.mBestMethodInstance.mMethodInstance->mIsIntrinsic) &&
if ((methodMatcher.mBestMethodInstance) &&
((findOp == BfUnaryOp_Increment) || (findOp == BfUnaryOp_Decrement)))
{
if (args[0].mTypedValue.IsAddr())
mModule->mBfIRBuilder->CreateStore(result.mValue, args[0].mTypedValue.mValue);
else
if (methodMatcher.mBestMethodInstance.mMethodInstance->mIsIntrinsic)
{
mModule->AssertErrorState();
if (args[0].mTypedValue.IsAddr())
mModule->mBfIRBuilder->CreateStore(result.mValue, args[0].mTypedValue.mValue);
else
{
mModule->AssertErrorState();
}
}
else
{
if (!result.mType->IsValuelessType())
{
if (targetVal.IsAddr())
{
result = mModule->LoadValue(result);
mModule->mBfIRBuilder->CreateStore(result.mValue, targetVal.mValue);
}
}
}
}