@mark1russell7/vex-compiler 0.11.2 → 0.12.0
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/build/index.js +8 -4
- package/build/index.js.map +1 -1
- package/package.json +4 -4
- package/src/facts.ts +2 -2
- package/src/lower.ts +1 -0
- package/src/module.ts +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@mark1russell7/vex-compiler",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"description": "The Vex compiler: generated JavaScript for Vex programs, at run time and at build time, with the results of the interpreter.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vex",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@mark1russell7/cue": "github:mark1russell7/cue",
|
|
46
|
-
"@mark1russell7/vex-domains": "0.
|
|
47
|
-
"@mark1russell7/vex-testkit": "0.
|
|
46
|
+
"@mark1russell7/vex-domains": "0.12.0",
|
|
47
|
+
"@mark1russell7/vex-testkit": "0.12.0",
|
|
48
48
|
"@types/node": "^26.6.4",
|
|
49
49
|
"fast-check": "^4.10.2",
|
|
50
50
|
"typescript": "^7.0.2",
|
|
51
51
|
"vitest": "^5.0.3"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@mark1russell7/vex": "0.
|
|
54
|
+
"@mark1russell7/vex": "0.12.0"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "tsdown",
|
package/src/facts.ts
CHANGED
|
@@ -13,9 +13,9 @@ export const MAX_CALLS = 10_000;
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* The list ops that give a list, or read a position or a key of a list (LIST.SORT, LIST.TAKE, LIST.NTH, LIST.BUILD,
|
|
16
|
-
* LIST.GET).
|
|
16
|
+
* LIST.GET, LIST.INDEXOF, LIST.FILL).
|
|
17
17
|
*/
|
|
18
|
-
const ORDER_OPS: ReadonlySet<string> = new Set(["sortBy", "take", "nth", "drop", "append", "flat", "without", "get"]);
|
|
18
|
+
const ORDER_OPS: ReadonlySet<string> = new Set(["sortBy", "take", "nth", "drop", "append", "flat", "without", "get", "indexOf", "fill"]);
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* This function gives the reason that tier 2 cannot take a program with lists as values. The reason is the axis `list`,
|
package/src/lower.ts
CHANGED
|
@@ -568,6 +568,7 @@ class Lowerer {
|
|
|
568
568
|
case "flat":
|
|
569
569
|
case "without":
|
|
570
570
|
case "get":
|
|
571
|
+
case "indexOf":
|
|
571
572
|
/* v8 ignore next -- @preserve */
|
|
572
573
|
// Stryker disable next-line all: listReason stops these ops before the lowering
|
|
573
574
|
throw new Unsupported(`the list op "${op}"`);
|
package/src/module.ts
CHANGED
|
@@ -654,8 +654,8 @@ interface TreeRange {
|
|
|
654
654
|
const LIST_OPS: ReadonlySet<string> = new Set(["count", "sum", "mean", "min", "max", "any", "all", "none", "first"]);
|
|
655
655
|
const NUMBER_LIST_OPS: ReadonlySet<string> = new Set(["count", "sum", "mean", "min", "max"]);
|
|
656
656
|
const BOOLEAN_LIST_OPS: ReadonlySet<string> = new Set(["any", "all", "none"]);
|
|
657
|
-
/** The list ops that build a list from lists (LIST.BUILD),
|
|
658
|
-
const BUILD_OPS: ReadonlySet<string> = new Set(["drop", "append", "flat", "without", "get"]);
|
|
657
|
+
/** The list ops that build a list from lists (LIST.BUILD), `get` (LIST.GET) and `indexOf` (LIST.INDEXOF). A module gives a reason for them. */
|
|
658
|
+
const BUILD_OPS: ReadonlySet<string> = new Set(["drop", "append", "flat", "without", "get", "indexOf"]);
|
|
659
659
|
|
|
660
660
|
/** This function tells if the step of a list op throws for a value of the kind `kind`, which is the wrong kind. */
|
|
661
661
|
const stepThrows = (op: string, kind: Kind | undefined): boolean => (NUMBER_STEPS.has(op) && kind !== "number") || (BOOLEAN_LIST_OPS.has(op) && kind !== "boolean");
|