mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-16 23:34:10 +02:00
Fixed erroneous 'int' widening during binary operation
This commit is contained in:
parent
3a8e4ebc9d
commit
7a4a7bd2fb
1 changed files with 4 additions and 1 deletions
|
@ -20850,6 +20850,7 @@ void BfExprEvaluator::PerformBinaryOperation(BfExpression* leftExpression, BfExp
|
||||||
}
|
}
|
||||||
|
|
||||||
BfType* wantType = leftValue.mType;
|
BfType* wantType = leftValue.mType;
|
||||||
|
BfType* origWantType = wantType;
|
||||||
if ((binaryOp == BfBinaryOp_LeftShift) || (binaryOp == BfBinaryOp_RightShift))
|
if ((binaryOp == BfBinaryOp_LeftShift) || (binaryOp == BfBinaryOp_RightShift))
|
||||||
wantType = NULL; // Don't presume
|
wantType = NULL; // Don't presume
|
||||||
wantType = mModule->FixIntUnknown(wantType);
|
wantType = mModule->FixIntUnknown(wantType);
|
||||||
|
@ -20858,7 +20859,9 @@ void BfExprEvaluator::PerformBinaryOperation(BfExpression* leftExpression, BfExp
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BfType* rightWantType = wantType;
|
BfType* rightWantType = wantType;
|
||||||
if ((mExpectingType != NULL) && (wantType != NULL) && (mExpectingType->IsIntegral()) && (wantType->IsIntegral()) && (mExpectingType->mSize > wantType->mSize) &&
|
if (origWantType->IsIntUnknown())
|
||||||
|
rightWantType = NULL;
|
||||||
|
else if ((mExpectingType != NULL) && (wantType != NULL) && (mExpectingType->IsIntegral()) && (wantType->IsIntegral()) && (mExpectingType->mSize > wantType->mSize) &&
|
||||||
((binaryOp == BfBinaryOp_Add) || (binaryOp == BfBinaryOp_Subtract) || (binaryOp == BfBinaryOp_Multiply)))
|
((binaryOp == BfBinaryOp_Add) || (binaryOp == BfBinaryOp_Subtract) || (binaryOp == BfBinaryOp_Multiply)))
|
||||||
rightWantType = mExpectingType;
|
rightWantType = mExpectingType;
|
||||||
rightValue = mModule->CreateValueFromExpression(rightExpression, rightWantType, (BfEvalExprFlags)((mBfEvalExprFlags & BfEvalExprFlags_InheritFlags) | BfEvalExprFlags_NoCast));
|
rightValue = mModule->CreateValueFromExpression(rightExpression, rightWantType, (BfEvalExprFlags)((mBfEvalExprFlags & BfEvalExprFlags_InheritFlags) | BfEvalExprFlags_NoCast));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue