mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Made comparison of valueless types be constant bools
This commit is contained in:
parent
7d680c2a48
commit
fb7251e71a
1 changed files with 9 additions and 0 deletions
|
@ -18593,6 +18593,15 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Valueless types always compare as 'equal'
|
||||||
|
if ((leftValue.mType == rightValue.mType) && (leftValue.mType->IsValuelessType()))
|
||||||
|
{
|
||||||
|
auto boolType = mModule->GetPrimitiveType(BfTypeCode_Boolean);
|
||||||
|
bool isEqual = (binaryOp == BfBinaryOp_Equality) || (binaryOp == BfBinaryOp_StrictEquality);
|
||||||
|
mResult = BfTypedValue(mModule->GetConstValue(isEqual ? 1 : 0, boolType), boolType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((leftValue.mType->IsTypeInstance()) || (leftValue.mType->IsGenericParam()) ||
|
if ((leftValue.mType->IsTypeInstance()) || (leftValue.mType->IsGenericParam()) ||
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue