@scriptc/compiler 0.0.17 → 0.0.18

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 (51) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +4 -4
  2. package/dist/backend/cc.d.ts +5 -0
  3. package/dist/backend/cc.js +2 -0
  4. package/dist/backend/cc.js.map +1 -1
  5. package/dist/backend/emission/emit-async.js +35 -2
  6. package/dist/backend/emission/emit-async.js.map +1 -1
  7. package/dist/backend/emission/emit-exprs.js +40 -4
  8. package/dist/backend/emission/emit-exprs.js.map +1 -1
  9. package/dist/backend/emission/emitter.js +69 -11
  10. package/dist/backend/emission/emitter.js.map +1 -1
  11. package/dist/backend/emission/may-throw.d.ts +3 -3
  12. package/dist/backend/emission/may-throw.js +15 -4
  13. package/dist/backend/emission/may-throw.js.map +1 -1
  14. package/dist/backend/llvm/emitter.js +199 -21
  15. package/dist/backend/llvm/emitter.js.map +1 -1
  16. package/dist/frontend/lowering/lower-builtins.js +4 -7
  17. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  18. package/dist/frontend/lowering/lower-calls.js +17 -9
  19. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  20. package/dist/frontend/lowering/lower-containers.d.ts +22 -17
  21. package/dist/frontend/lowering/lower-containers.js +628 -51
  22. package/dist/frontend/lowering/lower-containers.js.map +1 -1
  23. package/dist/frontend/lowering/lower-exprs.js +19 -1
  24. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  25. package/dist/frontend/lowering/lower-island.js +55 -7
  26. package/dist/frontend/lowering/lower-island.js.map +1 -1
  27. package/dist/frontend/lowering/lower-modules.js +144 -10
  28. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  29. package/dist/frontend/lowering/lower-stmts.d.ts +8 -0
  30. package/dist/frontend/lowering/lower-stmts.js +408 -21
  31. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  32. package/dist/frontend/lowering/lowerer.d.ts +38 -0
  33. package/dist/frontend/lowering/lowerer.js +149 -2
  34. package/dist/frontend/lowering/lowerer.js.map +1 -1
  35. package/dist/frontend/lowering/surfaces.js +4 -0
  36. package/dist/frontend/lowering/surfaces.js.map +1 -1
  37. package/dist/index.js +5 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/ir/nodes.d.ts +46 -12
  40. package/dist/ir/nodes.js +41 -0
  41. package/dist/ir/nodes.js.map +1 -1
  42. package/dist/ir/serialize.d.ts +1 -1
  43. package/dist/ir/serialize.js +1 -1
  44. package/dist/ir/validate.js +98 -39
  45. package/dist/ir/validate.js.map +1 -1
  46. package/dist/library/int-infer.js +191 -25
  47. package/dist/library/int-infer.js.map +1 -1
  48. package/dist/library/int-infer.test.js +206 -1
  49. package/dist/library/int-infer.test.js.map +1 -1
  50. package/package.json +2 -2
  51. package/surface-manifest.json +25 -1
@@ -93,20 +93,23 @@ export declare function lowerArrayFlatMapCall(L: Lowerer, call: ts.CallExpressio
93
93
  * any prefix of (acc, element, index, array). Without an initial value an
94
94
  * empty receiver throws Node's exact TypeError at runtime. */
95
95
  export declare function lowerArrayReduceCall(L: Lowerer, call: ts.CallExpression, access: ts.PropertyAccessExpression, method: "reduce" | "reduceRight", elem: IrType): IrExpr;
96
- /** `a.sort(cmp)` — in-place, returns the receiver (JS's `this`), desugared
97
- * to an interned synthetic function like the other array HOFs. The loop
98
- * is a binary-free INSERTION sort: stable (equal-comparing elements keep
99
- * their source order, which is what Node's stable TimSort produces for
100
- * any consistent comparator) and JS-faithful on the comparator contract —
101
- * an element moves left only while cmp(left, v) > 0, so a NaN or 0
102
- * result holds position exactly like the spec's "treat as equal". The
103
- * SEQUENCE of comparator calls differs from V8's TimSort (SEMANTICS.md);
104
- * results are identical for consistent comparators. The comparator-less
105
- * form lowers for STRING elements only — JS's default converts every
106
- * element to string and compares UTF-16 units, which for strings is the
107
- * relational operator the compiler already has (an interned synthesized
108
- * comparator); for numbers that default is the notorious string sort
109
- * ([10, 9, 1] → [1, 10, 9]), deliberately fenced toward an explicit
96
+ /** `a.sort(cmp)` / `a.toSorted(cmp)`, desugared to an interned synthetic
97
+ * function like the other array HOFs. sort mutates and returns the receiver;
98
+ * toSorted takes its shallow snapshot INSIDE the helper, after the receiver
99
+ * and comparator expressions have both been evaluated, then sorts and
100
+ * returns that copy without touching the receiver. The loop is a
101
+ * binary-free INSERTION sort: stable (equal-comparing elements keep their
102
+ * source order, which is what Node's stable TimSort produces for any
103
+ * consistent comparator) and JS-faithful on the comparator contract — an
104
+ * element moves left only while cmp(left, v) > 0, so a NaN or 0 result holds
105
+ * position exactly like the spec's "treat as equal". The SEQUENCE of
106
+ * comparator calls differs from V8's TimSort (SEMANTICS.md); results are
107
+ * identical for consistent comparators. The comparator-less form lowers for
108
+ * STRING elements only — JS's default converts every element to string and
109
+ * compares UTF-16 units, so the interned synthesized comparator selects the
110
+ * runtime's code-unit ordering rather than scriptc's documented code-point
111
+ * relational operators. For numbers that default is the notorious string
112
+ * sort ([10, 9, 1] → [1, 10, 9]), deliberately fenced toward an explicit
110
113
  * comparator. */
111
114
  export declare function lowerArraySortCall(L: Lowerer, call: ts.CallExpression, access: ts.PropertyAccessExpression, elem: IrType, arrT: IrType & {
112
115
  kind: "array";
@@ -274,7 +277,7 @@ export type ForOfIterProjection = "keys" | "values" | "entries";
274
277
  * enter/exit bracketing: the pair list compacts immediately (no
275
278
  * tombstones), so there is no iteration depth to keep exact. */
276
279
  export declare function lowerForOfSearchParams(L: Lowerer, stmt: ts.ForOfStatement, iterable: IrExpr, proj?: ForOfIterProjection): IrStmt;
277
- /** for-of over an ARRAY's keys()/entries() projections consumed directly
280
+ /** for-of over an ARRAY/typed-array keys()/entries() projection consumed directly
278
281
  * by the head (`for (const [index, line] of lines.entries())` — the
279
282
  * dominant formatter idiom): the LIVE index walk — the length re-reads
280
283
  * every pass, exactly the array iterator's contract (elements appended
@@ -287,9 +290,11 @@ export declare function lowerForOfSearchParams(L: Lowerer, stmt: ts.ForOfStateme
287
290
  * [number, T] tuple record. Stored iterator OBJECTS keep their fence
288
291
  * (only the direct for-of position unwraps). */
289
292
  export declare function lowerForOfArrayIter(L: Lowerer, stmt: ts.ForOfStatement, iterable: IrExpr & {
290
- type: IrType & {
293
+ type: (IrType & {
291
294
  kind: "array";
292
- };
295
+ }) | (IrType & {
296
+ kind: "bytes";
297
+ });
293
298
  }, proj: "keys" | "entries"): IrStmt;
294
299
  export declare function lowerForOfMap(L: Lowerer, stmt: ts.ForOfStatement, iterable: IrExpr, mapT: IrType & {
295
300
  kind: "map";