@mark1russell7/vex-compiler 0.11.1 → 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/README.md +2 -0
- package/build/index.d.ts +37 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +792 -88
- package/build/index.js.map +1 -1
- package/package.json +4 -4
- package/src/facts.ts +2 -2
- package/src/index.ts +1 -1
- package/src/js.ts +4 -2
- package/src/lower.ts +1 -0
- package/src/module.ts +639 -69
- package/src/runtime.ts +2 -7
- package/src/sheet-order.ts +123 -0
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/index.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { generate, load, tiered, type Generated, type GenerateOptions, type Tier2, type TieredProgram, type TierStats } from "./tiers.ts";
|
|
5
5
|
export type { Schema } from "./facts.ts";
|
|
6
|
-
export { emitModule, type Emitted, type ModuleOptions } from "./module.ts";
|
|
6
|
+
export { emitModule, emitSheetModule, type Emitted, type ModuleOptions, type SheetModuleOptions } from "./module.ts";
|
|
7
7
|
export { FALLBACK, createRuntime, type Fallback, type Runtime, type RuntimeOptions } from "./runtime.ts";
|
|
8
8
|
export type { LExpr, LoopProgram, LStmt, PrimOp, RuntimeFn } from "./loop.ts";
|
package/src/js.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* inline caches in the engine, and a guard sends each other case to the dispatch of the runtime.
|
|
10
10
|
*/
|
|
11
11
|
import { liftsAt, type ParamKind } from "@mark1russell7/vex";
|
|
12
|
-
import type
|
|
12
|
+
import { primitiveOf, type Facts, type SiteFacts, type StaticSite } from "./facts.ts";
|
|
13
13
|
import { constant, FIXED_LOCALS, type Fail, type LExpr, type LoopProgram, type LStmt, type RuntimeFn } from "./loop.ts";
|
|
14
14
|
|
|
15
15
|
type OpExpr = Extract<LExpr, { readonly t: "op" }>;
|
|
@@ -189,7 +189,9 @@ export function printJs(p: LoopProgram, facts: Facts): string {
|
|
|
189
189
|
const f = `f${x.name}_${st.domain}`;
|
|
190
190
|
fns.set(f, `${domain(st.domain)}.ops[${expr(constant(x.name))}].fn`);
|
|
191
191
|
attempt(`${f}(${values.join(", ")})`, indent);
|
|
192
|
-
|
|
192
|
+
// A local of tier 2 has a primitive kind or no kind (lower.ts). Thus a result of the kind of a domain gets the checks
|
|
193
|
+
// of the interpreter, as a result of the kind any (V-059).
|
|
194
|
+
const kind = primitiveOf(st.returns);
|
|
193
195
|
if (kind === undefined) {
|
|
194
196
|
resultChecks(out, facts.checks, indent);
|
|
195
197
|
return;
|
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}"`);
|