fez-lisp 1.1.32 → 1.1.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/interpreter.js +12 -2
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "fez-lisp",
3
3
  "description": "Lisp interpreted & compiled to JavaScript",
4
4
  "author": "AT290690",
5
- "version": "1.1.32",
5
+ "version": "1.1.33",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
@@ -497,7 +497,12 @@ const keywords = {
497
497
  if (circuit) continue
498
498
  else return 0
499
499
  }
500
- return evaluate(args.at(-1), env) ? 1 : 0
500
+ const end = evaluate(args.at(-1), env)
501
+ if (end !== FALSE && end !== TRUE)
502
+ throw new TypeError(
503
+ `Condition of (${KEYWORDS.AND}) must be 0 or 1 but got ${end}`
504
+ )
505
+ return end
501
506
  },
502
507
  [KEYWORDS.OR]: (args, env) => {
503
508
  if (args.length < 2)
@@ -516,7 +521,12 @@ const keywords = {
516
521
  if (circuit) return 1
517
522
  else continue
518
523
  }
519
- return evaluate(args.at(-1), env) ? 1 : 0
524
+ const end = evaluate(args.at(-1), env)
525
+ if (end !== FALSE && end !== TRUE)
526
+ throw new TypeError(
527
+ `Condition of (${KEYWORDS.OR}) must be 0 or 1 but got ${end}`
528
+ )
529
+ return end
520
530
  },
521
531
  [KEYWORDS.CALL_FUNCTION]: (args, env) => {
522
532
  if (!args.length)