mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed boxing from ternary operator
This commit is contained in:
parent
f09a9b41f1
commit
251a8bb379
1 changed files with 5 additions and 1 deletions
|
@ -16046,7 +16046,7 @@ void BfExprEvaluator::Visit(BfConditionalExpression* condExpr)
|
|||
}
|
||||
|
||||
if (isConstBranch)
|
||||
{
|
||||
{
|
||||
BfExpression* actualExpr = (constResult) ? condExpr->mTrueExpression : condExpr->mFalseExpression;
|
||||
BfExpression* ignoredExpr = (constResult) ? condExpr->mFalseExpression : condExpr->mTrueExpression;
|
||||
|
||||
|
@ -16090,6 +16090,8 @@ void BfExprEvaluator::Visit(BfConditionalExpression* condExpr)
|
|||
|
||||
mModule->mBfIRBuilder->CreateCondBr(condResult.mValue, trueBB, falseBB);
|
||||
|
||||
SetAndRestoreValue<bool> prevInCondBlock(mModule->mCurMethodState->mCurScope->mInnerIsConditional, true);
|
||||
|
||||
mModule->AddBasicBlock(trueBB);
|
||||
auto trueValue = mModule->CreateValueFromExpression(condExpr->mTrueExpression, mExpectingType, (BfEvalExprFlags)(BfEvalExprFlags_NoCast | BfEvalExprFlags_CreateConditionalScope));
|
||||
if ((mExpectingType != NULL) && (trueValue) && (trueValue.mType != mExpectingType))
|
||||
|
@ -16116,6 +16118,8 @@ void BfExprEvaluator::Visit(BfConditionalExpression* condExpr)
|
|||
mModule->FixIntUnknown(falseValue);
|
||||
}
|
||||
|
||||
prevInCondBlock.Restore();
|
||||
|
||||
bool isValid = trueValue && falseValue;
|
||||
|
||||
if (isValid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue