@dhis2/expression-parser 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4190,6 +4190,15 @@ function evalBinaryLogicOperator($this, op, operator, eval_0) {
4190
4190
  var rVal = eval_0(right);
4191
4191
  return op(lVal, rVal);
4192
4192
  }
4193
+ function evalBinaryLogicOperatorShortCircuit($this, op, operator, eval_0, shortCircuitOn) {
4194
+ var left = operator.mz(0);
4195
+ var right = operator.mz(1);
4196
+ var lVal = eval_0(left);
4197
+ if (!(lVal == null) ? lVal === shortCircuitOn : false)
4198
+ return shortCircuitOn;
4199
+ var rVal = eval_0(right);
4200
+ return op(lVal, rVal);
4201
+ }
4193
4202
  function evalBinaryOperator($this, op, operator, eval_0) {
4194
4203
  var left = operator.mz(0);
4195
4204
  var right = operator.mz(1);
@@ -4642,12 +4651,12 @@ protoOf(Calculator).h17 = function (operator) {
4642
4651
  case 12:
4643
4652
  var tmp_4 = Companion_instance_10;
4644
4653
  var tmp_5 = BinaryOperator$Companion$and$ref(Companion_getInstance_4());
4645
- tmp = evalBinaryOperator(tmp_4, tmp_5, operator, Calculator$evalToBoolean$ref(this));
4654
+ tmp = evalBinaryLogicOperatorShortCircuit(tmp_4, tmp_5, operator, Calculator$evalToBoolean$ref(this), false);
4646
4655
  break;
4647
4656
  case 13:
4648
4657
  var tmp_6 = Companion_instance_10;
4649
4658
  var tmp_7 = BinaryOperator$Companion$or$ref(Companion_getInstance_4());
4650
- tmp = evalBinaryOperator(tmp_6, tmp_7, operator, Calculator$evalToBoolean$ref_0(this));
4659
+ tmp = evalBinaryLogicOperatorShortCircuit(tmp_6, tmp_7, operator, Calculator$evalToBoolean$ref_0(this), true);
4651
4660
  break;
4652
4661
  case 6:
4653
4662
  var tmp_8 = Companion_instance_10;