Implemented comparison equality operators
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user