@mark1russell7/vex-compiler 0.11.2 → 0.13.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/facts.ts","../src/loop.ts","../src/tiers.ts","../src/module.ts","../src/runtime.ts"],"mappings":";;;KAqCY,aAAa;;;;;KAMb,OAAO;;;;;UAYF;WACN,SAAS,SAAS,eAAe;WACjC,OAAO,SAAS,eAAe;;;UAIzB;WACN,mBAAmB;WACnB,MAAM,SAAS,eAAe;WAC9B,aAAa,SAAS,eAAe;WACrC,SAAS;;;;;KC9CR;;KAeA;;KA2BA;WACG;WAAqB;;WACrB;WAAqB;;WACrB;WAAmB;;WACnB;WAAoB;;WACpB;;WACA;WAAqB,gBAAgB;;WACrC;WAAoB,IAAI;WAAiB,eAAe;;WACxD;WAAoB,IAAI;WAAoB,eAAe;;WAK3D;WAAkB;WAAuB,eAAe;WAAkB,iBAAiB;;WAE3F;WAAoB;;WAEpB;WAAuB;WAAuB,gBAAgB,OAAO,OAAO;;;;;;;;;;;KAW/E;WACG;;WACA;WAAwB;WAAwB;aAAoB,MAAM;aAAgB,MAAM;;;WAChG;WAAqB;;;KAGxB;WAEG;WAAmB;WAAoB,OAAO;;WAE9C;WAAmB;WAAoB,OAAO;;WAE9C;WAAqB,IAAI;WAAgB;WAAyB,MAAM;;WAExE;WAAoB,MAAM;;WAC1B;WAAkB,MAAM;WAAgB,cAAc;WAAkB,aAAa;;WAKrF;WAAoB;WAAwB;WAAuB;WAAwB;WAAwB,MAAM;WAAgB,eAAe;;WAExJ;WAAqB;WAAwB,eAAe;;WAE5D;WAAsB;WAAwB,eAAe;;WAE7D;;WAEA;WAAoB;WAAoB,OAAO;;WAC/C;WAAsB,OAAO;;;UAG3B;WACN,eAAe;WACf;;WAEA;;;;;KCrHC,kBAAkB;WAA4B,SAAS;;;;;;KAUvD;WACG;WAAmB,SAAS;WAAs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cAAc;EACjC,OAAO;EACP,KAAK;EACL,IAAI,0BAA0B;EAC9B,KAAK,yBAAyB;EAC9B,OAAO;EACP,IAAI,cAAc,eAAe,GAAG,OAAO,gBAAgB,eAAe;EAC1E,IAAI,MAAM,SAAS,sCAAsC;;;wBAI3C,cAAc,SAAS,iBAAiB"}
package/build/index.js CHANGED
@@ -12,7 +12,7 @@ import { CELL_KIND, MAX_NESTING, addrExprs, axisTargets, children, compile, find
12
12
  const MAX_CALLS = 1e4;
13
13
  /**
14
14
  * 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,
15
- * LIST.GET).
15
+ * LIST.GET, LIST.INDEXOF, LIST.FILL).
16
16
  */
17
17
  const ORDER_OPS = /* @__PURE__ */ new Set([
18
18
  "sortBy",
@@ -22,7 +22,9 @@ const ORDER_OPS = /* @__PURE__ */ new Set([
22
22
  "append",
23
23
  "flat",
24
24
  "without",
25
- "get"
25
+ "get",
26
+ "indexOf",
27
+ "fill"
26
28
  ]);
27
29
  /**
28
30
  * This function gives the reason that tier 2 cannot take a program with lists as values. The reason is the axis `list`,
@@ -1339,6 +1341,7 @@ var Lowerer = class {
1339
1341
  case "flat":
1340
1342
  case "without":
1341
1343
  case "get":
1344
+ case "indexOf":
1342
1345
  /* v8 ignore next -- @preserve */
1343
1346
  throw new Unsupported(`the list op "${op}"`);
1344
1347
  }
@@ -2384,13 +2387,14 @@ const BOOLEAN_LIST_OPS = /* @__PURE__ */ new Set([
2384
2387
  "all",
2385
2388
  "none"
2386
2389
  ]);
2387
- /** The list ops that build a list from lists (LIST.BUILD), and `get` (LIST.GET). A module gives a reason for them. */
2390
+ /** 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. */
2388
2391
  const BUILD_OPS = /* @__PURE__ */ new Set([
2389
2392
  "drop",
2390
2393
  "append",
2391
2394
  "flat",
2392
2395
  "without",
2393
- "get"
2396
+ "get",
2397
+ "indexOf"
2394
2398
  ]);
2395
2399
  /** This function tells if the step of a list op throws for a value of the kind `kind`, which is the wrong kind. */
2396
2400
  const stepThrows = (op, kind) => NUMBER_STEPS.has(op) && kind !== "number" || BOOLEAN_LIST_OPS.has(op) && kind !== "boolean";
@@ -3719,7 +3723,7 @@ var Printer = class {
3719
3723
  const { level } = inner;
3720
3724
  const testCodes = tests.map((t) => this.#hoist(this.expr(t, inner), hasLoop(t)));
3721
3725
  const body = this.#hoist(this.expr(target.body, inner), hasLoop(target.body));
3722
- if (op === "count" && fixed && tests.length === 0 && body.v.safe) return bare(plainValue("n", "number"));
3726
+ if (op === "count" && fixed && tests.length === 0 && body.v.safe && !body.v.deps.has(CELLS)) return bare(plainValue("n", "number"));
3723
3727
  const deps = new Set([...start, ...[body, ...testCodes].flatMap((x) => [...x.v.deps])].filter((d) => d !== level));
3724
3728
  const r = this.#reduction(op, body.v.kind);
3725
3729
  const { v } = r;