@scriptc/compiler 0.0.11 → 0.0.12

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.
Files changed (90) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +12 -9
  2. package/ambient/scriptc.d.ts +2 -2
  3. package/dist/backend/cc.d.ts +2 -2
  4. package/dist/backend/emission/emit-async.js +1 -1
  5. package/dist/backend/emission/emit-exprs.js +97 -52
  6. package/dist/backend/emission/emit-exprs.js.map +1 -1
  7. package/dist/backend/emission/emit-island.js +1 -1
  8. package/dist/backend/emission/emit-shapes.js +1 -1
  9. package/dist/backend/emission/emit-walkers.d.ts +14 -14
  10. package/dist/backend/emission/emit-walkers.js +44 -44
  11. package/dist/backend/emission/emit-walkers.js.map +1 -1
  12. package/dist/backend/emission/emitter.d.ts +3 -3
  13. package/dist/backend/emission/emitter.js +8 -8
  14. package/dist/backend/emission/may-throw.js +1 -1
  15. package/dist/backend/llvm/dyn.d.ts +10 -10
  16. package/dist/backend/llvm/dyn.js +26 -26
  17. package/dist/backend/llvm/dyn.js.map +1 -1
  18. package/dist/backend/llvm/emitter.js +97 -43
  19. package/dist/backend/llvm/emitter.js.map +1 -1
  20. package/dist/backend/llvm/shapes.js +1 -1
  21. package/dist/backend/llvm/walkers.js +2 -2
  22. package/dist/backend/llvm/walkers.js.map +1 -1
  23. package/dist/diagnostics/diagnostic.d.ts +1 -1
  24. package/dist/diagnostics/diagnostic.js +4 -3
  25. package/dist/diagnostics/diagnostic.js.map +1 -1
  26. package/dist/frontend/lowering/lib-boundary.js +5 -5
  27. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  28. package/dist/frontend/lowering/lower-assert.js +12 -12
  29. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  30. package/dist/frontend/lowering/lower-builtins.d.ts +7 -7
  31. package/dist/frontend/lowering/lower-builtins.js +92 -31
  32. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  33. package/dist/frontend/lowering/lower-calls.d.ts +4 -4
  34. package/dist/frontend/lowering/lower-calls.js +66 -66
  35. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  36. package/dist/frontend/lowering/lower-classes.js +31 -5
  37. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  38. package/dist/frontend/lowering/lower-containers.d.ts +5 -5
  39. package/dist/frontend/lowering/lower-containers.js +19 -19
  40. package/dist/frontend/lowering/lower-containers.js.map +1 -1
  41. package/dist/frontend/lowering/lower-emitter.js +2 -2
  42. package/dist/frontend/lowering/lower-emitter.js.map +1 -1
  43. package/dist/frontend/lowering/lower-exprs.d.ts +7 -7
  44. package/dist/frontend/lowering/lower-exprs.js +158 -112
  45. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  46. package/dist/frontend/lowering/lower-inspect.js +5 -5
  47. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  48. package/dist/frontend/lowering/lower-island.js +12 -3
  49. package/dist/frontend/lowering/lower-island.js.map +1 -1
  50. package/dist/frontend/lowering/lower-modules.js +16 -16
  51. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  52. package/dist/frontend/lowering/lower-namespaces.d.ts +11 -1
  53. package/dist/frontend/lowering/lower-namespaces.js +41 -6
  54. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  55. package/dist/frontend/lowering/lower-server.js +11 -11
  56. package/dist/frontend/lowering/lower-server.js.map +1 -1
  57. package/dist/frontend/lowering/lower-stmts.d.ts +1 -1
  58. package/dist/frontend/lowering/lower-stmts.js +191 -30
  59. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  60. package/dist/frontend/lowering/lower-stream.js +66 -22
  61. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  62. package/dist/frontend/lowering/lowerer.d.ts +10 -10
  63. package/dist/frontend/lowering/lowerer.js +51 -37
  64. package/dist/frontend/lowering/lowerer.js.map +1 -1
  65. package/dist/frontend/lowering/surfaces.js +2 -2
  66. package/dist/frontend/lowering/surfaces.js.map +1 -1
  67. package/dist/frontend/program.js +1 -1
  68. package/dist/frontend/shared.js +7 -7
  69. package/dist/frontend/shared.js.map +1 -1
  70. package/dist/frontend/types.d.ts +2 -2
  71. package/dist/frontend/types.js +15 -15
  72. package/dist/frontend/types.js.map +1 -1
  73. package/dist/index.js +38 -7
  74. package/dist/index.js.map +1 -1
  75. package/dist/ir/nodes.d.ts +110 -98
  76. package/dist/ir/nodes.js +48 -21
  77. package/dist/ir/nodes.js.map +1 -1
  78. package/dist/ir/validate.js +44 -34
  79. package/dist/ir/validate.js.map +1 -1
  80. package/dist/library/int-infer.js +13 -0
  81. package/dist/library/int-infer.js.map +1 -1
  82. package/dist/library/profile.d.ts +8 -6
  83. package/dist/library/profile.js.map +1 -1
  84. package/dist/library/sidecar-validate.js +1 -1
  85. package/dist/library/sidecar-validate.js.map +1 -1
  86. package/dist/library/sidecar.d.ts +1 -1
  87. package/dist/library/sidecar.js +20 -7
  88. package/dist/library/sidecar.js.map +1 -1
  89. package/package.json +2 -2
  90. package/surface-manifest.json +4 -4
@@ -366,7 +366,7 @@ export declare function lowerBufferStaticCall(L: Lowerer, call: ts.CallExpressio
366
366
  * result order is Node-exact; hybrids inherit the documented
367
367
  * declared-then-overflow divergence. Values surface as the checker's
368
368
  * result element type: identity, an arm-into-union wrap, or (dyn
369
- * results) the DOM conversion — recordKeyGet's own surfacing rules for
369
+ * results) the dyn conversion — recordKeyGet's own surfacing rules for
370
370
  * the overflow, mirrored statically for declared fields. */
371
371
  export declare function lowerObjectIterOverIndexShape(L: Lowerer, call: ts.CallExpression, member: "keys" | "values" | "entries", argIr: IrType & {
372
372
  kind: "record";
@@ -485,9 +485,9 @@ export declare function lowerEnvToPairsHelper(L: Lowerer, shapeId: string, loc:
485
485
  /** The validated-STRING extraction of a dyn method receiver — the receiver
486
486
  * expression the string/regex method lowerings consume. */
487
487
  export declare function dynStringReceiver(L: Lowerer, recv: IrExpr, access: ts.PropertyAccessExpression): IrExpr;
488
- /** `d.filter(pred)` on a dyn receiver: the receiver must BE a DOM array
488
+ /** `d.filter(pred)` on a dyn receiver: the receiver must BE a dyn array
489
489
  * (else the Node-shaped TypeError above); the predicate runs per element
490
- * over the DOM value, and each SURVIVOR is validated-extracted into the
490
+ * over the dyn value, and each SURVIVOR is validated-extracted into the
491
491
  * result's element type T — the type the checker already committed the
492
492
  * call to (the contextual `RouteMapping[]`/`string[]` slot). Extraction is
493
493
  * the checked-cast machinery: a survivor that doesn't fit T throws the
@@ -498,9 +498,9 @@ export declare function dynStringReceiver(L: Lowerer, recv: IrExpr, access: ts.P
498
498
  export declare function lowerDynArrayFilterCall(L: Lowerer, call: ts.CallExpression, access: ts.PropertyAccessExpression, recv: IrExpr): IrExpr | null;
499
499
  /** `.flatMap(f)` on a dyn ('unknown'/`any[]`-narrowed) receiver where the
500
500
  * callback returns a STATIC array (`parsed.flatMap((v) => typeof v ===
501
- * "string" ? parseTldList(v) : [])` — the tlds-file shape): the DOM
501
+ * "string" ? parseTldList(v) : [])` — the tlds-file shape): the checked-dynamic tree
502
502
  * array walks element-by-element, the callback sees each element as the
503
- * DOM value `unknown` code sees, and its typed results concatenate —
503
+ * dyn value `unknown` code sees, and its typed results concatenate —
504
504
  * depth-1 flatten by construction, no validation needed on the results
505
505
  * (they are already typed; only the RECEIVER is dynamic). Non-array
506
506
  * receivers throw the Node-shaped TypeError. Callbacks returning
@@ -65,11 +65,11 @@ export function lowerArrayMethodCall(L, call, access) {
65
65
  const result = { kind: "jsOp", op: "callMethod", name, args: [receiver, ...args], type: JSVAL, loc };
66
66
  return islandPrimitiveExit(L, call, result);
67
67
  }
68
- // An array-mapped CHECKER type whose VALUE lives in the DOM
69
- // (`Object.keys(dynObj).sort()` — the key-walk answers a DOM array):
68
+ // An array-mapped CHECKER type whose VALUE lives in the checked-dynamic tree
69
+ // (`Object.keys(dynObj).sort()` — the key-walk answers a dyn array):
70
70
  // the record family's array sibling. Methods with a runtime
71
71
  // receiver-kind dispatch ride dynInvoke — the real method runs on
72
- // the DOM array, JS-exact; the rest keep an honest fence instead of
72
+ // the dyn array, JS-exact; the rest keep an honest fence instead of
73
73
  // handing a static array intrinsic a dyn receiver (the validator
74
74
  // ICE). Consumers validate the dyn result where a static type is
75
75
  // required (dynCheck — the member-read discipline).
@@ -336,7 +336,7 @@ function hofCallbackArg(L, argNode, lead, arrT) {
336
336
  // A DYN-receiver HOF's callback (`parsed.flatMap((value) => ...)`):
337
337
  // the contextual signature types the unannotated param `any` (the
338
338
  // receiver is checker-`any[]`), while the VALUE each call receives is
339
- // the DOM element `unknown` code sees — narrow the param declaration
339
+ // the dyn element `unknown` code sees — narrow the param declaration
340
340
  // to `unknown` so it lowers as the dyn it carries (typeof tests and
341
341
  // validated extractions ride as usual) instead of fencing on `any`.
342
342
  const overridden = [];
@@ -4133,7 +4133,7 @@ export function lowerStringMethodCall(L, call, access, dynReceiver) {
4133
4133
  return null;
4134
4134
  // A validated dyn receiver (`pkg.name.replace(...)` on a JSON.parse
4135
4135
  // value) arrives pre-extracted through `dynReceiver`; its checker type
4136
- // is `any`, so the type/symbol gates don't apply — the DOM value's
4136
+ // is `any`, so the type/symbol gates don't apply — the dyn value's
4137
4137
  // methods can only BE the string intrinsics.
4138
4138
  if (dynReceiver === undefined) {
4139
4139
  const receiverIr = L.mapTypeOf(L.typeOf(access.expression));
@@ -4691,7 +4691,7 @@ function lowerBufferInstanceMethod(L, call, access, name, loc) {
4691
4691
  // literals) wrap in dynFrom, `undefined` literals ride the same wrap.
4692
4692
  // Fences (never returns) when the value cannot cross — an island jsval.
4693
4693
  const chkArg = (i) => {
4694
- // Object literals take the DOM literal path directly (method members
4694
+ // Object literals take the dyn literal path directly (method members
4695
4695
  // box as dyn functions — the typed record fence never applies).
4696
4696
  if (ts.isObjectLiteralExpression(args[i])) {
4697
4697
  return lowerDynObjectLiteral(L, args[i]);
@@ -5087,7 +5087,7 @@ export function lowerBufferStaticCall(L, call, access) {
5087
5087
  * result order is Node-exact; hybrids inherit the documented
5088
5088
  * declared-then-overflow divergence. Values surface as the checker's
5089
5089
  * result element type: identity, an arm-into-union wrap, or (dyn
5090
- * results) the DOM conversion — recordKeyGet's own surfacing rules for
5090
+ * results) the dyn conversion — recordKeyGet's own surfacing rules for
5091
5091
  * the overflow, mirrored statically for declared fields. */
5092
5092
  export function lowerObjectIterOverIndexShape(L, call, member, argIr, shape) {
5093
5093
  const resultT = L.irTypeOf(call);
@@ -5600,7 +5600,7 @@ export function lowerRecordOvfCaptureHelper(L, fromId, toId, loc) {
5600
5600
  // target also declares. Non-dyn slots store THROUGH on a collision, so
5601
5601
  // such writes need every declared field to BE the slot type (the
5602
5602
  // validator's recordKeySet rule); dyn slots validate per field
5603
- // (dynCheck), so each field must be DOM-convertible. Writes to
5603
+ // (dynCheck), so each field must be dyn-convertible. Writes to
5604
5604
  // literal names the target does NOT declare are overflowOnly and
5605
5605
  // exempt — which is what lets a direct-initialized required field
5606
5606
  // (`id: number` beside a `number | undefined` slot) coexist with a
@@ -6346,7 +6346,7 @@ export function lowerEnvToPairsHelper(L, shapeId, loc) {
6346
6346
  }
6347
6347
  /* ── dyn METHOD receivers ──────────────────────────────────────────────────
6348
6348
  * Method calls on `unknown`/JSON.parse-derived receivers (`pkg.name
6349
- * .replace(...)`, `ws.packages.filter(...)`): validate the receiver's DOM
6349
+ * .replace(...)`, `ws.packages.filter(...)`): validate the receiver's dyn
6350
6350
  * kind, extract, then ride the STATIC method machinery — the dyn boundary's
6351
6351
  * trust-but-VERIFY stance extended to receivers. A receiver of the wrong
6352
6352
  * kind throws the catchable Node-shaped TypeError V8 would ("x.replace is
@@ -6449,9 +6449,9 @@ export function dynStringReceiver(L, recv, access) {
6449
6449
  loc,
6450
6450
  };
6451
6451
  }
6452
- /** `d.filter(pred)` on a dyn receiver: the receiver must BE a DOM array
6452
+ /** `d.filter(pred)` on a dyn receiver: the receiver must BE a dyn array
6453
6453
  * (else the Node-shaped TypeError above); the predicate runs per element
6454
- * over the DOM value, and each SURVIVOR is validated-extracted into the
6454
+ * over the dyn value, and each SURVIVOR is validated-extracted into the
6455
6455
  * result's element type T — the type the checker already committed the
6456
6456
  * call to (the contextual `RouteMapping[]`/`string[]` slot). Extraction is
6457
6457
  * the checked-cast machinery: a survivor that doesn't fit T throws the
@@ -6489,8 +6489,8 @@ export function lowerDynArrayFilterCall(L, call, access, recv) {
6489
6489
  if (!elemT || !L.jsonSafe(elemT)) {
6490
6490
  // No JSON-representable destination (`const failed = checks.filter(
6491
6491
  // fn)` in untyped JS — test/common's runCallChecks): the result
6492
- // STAYS in the DOM — the runtime prototype dispatch (scr_dyn_invoke)
6493
- // runs the real filter over the DOM array and the survivors keep
6492
+ // STAYS in the checked-dynamic tree — the runtime prototype dispatch (scr_dyn_invoke)
6493
+ // runs the real filter over the dyn array and the survivors keep
6494
6494
  // their dyn selves, no extraction needed. The typed-destination path
6495
6495
  // above stays preferred: it hands back a real T[].
6496
6496
  return null;
@@ -6514,9 +6514,9 @@ export function lowerDynArrayFilterCall(L, call, access, recv) {
6514
6514
  }
6515
6515
  /** `.flatMap(f)` on a dyn ('unknown'/`any[]`-narrowed) receiver where the
6516
6516
  * callback returns a STATIC array (`parsed.flatMap((v) => typeof v ===
6517
- * "string" ? parseTldList(v) : [])` — the tlds-file shape): the DOM
6517
+ * "string" ? parseTldList(v) : [])` — the tlds-file shape): the checked-dynamic tree
6518
6518
  * array walks element-by-element, the callback sees each element as the
6519
- * DOM value `unknown` code sees, and its typed results concatenate —
6519
+ * dyn value `unknown` code sees, and its typed results concatenate —
6520
6520
  * depth-1 flatten by construction, no validation needed on the results
6521
6521
  * (they are already typed; only the RECEIVER is dynamic). Non-array
6522
6522
  * receivers throw the Node-shaped TypeError. Callbacks returning
@@ -6532,10 +6532,10 @@ export function lowerDynArrayFlatMapCall(L, call, access, recv) {
6532
6532
  if (ret.kind !== "array") {
6533
6533
  // A DYNAMIC-returning callback (`plugins.flatMap((plugin) =>
6534
6534
  // plugin.languages ?? [])` — the getSupportInfo shape, where the
6535
- // callback's members ride the DOM): the call dispatches on the
6535
+ // callback's members ride the checked-dynamic tree): the call dispatches on the
6536
6536
  // RECEIVER's runtime kind (dynInvoke) with the callback boxed —
6537
6537
  // a wrapped ISLAND receiver runs the ENGINE's own JS-exact
6538
- // Array.prototype.flatMap (the routed-ops lane), a native DOM
6538
+ // Array.prototype.flatMap (the routed-ops lane), a native dyn
6539
6539
  // array runs the runtime's flatMap, and non-arrays throw Node's
6540
6540
  // TypeError. The result stays dyn, checked per use.
6541
6541
  if (ret.kind === "dyn" || ret.kind === "jsval") {
@@ -6705,10 +6705,10 @@ function dynFilterHelper(L, elemT, arity, loc) {
6705
6705
  }
6706
6706
  /** out = []; n = d.length; for (i..n) { v = d[i]; if (f(v, i, d)) out.push(
6707
6707
  * check<T>(v)); } return out; — with the receiver-kind gate up front. The
6708
- * length reads ONCE (the DOM is immutable under the static surface), the
6708
+ * length reads ONCE (the checked-dynamic tree is immutable under the static surface), the
6709
6709
  * element reads through the canonical-index keyed read, the callback gets
6710
6710
  * whatever prefix of (element, index, receiver) it declares — the element
6711
- * and receiver as DOM values, exactly what `unknown` code sees. */
6711
+ * and receiver as dyn values, exactly what `unknown` code sees. */
6712
6712
  function buildDynFilterFn(name, elemT, arity, loc) {
6713
6713
  const outT = arrayOf(elemT);
6714
6714
  const fnT = funcOf([DYN, F64, DYN].slice(0, arity), BOOL);