@scriptc/compiler 0.2.7 → 0.2.8

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 (385) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +2 -0
  2. package/dist/backend/llvm/alloc.d.ts +3 -0
  3. package/dist/backend/llvm/alloc.js +54 -13
  4. package/dist/backend/llvm/alloc.js.map +1 -1
  5. package/dist/backend/llvm/blocks.d.ts +9 -0
  6. package/dist/backend/llvm/blocks.js +9 -0
  7. package/dist/backend/llvm/blocks.js.map +1 -1
  8. package/dist/backend/llvm/borrowed-receivers.d.ts +7 -0
  9. package/dist/backend/llvm/borrowed-receivers.js +39 -0
  10. package/dist/backend/llvm/borrowed-receivers.js.map +1 -1
  11. package/dist/backend/llvm/call-lifetimes.d.ts +4 -1
  12. package/dist/backend/llvm/call-lifetimes.js +14 -3
  13. package/dist/backend/llvm/call-lifetimes.js.map +1 -1
  14. package/dist/backend/llvm/call-lifetimes.test.js +8 -3
  15. package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
  16. package/dist/backend/llvm/checked-narrows.d.ts +24 -0
  17. package/dist/backend/llvm/checked-narrows.js +108 -0
  18. package/dist/backend/llvm/checked-narrows.js.map +1 -0
  19. package/dist/backend/llvm/checked-narrows.test.d.ts +1 -0
  20. package/dist/backend/llvm/checked-narrows.test.js +208 -0
  21. package/dist/backend/llvm/checked-narrows.test.js.map +1 -0
  22. package/dist/backend/llvm/classes.d.ts +13 -1
  23. package/dist/backend/llvm/classes.js +26 -18
  24. package/dist/backend/llvm/classes.js.map +1 -1
  25. package/dist/backend/llvm/classes.test.js +32 -3
  26. package/dist/backend/llvm/classes.test.js.map +1 -1
  27. package/dist/backend/llvm/debug-info.d.ts +6 -2
  28. package/dist/backend/llvm/debug-info.js +11 -1
  29. package/dist/backend/llvm/debug-info.js.map +1 -1
  30. package/dist/backend/llvm/dense-array-access.test.js +89 -0
  31. package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
  32. package/dist/backend/llvm/dyn.d.ts +4 -0
  33. package/dist/backend/llvm/dyn.js +31 -20
  34. package/dist/backend/llvm/dyn.js.map +1 -1
  35. package/dist/backend/llvm/emitter.d.ts +184 -11
  36. package/dist/backend/llvm/emitter.js +1189 -125
  37. package/dist/backend/llvm/emitter.js.map +1 -1
  38. package/dist/backend/llvm/emitter.test.js +21 -1
  39. package/dist/backend/llvm/emitter.test.js.map +1 -1
  40. package/dist/backend/llvm/expr-async.js +4 -4
  41. package/dist/backend/llvm/expr-async.js.map +1 -1
  42. package/dist/backend/llvm/expr-bytes.d.ts +1 -1
  43. package/dist/backend/llvm/expr-bytes.js +85 -8
  44. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  45. package/dist/backend/llvm/expr-callbacks.js +29 -21
  46. package/dist/backend/llvm/expr-callbacks.js.map +1 -1
  47. package/dist/backend/llvm/expr-calls.d.ts +5 -0
  48. package/dist/backend/llvm/expr-calls.js +55 -10
  49. package/dist/backend/llvm/expr-calls.js.map +1 -1
  50. package/dist/backend/llvm/expr-containers.d.ts +7 -1
  51. package/dist/backend/llvm/expr-containers.js +230 -27
  52. package/dist/backend/llvm/expr-containers.js.map +1 -1
  53. package/dist/backend/llvm/expr-control.js +25 -10
  54. package/dist/backend/llvm/expr-control.js.map +1 -1
  55. package/dist/backend/llvm/expr-dynamic.js +72 -21
  56. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  57. package/dist/backend/llvm/expr-island.js +3 -8
  58. package/dist/backend/llvm/expr-island.js.map +1 -1
  59. package/dist/backend/llvm/expr-primitives.js +41 -12
  60. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  61. package/dist/backend/llvm/expr-primitives.test.js +50 -2
  62. package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
  63. package/dist/backend/llvm/expr-records.js +28 -14
  64. package/dist/backend/llvm/expr-records.js.map +1 -1
  65. package/dist/backend/llvm/expr-stream-bridges.js +41 -31
  66. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  67. package/dist/backend/llvm/expr-stream-callbacks.js +6 -3
  68. package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
  69. package/dist/backend/llvm/layouts.d.ts +2 -1
  70. package/dist/backend/llvm/layouts.js +2 -2
  71. package/dist/backend/llvm/layouts.js.map +1 -1
  72. package/dist/backend/llvm/lib-abi.js +10 -0
  73. package/dist/backend/llvm/lib-abi.js.map +1 -1
  74. package/dist/backend/llvm/lib-filesystem.js +7 -11
  75. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  76. package/dist/backend/llvm/lib-process.js +8 -8
  77. package/dist/backend/llvm/lib-process.js.map +1 -1
  78. package/dist/backend/llvm/lib-shared.js +1 -0
  79. package/dist/backend/llvm/lib-shared.js.map +1 -1
  80. package/dist/backend/llvm/local-array-reads.js +73 -13
  81. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  82. package/dist/backend/llvm/local-array-reads.test.js +7 -3
  83. package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
  84. package/dist/backend/llvm/local-union-storage.js +10 -6
  85. package/dist/backend/llvm/local-union-storage.js.map +1 -1
  86. package/dist/backend/llvm/local-union-storage.test.js +3 -2
  87. package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
  88. package/dist/backend/llvm/map-number-lookup.d.ts +18 -0
  89. package/dist/backend/llvm/map-number-lookup.js +62 -0
  90. package/dist/backend/llvm/map-number-lookup.js.map +1 -0
  91. package/dist/backend/llvm/map-read-lifetimes.d.ts +6 -0
  92. package/dist/backend/llvm/map-read-lifetimes.js +24 -3
  93. package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
  94. package/dist/backend/llvm/map-read-lifetimes.test.js +38 -19
  95. package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
  96. package/dist/backend/llvm/nullable-unions.d.ts +68 -0
  97. package/dist/backend/llvm/nullable-unions.js +132 -0
  98. package/dist/backend/llvm/nullable-unions.js.map +1 -0
  99. package/dist/backend/llvm/publish.d.ts +58 -0
  100. package/dist/backend/llvm/publish.js +286 -0
  101. package/dist/backend/llvm/publish.js.map +1 -0
  102. package/dist/backend/llvm/rebound-parameters.d.ts +12 -0
  103. package/dist/backend/llvm/rebound-parameters.js +72 -0
  104. package/dist/backend/llvm/rebound-parameters.js.map +1 -0
  105. package/dist/backend/llvm/rebound-parameters.test.d.ts +1 -0
  106. package/dist/backend/llvm/rebound-parameters.test.js +67 -0
  107. package/dist/backend/llvm/rebound-parameters.test.js.map +1 -0
  108. package/dist/backend/llvm/reference-effects.d.ts +18 -2
  109. package/dist/backend/llvm/reference-effects.js +106 -16
  110. package/dist/backend/llvm/reference-effects.js.map +1 -1
  111. package/dist/backend/llvm/reference-effects.test.js +52 -1
  112. package/dist/backend/llvm/reference-effects.test.js.map +1 -1
  113. package/dist/backend/llvm/shapes.d.ts +45 -17
  114. package/dist/backend/llvm/shapes.js +131 -53
  115. package/dist/backend/llvm/shapes.js.map +1 -1
  116. package/dist/backend/llvm/shapes.test.js +33 -8
  117. package/dist/backend/llvm/shapes.test.js.map +1 -1
  118. package/dist/backend/llvm/stack-unions.test.js +5 -2
  119. package/dist/backend/llvm/stack-unions.test.js.map +1 -1
  120. package/dist/backend/llvm/string-construction.d.ts +10 -0
  121. package/dist/backend/llvm/string-construction.js +42 -0
  122. package/dist/backend/llvm/string-construction.js.map +1 -1
  123. package/dist/backend/llvm/string-key-hash.d.ts +9 -2
  124. package/dist/backend/llvm/string-key-hash.js +20 -3
  125. package/dist/backend/llvm/string-key-hash.js.map +1 -1
  126. package/dist/backend/llvm/string-key-hash.test.js +14 -3
  127. package/dist/backend/llvm/string-key-hash.test.js.map +1 -1
  128. package/dist/backend/llvm/string-lifetimes.test.js +24 -11
  129. package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
  130. package/dist/backend/llvm/string-reads.d.ts +7 -0
  131. package/dist/backend/llvm/string-reads.js +76 -0
  132. package/dist/backend/llvm/string-reads.js.map +1 -0
  133. package/dist/backend/llvm/switch-dispatch.test.js +1 -1
  134. package/dist/backend/llvm/switch-dispatch.test.js.map +1 -1
  135. package/dist/backend/llvm/test-boxed-unions.d.ts +5 -0
  136. package/dist/backend/llvm/test-boxed-unions.js +13 -0
  137. package/dist/backend/llvm/test-boxed-unions.js.map +1 -0
  138. package/dist/backend/llvm/union-repr.d.ts +15 -0
  139. package/dist/backend/llvm/union-repr.js +89 -0
  140. package/dist/backend/llvm/union-repr.js.map +1 -0
  141. package/dist/backend/llvm/virtual-borrows.d.ts +31 -0
  142. package/dist/backend/llvm/virtual-borrows.js +82 -0
  143. package/dist/backend/llvm/virtual-borrows.js.map +1 -0
  144. package/dist/backend/llvm/walk-borrows.d.ts +43 -0
  145. package/dist/backend/llvm/walk-borrows.js +150 -0
  146. package/dist/backend/llvm/walk-borrows.js.map +1 -0
  147. package/dist/backend/llvm/walk-borrows.test.d.ts +1 -0
  148. package/dist/backend/llvm/walk-borrows.test.js +119 -0
  149. package/dist/backend/llvm/walk-borrows.test.js.map +1 -0
  150. package/dist/backend/llvm/walkers.d.ts +5 -1
  151. package/dist/backend/llvm/walkers.js +24 -21
  152. package/dist/backend/llvm/walkers.js.map +1 -1
  153. package/dist/backend/may-throw.d.ts +29 -1
  154. package/dist/backend/may-throw.js +346 -3
  155. package/dist/backend/may-throw.js.map +1 -1
  156. package/dist/backend/may-throw.test.js +113 -1
  157. package/dist/backend/may-throw.test.js.map +1 -1
  158. package/dist/backend/native/runtime-inputs.d.ts +1 -1
  159. package/dist/backend/native/runtime-inputs.js +1 -0
  160. package/dist/backend/native/runtime-inputs.js.map +1 -1
  161. package/dist/backend/native-codegen-core.d.ts +7 -5
  162. package/dist/backend/native-codegen-core.js +14 -9
  163. package/dist/backend/native-codegen-core.js.map +1 -1
  164. package/dist/backend/native-codegen.d.ts +4 -0
  165. package/dist/backend/native-codegen.js +49 -2
  166. package/dist/backend/native-codegen.js.map +1 -1
  167. package/dist/backend/native-codegen.test.js +41 -10
  168. package/dist/backend/native-codegen.test.js.map +1 -1
  169. package/dist/backend/native-tools.d.ts +2 -0
  170. package/dist/backend/native-tools.js +3 -0
  171. package/dist/backend/native-tools.js.map +1 -1
  172. package/dist/backend/publication.d.ts +28 -0
  173. package/dist/backend/publication.js +155 -0
  174. package/dist/backend/publication.js.map +1 -0
  175. package/dist/backend/publication.test.d.ts +1 -0
  176. package/dist/backend/publication.test.js +72 -0
  177. package/dist/backend/publication.test.js.map +1 -0
  178. package/dist/backend/runtime-abi.d.ts +2 -2
  179. package/dist/backend/runtime-abi.js +2 -2
  180. package/dist/backend/runtime-pack-targets.test.js +1 -1
  181. package/dist/backend/runtime-pack.test.js +1 -1
  182. package/dist/cli/command.js +70 -7
  183. package/dist/cli/command.js.map +1 -1
  184. package/dist/cli/usage.d.ts +4 -1
  185. package/dist/cli/usage.js +8 -1
  186. package/dist/cli/usage.js.map +1 -1
  187. package/dist/compile-types.d.ts +12 -3
  188. package/dist/coverage/report.d.ts +25 -2
  189. package/dist/coverage/report.js +161 -33
  190. package/dist/coverage/report.js.map +1 -1
  191. package/dist/coverage/verdict-cache.d.ts +63 -0
  192. package/dist/coverage/verdict-cache.js +193 -0
  193. package/dist/coverage/verdict-cache.js.map +1 -0
  194. package/dist/coverage/verdict-cache.test.d.ts +1 -0
  195. package/dist/coverage/verdict-cache.test.js +52 -0
  196. package/dist/coverage/verdict-cache.test.js.map +1 -0
  197. package/dist/coverage/verdict-semantic.d.ts +2 -0
  198. package/dist/coverage/verdict-semantic.js +24 -0
  199. package/dist/coverage/verdict-semantic.js.map +1 -0
  200. package/dist/coverage/verdict-startup.d.ts +15 -0
  201. package/dist/coverage/verdict-startup.js +66 -0
  202. package/dist/coverage/verdict-startup.js.map +1 -0
  203. package/dist/diagnostics/diagnostic.d.ts +29 -1
  204. package/dist/diagnostics/diagnostic.js +74 -4
  205. package/dist/diagnostics/diagnostic.js.map +1 -1
  206. package/dist/diagnostics/envelope.d.ts +130 -0
  207. package/dist/diagnostics/envelope.js +257 -0
  208. package/dist/diagnostics/envelope.js.map +1 -0
  209. package/dist/diagnostics/envelope.test.d.ts +1 -0
  210. package/dist/diagnostics/envelope.test.js +91 -0
  211. package/dist/diagnostics/envelope.test.js.map +1 -0
  212. package/dist/diagnostics/render.d.ts +3 -0
  213. package/dist/diagnostics/render.js +13 -2
  214. package/dist/diagnostics/render.js.map +1 -1
  215. package/dist/executable/prepare.d.ts +4 -0
  216. package/dist/executable/prepare.js +7 -1
  217. package/dist/executable/prepare.js.map +1 -1
  218. package/dist/frontend/analysis.js +1 -0
  219. package/dist/frontend/analysis.js.map +1 -1
  220. package/dist/frontend/lowering/array-values.d.ts +7 -0
  221. package/dist/frontend/lowering/array-values.js +120 -4
  222. package/dist/frontend/lowering/array-values.js.map +1 -1
  223. package/dist/frontend/lowering/builtins/numbers.js +29 -1
  224. package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
  225. package/dist/frontend/lowering/builtins/process.d.ts +4 -0
  226. package/dist/frontend/lowering/builtins/process.js +10 -0
  227. package/dist/frontend/lowering/builtins/process.js.map +1 -1
  228. package/dist/frontend/lowering/builtins/workers.js +4 -2
  229. package/dist/frontend/lowering/builtins/workers.js.map +1 -1
  230. package/dist/frontend/lowering/class-assertions.d.ts +8 -0
  231. package/dist/frontend/lowering/class-assertions.js +217 -1
  232. package/dist/frontend/lowering/class-assertions.js.map +1 -1
  233. package/dist/frontend/lowering/class-dynamic-dispatch.js +8 -5
  234. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  235. package/dist/frontend/lowering/coercions/state.d.ts +6 -0
  236. package/dist/frontend/lowering/coercions/state.js +2 -0
  237. package/dist/frontend/lowering/coercions/state.js.map +1 -1
  238. package/dist/frontend/lowering/coercions/unions.d.ts +8 -0
  239. package/dist/frontend/lowering/coercions/unions.js +67 -2
  240. package/dist/frontend/lowering/coercions/unions.js.map +1 -1
  241. package/dist/frontend/lowering/collation-repertoire.d.ts +1 -0
  242. package/dist/frontend/lowering/collation-repertoire.js +19 -0
  243. package/dist/frontend/lowering/collation-repertoire.js.map +1 -0
  244. package/dist/frontend/lowering/construction-escapes.d.ts +38 -0
  245. package/dist/frontend/lowering/construction-escapes.js +146 -0
  246. package/dist/frontend/lowering/construction-escapes.js.map +1 -0
  247. package/dist/frontend/lowering/construction-escapes.test.d.ts +1 -0
  248. package/dist/frontend/lowering/construction-escapes.test.js +150 -0
  249. package/dist/frontend/lowering/construction-escapes.test.js.map +1 -0
  250. package/dist/frontend/lowering/containers/array-callbacks.js +81 -44
  251. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  252. package/dist/frontend/lowering/containers/array-construction.js +15 -2
  253. package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
  254. package/dist/frontend/lowering/containers/array-methods.js +231 -12
  255. package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
  256. package/dist/frontend/lowering/containers/callback-arguments.js +43 -1
  257. package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
  258. package/dist/frontend/lowering/containers/string-and-regexp.js +7 -63
  259. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  260. package/dist/frontend/lowering/cycle-initialization.d.ts +6 -1
  261. package/dist/frontend/lowering/cycle-initialization.js +59 -33
  262. package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
  263. package/dist/frontend/lowering/divergences.d.ts +9 -0
  264. package/dist/frontend/lowering/divergences.js +630 -0
  265. package/dist/frontend/lowering/divergences.js.map +1 -0
  266. package/dist/frontend/lowering/expressions/object-literals.js +40 -2
  267. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  268. package/dist/frontend/lowering/lower-calls.d.ts +5 -0
  269. package/dist/frontend/lowering/lower-calls.js +226 -157
  270. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  271. package/dist/frontend/lowering/lower-classes.d.ts +4 -0
  272. package/dist/frontend/lowering/lower-classes.js +72 -22
  273. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  274. package/dist/frontend/lowering/lower-exprs.d.ts +13 -0
  275. package/dist/frontend/lowering/lower-exprs.js +431 -107
  276. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  277. package/dist/frontend/lowering/lower-generators.d.ts +19 -13
  278. package/dist/frontend/lowering/lower-generators.js +67 -44
  279. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  280. package/dist/frontend/lowering/lower-inspect.js +3 -2
  281. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  282. package/dist/frontend/lowering/lower-island.d.ts +1 -1
  283. package/dist/frontend/lowering/lower-island.js +24 -7
  284. package/dist/frontend/lowering/lower-island.js.map +1 -1
  285. package/dist/frontend/lowering/lower-modules.js +90 -1
  286. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  287. package/dist/frontend/lowering/lower-stmts.js +36 -6
  288. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  289. package/dist/frontend/lowering/lowerer.d.ts +78 -2
  290. package/dist/frontend/lowering/lowerer.js +986 -73
  291. package/dist/frontend/lowering/lowerer.js.map +1 -1
  292. package/dist/frontend/lowering/runtime-optional-bounds.d.ts +19 -0
  293. package/dist/frontend/lowering/runtime-optional-bounds.js +354 -0
  294. package/dist/frontend/lowering/runtime-optional-bounds.js.map +1 -0
  295. package/dist/frontend/lowering/runtime-optional-bounds.test.d.ts +1 -0
  296. package/dist/frontend/lowering/runtime-optional-bounds.test.js +66 -0
  297. package/dist/frontend/lowering/runtime-optional-bounds.test.js.map +1 -0
  298. package/dist/frontend/lowering/runtime-optional-elements.d.ts +117 -0
  299. package/dist/frontend/lowering/runtime-optional-elements.js +738 -0
  300. package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -0
  301. package/dist/frontend/lowering/runtime-optional-guards.d.ts +36 -0
  302. package/dist/frontend/lowering/runtime-optional-guards.js +375 -0
  303. package/dist/frontend/lowering/runtime-optional-guards.js.map +1 -0
  304. package/dist/frontend/lowering/runtime-optional-guards.test.d.ts +1 -0
  305. package/dist/frontend/lowering/runtime-optional-guards.test.js +92 -0
  306. package/dist/frontend/lowering/runtime-optional-guards.test.js.map +1 -0
  307. package/dist/frontend/lowering/runtime-optional-ownership.d.ts +63 -0
  308. package/dist/frontend/lowering/runtime-optional-ownership.js +382 -0
  309. package/dist/frontend/lowering/runtime-optional-ownership.js.map +1 -0
  310. package/dist/frontend/lowering/runtime-optional-provenance.d.ts +2 -1
  311. package/dist/frontend/lowering/runtime-optional-provenance.js +2 -1
  312. package/dist/frontend/lowering/runtime-optional-provenance.js.map +1 -1
  313. package/dist/frontend/lowering/string-index-bounds.d.ts +36 -0
  314. package/dist/frontend/lowering/string-index-bounds.js +537 -0
  315. package/dist/frontend/lowering/string-index-bounds.js.map +1 -0
  316. package/dist/frontend/lowering/string-index-bounds.test.d.ts +1 -0
  317. package/dist/frontend/lowering/string-index-bounds.test.js +223 -0
  318. package/dist/frontend/lowering/string-index-bounds.test.js.map +1 -0
  319. package/dist/frontend/lowering/union-narrow.d.ts +2 -0
  320. package/dist/frontend/lowering/union-narrow.js +10 -6
  321. package/dist/frontend/lowering/union-narrow.js.map +1 -1
  322. package/dist/frontend/program-analysis.d.ts +10 -0
  323. package/dist/frontend/program-analysis.js +7 -0
  324. package/dist/frontend/program-analysis.js.map +1 -1
  325. package/dist/frontend/program.d.ts +25 -0
  326. package/dist/frontend/program.js +613 -17
  327. package/dist/frontend/program.js.map +1 -1
  328. package/dist/frontend/program.test.js +64 -1
  329. package/dist/frontend/program.test.js.map +1 -1
  330. package/dist/frontend/resolve.d.ts +6 -0
  331. package/dist/frontend/resolve.js +14 -0
  332. package/dist/frontend/resolve.js.map +1 -1
  333. package/dist/frontend/threads-import.d.ts +5 -0
  334. package/dist/frontend/threads-import.js +21 -0
  335. package/dist/frontend/threads-import.js.map +1 -0
  336. package/dist/frontend/type-mapper.d.ts +3 -0
  337. package/dist/frontend/type-mapper.js +72 -6
  338. package/dist/frontend/type-mapper.js.map +1 -1
  339. package/dist/frontend/worker-target.d.ts +4 -0
  340. package/dist/frontend/worker-target.js +8 -1
  341. package/dist/frontend/worker-target.js.map +1 -1
  342. package/dist/index.d.ts +6 -1
  343. package/dist/index.js +47 -9
  344. package/dist/index.js.map +1 -1
  345. package/dist/ir/build.d.ts +5 -0
  346. package/dist/ir/build.js +7 -0
  347. package/dist/ir/build.js.map +1 -1
  348. package/dist/ir/builtin-signatures.d.ts +1 -1
  349. package/dist/ir/builtin-signatures.js +3 -0
  350. package/dist/ir/builtin-signatures.js.map +1 -1
  351. package/dist/ir/int32-slots.d.ts +72 -0
  352. package/dist/ir/int32-slots.js +837 -0
  353. package/dist/ir/int32-slots.js.map +1 -0
  354. package/dist/ir/int32-slots.test.d.ts +1 -0
  355. package/dist/ir/int32-slots.test.js +222 -0
  356. package/dist/ir/int32-slots.test.js.map +1 -0
  357. package/dist/ir/integer-ranges.d.ts +19 -3
  358. package/dist/ir/integer-ranges.js +168 -23
  359. package/dist/ir/integer-ranges.js.map +1 -1
  360. package/dist/ir/integer-ranges.test.js +74 -2
  361. package/dist/ir/integer-ranges.test.js.map +1 -1
  362. package/dist/ir/ir.d.ts +24 -6
  363. package/dist/ir/ir.js.map +1 -1
  364. package/dist/ir/validate.js +21 -2
  365. package/dist/ir/validate.js.map +1 -1
  366. package/dist/ir/validate.test.js +39 -0
  367. package/dist/ir/validate.test.js.map +1 -1
  368. package/dist/native/cache.d.ts +3 -0
  369. package/dist/native/cache.js +49 -1
  370. package/dist/native/cache.js.map +1 -1
  371. package/dist/native/cache.test.js +21 -1
  372. package/dist/native/cache.test.js.map +1 -1
  373. package/dist/native/cli.js +1 -1
  374. package/dist/native/cli.js.map +1 -1
  375. package/dist/native/compiler.d.ts +5 -0
  376. package/dist/native/compiler.js +51 -4
  377. package/dist/native/compiler.js.map +1 -1
  378. package/dist/native/prepare.d.ts +4 -0
  379. package/dist/native/prepare.js +2 -1
  380. package/dist/native/prepare.js.map +1 -1
  381. package/dist/startup-cache.d.ts +2 -0
  382. package/dist/startup-cache.js +2 -0
  383. package/dist/startup-cache.js.map +1 -1
  384. package/package.json +20 -20
  385. package/surface-manifest.json +1 -1
@@ -1,20 +1,24 @@
1
1
  import type { IrBytesElem, IrExpr, IrFfiImport, IrFunction, IrLocal, IrModule, IrRecordShape, IrStmt, IrType, IrUnionDef, SrcLoc } from "../../ir/ir.js";
2
2
  import { type SplitSpan } from "./split-loops.js";
3
3
  import { type IntegerRanges } from "../../ir/integer-ranges.js";
4
+ import { type Int32Slots } from "../../ir/int32-slots.js";
4
5
  import { type ConstantNumericTable } from "../../ir/constant-tables.js";
5
6
  import { type FfiCallbackAdapter } from "../ffi-callbacks.js";
6
7
  import { type CallLifetimes } from "./call-lifetimes.js";
7
8
  import { BlockBuilder } from "./blocks.js";
8
9
  import { NullableRefFields, type NullableRefField } from "./nullable-fields.js";
9
10
  import { OptionalArrayReads, type LocalArrayRead } from "./local-array-reads.js";
11
+ import { CheckedNarrows } from "./checked-narrows.js";
10
12
  import { type MapReadLifetimes } from "./map-read-lifetimes.js";
11
13
  import { ReferenceEffects } from "./reference-effects.js";
12
14
  import { StackCallbacks } from "./stack-callbacks.js";
13
15
  import { AmbientReceiverReaders } from "./constant-callbacks.js";
14
16
  import { type StringSliceSnapshot } from "./string-slices.js";
17
+ import { type PublishedTypes } from "../publication.js";
15
18
  import { type LlClassMeta } from "./classes.js";
16
19
  import { LlDyn, type DynHost } from "./dyn.js";
17
20
  import { LlWalkers } from "./walkers.js";
21
+ import { NullableUnions } from "./nullable-unions.js";
18
22
  import { type MapKeyAccess } from "./shapes.js";
19
23
  import type { ExprOf, LibCallExpr, LlStreamTypedRefAdapter, LlValue } from "./expr-context.js";
20
24
  export { LlvmUnsupportedError } from "./unsupported.js";
@@ -71,17 +75,23 @@ export declare class LlEmitter {
71
75
  readonly ffiExtendNarrowIntegers: boolean;
72
76
  readonly cycleColorOffset: number;
73
77
  readonly wasi: boolean;
78
+ /** ELF worker executables give thread-locals the executable TLS models. */
79
+ private readonly executableTls;
74
80
  private readonly emitLibraryIdentity;
75
81
  private readonly runtimeAbiMarker;
76
82
  /** Interned string literals: UTF-8 text → { symbol, byte length } —
77
83
  * first-use order, the runtime ABI’s determinism discipline. */
78
84
  private readonly literals;
85
+ /** Symbols of interned constant data, named by content (contentSymbol). */
86
+ private readonly contentSymbols;
79
87
  /** Interned unit-armed union instances: "unionId:tag" → symbol — one
80
88
  * immortal (rc == SIZE_MAX) static per (union, unit tag).
81
89
  * RC entry points and the collector skip immortals. */
82
90
  private readonly unitInstances;
83
91
  /** unionId → symbol of the union's immortal ABSENT field-slot instance. */
84
92
  private readonly absentInstances;
93
+ /** The nullable-union ABSENT sentinel was referenced (absentInstanceRef). */
94
+ private needsNullableAbsent;
85
95
  private readonly immortalValues;
86
96
  /** Regex literal templates: "<flags>/<pattern>" → { symbol, interned
87
97
  * source/flags literal refs } — one immortal ScrRegex template per distinct
@@ -131,6 +141,7 @@ export declare class LlEmitter {
131
141
  private readonly fnDefText;
132
142
  readonly referenceEffects: ReferenceEffects;
133
143
  readonly optionalArrayReads: OptionalArrayReads;
144
+ readonly checkedNarrows: CheckedNarrows;
134
145
  callArrayReads: Map<IrExpr, LocalArrayRead>;
135
146
  mapReadLifetimes: MapReadLifetimes;
136
147
  readonly callLifetimes: CallLifetimes;
@@ -148,6 +159,18 @@ export declare class LlEmitter {
148
159
  /** Parameters proven projection-only: callers may pass stack boxes. */
149
160
  private projectedParameters;
150
161
  private stableCallBindings;
162
+ /** Locals and rebound parameters holding borrowed pointers for their
163
+ * whole lifetime (walk-borrows.ts), per function and for the current one. */
164
+ private readonly walkBorrowsByFunction;
165
+ private walkBorrows;
166
+ /** Functions whose borrowing body returns its result without a reference
167
+ * (analyzeBorrowedReturns), and whether the current body is one. */
168
+ readonly borrowedReturns: Set<string>;
169
+ /** Rebound parameters that keep the borrowed convention with an owner
170
+ * slot (rebound-parameters.ts), per function, and the current owner slots. */
171
+ private readonly reboundByFunction;
172
+ private readonly reboundOwnerSlots;
173
+ private currentBorrowedReturn;
151
174
  /** Manifest-bound native imports, used by ffiCall emission. */
152
175
  readonly ffiByName: Map<string, IrFfiImport>;
153
176
  /** C-ABI callback trampolines and (for raw/no-userdata callbacks) their
@@ -166,6 +189,15 @@ export declare class LlEmitter {
166
189
  * checks are emitted only after calls that can actually raise. */
167
190
  readonly mayThrow: Set<string>;
168
191
  readonly indirectMayThrow: boolean;
192
+ /** Worker programs: the functions that poll for termination on entry
193
+ * (workerTerminationPolls); null outside worker programs. */
194
+ private readonly workerEntryPolls;
195
+ /** Functions that check the native stack guard on entry
196
+ * (stackCheckedFunctions); null where the runtime has no guard. */
197
+ private readonly stackChecks;
198
+ /** Static types whose values can be published (@scriptc/threads): their
199
+ * stores carry the frozen-object guard. Null without publish calls. */
200
+ readonly publishedTypes: PublishedTypes | null;
169
201
  /** Method names with at least one may-throw implementation — the
170
202
  * virtualCall pending check's key. */
171
203
  readonly mayThrowMethods: Set<string>;
@@ -187,6 +219,10 @@ export declare class LlEmitter {
187
219
  readonly dynPromiseAdapters: Map<string, string>;
188
220
  readonly unionsById: Map<string, IrUnionDef>;
189
221
  readonly nullableFields: NullableRefFields;
222
+ /** Unions whose values are nullable arm pointers (nullable-unions.ts). */
223
+ readonly nullableUnions: NullableUnions;
224
+ /** The union table without nullable unions: the stack-box analyses. */
225
+ readonly boxedUnionsById: Map<string, IrUnionDef>;
190
226
  readonly recordsById: Map<string, IrRecordShape>;
191
227
  readonly recordCloneShapes: Set<string>;
192
228
  readonly tracedShapes: Set<string>;
@@ -194,6 +230,8 @@ export declare class LlEmitter {
194
230
  /** The class graph (buildClassGraph): preorder numbering, hierarchy
195
231
  * membership, virtual slot lists. */
196
232
  readonly classMeta: Map<string, LlClassMeta>;
233
+ /** Which vtable slots borrow which parameters (virtual-borrows.ts). */
234
+ private virtualBorrows;
197
235
  /** Class objects (classes as first-class values): className → the
198
236
  * interned .name literal ref — registered during body emission, the
199
237
  * statics and construct thunks assemble around the bodies. */
@@ -233,6 +271,8 @@ export declare class LlEmitter {
233
271
  private storedSplits;
234
272
  private streamingSplitsEnabled;
235
273
  private readonly initializerBindings;
274
+ /** Whole-program int32 storage and parameter/result facts. */
275
+ readonly int32Slots: Int32Slots;
236
276
  private numericLocals;
237
277
  private captureIds;
238
278
  /** Active induction bindings retain their width independently of size_t. */
@@ -293,6 +333,11 @@ export declare class LlEmitter {
293
333
  logArgSlots: number;
294
334
  private readonly stackTraces;
295
335
  constructor(mod: IrModule, options: LlvmTargetOptions);
336
+ /** The borrowed parameters of a hierarchy's vtable slot (empty: owned). */
337
+ virtualSlotBorrowed(rootName: string, slotIndex: number): ReadonlySet<number>;
338
+ /** The vtable entry for one implementation (VirtualBorrows.entry). */
339
+ virtualEntry(implFn: string): string;
340
+ private implSlotBorrowed;
296
341
  abiOffset(native64: number, wasm32: number): number;
297
342
  llType(t: IrType): string;
298
343
  ffiCallbackAdapter(binding: string, id: string): FfiCallbackAdapter;
@@ -303,6 +348,7 @@ export declare class LlEmitter {
303
348
  private emitFfiCallbackDefs;
304
349
  emit(): string;
305
350
  emitParts(): string[];
351
+ private emitModuleParts;
306
352
  /** LIBRARY mode: the profile-declared external definitions — the
307
353
  * export-map wrappers plus init / sink-registration / reset / collect.
308
354
  * Plain `define` (not `define internal`) — the exact linkage distinction
@@ -367,6 +413,12 @@ export declare class LlEmitter {
367
413
  * spawn wrapper that only ALLOCATES the suspended fiber, and the
368
414
  * never-started teardown that drops the packed (+1) arguments. */
369
415
  private emitGenScaffolding;
416
+ /** A symbol derived from the constant's text rather than its first-use
417
+ * index, so an edit that interns one more string leaves every other
418
+ * constant's symbol, and the code referencing it, unchanged. This lets
419
+ * native builds reuse the compiled partitions an edit does not touch. A
420
+ * collision retries with a counter, still in first-use order. */
421
+ private contentSymbol;
370
422
  internLiteral(text: string): string;
371
423
  /** Interned NUL-terminated C-string constant (the scr_jb_puts /
372
424
  * stringify-indent currency) — `@`-ref, first-use order. */
@@ -383,6 +435,9 @@ export declare class LlEmitter {
383
435
  /** i1: a union value loaded from a field slot is the ABSENT state — the
384
436
  * undefined arm's tag with the absent payload marker. */
385
437
  fieldAbsentTest(value: string, unionId: string): string;
438
+ /** fieldAbsentTest in another block builder (helper generators). A
439
+ * nullable union's ABSENT state is the module's immortal sentinel. */
440
+ fieldAbsentTestIn(B: BlockBuilder, value: string, unionId: string): string;
386
441
  /** Loads a record field slot as a VALUE: an undefined-armed union slot
387
442
  * holding the ABSENT state surfaces as the ordinary undefined arm, so
388
443
  * absence never travels beyond its slot (a later `{ f: r.f }` is an
@@ -391,6 +446,12 @@ export declare class LlEmitter {
391
446
  declare(decl: string): void;
392
447
  needOom(): void;
393
448
  private currentFrame;
449
+ /** Whether a value is immortal: an interned constant, or a temp marked by
450
+ * markImmortal. */
451
+ private isImmortal;
452
+ /** Record that a temp holds an immortal value (a choice between interned
453
+ * literals): nothing owns it, and retains, releases and moves skip it. */
454
+ markImmortal(v: LlValue): LlValue;
394
455
  /** Registers an owned refcounted value on the current statement frame. */
395
456
  own(v: LlValue): LlValue;
396
457
  /** Registers a SLOT whose current contents the frame owns (conditional
@@ -420,13 +481,40 @@ export declare class LlEmitter {
420
481
  * function — and branch to the handler / return a dummy value (never
421
482
  * read: callers of a may-throw function test the pending flag before
422
483
  * using the result). Callers own the surrounding pending branch; a
423
- * `throw` unwinds unconditionally. */
484
+ * `throw` unwinds unconditionally. `passThrough` names a scalar call
485
+ * result of the function's own return type: with nothing to release, the
486
+ * unwind returns it as the dummy, so a call in tail position keeps a single
487
+ * return and stays eligible for tail-call and recursion elimination. */
424
488
  private emitUnwind;
489
+ /** Instructions (two-space indented) that set the i1 `dest` to "an
490
+ * exception is pending in the active context" — scr_exc_pending()'s
491
+ * meaning — for the helper and adapter bodies that test it outside
492
+ * emitPendingCheck. Executables read the runtime's exported active-cell
493
+ * pointer and compare its i32 kind (offset 0) against SCR_EXC_NONE inline,
494
+ * as emitPendingCheck does; the out-of-line call would be opaque to LLVM
495
+ * because the runtime links as prebuilt objects. Libraries and worker
496
+ * programs keep the runtime call, which is emitPendingCheck's path there
497
+ * too (workers also observe cross-thread termination in it). */
498
+ pendingTestLines(dest: string): string[];
425
499
  /** The emitter contract for exceptions: after EVERY call that can throw
426
500
  * (per the may-throw analysis), test the pending flag and unwind. The
427
501
  * call's result temp must join its frame BEFORE this runs so the unwind
428
- * releases the dummy (NULL for refcounted kinds) harmlessly. */
429
- emitPendingCheck(): void;
502
+ * releases the dummy (NULL for refcounted kinds) harmlessly. A scalar
503
+ * call result of the function's return type may be passed as the unwind's
504
+ * dummy value (see emitUnwind). */
505
+ emitPendingCheck(passThrough?: {
506
+ name: string;
507
+ type: IrType;
508
+ }): void;
509
+ /** After a runtime call that ALWAYS leaves an exception pending (the
510
+ * compiler-resolved Node throws): the pending test would always answer
511
+ * true, so unwind unconditionally. Emission continues in a block with no
512
+ * predecessors so the caller's remaining instructions stay well-formed;
513
+ * LLVM deletes it. */
514
+ emitAlwaysPendingUnwind(): void;
515
+ /** A recursive function's entry check: below the running stack's guard,
516
+ * throw Node's RangeError and unwind like any other pending exception. */
517
+ private emitStackCheck;
430
518
  private workerLoopBudget;
431
519
  private emitWorkerLoopCheck;
432
520
  /** Moves an already-evaluated value into the runtime's exception cell —
@@ -442,11 +530,16 @@ export declare class LlEmitter {
442
530
  /** Emit truthiness for one non-union kind. Union arms are known-present,
443
531
  * so object kinds become the constant true instead of a pointer test. */
444
532
  private truthyOf;
445
- /** Loads a union box's tag (i32). */
446
- unionTag(uName: string): string;
533
+ /** A union value's tag (i32): the box's tag word, or the NULL test of a
534
+ * nullable union's pointer. */
535
+ unionTag(uName: string, unionId: string): string;
536
+ /** Guard for helpers that build or read a union's `%ScrUnion` box
537
+ * directly (library-shaped unions with fixed arms): a nullable union
538
+ * reaching one is an emitter bug, never a silent miscompile. */
539
+ requireBoxedUnion(unionId: string): void;
447
540
  /** The BORROWED payload pointer of a ref arm (scr_union_peek inlined —
448
- * the runtime's is a static inline). */
449
- unionPeek(uName: string): string;
541
+ * the runtime's is a static inline); a nullable union is its payload. */
542
+ unionPeek(uName: string, unionId: string): string;
450
543
  /** Emits `switch` over a union's tag with one block per arm; each arm
451
544
  * body must TERMINATE its block (the callers branch to a join). The
452
545
  * default block is the runtime ABI’s invalid-tag abort. Shared field
@@ -455,7 +548,7 @@ export declare class LlEmitter {
455
548
  /** The +1 extraction of a union's single narrowed arm (unionNarrow /
456
549
  * the nullish-family reads): scalars via inline payload loads, ref arms
457
550
  * a retained peek. */
458
- unionExtract(uName: string, arm: IrType): string;
551
+ unionExtract(uName: string, unionId: string, arm: IrType): string;
459
552
  /** A scalar f64 arm's payload (scr_union_get_f64 inlined). Inline loads
460
553
  * keep stack boxes free of escaping calls, so LLVM can scalarize them. */
461
554
  unionGetF64(uName: string): string;
@@ -464,7 +557,7 @@ export declare class LlEmitter {
464
557
  /** Constructs a union box around an OWNED (+1, already moved) value —
465
558
  * the scr_union_new_* dispatch of unionWrap and the wrap-into-join
466
559
  * sites (shift). */
467
- unionNewOwned(tag: number, v: LlValue): string;
560
+ unionNewOwned(unionId: string, tag: number, v: LlValue): string;
468
561
  classMetaOf(className: string): LlClassMeta;
469
562
  /** The field-slot pointer of a class member: rc at 0, the vtable word at
470
563
  * 1 on hierarchy members, then the flattened field list. Runtime error
@@ -497,6 +590,12 @@ export declare class LlEmitter {
497
590
  loadField(ptr: string, t: IrType): string;
498
591
  /** Stores a record field (i1 zext to the i8 storage). */
499
592
  storeField(ptr: string, t: IrType, value: string): void;
593
+ /** Reads an int32-specialized class field: the i32 slot is the value,
594
+ * and its widening is the exact double every program observation sees. */
595
+ loadInt32Field(ptr: string, type: IrType): LlValue;
596
+ /** Stores a value the whole-program analysis proved to be an int32 (never
597
+ * -0, NaN or fractional) into an int32-specialized class field. */
598
+ storeInt32Field(ptr: string, value: LlValue, expr: IrExpr): void;
500
599
  /** A binding's storage: a module global, a plain local slot, or a boxed
501
600
  * local (the slot holds the capture BOX; access goes through it). */
502
601
  binding(id: string): {
@@ -556,6 +655,9 @@ export declare class LlEmitter {
556
655
  * borrowing body. Ownership of other parameters moves into that body;
557
656
  * borrowed parameters are released here on normal and exceptional exits.
558
657
  * The pending exception remains for the adapter's caller to handle. */
658
+ /** With `kept`, the virtual adapter of a borrowing slot instead: the
659
+ * slot's parameters stay borrowed, the body's other borrowed ones are
660
+ * released here. */
559
661
  private emitOwnedCallAdapter;
560
662
  /** A local stable binding keeps its value alive while later arguments
561
663
  * and the callee execute. A proven local union box cannot escape or be
@@ -615,6 +717,22 @@ export declare class LlEmitter {
615
717
  emitBranchInto(slot: string, expr: IrExpr, integerSlot?: string): boolean;
616
718
  emitLiteralExpr(e: ExprOf<"numLit" | "boolLit" | "strLit" | "moduleNsRef" | "unitLit" | "varRef">): LlValue;
617
719
  emitOperatorExpr(e: ExprOf<"bin" | "unary" | "incDec" | "fieldIncDec" | "assignExpr" | "seqExpr">): LlValue;
720
+ /** Saved operands can feed later call arguments. Transfer ownership of a
721
+ * sequence's locals to this expression's frame so they survive those
722
+ * reads and still die on the path that created them, including inside
723
+ * lazy branches. */
724
+ private emitSequence;
725
+ /** A statement-position expression whose value is dropped. When a
726
+ * sequence's result only reads an unchanged local (a derived
727
+ * constructor's `super()` evaluates to `this`), its statements still run
728
+ * in place, but the result is neither retained nor released. */
729
+ /** Whether a discarded value can be skipped entirely: a borrowable read
730
+ * with no effect of its own. canBorrowCallArgument also accepts checked
731
+ * projections (a ternary or narrow whose failing arm throws, and the
732
+ * throwing call itself) because a borrowed use still evaluates them;
733
+ * skipping those would drop the throw. */
734
+ private discardableRead;
735
+ private emitDiscarded;
618
736
  emitControlExpr(e: ExprOf<"dynDestrCheck" | "dynIterN" | "toBool" | "logical" | "ternary" | "optChain" | "chainRecv" | "orDefault" | "nullish">): LlValue;
619
737
  emitStringExpr(e: ExprOf<"strConcat" | "strEq" | "strCmp" | "toString" | "strIntrinsic" | "regexLit" | "templateStrings" | "regexIntrinsic">): LlValue;
620
738
  /**
@@ -624,11 +742,39 @@ export declare class LlEmitter {
624
742
  * value, making the snapshot unique unless a real observable alias exists.
625
743
  */
626
744
  emitStringSelfConcatAssign(localId: string, left: IrExpr, suffix: IrExpr, retainForYield: boolean): LlValue;
745
+ /** `local = local + suffix` when the suffix cannot read or write the
746
+ * local (an unboxed binding is only reachable through this function's own
747
+ * expressions): reading the binding after the suffix gives the value the
748
+ * left side had, so it moves into a consuming concat, and the result takes
749
+ * its place. Null when the general snapshot path is needed. */
750
+ private emitMovedSelfConcat;
627
751
  emitContainerExpr(e: ExprOf<"arrayLit" | "arrayNewLen" | "arrayGet" | "arrayHas" | "arrayState" | "arrIntrinsic" | "bytesNew" | "bytesIntrinsic" | "mapNew" | "mapIntrinsic" | "setIntrinsic" | "setNew">): LlValue;
628
752
  emitCallExpr(e: ExprOf<"call" | "ffiCall" | "closure" | "callValue" | "selfRef" | "new" | "classRef" | "newValue" | "instanceOfValue" | "promiseVoidWiden" | "upcast" | "downcast" | "instanceOf" | "virtualCall">): LlValue;
629
753
  emitRecordExpr(e: ExprOf<"fieldGet" | "recordGet" | "recordLit" | "recordClone" | "recordKeyGet" | "recordOvfKeys" | "recordOvfHas" | "recordHas" | "fieldAbsent">): LlValue;
630
754
  emitDynamicExpr(e: ExprOf<"dynFrom" | "dynFromJsval" | "dynCall" | "dynInvoke" | "dynArrLit" | "dynObjLit" | "unionWrap" | "unionNarrow" | "unionDisc" | "unionKeyGet" | "unionIsTag" | "dynKeyGet" | "dynHasKey" | "dynScalarEq" | "dynTest" | "unionEq" | "unionFuncEq" | "caughtTest" | "caughtCheck" | "caughtNarrow" | "caughtToDyn">): LlValue;
631
755
  emitIntrinsicExpr(e: ExprOf<"intrinsic">): LlValue;
756
+ private publishWalkersCache;
757
+ /** Per-type publication walkers, created on the first publish. */
758
+ private get publishWalkers();
759
+ /** `publish(value)` (@scriptc/threads): makes the graph immortal and
760
+ * immutable (scr_publish with the static type's walker) and answers the
761
+ * same value. Throws (pending) when a dyn part is unpublishable. */
762
+ private emitPublish;
763
+ /** Branches on "`obj` is published" (rc == SIZE_MAX); leaves the builder
764
+ * in the cold block and answers the continuation label. */
765
+ private emitPublishedTest;
766
+ private publishedNamesSym;
767
+ /** The class-name table the hierarchy field guards index by preorder. */
768
+ private publishedClassNamesDefs;
769
+ /** The frozen-object guard of a class field or record field store:
770
+ * Node's "Cannot assign to read only property" TypeError when the target
771
+ * is published. `className` null means a record (`#<Object>`). */
772
+ emitPublishedFieldGuard(obj: string, className: string | null, field: string): void;
773
+ /** The frozen-array guard (scr_throw_published_array's ops): `index` and
774
+ * `count` are doubles (the written index, the argument count). */
775
+ emitPublishedArrayGuard(arr: string, arrType: IrType, op: number, index?: string, count?: string): void;
776
+ /** The published Map/Set guard: "Cannot modify a published Map/Set". */
777
+ emitPublishedCollectionGuard(m: string, t: IrType): void;
632
778
  emitSerializationExpr(e: ExprOf<"jsonStringify" | "dynCheck">): LlValue;
633
779
  emitAsyncExpr(e: ExprOf<"yieldExpr" | "genResume" | "awaitExpr" | "awaitUnionExpr" | "newPromise" | "promiseWithResolvers">): LlValue;
634
780
  emitJsInteropExpr(e: ExprOf<"jsMarshal" | "jsOp" | "jsExit" | "jsBridgePromise">): LlValue;
@@ -679,6 +825,33 @@ export declare class LlEmitter {
679
825
  * box must only be projected: never retained, released, or stored. */
680
826
  isStackUnionLocal(localId: string): boolean;
681
827
  canBorrowReceiver(e: IrExpr): boolean;
828
+ /** A reference held as one plain pointer that emitReadReceiver can read
829
+ * without owning: class instances, records, arrays, strings and
830
+ * nullable-pointer unions. Tagged union boxes, closures and dynamic
831
+ * values keep ordinary ownership. */
832
+ plainReference(type: IrType): boolean;
833
+ /** Functions returning a walk of their borrowed parameters return it
834
+ * without a reference (+0) from their borrowing body; direct callers
835
+ * either consume it as a receiver/walk or retain it at once, and the owned
836
+ * adapter retains before releasing its parameters. Candidates preserve
837
+ * every heap edge (so the result stays reachable from the arguments),
838
+ * borrow every reference parameter and return plain pointers. The set
839
+ * grows to a fixpoint because a call to a borrowed-return function with
840
+ * walk arguments is itself a walk; walk facts are then recomputed with
841
+ * the final set, admitting only parameters whose convention borrows. */
842
+ private analyzeBorrowedReturns;
843
+ /** emitReadReceiver produces this node's pointer without acquiring a
844
+ * reference, given operands (and ternary arms) that do the same: plain
845
+ * class/record field reads, class casts, nullable-pointer narrows and
846
+ * wraps, and checked ternaries. Stack-boxed, map-read and boxed-field
847
+ * sources are owned. Depends only on module facts, not the current
848
+ * function. */
849
+ borrowsWithoutOwning(e: IrExpr): boolean;
850
+ /** A wrap into a nullable-pointer union is the payload pointer itself
851
+ * (the reference arm) or an immortal constant (a unit arm), so it can
852
+ * borrow exactly when its payload can. Void payloads run for effects and
853
+ * keep the ordinary path; tagged unions still construct a box. */
854
+ borrowableNullableWrap(e: IrExpr): "unit" | "ref" | null;
682
855
  materializeSplitLocal(localId: string): void;
683
856
  emitExpr(e: IrExpr): LlValue;
684
857
  emitJsMarshal(e: IrExpr & {
@@ -740,7 +913,7 @@ export declare class LlEmitter {
740
913
  }): string;
741
914
  streamCbThunkFor(kind: "r" | "w" | "f" | "d" | "t" | "l" | "e", cbT: IrType): string;
742
915
  resolveThunkFor(inner: IrType): string;
743
- tagInSet(uName: string, tags: number[]): string;
916
+ tagInSet(uName: string, unionId: string, tags: number[]): string;
744
917
  arrPush(arr: string, acc: "f64" | "bool" | "ref", value: string): string;
745
918
  emitArrayCopyLoop(dst: string, src: string, acc: "f64" | "bool" | "ref"): void;
746
919
  emitStrIntrinsic(e: IrExpr & {
@@ -767,7 +940,7 @@ export declare class LlEmitter {
767
940
  emitBytesIndex(receiver: string, index: LlValue, expr?: IrExpr, inBounds?: boolean): string;
768
941
  emitBytesData(receiver: string): string;
769
942
  emitBytesLength(elem: IrBytesElem, receiver: string, bytes: boolean): LlValue;
770
- emitBytesGet(elem: IrBytesElem, receiver: string, index: LlValue, expr?: IrExpr, inBounds?: boolean): LlValue;
943
+ emitBytesGet(elem: IrBytesElem, receiver: string, index: LlValue, expr?: IrExpr, inBounds?: boolean, invalidNaN?: boolean): LlValue;
771
944
  emitToUint32(value: string, expr?: IrExpr, uint32?: string): string;
772
945
  storeIntegerView(localId: string, value: LlValue, expr?: IrExpr): void;
773
946
  private emitBytesSet;