fez-lisp 1.2.59 → 1.2.60
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.
- package/package.json +1 -1
- package/src/utils.js +42 -2
package/package.json
CHANGED
package/src/utils.js
CHANGED
@@ -381,6 +381,38 @@ export const deSuggar = (ast) => {
|
|
381
381
|
if (first != undefined) {
|
382
382
|
switch (first[TYPE]) {
|
383
383
|
case WORD:
|
384
|
+
{
|
385
|
+
switch (first[VALUE]) {
|
386
|
+
case SUGGAR.POWER:
|
387
|
+
throw new TypeError(
|
388
|
+
`(${
|
389
|
+
SUGGAR.POWER
|
390
|
+
}), can't be used as a word (hint use math:power instead) (${
|
391
|
+
SUGGAR.POWER
|
392
|
+
} ${stringifyArgs(rest)})`
|
393
|
+
)
|
394
|
+
break
|
395
|
+
case SUGGAR.INTEGER_DEVISION:
|
396
|
+
exp.length = 0
|
397
|
+
exp.push(
|
398
|
+
...[
|
399
|
+
[APPLY, KEYWORDS.ANONYMOUS_FUNCTION],
|
400
|
+
[WORD, 'a'],
|
401
|
+
[WORD, 'b'],
|
402
|
+
[
|
403
|
+
[APPLY, KEYWORDS.BITWISE_OR],
|
404
|
+
[
|
405
|
+
[APPLY, KEYWORDS.DIVISION],
|
406
|
+
[WORD, 'a'],
|
407
|
+
[WORD, 'b']
|
408
|
+
],
|
409
|
+
[ATOM, 0]
|
410
|
+
]
|
411
|
+
]
|
412
|
+
)
|
413
|
+
break
|
414
|
+
}
|
415
|
+
}
|
384
416
|
break
|
385
417
|
case ATOM:
|
386
418
|
break
|
@@ -478,7 +510,15 @@ export const deSuggar = (ast) => {
|
|
478
510
|
break
|
479
511
|
case SUGGAR.INTEGER_DEVISION:
|
480
512
|
{
|
481
|
-
if (rest.
|
513
|
+
if (rest.length !== 2)
|
514
|
+
throw new RangeError(
|
515
|
+
`Invalid number of arguments for (${
|
516
|
+
SUGGAR.INTEGER_DEVISION
|
517
|
+
}), expected (= 2) but got ${rest.length} (${
|
518
|
+
SUGGAR.INTEGER_DEVISION
|
519
|
+
} ${stringifyArgs(rest)})`
|
520
|
+
)
|
521
|
+
else if (rest.some((x) => x[TYPE] === APPLY))
|
482
522
|
throw new TypeError(
|
483
523
|
`Arguments of (${
|
484
524
|
SUGGAR.INTEGER_DEVISION
|
@@ -492,7 +532,7 @@ export const deSuggar = (ast) => {
|
|
492
532
|
exp.length = 1
|
493
533
|
exp[0] = [APPLY, KEYWORDS.BITWISE_OR]
|
494
534
|
exp.push([[APPLY, KEYWORDS.DIVISION], ...rest])
|
495
|
-
exp.push([ATOM,
|
535
|
+
exp.push([ATOM, 0])
|
496
536
|
}
|
497
537
|
}
|
498
538
|
break
|