Implemented comparison equality operators

This commit is contained in:
2019-06-08 15:38:08 +02:00
parent fc66c15c2f
commit 7d75131822
10 changed files with 274 additions and 0 deletions

View File

@@ -45,6 +45,35 @@ shared_ptr<BooleanEvalValue> Evaluator::EvaluateBooleanBinary(BoundBinaryExpress
bool equals = leftValue.get()->operator!=(rightValue.get());
return make_shared<BooleanEvalValue>(equals);
}
case BoundBinaryOperation ::LessThan:
{
auto leftValue = this -> EvaluateIntegerExpression(expression->GetLeft());
auto rightValue = this -> EvaluateIntegerExpression(expression->GetRight());
BooleanEvalValue* b = leftValue->operator<(rightValue.get());
return shared_ptr<BooleanEvalValue>(b);
}
case BoundBinaryOperation ::LessThanEquals:
{
auto leftValue = this -> EvaluateIntegerExpression(expression->GetLeft());
auto rightValue = this -> EvaluateIntegerExpression(expression->GetRight());
BooleanEvalValue* b = leftValue->operator<=(rightValue.get());
return shared_ptr<BooleanEvalValue>(b);
}
case BoundBinaryOperation ::GreaterThan:
{
auto leftValue = this -> EvaluateIntegerExpression(expression->GetLeft());
auto rightValue = this -> EvaluateIntegerExpression(expression->GetRight());
BooleanEvalValue* b = leftValue->operator>(rightValue.get());
return shared_ptr<BooleanEvalValue>(b);
}
case BoundBinaryOperation ::GreaterThanEquals:
{
auto leftValue = this -> EvaluateIntegerExpression(expression->GetLeft());
auto rightValue = this -> EvaluateIntegerExpression(expression->GetRight());
BooleanEvalValue* b = leftValue->operator>=(rightValue.get());
return shared_ptr<BooleanEvalValue>(b);
}
case BoundBinaryOperation::LogicalAnd:
{
auto leftValue = this -> EvaluateBoolExpression(expression->GetLeft());