Fixed right hand in Logical And operation being evaluated when left hand was false
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
fab2c9eabd
commit
bd054b1077
|
@ -267,13 +267,17 @@ namespace Porygon::Evaluation {
|
|||
}
|
||||
|
||||
EvalValuePointer Evaluator::EvaluateBinary(const BoundBinaryExpression *expression){
|
||||
auto leftValue = this -> EvaluateExpression(expression->GetLeft());
|
||||
auto rightValue = this -> EvaluateExpression(expression->GetRight());
|
||||
auto operation = expression->GetOperation();
|
||||
auto leftValue = this -> EvaluateExpression(expression->GetLeft());
|
||||
if (operation == BoundBinaryOperation::LogicalAnd){
|
||||
if (!leftValue->EvaluateBool())
|
||||
return new BooleanEvalValue(false);
|
||||
}
|
||||
auto rightValue = this -> EvaluateExpression(expression->GetRight());
|
||||
if (operation == BoundBinaryOperation::Equality){
|
||||
return new BooleanEvalValue(leftValue == rightValue);
|
||||
return new BooleanEvalValue(leftValue->operator==(rightValue.Get()));
|
||||
} else if (operation == BoundBinaryOperation::Inequality){
|
||||
return new BooleanEvalValue(leftValue != rightValue);
|
||||
return new BooleanEvalValue(leftValue->operator!=(rightValue.Get()));
|
||||
}
|
||||
return leftValue->BinaryOperation(operation, rightValue.Get());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue