greybel-interpreter 0.5.5 → 0.5.6
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.
|
@@ -162,7 +162,7 @@ var LogicalAndBinaryExpression = /** @class */ (function (_super) {
|
|
|
162
162
|
case 0:
|
|
163
163
|
me = this;
|
|
164
164
|
evaluate = function (node) { return __awaiter(_this, void 0, void 0, function () {
|
|
165
|
-
var expr, _a, binaryResult, _b, _c, _d, logicalResult, _e, _f, _g;
|
|
165
|
+
var expr, _a, binaryResult, _b, _c, _d, logicalLeft, logicalResult, _e, _f, _g;
|
|
166
166
|
return __generator(this, function (_h) {
|
|
167
167
|
switch (_h.label) {
|
|
168
168
|
case 0:
|
|
@@ -189,11 +189,20 @@ var LogicalAndBinaryExpression = /** @class */ (function (_super) {
|
|
|
189
189
|
case 4:
|
|
190
190
|
binaryResult = _c.apply(_b, _d.concat([_h.sent()]));
|
|
191
191
|
return [2 /*return*/, Number.isNaN(binaryResult) ? null : binaryResult];
|
|
192
|
-
case 5:
|
|
193
|
-
_f = (_e = exports.OPERATIONS)[expr.operator];
|
|
194
|
-
return [4 /*yield*/, evaluate(expr.left)];
|
|
192
|
+
case 5: return [4 /*yield*/, evaluate(expr.left)];
|
|
195
193
|
case 6:
|
|
196
|
-
|
|
194
|
+
logicalLeft = _h.sent();
|
|
195
|
+
if ((0, typer_1.isCustomList)(logicalLeft) && !logicalLeft.valueOf()) {
|
|
196
|
+
logicalLeft = false;
|
|
197
|
+
}
|
|
198
|
+
if (expr.operator === greybel_core_1.Operator.And && !(0, exports.toPrimitive)(logicalLeft)) {
|
|
199
|
+
return [2 /*return*/, false];
|
|
200
|
+
}
|
|
201
|
+
else if (expr.operator === greybel_core_1.Operator.Or && (0, exports.toPrimitive)(logicalLeft)) {
|
|
202
|
+
return [2 /*return*/, true];
|
|
203
|
+
}
|
|
204
|
+
_f = (_e = exports.OPERATIONS)[expr.operator];
|
|
205
|
+
_g = [logicalLeft];
|
|
197
206
|
return [4 /*yield*/, evaluate(expr.right)];
|
|
198
207
|
case 7:
|
|
199
208
|
logicalResult = _f.apply(_e, _g.concat([_h.sent()]));
|