mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Made operator precedence match everyone else
This commit is contained in:
parent
8376355098
commit
1171e6ef64
3 changed files with 33 additions and 11 deletions
|
@ -12394,7 +12394,11 @@ void BfExprEvaluator::Visit(BfObjectCreateExpression* objCreateExpr)
|
|||
continue;
|
||||
}
|
||||
|
||||
auto elemAddr = mModule->CreateIndexedValue(resultType, addr, writeIdx);
|
||||
BfIRValue elemAddr;
|
||||
if (!resultType->IsValuelessType())
|
||||
elemAddr = mModule->CreateIndexedValue(resultType, addr, writeIdx);
|
||||
else
|
||||
elemAddr = mModule->mBfIRBuilder->GetFakeVal();
|
||||
writeIdx++;
|
||||
dimWriteIdx++;
|
||||
|
||||
|
@ -20508,6 +20512,20 @@ void BfExprEvaluator::Visit(BfBinaryOperatorExpression* binOpExpr)
|
|||
}
|
||||
}
|
||||
|
||||
if ((binOpExpr->mOp == BfBinaryOp_LeftShift) || (binOpExpr->mOp == BfBinaryOp_RightShift))
|
||||
{
|
||||
for (int side = 0; side < 2; side++)
|
||||
{
|
||||
if (auto innerBinOpExpr = BfNodeDynCast<BfBinaryOperatorExpression>((side == 0) ? binOpExpr->mLeft : binOpExpr->mRight))
|
||||
{
|
||||
if ((innerBinOpExpr->mOp == BfBinaryOp_Add) || (innerBinOpExpr->mOp == BfBinaryOp_Subtract))
|
||||
{
|
||||
mModule->Warn(BfWarning_C4554_PossiblePrecedenceError, "Check operator precedence for possible error. Consider using parentheses to clarify precedence", innerBinOpExpr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (binOpExpr->mRight == NULL)
|
||||
{
|
||||
// We visit the children for autocompletion only
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue