Dont evaluate right hand side of Logical Or if left hand is true.
This commit is contained in:
parent
256244eabb
commit
7bca80092d
|
@ -291,6 +291,10 @@ namespace Porygon::Evaluation {
|
||||||
if (!leftValue->EvaluateBool())
|
if (!leftValue->EvaluateBool())
|
||||||
return new BooleanEvalValue(false);
|
return new BooleanEvalValue(false);
|
||||||
}
|
}
|
||||||
|
else if (operation == BoundBinaryOperation::LogicalOr) {
|
||||||
|
if (leftValue->EvaluateBool())
|
||||||
|
return new BooleanEvalValue(true);
|
||||||
|
}
|
||||||
auto rightValue = this -> EvaluateExpression(expression->GetRight());
|
auto rightValue = this -> EvaluateExpression(expression->GetRight());
|
||||||
if (operation == BoundBinaryOperation::Equality){
|
if (operation == BoundBinaryOperation::Equality){
|
||||||
return new BooleanEvalValue(leftValue->operator==(rightValue.Get()));
|
return new BooleanEvalValue(leftValue->operator==(rightValue.Get()));
|
||||||
|
|
Loading…
Reference in New Issue