mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Improved 'var' inference for binary operations
This commit is contained in:
parent
0d0d55741d
commit
39ad1dbe85
1 changed files with 7 additions and 1 deletions
|
@ -18512,7 +18512,13 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
||||||
|
|
||||||
if ((resultType->IsVar()) || (otherType->IsVar()))
|
if ((resultType->IsVar()) || (otherType->IsVar()))
|
||||||
{
|
{
|
||||||
mResult = mModule->GetDefaultTypedValue(resultType);
|
bool isComparison = (binaryOp >= BfBinaryOp_Equality) && (binaryOp <= BfBinaryOp_LessThanOrEqual);
|
||||||
|
if (isComparison)
|
||||||
|
mResult = mModule->GetDefaultTypedValue(mModule->GetPrimitiveType(BfTypeCode_Boolean), false, BfDefaultValueKind_Addr);
|
||||||
|
else if (mExpectingType != NULL)
|
||||||
|
mResult = mModule->GetDefaultTypedValue(mExpectingType, false, BfDefaultValueKind_Addr);
|
||||||
|
else
|
||||||
|
mResult = mModule->GetDefaultTypedValue(resultType, false, BfDefaultValueKind_Addr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue