@scriptc/compiler 0.0.0 → 0.0.2

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 (206) hide show
  1. package/LICENSE +202 -0
  2. package/ambient/package.json +3 -0
  3. package/ambient/scriptc-node-fallback.d.ts +3001 -0
  4. package/ambient/scriptc-overrides.d.ts +95 -0
  5. package/ambient/scriptc.d.ts +74 -0
  6. package/dist/backend/cc.d.ts +169 -0
  7. package/dist/backend/cc.js +897 -0
  8. package/dist/backend/cc.js.map +1 -0
  9. package/dist/backend/emission/emit-async.d.ts +145 -0
  10. package/dist/backend/emission/emit-async.js +996 -0
  11. package/dist/backend/emission/emit-async.js.map +1 -0
  12. package/dist/backend/emission/emit-exprs.d.ts +3 -0
  13. package/dist/backend/emission/emit-exprs.js +5949 -0
  14. package/dist/backend/emission/emit-exprs.js.map +1 -0
  15. package/dist/backend/emission/emit-island.d.ts +45 -0
  16. package/dist/backend/emission/emit-island.js +271 -0
  17. package/dist/backend/emission/emit-island.js.map +1 -0
  18. package/dist/backend/emission/emit-shapes.d.ts +142 -0
  19. package/dist/backend/emission/emit-shapes.js +575 -0
  20. package/dist/backend/emission/emit-shapes.js.map +1 -0
  21. package/dist/backend/emission/emit-stmts.d.ts +78 -0
  22. package/dist/backend/emission/emit-stmts.js +960 -0
  23. package/dist/backend/emission/emit-stmts.js.map +1 -0
  24. package/dist/backend/emission/emit-types.d.ts +65 -0
  25. package/dist/backend/emission/emit-types.js +652 -0
  26. package/dist/backend/emission/emit-types.js.map +1 -0
  27. package/dist/backend/emission/emit-walkers.d.ts +154 -0
  28. package/dist/backend/emission/emit-walkers.js +1587 -0
  29. package/dist/backend/emission/emit-walkers.js.map +1 -0
  30. package/dist/backend/emission/emitter.d.ts +452 -0
  31. package/dist/backend/emission/emitter.js +1249 -0
  32. package/dist/backend/emission/emitter.js.map +1 -0
  33. package/dist/backend/emission/may-throw.d.ts +15 -0
  34. package/dist/backend/emission/may-throw.js +250 -0
  35. package/dist/backend/emission/may-throw.js.map +1 -0
  36. package/dist/backend/llvm/blocks.d.ts +21 -0
  37. package/dist/backend/llvm/blocks.js +68 -0
  38. package/dist/backend/llvm/blocks.js.map +1 -0
  39. package/dist/backend/llvm/classes.d.ts +84 -0
  40. package/dist/backend/llvm/classes.js +438 -0
  41. package/dist/backend/llvm/classes.js.map +1 -0
  42. package/dist/backend/llvm/dyn.d.ts +123 -0
  43. package/dist/backend/llvm/dyn.js +2624 -0
  44. package/dist/backend/llvm/dyn.js.map +1 -0
  45. package/dist/backend/llvm/emitter.d.ts +3 -0
  46. package/dist/backend/llvm/emitter.js +10102 -0
  47. package/dist/backend/llvm/emitter.js.map +1 -0
  48. package/dist/backend/llvm/shapes.d.ts +78 -0
  49. package/dist/backend/llvm/shapes.js +754 -0
  50. package/dist/backend/llvm/shapes.js.map +1 -0
  51. package/dist/backend/llvm/unsupported.d.ts +6 -0
  52. package/dist/backend/llvm/unsupported.js +12 -0
  53. package/dist/backend/llvm/unsupported.js.map +1 -0
  54. package/dist/backend/llvm/walkers.d.ts +58 -0
  55. package/dist/backend/llvm/walkers.js +793 -0
  56. package/dist/backend/llvm/walkers.js.map +1 -0
  57. package/dist/backend/mangle.d.ts +124 -0
  58. package/dist/backend/mangle.js +232 -0
  59. package/dist/backend/mangle.js.map +1 -0
  60. package/dist/coverage/report.d.ts +65 -0
  61. package/dist/coverage/report.js +238 -0
  62. package/dist/coverage/report.js.map +1 -0
  63. package/dist/diagnostics/diagnostic.d.ts +140 -0
  64. package/dist/diagnostics/diagnostic.js +458 -0
  65. package/dist/diagnostics/diagnostic.js.map +1 -0
  66. package/dist/diagnostics/render.d.ts +11 -0
  67. package/dist/diagnostics/render.js +58 -0
  68. package/dist/diagnostics/render.js.map +1 -0
  69. package/dist/frontend/cjs-lexer.d.ts +20 -0
  70. package/dist/frontend/cjs-lexer.js +813 -0
  71. package/dist/frontend/cjs-lexer.js.map +1 -0
  72. package/dist/frontend/lowering/http2-constants.d.ts +1 -0
  73. package/dist/frontend/lowering/http2-constants.js +251 -0
  74. package/dist/frontend/lowering/http2-constants.js.map +1 -0
  75. package/dist/frontend/lowering/lib-boundary.d.ts +6 -0
  76. package/dist/frontend/lowering/lib-boundary.js +143 -0
  77. package/dist/frontend/lowering/lib-boundary.js.map +1 -0
  78. package/dist/frontend/lowering/lower-assert.d.ts +18 -0
  79. package/dist/frontend/lowering/lower-assert.js +1269 -0
  80. package/dist/frontend/lowering/lower-assert.js.map +1 -0
  81. package/dist/frontend/lowering/lower-builtins.d.ts +511 -0
  82. package/dist/frontend/lowering/lower-builtins.js +5249 -0
  83. package/dist/frontend/lowering/lower-builtins.js.map +1 -0
  84. package/dist/frontend/lowering/lower-calls.d.ts +581 -0
  85. package/dist/frontend/lowering/lower-calls.js +6286 -0
  86. package/dist/frontend/lowering/lower-calls.js.map +1 -0
  87. package/dist/frontend/lowering/lower-classes.d.ts +727 -0
  88. package/dist/frontend/lowering/lower-classes.js +4701 -0
  89. package/dist/frontend/lowering/lower-classes.js.map +1 -0
  90. package/dist/frontend/lowering/lower-comptime.d.ts +53 -0
  91. package/dist/frontend/lowering/lower-comptime.js +244 -0
  92. package/dist/frontend/lowering/lower-comptime.js.map +1 -0
  93. package/dist/frontend/lowering/lower-containers.d.ts +486 -0
  94. package/dist/frontend/lowering/lower-containers.js +6345 -0
  95. package/dist/frontend/lowering/lower-containers.js.map +1 -0
  96. package/dist/frontend/lowering/lower-dgram.d.ts +20 -0
  97. package/dist/frontend/lowering/lower-dgram.js +319 -0
  98. package/dist/frontend/lowering/lower-dgram.js.map +1 -0
  99. package/dist/frontend/lowering/lower-emitter.d.ts +10 -0
  100. package/dist/frontend/lowering/lower-emitter.js +688 -0
  101. package/dist/frontend/lowering/lower-emitter.js.map +1 -0
  102. package/dist/frontend/lowering/lower-enums.d.ts +22 -0
  103. package/dist/frontend/lowering/lower-enums.js +235 -0
  104. package/dist/frontend/lowering/lower-enums.js.map +1 -0
  105. package/dist/frontend/lowering/lower-expando.d.ts +35 -0
  106. package/dist/frontend/lowering/lower-expando.js +276 -0
  107. package/dist/frontend/lowering/lower-expando.js.map +1 -0
  108. package/dist/frontend/lowering/lower-exprs.d.ts +524 -0
  109. package/dist/frontend/lowering/lower-exprs.js +8111 -0
  110. package/dist/frontend/lowering/lower-exprs.js.map +1 -0
  111. package/dist/frontend/lowering/lower-generators.d.ts +50 -0
  112. package/dist/frontend/lowering/lower-generators.js +421 -0
  113. package/dist/frontend/lowering/lower-generators.js.map +1 -0
  114. package/dist/frontend/lowering/lower-inspect.d.ts +20 -0
  115. package/dist/frontend/lowering/lower-inspect.js +1074 -0
  116. package/dist/frontend/lowering/lower-inspect.js.map +1 -0
  117. package/dist/frontend/lowering/lower-island.d.ts +108 -0
  118. package/dist/frontend/lowering/lower-island.js +650 -0
  119. package/dist/frontend/lowering/lower-island.js.map +1 -0
  120. package/dist/frontend/lowering/lower-mixins.d.ts +96 -0
  121. package/dist/frontend/lowering/lower-mixins.js +534 -0
  122. package/dist/frontend/lowering/lower-mixins.js.map +1 -0
  123. package/dist/frontend/lowering/lower-modules.d.ts +135 -0
  124. package/dist/frontend/lowering/lower-modules.js +1613 -0
  125. package/dist/frontend/lowering/lower-modules.js.map +1 -0
  126. package/dist/frontend/lowering/lower-namespaces.d.ts +168 -0
  127. package/dist/frontend/lowering/lower-namespaces.js +706 -0
  128. package/dist/frontend/lowering/lower-namespaces.js.map +1 -0
  129. package/dist/frontend/lowering/lower-server.d.ts +90 -0
  130. package/dist/frontend/lowering/lower-server.js +3471 -0
  131. package/dist/frontend/lowering/lower-server.js.map +1 -0
  132. package/dist/frontend/lowering/lower-stmts.d.ts +361 -0
  133. package/dist/frontend/lowering/lower-stmts.js +5341 -0
  134. package/dist/frontend/lowering/lower-stmts.js.map +1 -0
  135. package/dist/frontend/lowering/lower-stream.d.ts +88 -0
  136. package/dist/frontend/lowering/lower-stream.js +1533 -0
  137. package/dist/frontend/lowering/lower-stream.js.map +1 -0
  138. package/dist/frontend/lowering/lower-test.d.ts +27 -0
  139. package/dist/frontend/lowering/lower-test.js +353 -0
  140. package/dist/frontend/lowering/lower-test.js.map +1 -0
  141. package/dist/frontend/lowering/lowerer.d.ts +1748 -0
  142. package/dist/frontend/lowering/lowerer.js +6257 -0
  143. package/dist/frontend/lowering/lowerer.js.map +1 -0
  144. package/dist/frontend/lowering/surfaces.d.ts +272 -0
  145. package/dist/frontend/lowering/surfaces.js +1096 -0
  146. package/dist/frontend/lowering/surfaces.js.map +1 -0
  147. package/dist/frontend/npm-static.d.ts +55 -0
  148. package/dist/frontend/npm-static.js +300 -0
  149. package/dist/frontend/npm-static.js.map +1 -0
  150. package/dist/frontend/npm.d.ts +330 -0
  151. package/dist/frontend/npm.js +1259 -0
  152. package/dist/frontend/npm.js.map +1 -0
  153. package/dist/frontend/program.d.ts +186 -0
  154. package/dist/frontend/program.js +2255 -0
  155. package/dist/frontend/program.js.map +1 -0
  156. package/dist/frontend/provenance-registry.d.ts +48 -0
  157. package/dist/frontend/provenance-registry.js +87 -0
  158. package/dist/frontend/provenance-registry.js.map +1 -0
  159. package/dist/frontend/provenance.d.ts +6 -0
  160. package/dist/frontend/provenance.js +459 -0
  161. package/dist/frontend/provenance.js.map +1 -0
  162. package/dist/frontend/resolve.d.ts +56 -0
  163. package/dist/frontend/resolve.js +682 -0
  164. package/dist/frontend/resolve.js.map +1 -0
  165. package/dist/frontend/shared.d.ts +67 -0
  166. package/dist/frontend/shared.js +241 -0
  167. package/dist/frontend/shared.js.map +1 -0
  168. package/dist/frontend/ts7/adapter.d.ts +7 -0
  169. package/dist/frontend/ts7/adapter.js +54 -0
  170. package/dist/frontend/ts7/adapter.js.map +1 -0
  171. package/dist/frontend/ts7/ast.d.ts +50 -0
  172. package/dist/frontend/ts7/ast.js +211 -0
  173. package/dist/frontend/ts7/ast.js.map +1 -0
  174. package/dist/frontend/ts7/census-check.d.ts +1 -0
  175. package/dist/frontend/ts7/census-check.js +12 -0
  176. package/dist/frontend/ts7/census-check.js.map +1 -0
  177. package/dist/frontend/ts7/checker.d.ts +140 -0
  178. package/dist/frontend/ts7/checker.js +544 -0
  179. package/dist/frontend/ts7/checker.js.map +1 -0
  180. package/dist/frontend/ts7/enums.d.ts +18 -0
  181. package/dist/frontend/ts7/enums.js +43 -0
  182. package/dist/frontend/ts7/enums.js.map +1 -0
  183. package/dist/frontend/ts7/program.d.ts +99 -0
  184. package/dist/frontend/ts7/program.js +278 -0
  185. package/dist/frontend/ts7/program.js.map +1 -0
  186. package/dist/frontend/ts7/world-check.d.ts +3 -0
  187. package/dist/frontend/ts7/world-check.js +34 -0
  188. package/dist/frontend/ts7/world-check.js.map +1 -0
  189. package/dist/frontend/types.d.ts +205 -0
  190. package/dist/frontend/types.js +2485 -0
  191. package/dist/frontend/types.js.map +1 -0
  192. package/dist/index.d.ts +85 -0
  193. package/dist/index.js +429 -0
  194. package/dist/index.js.map +1 -0
  195. package/dist/ir/nodes.d.ts +4334 -0
  196. package/dist/ir/nodes.js +1906 -0
  197. package/dist/ir/nodes.js.map +1 -0
  198. package/dist/ir/serialize.d.ts +4 -0
  199. package/dist/ir/serialize.js +34 -0
  200. package/dist/ir/serialize.js.map +1 -0
  201. package/dist/ir/validate.d.ts +36 -0
  202. package/dist/ir/validate.js +4885 -0
  203. package/dist/ir/validate.js.map +1 -0
  204. package/package.json +30 -6
  205. package/README.md +0 -3
  206. package/index.js +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lower-expando.js","sourceRoot":"","sources":["../../../src/frontend/lowering/lower-expando.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0DA+B0D;AAC1D,OAAO,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAc9D;;;gDAGgD;AAChD,MAAM,mBAAm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EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;AACrG,CAAC;AAED;yEACyE;AACzE,MAAM,UAAU,sBAAsB,CAAC,CAAU,EAAE,IAAyB;IAC1E,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IACvE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACvB,IAAI,CAAC,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7F,MAAM,MAAM,GAAG,qBAAqB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,MAAM,KAAK,GAAG,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;AACzE,CAAC"}
@@ -0,0 +1,524 @@
1
+ import * as ts from "../ts7/adapter.js";
2
+ import type { Lowerer } from "./lowerer.js";
3
+ import { IrExpr, IrLocal, IrRecordShape, IrStmt, IrType, SrcLoc } from "../../ir/nodes.js";
4
+ import { CompoundOp } from "./surfaces.js";
5
+ /** An assignable `obj.field` target — a class field, a record field, or a
6
+ * class ACCESSOR property (reads become getter calls, writes setter calls;
7
+ * fieldType is the property's one type). */
8
+ export type FieldTarget = {
9
+ container: "class";
10
+ obj: IrExpr;
11
+ className: string;
12
+ field: string;
13
+ fieldType: IrType;
14
+ } | {
15
+ container: "record";
16
+ obj: IrExpr;
17
+ shapeId: string;
18
+ field: string;
19
+ fieldType: IrType;
20
+ } | {
21
+ container: "recordOvf";
22
+ obj: IrExpr;
23
+ shapeId: string;
24
+ field: string;
25
+ fieldType: IrType;
26
+ } | {
27
+ container: "accessor";
28
+ obj: IrExpr;
29
+ className: string;
30
+ field: string;
31
+ fieldType: IrType;
32
+ } | {
33
+ container: "recordAccessor";
34
+ obj: IrExpr;
35
+ shapeId: string;
36
+ field: string;
37
+ fieldType: IrType;
38
+ getType?: IrType & {
39
+ kind: "func";
40
+ };
41
+ setType?: IrType & {
42
+ kind: "func";
43
+ };
44
+ };
45
+ /** A template piece's RAW text (String.raw's contract: escapes stay
46
+ * characters). 7's client AST ships no rawText at runtime (the typing
47
+ * declares it; the serialized node data omits it), so the raw span comes
48
+ * off the SOURCE: between the piece's delimiters — backticks for the
49
+ * no-substitution form, `\`...${` / `}...${` / `}...\`` for head/middle/
50
+ * tail. 5.9.3's rawText, when a build ever supplies it, wins unchanged. */
51
+ export declare function templateRawTextOf(node: ts.NoSubstitutionTemplateLiteral | ts.TemplateHead | ts.TemplateMiddle | ts.TemplateTail): string;
52
+ /** True when a property access names an ABSTRACT property declaration
53
+ * (`abstract p: number` — a PropertyDeclaration, not an accessor): the
54
+ * named-fence test for reads/writes through abstract-typed receivers. */
55
+ export declare function abstractPropertyDeclOf(L: Lowerer, expr: ts.PropertyAccessExpression): boolean;
56
+ export declare function lowerExpr(L: Lowerer, expr: ts.Expression): IrExpr;
57
+ /** `c ? a : b` — see the inline comments. `expected` plays the contextual
58
+ * array type's role when the caller knows the slot's array type and tsc's
59
+ * API doesn't surface it (a ternary as a SPREAD source — lowerArrayLiteral
60
+ * threads the literal's own type in). */
61
+ export declare function lowerTernary(L: Lowerer, expr: ts.ConditionalExpression, expected?: IrType & {
62
+ kind: "array";
63
+ }): IrExpr;
64
+ /** Checker-driven union narrowing. tsc's control-flow analysis narrows a
65
+ * union-typed reference at use sites (`if (r.kind === "ok") { ...r... }`
66
+ * types `r` as the ok-arm inside the branch); the IR value is still the
67
+ * tagged union, so the read is bridged with a `unionNarrow` extracting
68
+ * the arm's payload. The extraction is tag-UNCHECKED at runtime —
69
+ * soundness rests entirely on tsc having proven the tag (the project's
70
+ * trust-the-checker thesis; see docs/ir.md). A checker type that maps to
71
+ * the same union (unnarrowed use), to a SUB-union (partial narrowing —
72
+ * unrepresentable without a re-tag), or to nothing (`never` in an
73
+ * exhaustive default) leaves the expression union-typed. */
74
+ export declare function maybeNarrow(L: Lowerer, expr: IrExpr, node: ts.Node): IrExpr;
75
+ /** `v === undefined` / `v !== null` — the narrowing tests for unit-armed
76
+ * unions. A union operand compared with a unit literal lowers to a
77
+ * runtime TAG test (unionIsTag); afterwards tsc's control-flow narrowing
78
+ * types the branches and reads bridge through maybeNarrow as usual. When
79
+ * the checker already narrowed the non-literal side PAST the union
80
+ * (`w = 5; if (w !== null)`), the comparison is statically decided and
81
+ * folds to a bool literal — that drops only a side-effect-free read
82
+ * (flow narrowing applies to references, never to calls), and soundness
83
+ * is the same trust-the-checker bet unionNarrow already makes. Null when
84
+ * neither side is a unit literal (not a unit comparison). */
85
+ export declare function lowerUnitComparison(L: Lowerer, left: IrExpr, right: IrExpr, negated: boolean, loc: SrcLoc): IrExpr | null;
86
+ /** `x == null` / `x != null` — JS's idiomatic null-OR-undefined test, the
87
+ * ONE loose comparison with static semantics: `== null` matches exactly
88
+ * null and undefined (0, "", and false do not). Requires a syntactic
89
+ * null LITERAL on either side; the other operand's unit arms become a
90
+ * runtime tag test — one `unionIsTag` when the union has a single unit
91
+ * arm, a short-circuit pair over both tags otherwise (that shape re-emits
92
+ * the operand, so only side-effect-free reads compose; anything else
93
+ * keeps the fence). A unit-literal operand folds (null and undefined are
94
+ * mutually loose-equal), and a non-nullable operand folds statically —
95
+ * the same trust-the-checker bet as lowerUnitComparison. Null (fence)
96
+ * when this isn't a null-literal comparison or the operand has no
97
+ * lowering here (dyn/jsval/void). */
98
+ export declare function lowerLooseNullCompare(L: Lowerer, expr: ts.BinaryExpression, loc: SrcLoc): IrExpr | null;
99
+ /** Safe to EMIT twice: plain reads with no side effects — local/global
100
+ * reads and record/class field reads over such (accessor properties
101
+ * lower to getter CALLS, so they never appear as field reads). Used by
102
+ * the two-unit-arm `== null` composition, the union `typeof` forms, and
103
+ * the union-switch desugar, whose operands ride several tests. */
104
+ /** A static expression whose evaluation is unobservable — safe to DROP
105
+ * (typeof's constant fold: JS evaluates the operand, but when nothing in
106
+ * it can throw, call, write, or allocate observably, folding it away
107
+ * changes nothing). Strictly wider than pureReemittable: numeric
108
+ * arithmetic (f64 ops never throw — division by zero is Infinity),
109
+ * string concatenation, logical/ternary composition, and unit/literal
110
+ * leaves compose; anything with a call, an island op, an index read (can
111
+ * trap), or an unknown kind answers false. */
112
+ export declare function droppableStatic(e: IrExpr): boolean;
113
+ export declare function pureReemittable(e: IrExpr): boolean;
114
+ /** `a ?? b` — JS-exact nullish coalescing: ONLY null/undefined take the
115
+ * default (0, "", and false do not), and the right side evaluates lazily.
116
+ * On a unit-armed union left this is the `nullish` node (a runtime tag
117
+ * test against the unit arms, docs/ir.md); the two lowered shapes follow
118
+ * the checker's result type — pass-through (`(s: string | undefined) ??
119
+ * t` with t also `string | undefined`) and narrowed (`s ?? "d"` → plain
120
+ * string, the single non-unit arm). A left the checker types non-nullish
121
+ * never takes the right side, so the whole expression folds to the left
122
+ * value — dropping only the never-evaluated default, the same
123
+ * trust-the-checker bet as lowerUnitComparison's static fold. Sub-union
124
+ * results (several non-unit arms) and defaults that change the result
125
+ * type are fenced with narrow-first hints. */
126
+ export declare function lowerNullishCoalesce(L: Lowerer, expr: ts.BinaryExpression, loc: SrcLoc): IrExpr;
127
+ /** One optional-chain STEP: `a?.b`, `a?.m(...)`, `a?.[i]` (the token on
128
+ * the member access) and `f?.()` (the token on the call). The receiver
129
+ * lowers once; when it is a unit-armed union with ONE non-unit arm, the
130
+ * member/call lowers exactly as its non-optional spelling would — the
131
+ * receiver node reads back as the chain's bound narrowed value
132
+ * (chainRecv) and types as its non-nullish type — and the whole thing
133
+ * becomes an optChain node: tag test, undefined on the unit path (JS:
134
+ * null receivers still yield undefined), the body lazily otherwise,
135
+ * argument side effects included. A receiver the checker types
136
+ * never-nullish makes `?.` behave exactly like `.` — the guard folds
137
+ * away and the plain lowering is the value (trust-the-checker, like
138
+ * ??'s fold). Multi-step TAILS (`a?.b.c`, `x?.trim().toLowerCase()`)
139
+ * short-circuit whole: the guarded member step is the chain's dot and
140
+ * every later step lowers inside the guard, checker-narrowed non-nullish
141
+ * (see chainTailDot); sub-union receivers are fenced with rewrite
142
+ * hints. */
143
+ /** The unhandled `?.`-carrying MEMBER step in this node's receiver
144
+ * spine, when the node is the TAIL of an optional chain whose token sits
145
+ * deeper — `x?.trim().toLowerCase()` reads nothing past the guard when x
146
+ * is nullish, so the whole tail must lower inside it. Walks
147
+ * property/element accesses and call steps only (parens and `!` break
148
+ * the chain per the grammar: `(a?.b).c` throws on undefined in JS);
149
+ * the node's OWN token — and a call's immediate callee token — are the
150
+ * plain entries' cases, not tails, and handled markers make the chain
151
+ * lowering's re-dispatch walk past its own step. `f?.()` steps stay out
152
+ * (a call carrying the token has no member step to re-enter — the
153
+ * split-it fence keeps them). */
154
+ export declare function chainTailDot(L: Lowerer, expr: ts.Expression): ts.PropertyAccessExpression | ts.ElementAccessExpression | null;
155
+ /** True when `expr` is `require.main.filename` (either dot optional) on
156
+ * the AMBIENT CommonJS require — the entry-module identity read. The
157
+ * value is the ENTRY file's path, a compile-time constant like
158
+ * __filename; ESM files stay out (Node never defines require there —
159
+ * the ambient symbol would not resolve anyway). Shared by the property
160
+ * lowering (the fold) and lowerStringMethodCall's receiver gate (the
161
+ * checker types the chain `string | undefined`, but the folded receiver
162
+ * IS a string). */
163
+ export declare function isRequireMainFilename(L: Lowerer, expr: ts.Expression): boolean;
164
+ /** True when `expr` is the tail of an optional chain the STATIC chain
165
+ * machinery should short-circuit whole: an unhandled deeper `?.` whose
166
+ * guarded receiver lowers as a unit-armed union. Dyn ('unknown') and
167
+ * island ('any') receivers answer their tails through their own
168
+ * undefined-propagating reads and stay out; never-nullish receivers fold
169
+ * at the token's own entry. */
170
+ export declare function chainTailClaimed(L: Lowerer, expr: ts.Expression): boolean;
171
+ /** True when an EARLIER step of this access chain carries `?.` — JS
172
+ * short-circuits the whole tail (`a?.b.c` reads nothing when a is
173
+ * nullish), so a dyn tail read must answer undefined instead of
174
+ * throwing. Walks the receiver spine only; the argument of the access
175
+ * itself is not part of the guard. */
176
+ export declare function chainGuardedByQuestionDot(expr: ts.Expression): boolean;
177
+ export declare function lowerOptionalChain(L: Lowerer, expr: ts.CallExpression | ts.PropertyAccessExpression | ts.ElementAccessExpression): IrExpr;
178
+ /** The optChain node around a lowered chain body: void bodies keep the
179
+ * statement form (`cb?.();` — the checker's `void | undefined` result IS
180
+ * void here); value bodies wrap into the checker's undefined-armed
181
+ * result union. */
182
+ export declare function finishOptionalChain(L: Lowerer, expr: ts.Expression, id: string, receiver: IrExpr, body: IrExpr, loc: SrcLoc): IrExpr;
183
+ /** A CONDITION-position expression: the result is consumed as a bool
184
+ * only, so `&&`/`||` descend recursively over ToBoolean'd operands —
185
+ * JS-exact (`ToBoolean(a && b)` ≡ `ToBoolean(a) && ToBoolean(b)`), still
186
+ * short-circuiting, and mixed operand kinds that have no VALUE
187
+ * representation (`u && flag` — a union and a bool) test fine here. */
188
+ export declare function lowerCondition(L: Lowerer, expr: ts.Expression): IrExpr;
189
+ /** JS ToBoolean: bool passes through; f64/string get a `toBool` wrapper
190
+ * (falsy: 0, -0, NaN, ""); unions get the same wrapper answered by a
191
+ * per-union interned helper (unit arms falsy; scalar/string arms by
192
+ * value; ref arms always truthy). Anything else (void) cannot be
193
+ * tested. */
194
+ export declare function ensureBool(L: Lowerer, e: IrExpr, node: ts.Expression): IrExpr;
195
+ /** Truthiness needs a ToBoolean per arm: dyn/caught arms have none (a
196
+ * dynamic ToBoolean over the DOM / the snapshot box) — fence those
197
+ * unions; every other arm kind is answerable (units false, scalars and
198
+ * strings by value, refs true, jsval by the engine). */
199
+ export declare function requireTruthyUnion(L: Lowerer, unionId: string, node: ts.Expression): void;
200
+ /** Strict equality needs a per-arm comparison: units, scalars, strings,
201
+ * and ref kinds (pointer identity) all have one; dyn/caught arms have no
202
+ * static equality and jsval arms would need the engine's `===` — those
203
+ * unions keep the narrow-first fence. */
204
+ export declare function eqComparableUnion(L: Lowerer, unionId: string): boolean;
205
+ /** Property access on a string or array receiver: `.length` lowers to the
206
+ * matching intrinsic; a bare method reference (`const f = s.slice` — a
207
+ * function value) is rejected with a specific message. Returns null for
208
+ * other receivers (the generic property-access rejection applies). Both
209
+ * the receiver type AND the ambient-file provenance of the member are
210
+ * verified — the name alone proves nothing. */
211
+ export declare function lowerIntrinsicProperty(L: Lowerer, expr: ts.PropertyAccessExpression): IrExpr | null;
212
+ /** `[a, b, c]`. The element type comes from the contextual type when tsc
213
+ * has one (`const a: number[] = []`, arguments, nested literals) and from
214
+ * the literal's own inferred type otherwise. A bare `[]` with no context
215
+ * is `never[]` — unmappable, rejected with SC2001. `expected` overrides
216
+ * the contextual lookup where the caller knows the slot's array type and
217
+ * tsc's API doesn't surface it (ternary arms under an array context —
218
+ * tsc accepts the arm covariantly, but a tagged element representation
219
+ * must be BUILT as the slot's element type). */
220
+ export declare function lowerArrayLiteral(L: Lowerer, expr: ts.ArrayLiteralExpression, expected?: IrType & {
221
+ kind: "array";
222
+ }): IrExpr;
223
+ export declare function foldedStringKeyOf(L: Lowerer, expr: ts.Expression): string | null;
224
+ export declare function lowerObjectLiteral(L: Lowerer, expr: ts.ObjectLiteralExpression): IrExpr;
225
+ /** A conditional spread's carrier property: `name: value` or shorthand,
226
+ * with an identifier/string-literal name. */
227
+ export type CondSpreadProp = (ts.PropertyAssignment | ts.ShorthandPropertyAssignment) & {
228
+ name: ts.Identifier | ts.StringLiteral;
229
+ };
230
+ /** Parses the conditional-spread idiom `...(c ? { k: v, ... } : {})`
231
+ * (either orientation). Returns the condition, the non-empty arm's
232
+ * properties, and which arm carries them; "unsupported" for conditional
233
+ * sources OUTSIDE the idiom (both arms non-empty, computed/method
234
+ * members); null when the spread source isn't a conditional at all.
235
+ * Callers slice their own honest subset (the static record path takes
236
+ * exactly one property; the island literal takes any number; spawn's
237
+ * options walk takes a `detached` boolean literal). */
238
+ export declare function conditionalSpreadOf(expr: ts.Expression): {
239
+ cond: ts.Expression;
240
+ props: CondSpreadProp[];
241
+ whenTrue: boolean;
242
+ } | "unsupported" | null;
243
+ /** The value of a shorthand property (`{ x }`): the binding `x` refers to.
244
+ * The property name's own symbol is the PROPERTY, so resolution goes
245
+ * through getShorthandAssignmentValueSymbol. */
246
+ export declare function lowerShorthandValue(L: Lowerer, prop: ts.ShorthandPropertyAssignment): IrExpr;
247
+ /** Rejects any `this` inside an object-literal method body — including in
248
+ * nested arrows, which inherit the method's `this` (nested function
249
+ * expressions reset it, but their bare `this` is already a tsc error
250
+ * under noImplicitThis, so over-rejecting them here changes nothing). */
251
+ export declare function rejectThisInObjectMethod(L: Lowerer, node: ts.Node): void;
252
+ /** The accessor twin of rejectThisInObjectMethod: a get/set accessor body
253
+ * referencing `this` (`get x() { return this._x }`). The accessor lowers
254
+ * as a closure stored IN the record — passing the record as a receiver
255
+ * would capture the value under construction (an RC cycle), and the
256
+ * generic lexical-this walk would silently bind an ENCLOSING method's
257
+ * `this`; the fence names the fix (capture a binding instead). */
258
+ export declare function rejectThisInObjectAccessor(L: Lowerer, node: ts.Node): void;
259
+ /** `a[i]` reads. Only f64 indices into array receivers are modeled; JS
260
+ * string-key element access (`a["length"]`) and string indexing (`s[0]`
261
+ * typechecks against the lib's index signature; use .charAt) stay out. */
262
+ export declare function lowerElementAccess(L: Lowerer, expr: ts.ElementAccessExpression): IrExpr;
263
+ /** `r[k]` over a (non-tuple) record shape. A LITERAL key naming a declared
264
+ * field is the bracket spelling of field access (the ONLY spelling tsc
265
+ * permits for signature-declared fields under
266
+ * noPropertyAccessFromIndexSignature) — an ordinary recordGet. Everything
267
+ * else is a runtime-keyed read (recordKeyGet): declared fields answer
268
+ * first via an emitted string-switch, index-signature shapes fall through
269
+ * to the overflow map. The result type is the CHECKER's for the access —
270
+ * the index signature's value type (dyn for `unknown`), or its
271
+ * undefined-armed union under noUncheckedIndexedAccess. Every declared
272
+ * field must be able to SURFACE as that type (equal, an arm of it, or —
273
+ * for dyn results — JSON-safe for the DOM conversion); shapes mixing in
274
+ * fields outside that stay fenced. Declared-only shapes support reads
275
+ * whose key type proves membership (tsc's keyof check): all fields must
276
+ * share the result type, and a smuggled miss traps. */
277
+ export declare function lowerRecordKeyRead(L: Lowerer, expr: ts.ElementAccessExpression, shapeId: string, shape: IrRecordShape): IrExpr;
278
+ /** The compile-time string spelling of a record key literal: a string
279
+ * literal's text, or a NON-NEGATIVE numeric literal's canonical JS
280
+ * spelling (`1` → "1", `1e21` → "1e+21" — String(Number(text)), which is
281
+ * exactly the key JS derives; negative/computed keys stay runtime
282
+ * expressions and canonicalize through ensureString instead). Null for
283
+ * everything else. */
284
+ export declare function recordKeyLiteralText(node: ts.Expression): string | null;
285
+ /** `a[i] = v` in statement position → arraySet (element writes, like local
286
+ * assignment, produce no value in our subset). */
287
+ export declare function lowerElementWrite(L: Lowerer, expr: ts.BinaryExpression): IrStmt;
288
+ export declare function ensureString(L: Lowerer, e: IrExpr, node: ts.Node): IrExpr;
289
+ export declare function lowerTemplate(L: Lowerer, expr: ts.TemplateExpression): IrExpr;
290
+ /** `x as T`. Non-dyn inner values keep today's pure-erasure semantics.
291
+ * A dyn ('unknown') inner value makes this THE dynamic boundary:
292
+ * - `as unknown` (dyn → dyn) stays erasure;
293
+ * - dyn → a JSON-representable target type T compiles to `dynCheck`, a
294
+ * runtime validation that builds the typed value or THROWS a catchable
295
+ * TypeError-flavored error (JS `as` never checks — the headline
296
+ * documented divergence: a lying cast throws instead of corrupting
297
+ * memory);
298
+ * - dyn → anything else (closures, class instances, void) is rejected:
299
+ * those types cannot be found inside a JSON DOM. */
300
+ /** `e as T` and the old-style assertion `<T>e` — one node shape (both
301
+ * carry `.type` and `.expression`), one lowering. */
302
+ export declare function lowerAsExpression(L: Lowerer, expr: ts.AsExpression | ts.TypeAssertion): IrExpr;
303
+ export declare function lowerPrefixUnary(L: Lowerer, expr: ts.PrefixUnaryExpression): IrExpr;
304
+ /** `x++`/`x--`/`++x`/`--x` in EXPRESSION position — the incDec node:
305
+ * read, write ±1, yield old (postfix) or new (prefix) value. Receivers
306
+ * are f64 LOCALS or module globals (captured/boxed included — the
307
+ * backend reads/writes through the box); record fields and array
308
+ * elements keep the fence in value position (statement-position `obj.f++`
309
+ * still desugars through the compound-field path). */
310
+ export declare function lowerIncDec(L: Lowerer, expr: ts.PrefixUnaryExpression | ts.PostfixUnaryExpression, prefix: boolean): IrExpr;
311
+ export declare function lowerBinary(L: Lowerer, expr: ts.BinaryExpression): IrExpr;
312
+ export declare function lowerCaughtTypeofTest(L: Lowerer, expr: ts.BinaryExpression, loc: SrcLoc): IrExpr | null;
313
+ /** ALIASED-TYPEOF narrowing (npm-static JS): the narrows a condition
314
+ * PROVES about typeof-aliased operands when it evaluates to `polarity` —
315
+ * ms's `var type = typeof val; if (type === 'string' && val.length > 0)`
316
+ * shape, which tsc narrows only for CONST aliases. The walk follows the
317
+ * checker's own condition structure: parens, `!`, `&&` under true, `||`
318
+ * under false, and ===/!== leaves against string literals. A leaf
319
+ * qualifies when the alias is a never-reassigned var/let/const local
320
+ * initialized `typeof <param>`, the operand is a never-written
321
+ * identifier PARAMETER of a function containing the test (so `typeof
322
+ * val` is a post-entry constant and the alias can never be stale — the
323
+ * condition itself still lowers as the plain string comparison), the
324
+ * operand's type maps to a union whose arms all have static typeof
325
+ * answers, and EXACTLY ONE arm answers the literal. The result feeds
326
+ * L.narrowingAliases: branch-scoped typeOf overrides, bridged by
327
+ * maybeNarrow's ordinary unionNarrow. */
328
+ export declare function aliasTypeofNarrows(L: Lowerer, cond: ts.Expression, polarity: boolean): {
329
+ sym: ts.Symbol;
330
+ tsArm: ts.Type;
331
+ }[];
332
+ /** `typeof v === "lit"` / `typeof v !== "lit"` where v is UNION-typed: the
333
+ * arms whose static typeof answer equals the literal form a tag set, and
334
+ * the test is a runtime tag test — one `unionIsTag` for a single matching
335
+ * arm (the operand embeds once, so even effectful operands compose), a
336
+ * short-circuit chain for several (pure reads only — the operand rides
337
+ * every test, exactly the `== null` composition rule). When every arm
338
+ * answers the same way the comparison is statically decided and folds to
339
+ * a bool literal — dropping only a side-effect-free read, the same
340
+ * trust-the-checker bet as lowerUnitComparison. tsc's control-flow
341
+ * narrowing then types the branches, and reads bridge through
342
+ * maybeNarrow's unionNarrow as usual. Null when neither side is a typeof
343
+ * over a union-typed operand or the literal side isn't a literal (the
344
+ * bare-typeof value form then composes with strEq for pure operands). */
345
+ export declare function lowerUnionTypeofTest(L: Lowerer, expr: ts.BinaryExpression, loc: SrcLoc): IrExpr | null;
346
+ /** `typeof v === "lit"` / `typeof v !== "lit"` where v is `unknown`-typed
347
+ * (dyn): the runtime kind test over the DOM node's tag. Only the kinds a
348
+ * later read can bridge narrow ("string"/"number"/"boolean") plus
349
+ * "undefined" (no payload to read); "object"/"function" tests keep the
350
+ * fence — an object-narrowed `unknown` read has no lowering anyway (a
351
+ * checked cast `v as T` is the supported extraction). Null when neither
352
+ * side is a typeof over a dyn-typed operand (not this pattern). */
353
+ export declare function lowerDynTypeofTest(L: Lowerer, expr: ts.BinaryExpression, loc: SrcLoc): IrExpr | null;
354
+ /** `exports.<name>` in a JS module whose `module.exports =` REPLACED the
355
+ * export object, with no `exports.<name> =` attachment anywhere in the
356
+ * file: the read observes the ORIGINAL (empty-here) exports object, so
357
+ * the honest value is undefined (Node's object identity exactly; tsc's
358
+ * CJS model types the read off the replacement — identity-blind). Null
359
+ * everywhere else: no replacement, a real attachment of this name, a
360
+ * shadowing binding named `exports`, or write position. */
361
+ export declare function lowerReplacedExportsRead(L: Lowerer, expr: ts.PropertyAccessExpression): IrExpr | null;
362
+ /** A read that resolves to a CJS export-table ACCESSOR property
363
+ * (`module.exports = { get path() {...}, set path(v) {...} }`): the
364
+ * getter lifts as a module-level function (module globals need no
365
+ * captures) — interned per declaration so every read site calls ONE
366
+ * function — and the read IS the call, Node's per-read evaluation
367
+ * exactly. Null when the identifier doesn't resolve to such a property
368
+ * (or it has no getter: a setter-only read answers undefined in Node —
369
+ * rare enough to keep fenced). */
370
+ export declare function cjsExportAccessorRead(L: Lowerer, ident: ts.Identifier): IrExpr | null;
371
+ /** `this.<name>` INSIDE a CJS export-table accessor (test/common's
372
+ * `get localhostIPv4() { if (this.inFreeBSDJail) ... }`): Node binds the
373
+ * getter's receiver to module.exports, so the read is the SIBLING table
374
+ * property — a sibling GETTER's lifted call (per-read evaluation, like
375
+ * any accessor read). Only arrows inherit the binding (a nested function
376
+ * expression's `this` is its own). Null everywhere else — non-getter
377
+ * siblings and absent names keep their per-site fences (none of the
378
+ * probed suite shapes read them). */
379
+ export declare function lowerCjsExportTableThisMember(L: Lowerer, expr: ts.PropertyAccessExpression): IrExpr | null;
380
+ /** Lowers an expression, converting a fence (PoisonError) into a null
381
+ * DECLINE — the probing dispatch for shapes where only the lowered
382
+ * value's type can say whether a lowering applies. unsupported() pushes
383
+ * its diagnostic BEFORE throwing, so the probe runs behind a diagnostic
384
+ * sink: a declined probe's diagnostics vanish (the sibling lowerings
385
+ * own the site), a successful probe's flush through afterwards. */
386
+ export declare function probeLower(L: Lowerer, node: ts.Expression): IrExpr | null;
387
+ /** A read of a catch binding — the caught analog of maybeNarrow. Where
388
+ * tsc's control-flow narrowing has proven a supported test (`instanceof`
389
+ * over a hierarchy class, `typeof` over a primitive), the read bridges
390
+ * with a kind-unchecked `caughtNarrow` extraction (trust-the-checker,
391
+ * exactly like unionNarrow). Every OTHER read is the narrowness fence:
392
+ * the binding's payload is a typed exception snapshot, not a dyn DOM, so
393
+ * un-narrowed uses have nothing sound to lower to. */
394
+ export declare function caughtRead(L: Lowerer, node: ts.Identifier, local: IrLocal, loc: SrcLoc): IrExpr;
395
+ /** `String(e)` / `${e}` where e is a catch binding: JS's String() over
396
+ * the exception snapshot (scr_caught_to_string) — the one un-narrowed
397
+ * read with a sound rendering for every payload kind. Intercepts BEFORE
398
+ * lowerExpr like the other caught lowerings (caughtRead would fence).
399
+ * Null when the expression isn't a catch binding. */
400
+ export declare function caughtToString(L: Lowerer, node: ts.Expression): IrExpr | null;
401
+ /** The catch-binding local an expression names, or null. The dedicated
402
+ * lowerings (instanceof, typeof tests, rethrow) intercept on this BEFORE
403
+ * lowering the operand — a raw lowerExpr of the identifier would hit
404
+ * caughtRead's fence. */
405
+ export declare function caughtLocalOf(L: Lowerer, node: ts.Expression): IrLocal | null;
406
+ /** `x instanceof C` for a program-declared class C. When x's static
407
+ * class and C are both in extends-hierarchies the test is dynamic — the
408
+ * O(1) preorder-interval check against the vtable (`instanceOf` node).
409
+ * Everything else is decided by the static class graph alone and folds
410
+ * to the honest constant: `x instanceof C` is always true when x's
411
+ * static class IS C or descends from it, and always false when the
412
+ * classes are unrelated (a standalone class has no other relatives).
413
+ * Folding is limited to side-effect-free operands — dropping a computed
414
+ * operand would skip its effects, so those are rejected instead. */
415
+ export declare function lowerInstanceOf(L: Lowerer, expr: ts.BinaryExpression, loc: SrcLoc): IrExpr;
416
+ /** `"key" in v` — the key-presence test. Three lowered receivers:
417
+ * process.env (getenv(3) presence — Node-exact, an empty value still
418
+ * counts as present), and monomorphic record shapes, where the answer is
419
+ * type-directed: a declared non-optional field is a compile-time `true`,
420
+ * a missing field (no index signature) a compile-time `false` — both
421
+ * folds limited to side-effect-free receivers, the lowerInstanceOf rule —
422
+ * and an OPTIONAL field (undefined-armed union) is a runtime tag test on
423
+ * the slot: present iff the arm is not undefined. That last case is the
424
+ * representation's honest answer — a field explicitly assigned
425
+ * `undefined` reads as absent (`"a" in {a: undefined}` is true in JS,
426
+ * false here; SEMANTICS.md 55). Union receivers (the `in`-narrowing
427
+ * idiom over multiple shapes), index-signature keys, class instances,
428
+ * and dyn/unknown stay fenced. Keys are literal strings — a computed key
429
+ * over a shape would need the runtime key table. */
430
+ export declare function lowerInExpression(L: Lowerer, expr: ts.BinaryExpression, loc: SrcLoc): IrExpr;
431
+ /** A regex literal `/ab+c/gi` → regexLit (interned per (pattern, flags)
432
+ * by the backend). The TS parser has already syntax-checked the literal;
433
+ * what remains here are the slice fences: the flag alphabet (d and v are
434
+ * declared-valid TS flags outside this slice) and named capture groups
435
+ * (their results are unreachable without exec/match). The engine
436
+ * validates the pattern itself lazily at first use (SEMANTICS.md
437
+ * documents the divergence from Node's parse-time SyntaxError). */
438
+ export declare function lowerRegexLiteral(L: Lowerer, expr: ts.RegularExpressionLiteral): IrExpr;
439
+ /** Field read `obj.f` on class-instance and record receivers, through the
440
+ * shared FieldTarget union (fieldGet / recordGet). Bound method references
441
+ * on classes are rejected specifically; func-typed record fields are
442
+ * ordinary closure values, so bare references to them work (unlike class
443
+ * methods, which have no bound-value form). */
444
+ export declare function lowerFieldRead(L: Lowerer, expr: ts.PropertyAccessExpression): IrExpr | null;
445
+ /** Shared-field read `r.f` on a UNION receiver: supported exactly when
446
+ * every arm is a record/class possessing the field with ONE shared IR
447
+ * type — the discriminant pattern (`r.kind`, primitive) and the
448
+ * shared-payload pattern (`spec.config` where every ServiceSpec arm
449
+ * carries the same record). Lowers to `unionDisc` (the backend switches
450
+ * on the runtime tag and reads the field from the concrete arm), which
451
+ * composes with existing strEq/bin/switch nodes, so `r.kind === "ok"`
452
+ * and `switch (r.kind)` work without dedicated test nodes. Anything else
453
+ * on a union receiver is rejected specifically (narrow first). */
454
+ export declare function lowerUnionProperty(L: Lowerer, expr: ts.PropertyAccessExpression): IrExpr | null;
455
+ /** Recognizes `obj.field` as an assignable field target: receiver is a
456
+ * known class instance OR a record, and the member is a field or (class
457
+ * receivers) a declared accessor property. Returns the pieces of a
458
+ * fieldSet/recordSet/accessor-call (minus value/kind) or null. */
459
+ export declare function fieldTarget(L: Lowerer, access: ts.PropertyAccessExpression): FieldTarget | null;
460
+ /** A STATICALLY-RESOLVABLE unique-symbol key: an identifier whose value
461
+ * resolves (imports included) to a module-level `const k = Symbol(...)`
462
+ * with no description or a literal one. tsc types such a const `unique
463
+ * symbol` — a compile-time identity — so a `this[k]` member is an
464
+ * ordinary hidden field of the static layout, named in Node's inspect
465
+ * spelling (`Symbol(limit)`). Everything else is null and keeps the
466
+ * symbol fences: `symbol`-typed parameters and locals (identity known
467
+ * only at runtime), `Symbol.for(...)` consts (two distinct consts can
468
+ * alias ONE runtime symbol through the global registry — tsc still
469
+ * types them as distinct unique symbols, so static slots would split
470
+ * what JS shares), and computed descriptions (the field name below
471
+ * must BE Node's, for inspect). */
472
+ export declare function uniqueSymbolKeyOf(L: Lowerer, key: ts.Expression): {
473
+ sym: ts.Symbol;
474
+ fieldName: string;
475
+ } | null;
476
+ /** The declared symbol-keyed field (class name / layout field / type)
477
+ * `expr` resolves to, WITHOUT lowering the receiver — the routing test
478
+ * for the wiring sites (statement dispatch must not emit anything when
479
+ * it declines). Null off class receivers, for non-static keys, and for
480
+ * keys no class on the chain declares. */
481
+ export declare function symbolFieldInfo(L: Lowerer, expr: ts.ElementAccessExpression): {
482
+ className: string;
483
+ field: string;
484
+ fieldType: IrType;
485
+ } | null;
486
+ /** `obj[k]` as an assignable field target — the symbol-keyed twin of
487
+ * fieldTarget's class branch (the receiver lowers here, exactly once). */
488
+ export declare function symbolFieldTarget(L: Lowerer, expr: ts.ElementAccessExpression): FieldTarget | null;
489
+ /** The read expression for a field target (fieldGet / recordGet /
490
+ * getter call). `blame` locates the rejection of a setter-only read —
491
+ * tsc-clean (the property types as the setter's param), but Node yields
492
+ * undefined, which these property types cannot represent. */
493
+ export declare function fieldGetExpr(L: Lowerer, target: FieldTarget, loc: SrcLoc, blame: ts.Node): IrExpr;
494
+ /** The write statement for a field target (fieldSet / recordSet / setter
495
+ * call). A write to a getter-only property never gets here in a clean
496
+ * program (tsc's TS2540 is the fence); the rejection is the backstop. */
497
+ export declare function fieldSetStmt(L: Lowerer, target: FieldTarget, value: IrExpr, loc: SrcLoc, blame: ts.Node): IrStmt;
498
+ /** `Promise.reject(reason)` on THE Promise global: a pre-rejected
499
+ * promise. The reason is pinned to the Error hierarchy (the executor
500
+ * reject parameter's contract — rejection payloads share the
501
+ * thrown-Error representation, so catch-side instanceof and the
502
+ * uncaught printer keep working) and moves into the rejection slot
503
+ * exactly as an executor's reject() would store it; the result enters
504
+ * the unhandled ledger until something observes it, JS-exact. The
505
+ * checker types the call Promise<never>, so the CONTEXT names the
506
+ * result type (a declared return type, an annotated initializer, an
507
+ * argument slot); without one no representable type exists and the
508
+ * fence says so. Null for other members and non-Promise receivers. */
509
+ export declare function lowerPromiseRejectCall(L: Lowerer, call: ts.CallExpression, access: ts.PropertyAccessExpression): IrExpr | null;
510
+ /** `Promise.all([...])` where the literal's every entry is the SAME
511
+ * promise type: the checker's tuple overload types the literal
512
+ * [Promise<T>, Promise<T>] — a tuple RECORD, which the array path
513
+ * rejects — but a homogeneous tuple of promises IS a Promise<T>[] in
514
+ * every observable way, so the entries build the array directly and
515
+ * the runtime's countdown combinator runs (the certs read-both-files
516
+ * shape). Result Promise<T[]>; void inners collapse to Promise<void>
517
+ * exactly like the array path. Null otherwise: heterogeneous literals
518
+ * and non-literal arguments keep the array path and its fences. */
519
+ export declare function lowerPromiseAllTupleCall(L: Lowerer, call: ts.CallExpression, access: ts.PropertyAccessExpression): IrExpr | null;
520
+ /** `obj.f op= e` (and `obj.f++` with rhs null ≡ 1) — the element spelling
521
+ * `obj[k] op= e` included when k is a declared symbol-keyed field.
522
+ * Restricted to side-effect-free receivers (identifier or `this`)
523
+ * because the desugar evaluates the receiver twice. */
524
+ export declare function lowerFieldCompound(L: Lowerer, access: ts.PropertyAccessExpression | ts.ElementAccessExpression, op: CompoundOp, rhsNode: ts.Expression | null, loc: SrcLoc): IrStmt;