@scriptc/compiler 0.0.35 → 0.1.1

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 (439) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +14 -11
  2. package/ambient/scriptc-overrides.d.ts +0 -7
  3. package/ambient/scriptc.d.ts +1 -1
  4. package/dist/backend/build-cache.d.ts +44 -0
  5. package/dist/backend/build-cache.js +241 -0
  6. package/dist/backend/build-cache.js.map +1 -0
  7. package/dist/backend/{emission/emit-async.d.ts → c/async.d.ts} +21 -30
  8. package/dist/backend/{emission/emit-async.js → c/async.js} +270 -286
  9. package/dist/backend/c/async.js.map +1 -0
  10. package/dist/backend/{emission/emitter.d.ts → c/c-emitter.d.ts} +6 -23
  11. package/dist/backend/{emission/emitter.js → c/c-emitter.js} +53 -107
  12. package/dist/backend/c/c-emitter.js.map +1 -0
  13. package/dist/backend/c/exprs.d.ts +8 -0
  14. package/dist/backend/c/exprs.js +7937 -0
  15. package/dist/backend/c/exprs.js.map +1 -0
  16. package/dist/backend/{emission/emit-island.d.ts → c/island.d.ts} +5 -5
  17. package/dist/backend/{emission/emit-island.js → c/island.js} +24 -22
  18. package/dist/backend/c/island.js.map +1 -0
  19. package/dist/backend/{emission → c}/may-throw.d.ts +1 -1
  20. package/dist/backend/{emission → c}/may-throw.js +4 -1
  21. package/dist/backend/c/may-throw.js.map +1 -0
  22. package/dist/backend/{emission/emit-shapes.d.ts → c/shapes.d.ts} +19 -19
  23. package/dist/backend/{emission/emit-shapes.js → c/shapes.js} +78 -87
  24. package/dist/backend/c/shapes.js.map +1 -0
  25. package/dist/backend/{emission/emit-stmts.d.ts → c/stmts.d.ts} +12 -12
  26. package/dist/backend/{emission/emit-stmts.js → c/stmts.js} +395 -343
  27. package/dist/backend/c/stmts.js.map +1 -0
  28. package/dist/backend/{emission/emit-types.d.ts → c/types.d.ts} +1 -1
  29. package/dist/backend/{emission/emit-types.js → c/types.js} +42 -286
  30. package/dist/backend/c/types.js.map +1 -0
  31. package/dist/backend/c/types.test.js +25 -0
  32. package/dist/backend/c/types.test.js.map +1 -0
  33. package/dist/backend/{emission/emit-walkers.d.ts → c/walkers.d.ts} +19 -41
  34. package/dist/backend/{emission/emit-walkers.js → c/walkers.js} +242 -304
  35. package/dist/backend/c/walkers.js.map +1 -0
  36. package/dist/backend/external-c.d.ts +33 -0
  37. package/dist/backend/external-c.js +51 -0
  38. package/dist/backend/external-c.js.map +1 -0
  39. package/dist/backend/ffi-callbacks.d.ts +1 -1
  40. package/dist/backend/ffi-callbacks.js +4 -3
  41. package/dist/backend/ffi-callbacks.js.map +1 -1
  42. package/dist/backend/{library-identity.d.ts → library-identity-markers.d.ts} +0 -4
  43. package/dist/backend/{library-identity.js → library-identity-markers.js} +10 -9
  44. package/dist/backend/library-identity-markers.js.map +1 -0
  45. package/dist/backend/link-plan.d.ts +37 -0
  46. package/dist/backend/link-plan.js +26 -0
  47. package/dist/backend/link-plan.js.map +1 -0
  48. package/dist/backend/linker.d.ts +22 -0
  49. package/dist/backend/linker.js +236 -0
  50. package/dist/backend/linker.js.map +1 -0
  51. package/dist/backend/llvm/blocks.d.ts +4 -0
  52. package/dist/backend/llvm/blocks.js +29 -0
  53. package/dist/backend/llvm/blocks.js.map +1 -1
  54. package/dist/backend/llvm/classes.d.ts +2 -19
  55. package/dist/backend/llvm/classes.js +20 -52
  56. package/dist/backend/llvm/classes.js.map +1 -1
  57. package/dist/backend/llvm/common.d.ts +4 -0
  58. package/dist/backend/llvm/common.js +27 -0
  59. package/dist/backend/llvm/common.js.map +1 -0
  60. package/dist/backend/llvm/dyn.d.ts +3 -8
  61. package/dist/backend/llvm/dyn.js +159 -224
  62. package/dist/backend/llvm/dyn.js.map +1 -1
  63. package/dist/backend/llvm/emitter.d.ts +4 -1
  64. package/dist/backend/llvm/emitter.js +548 -9988
  65. package/dist/backend/llvm/emitter.js.map +1 -1
  66. package/dist/backend/llvm/expr-async.d.ts +4 -0
  67. package/dist/backend/llvm/expr-async.js +726 -0
  68. package/dist/backend/llvm/expr-async.js.map +1 -0
  69. package/dist/backend/llvm/expr-bytes.d.ts +13 -0
  70. package/dist/backend/llvm/expr-bytes.js +456 -0
  71. package/dist/backend/llvm/expr-bytes.js.map +1 -0
  72. package/dist/backend/llvm/expr-callbacks.d.ts +22 -0
  73. package/dist/backend/llvm/expr-callbacks.js +520 -0
  74. package/dist/backend/llvm/expr-callbacks.js.map +1 -0
  75. package/dist/backend/llvm/expr-calls.d.ts +2 -0
  76. package/dist/backend/llvm/expr-calls.js +618 -0
  77. package/dist/backend/llvm/expr-calls.js.map +1 -0
  78. package/dist/backend/llvm/expr-containers.d.ts +25 -0
  79. package/dist/backend/llvm/expr-containers.js +637 -0
  80. package/dist/backend/llvm/expr-containers.js.map +1 -0
  81. package/dist/backend/llvm/expr-context.d.ts +255 -0
  82. package/dist/backend/llvm/expr-context.js +2 -0
  83. package/dist/backend/llvm/expr-context.js.map +1 -0
  84. package/dist/backend/llvm/expr-control.d.ts +2 -0
  85. package/dist/backend/llvm/expr-control.js +473 -0
  86. package/dist/backend/llvm/expr-control.js.map +1 -0
  87. package/dist/backend/llvm/expr-dispatch.d.ts +4 -0
  88. package/dist/backend/llvm/expr-dispatch.js +153 -0
  89. package/dist/backend/llvm/expr-dispatch.js.map +1 -0
  90. package/dist/backend/llvm/expr-dynamic.d.ts +2 -0
  91. package/dist/backend/llvm/expr-dynamic.js +810 -0
  92. package/dist/backend/llvm/expr-dynamic.js.map +1 -0
  93. package/dist/backend/llvm/expr-island.d.ts +15 -0
  94. package/dist/backend/llvm/expr-island.js +690 -0
  95. package/dist/backend/llvm/expr-island.js.map +1 -0
  96. package/dist/backend/llvm/expr-primitives.d.ts +6 -0
  97. package/dist/backend/llvm/expr-primitives.js +642 -0
  98. package/dist/backend/llvm/expr-primitives.js.map +1 -0
  99. package/dist/backend/llvm/expr-records.d.ts +9 -0
  100. package/dist/backend/llvm/expr-records.js +299 -0
  101. package/dist/backend/llvm/expr-records.js.map +1 -0
  102. package/dist/backend/llvm/expr-stream-bridges.d.ts +13 -0
  103. package/dist/backend/llvm/expr-stream-bridges.js +420 -0
  104. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -0
  105. package/dist/backend/llvm/expr-stream-callbacks.d.ts +12 -0
  106. package/dist/backend/llvm/expr-stream-callbacks.js +360 -0
  107. package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -0
  108. package/dist/backend/llvm/lib-dispatch.d.ts +5 -0
  109. package/dist/backend/llvm/lib-dispatch.js +267 -0
  110. package/dist/backend/llvm/lib-dispatch.js.map +1 -0
  111. package/dist/backend/llvm/lib-filesystem.d.ts +6 -0
  112. package/dist/backend/llvm/lib-filesystem.js +594 -0
  113. package/dist/backend/llvm/lib-filesystem.js.map +1 -0
  114. package/dist/backend/llvm/lib-network.d.ts +2 -0
  115. package/dist/backend/llvm/lib-network.js +429 -0
  116. package/dist/backend/llvm/lib-network.js.map +1 -0
  117. package/dist/backend/llvm/lib-process.d.ts +5 -0
  118. package/dist/backend/llvm/lib-process.js +585 -0
  119. package/dist/backend/llvm/lib-process.js.map +1 -0
  120. package/dist/backend/llvm/lib-shared.d.ts +6 -0
  121. package/dist/backend/llvm/lib-shared.js +687 -0
  122. package/dist/backend/llvm/lib-shared.js.map +1 -0
  123. package/dist/backend/llvm/lib-stream.d.ts +2 -0
  124. package/dist/backend/llvm/lib-stream.js +470 -0
  125. package/dist/backend/llvm/lib-stream.js.map +1 -0
  126. package/dist/backend/llvm/shapes.d.ts +12 -2
  127. package/dist/backend/llvm/shapes.js +66 -307
  128. package/dist/backend/llvm/shapes.js.map +1 -1
  129. package/dist/backend/llvm/shapes.test.js +52 -0
  130. package/dist/backend/llvm/shapes.test.js.map +1 -0
  131. package/dist/backend/llvm/unsupported.d.ts +1 -1
  132. package/dist/backend/llvm/walkers.d.ts +2 -3
  133. package/dist/backend/llvm/walkers.js +195 -222
  134. package/dist/backend/llvm/walkers.js.map +1 -1
  135. package/dist/backend/native-codegen.d.ts +45 -0
  136. package/dist/backend/native-codegen.js +275 -0
  137. package/dist/backend/native-codegen.js.map +1 -0
  138. package/dist/backend/native-codegen.test.js +226 -0
  139. package/dist/backend/native-codegen.test.js.map +1 -0
  140. package/dist/backend/native-link-info.d.ts +96 -0
  141. package/dist/backend/native-link-info.js +243 -0
  142. package/dist/backend/native-link-info.js.map +1 -0
  143. package/dist/backend/native-link-info.test.d.ts +1 -0
  144. package/dist/backend/native-link-info.test.js +134 -0
  145. package/dist/backend/native-link-info.test.js.map +1 -0
  146. package/dist/backend/{cc.d.ts → native-toolchain.d.ts} +54 -34
  147. package/dist/backend/{cc.js → native-toolchain.js} +231 -810
  148. package/dist/backend/native-toolchain.js.map +1 -0
  149. package/dist/backend/native-toolchain.test.d.ts +1 -0
  150. package/dist/backend/{cc-cache.test.js → native-toolchain.test.js} +219 -7
  151. package/dist/backend/native-toolchain.test.js.map +1 -0
  152. package/dist/backend/object-localize.js +1 -1
  153. package/dist/backend/runtime-abi.d.ts +10 -0
  154. package/dist/backend/runtime-abi.js +11 -0
  155. package/dist/backend/runtime-abi.js.map +1 -0
  156. package/dist/backend/runtime-pack-targets.test.d.ts +1 -0
  157. package/dist/backend/runtime-pack-targets.test.js +54 -0
  158. package/dist/backend/runtime-pack-targets.test.js.map +1 -0
  159. package/dist/backend/runtime-pack.d.ts +112 -0
  160. package/dist/backend/runtime-pack.js +305 -0
  161. package/dist/backend/runtime-pack.js.map +1 -0
  162. package/dist/backend/runtime-pack.test.d.ts +1 -0
  163. package/dist/backend/runtime-pack.test.js +473 -0
  164. package/dist/backend/runtime-pack.test.js.map +1 -0
  165. package/dist/backend/targets.d.ts +76 -0
  166. package/dist/backend/targets.js +262 -0
  167. package/dist/backend/targets.js.map +1 -0
  168. package/dist/backend/targets.test.d.ts +1 -0
  169. package/dist/backend/targets.test.js +41 -0
  170. package/dist/backend/targets.test.js.map +1 -0
  171. package/dist/backend/vendor-archives.d.ts +41 -0
  172. package/dist/backend/vendor-archives.js +462 -0
  173. package/dist/backend/vendor-archives.js.map +1 -0
  174. package/dist/compat/fetch-profile.d.ts +0 -1
  175. package/dist/compat/fetch-profile.js +0 -1
  176. package/dist/compat/fetch-profile.js.map +1 -1
  177. package/dist/coverage/report.js +3 -3
  178. package/dist/coverage/report.js.map +1 -1
  179. package/dist/coverage/surface-manifest.js +35 -33
  180. package/dist/coverage/surface-manifest.js.map +1 -1
  181. package/dist/diagnostics/diagnostic.d.ts +11 -12
  182. package/dist/diagnostics/diagnostic.js +19 -17
  183. package/dist/diagnostics/diagnostic.js.map +1 -1
  184. package/dist/diagnostics/render.d.ts +1 -1
  185. package/dist/diagnostics/render.js +1 -1
  186. package/dist/diagnostics/render.js.map +1 -1
  187. package/dist/errors.d.ts +5 -0
  188. package/dist/errors.js +9 -0
  189. package/dist/errors.js.map +1 -0
  190. package/dist/executable/{early-cache.d.ts → executable-cache.d.ts} +2 -2
  191. package/dist/executable/{early-cache.js → executable-cache.js} +36 -98
  192. package/dist/executable/executable-cache.js.map +1 -0
  193. package/dist/executable/executable-cache.test.d.ts +1 -0
  194. package/dist/executable/{early-cache.test.js → executable-cache.test.js} +3 -3
  195. package/dist/executable/executable-cache.test.js.map +1 -0
  196. package/dist/ffi/{profile.js → ffi-manifest.js} +1 -1
  197. package/dist/ffi/ffi-manifest.js.map +1 -0
  198. package/dist/frontend/builtin-modules.d.ts +21 -0
  199. package/dist/frontend/builtin-modules.js +82 -0
  200. package/dist/frontend/builtin-modules.js.map +1 -0
  201. package/dist/frontend/cjs-lexer.d.ts +7 -0
  202. package/dist/frontend/cjs-lexer.js +15 -17
  203. package/dist/frontend/cjs-lexer.js.map +1 -1
  204. package/dist/frontend/dts-paths.d.ts +26 -0
  205. package/dist/frontend/dts-paths.js +41 -0
  206. package/dist/frontend/dts-paths.js.map +1 -0
  207. package/dist/frontend/input-tracker.d.ts +0 -2
  208. package/dist/frontend/input-tracker.js +1 -4
  209. package/dist/frontend/input-tracker.js.map +1 -1
  210. package/dist/frontend/lib-contract.d.ts +1 -5
  211. package/dist/frontend/lib-contract.js +1 -1
  212. package/dist/frontend/lib-contract.js.map +1 -1
  213. package/dist/frontend/lib-exports.d.ts +1 -1
  214. package/dist/frontend/lowering/array-values.d.ts +8 -0
  215. package/dist/frontend/lowering/array-values.js +60 -0
  216. package/dist/frontend/lowering/array-values.js.map +1 -0
  217. package/dist/frontend/lowering/call-position.d.ts +4 -0
  218. package/dist/frontend/lowering/call-position.js +7 -0
  219. package/dist/frontend/lowering/call-position.js.map +1 -0
  220. package/dist/frontend/lowering/callback-arg.d.ts +20 -0
  221. package/dist/frontend/lowering/callback-arg.js +44 -0
  222. package/dist/frontend/lowering/callback-arg.js.map +1 -0
  223. package/dist/frontend/lowering/lib-boundary.d.ts +1 -1
  224. package/dist/frontend/lowering/lib-boundary.js +34 -34
  225. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  226. package/dist/frontend/lowering/lower-array-sort.d.ts +22 -0
  227. package/dist/frontend/lowering/lower-array-sort.js +619 -0
  228. package/dist/frontend/lowering/lower-array-sort.js.map +1 -0
  229. package/dist/frontend/lowering/lower-assert.d.ts +3 -3
  230. package/dist/frontend/lowering/lower-assert.js +214 -241
  231. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  232. package/dist/frontend/lowering/lower-builtins.d.ts +74 -146
  233. package/dist/frontend/lowering/lower-builtins.js +1285 -1233
  234. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  235. package/dist/frontend/lowering/lower-calls.d.ts +59 -192
  236. package/dist/frontend/lowering/lower-calls.js +1644 -1506
  237. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  238. package/dist/frontend/lowering/lower-classes.d.ts +62 -125
  239. package/dist/frontend/lowering/lower-classes.js +832 -866
  240. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  241. package/dist/frontend/lowering/lower-comptime.d.ts +5 -12
  242. package/dist/frontend/lowering/lower-comptime.js +32 -31
  243. package/dist/frontend/lowering/lower-comptime.js.map +1 -1
  244. package/dist/frontend/lowering/lower-containers.d.ts +35 -135
  245. package/dist/frontend/lowering/lower-containers.js +1984 -2227
  246. package/dist/frontend/lowering/lower-containers.js.map +1 -1
  247. package/dist/frontend/lowering/lower-dgram.d.ts +3 -7
  248. package/dist/frontend/lowering/lower-dgram.js +97 -111
  249. package/dist/frontend/lowering/lower-dgram.js.map +1 -1
  250. package/dist/frontend/lowering/lower-enums.d.ts +4 -4
  251. package/dist/frontend/lowering/lower-enums.js +30 -30
  252. package/dist/frontend/lowering/lower-enums.js.map +1 -1
  253. package/dist/frontend/lowering/{lower-emitter.d.ts → lower-event-emitter.d.ts} +7 -18
  254. package/dist/frontend/lowering/{lower-emitter.js → lower-event-emitter.js} +172 -174
  255. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -0
  256. package/dist/frontend/lowering/lower-expando.d.ts +5 -5
  257. package/dist/frontend/lowering/lower-expando.js +40 -40
  258. package/dist/frontend/lowering/lower-expando.js.map +1 -1
  259. package/dist/frontend/lowering/lower-exprs.d.ts +60 -264
  260. package/dist/frontend/lowering/lower-exprs.js +2361 -1765
  261. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  262. package/dist/frontend/lowering/lower-generators.d.ts +6 -6
  263. package/dist/frontend/lowering/lower-generators.js +73 -72
  264. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  265. package/dist/frontend/lowering/lower-inspect.d.ts +5 -17
  266. package/dist/frontend/lowering/lower-inspect.js +273 -261
  267. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  268. package/dist/frontend/lowering/lower-island.d.ts +39 -49
  269. package/dist/frontend/lowering/lower-island.js +447 -513
  270. package/dist/frontend/lowering/lower-island.js.map +1 -1
  271. package/dist/frontend/lowering/lower-mixins.d.ts +7 -10
  272. package/dist/frontend/lowering/lower-mixins.js +85 -85
  273. package/dist/frontend/lowering/lower-mixins.js.map +1 -1
  274. package/dist/frontend/lowering/lower-modules.d.ts +12 -18
  275. package/dist/frontend/lowering/lower-modules.js +284 -283
  276. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  277. package/dist/frontend/lowering/lower-namespaces.d.ts +23 -49
  278. package/dist/frontend/lowering/lower-namespaces.js +123 -115
  279. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  280. package/dist/frontend/lowering/lower-server.d.ts +18 -25
  281. package/dist/frontend/lowering/lower-server.js +909 -899
  282. package/dist/frontend/lowering/lower-server.js.map +1 -1
  283. package/dist/frontend/lowering/lower-stmts.d.ts +30 -149
  284. package/dist/frontend/lowering/lower-stmts.js +1463 -1285
  285. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  286. package/dist/frontend/lowering/lower-stream.d.ts +12 -12
  287. package/dist/frontend/lowering/lower-stream.js +300 -301
  288. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  289. package/dist/frontend/lowering/lower-test.d.ts +5 -5
  290. package/dist/frontend/lowering/lower-test.js +82 -82
  291. package/dist/frontend/lowering/lower-test.js.map +1 -1
  292. package/dist/frontend/lowering/lowerer.d.ts +134 -22
  293. package/dist/frontend/lowering/lowerer.js +1277 -126
  294. package/dist/frontend/lowering/lowerer.js.map +1 -1
  295. package/dist/frontend/lowering/pairs-snapshot.d.ts +11 -0
  296. package/dist/frontend/lowering/pairs-snapshot.js +85 -0
  297. package/dist/frontend/lowering/pairs-snapshot.js.map +1 -0
  298. package/dist/frontend/lowering/static-this.d.ts +6 -0
  299. package/dist/frontend/lowering/static-this.js +24 -0
  300. package/dist/frontend/lowering/static-this.js.map +1 -0
  301. package/dist/frontend/lowering/surfaces.d.ts +24 -35
  302. package/dist/frontend/lowering/surfaces.js +78 -66
  303. package/dist/frontend/lowering/surfaces.js.map +1 -1
  304. package/dist/frontend/npm-static-rewrite.js +6 -28
  305. package/dist/frontend/npm-static-rewrite.js.map +1 -1
  306. package/dist/frontend/npm-static.d.ts +0 -10
  307. package/dist/frontend/npm-static.js +4 -7
  308. package/dist/frontend/npm-static.js.map +1 -1
  309. package/dist/frontend/npm.d.ts +0 -24
  310. package/dist/frontend/npm.js +11 -85
  311. package/dist/frontend/npm.js.map +1 -1
  312. package/dist/frontend/program.d.ts +3 -1
  313. package/dist/frontend/program.js +9 -4
  314. package/dist/frontend/program.js.map +1 -1
  315. package/dist/frontend/provenance-registry.d.ts +0 -2
  316. package/dist/frontend/provenance-registry.js +0 -10
  317. package/dist/frontend/provenance-registry.js.map +1 -1
  318. package/dist/frontend/provenance.js +4 -7
  319. package/dist/frontend/provenance.js.map +1 -1
  320. package/dist/frontend/resolve.d.ts +7 -2
  321. package/dist/frontend/resolve.js +12 -17
  322. package/dist/frontend/resolve.js.map +1 -1
  323. package/dist/frontend/resolve.test.d.ts +1 -0
  324. package/dist/frontend/resolve.test.js +29 -0
  325. package/dist/frontend/resolve.test.js.map +1 -0
  326. package/dist/frontend/ts7/adapter.d.ts +2 -2
  327. package/dist/frontend/ts7/adapter.js +1 -1
  328. package/dist/frontend/ts7/adapter.js.map +1 -1
  329. package/dist/frontend/ts7/checker.js +2 -36
  330. package/dist/frontend/ts7/checker.js.map +1 -1
  331. package/dist/frontend/ts7/enums.js +2 -1
  332. package/dist/frontend/ts7/enums.js.map +1 -1
  333. package/dist/frontend/ts7/{program.js → program-adapter.js} +7 -6
  334. package/dist/frontend/ts7/program-adapter.js.map +1 -0
  335. package/dist/frontend/ts7/world-check.d.ts +1 -3
  336. package/dist/frontend/ts7/world-check.js +3 -1
  337. package/dist/frontend/ts7/world-check.js.map +1 -1
  338. package/dist/frontend/tsc-codes.d.ts +8 -0
  339. package/dist/frontend/tsc-codes.js +109 -0
  340. package/dist/frontend/tsc-codes.js.map +1 -0
  341. package/dist/frontend/{types.d.ts → type-mapper.d.ts} +2 -25
  342. package/dist/frontend/{types.js → type-mapper.js} +12 -11
  343. package/dist/frontend/type-mapper.js.map +1 -0
  344. package/dist/frontend/workspace-registry.d.ts +26 -0
  345. package/dist/frontend/workspace-registry.js +71 -0
  346. package/dist/frontend/workspace-registry.js.map +1 -0
  347. package/dist/index.d.ts +113 -31
  348. package/dist/index.js +536 -128
  349. package/dist/index.js.map +1 -1
  350. package/dist/ir/analysis.d.ts +37 -0
  351. package/dist/ir/analysis.js +118 -0
  352. package/dist/ir/analysis.js.map +1 -0
  353. package/dist/ir/analysis.test.d.ts +1 -0
  354. package/dist/ir/analysis.test.js +21 -0
  355. package/dist/ir/analysis.test.js.map +1 -0
  356. package/dist/ir/build.d.ts +9 -0
  357. package/dist/ir/build.js +33 -0
  358. package/dist/ir/build.js.map +1 -0
  359. package/dist/ir/integer-loops.d.ts +1 -1
  360. package/dist/ir/{nodes.d.ts → ir.d.ts} +119 -37
  361. package/dist/ir/{nodes.js → ir.js} +170 -166
  362. package/dist/ir/ir.js.map +1 -0
  363. package/dist/ir/ir.test.d.ts +1 -0
  364. package/dist/ir/ir.test.js +17 -0
  365. package/dist/ir/ir.test.js.map +1 -0
  366. package/dist/ir/serialize.d.ts +2 -2
  367. package/dist/ir/serialize.js +3 -2
  368. package/dist/ir/serialize.js.map +1 -1
  369. package/dist/ir/validate.d.ts +1 -1
  370. package/dist/ir/validate.js +93 -41
  371. package/dist/ir/validate.js.map +1 -1
  372. package/dist/library/cache-primitives.d.ts +24 -0
  373. package/dist/library/cache-primitives.js +83 -0
  374. package/dist/library/cache-primitives.js.map +1 -0
  375. package/dist/library/cache-reset.test.d.ts +1 -0
  376. package/dist/library/cache-reset.test.js +47 -0
  377. package/dist/library/cache-reset.test.js.map +1 -0
  378. package/dist/library/{implementation-identity.js → compiler-self-identity.js} +1 -1
  379. package/dist/library/compiler-self-identity.js.map +1 -0
  380. package/dist/library/fence-eval.d.ts +3 -1
  381. package/dist/library/fence-eval.js +8 -2
  382. package/dist/library/fence-eval.js.map +1 -1
  383. package/dist/library/int-infer.d.ts +1 -36
  384. package/dist/library/int-infer.js +29 -18
  385. package/dist/library/int-infer.js.map +1 -1
  386. package/dist/library/int-infer.test.js +4 -4
  387. package/dist/library/{early-cache.d.ts → library-cache.d.ts} +1 -1
  388. package/dist/library/{early-cache.js → library-cache.js} +34 -89
  389. package/dist/library/library-cache.js.map +1 -0
  390. package/dist/library/library-cache.test.d.ts +1 -0
  391. package/dist/library/{early-cache.test.js → library-cache.test.js} +7 -7
  392. package/dist/library/library-cache.test.js.map +1 -0
  393. package/dist/library/{profile.d.ts → library-profile.d.ts} +4 -7
  394. package/dist/library/{profile.js → library-profile.js} +18 -11
  395. package/dist/library/library-profile.js.map +1 -0
  396. package/dist/library/semantic-source.js +2 -1
  397. package/dist/library/semantic-source.js.map +1 -1
  398. package/dist/library/sidecar.d.ts +5 -2
  399. package/dist/library/sidecar.js +11 -5
  400. package/dist/library/sidecar.js.map +1 -1
  401. package/dist/startup-cache.d.ts +11 -3
  402. package/dist/startup-cache.js +17 -2
  403. package/dist/startup-cache.js.map +1 -1
  404. package/package.json +19 -2
  405. package/surface-manifest.json +5 -5
  406. package/dist/backend/cc-cache.test.js.map +0 -1
  407. package/dist/backend/cc.js.map +0 -1
  408. package/dist/backend/emission/emit-async.js.map +0 -1
  409. package/dist/backend/emission/emit-exprs.d.ts +0 -13
  410. package/dist/backend/emission/emit-exprs.js +0 -7407
  411. package/dist/backend/emission/emit-exprs.js.map +0 -1
  412. package/dist/backend/emission/emit-island.js.map +0 -1
  413. package/dist/backend/emission/emit-shapes.js.map +0 -1
  414. package/dist/backend/emission/emit-stmts.js.map +0 -1
  415. package/dist/backend/emission/emit-types.js.map +0 -1
  416. package/dist/backend/emission/emit-walkers.js.map +0 -1
  417. package/dist/backend/emission/emitter.js.map +0 -1
  418. package/dist/backend/emission/may-throw.js.map +0 -1
  419. package/dist/backend/library-identity.js.map +0 -1
  420. package/dist/executable/early-cache.js.map +0 -1
  421. package/dist/executable/early-cache.test.js.map +0 -1
  422. package/dist/ffi/profile.js.map +0 -1
  423. package/dist/frontend/lowering/lower-emitter.js.map +0 -1
  424. package/dist/frontend/shared.d.ts +0 -82
  425. package/dist/frontend/shared.js +0 -308
  426. package/dist/frontend/shared.js.map +0 -1
  427. package/dist/frontend/ts7/program.js.map +0 -1
  428. package/dist/frontend/types.js.map +0 -1
  429. package/dist/ir/nodes.js.map +0 -1
  430. package/dist/library/early-cache.js.map +0 -1
  431. package/dist/library/early-cache.test.js.map +0 -1
  432. package/dist/library/implementation-identity.js.map +0 -1
  433. package/dist/library/profile.js.map +0 -1
  434. /package/dist/backend/{cc-cache.test.d.ts → c/types.test.d.ts} +0 -0
  435. /package/dist/{executable/early-cache.test.d.ts → backend/llvm/shapes.test.d.ts} +0 -0
  436. /package/dist/{library/early-cache.test.d.ts → backend/native-codegen.test.d.ts} +0 -0
  437. /package/dist/ffi/{profile.d.ts → ffi-manifest.d.ts} +0 -0
  438. /package/dist/frontend/ts7/{program.d.ts → program-adapter.d.ts} +0 -0
  439. /package/dist/library/{implementation-identity.d.ts → compiler-self-identity.d.ts} +0 -0
@@ -1,18 +1,119 @@
1
- /* scriptc IR — the only interface between frontend and backends.
2
- *
3
- * Design rules (see docs/ir.md for node-by-node semantics):
4
- * - Plain JSON-safe discriminated unions: no classes, no parent pointers,
5
- * no cycles. Cross-references are by string id.
6
- * - Every node carries `loc` (source span) and every expression carries its
7
- * computed `type` — backends never re-derive types.
8
- * - Structured control flow (statement tree), not basic blocks: the only
9
- * current backend is C and there are no optimization passes yet. When a mid-end
10
- * arrives, a structured→CFG lowering pass slots in after validation.
11
- * - The type union is deliberately written for extension (`dyn` shipped
12
- * with JSON, `promise` with async). All switches over IrType/IrExpr/
13
- * IrStmt must have exhaustive `never` default arms so adding a member
14
- * turns into compile errors, not silent misbehavior.
15
- */
1
+ import { InternalCompilerError } from "../errors.js";
2
+ const POINTER_HANDLE_KINDS = [
3
+ "stats",
4
+ "fileHandle",
5
+ "spawnRes",
6
+ "child",
7
+ "netServer",
8
+ "netSocket",
9
+ "http2Session",
10
+ "http2Stream",
11
+ "dgramSocket",
12
+ "testCtx",
13
+ "httpReq",
14
+ "httpRes",
15
+ "httpClientReq",
16
+ "secureCtx",
17
+ "fsWatcher",
18
+ "childStream",
19
+ ];
20
+ function irKindSet(kinds) {
21
+ return new Set(kinds);
22
+ }
23
+ /** The opaque runtime handle kinds. procStream is the one scalar handle;
24
+ * every other handle has pointer representation. */
25
+ const HANDLE_KIND_LIST = [
26
+ ...POINTER_HANDLE_KINDS,
27
+ "procStream",
28
+ ];
29
+ export const HANDLE_KINDS = irKindSet(HANDLE_KIND_LIST);
30
+ /** The IR kinds represented as pointers in both native backends. */
31
+ const POINTER_KIND_LIST = [
32
+ "string",
33
+ "array",
34
+ "map",
35
+ "set",
36
+ "regex",
37
+ "bytes",
38
+ "url",
39
+ "searchParams",
40
+ "symbol",
41
+ ...POINTER_HANDLE_KINDS,
42
+ "func",
43
+ "object",
44
+ "classval",
45
+ "record",
46
+ "union",
47
+ "dyn",
48
+ "jsval",
49
+ "caught",
50
+ "promise",
51
+ "generator",
52
+ ];
53
+ export const POINTER_KINDS = irKindSet(POINTER_KIND_LIST);
54
+ /** Runtime RC symbol stem for each IR type kind. An empty stem means the
55
+ * kind is scalar/unit or uses an emitted per-shape helper (object/record).
56
+ * Keeping this exhaustive makes a new runtime handle kind a compile error
57
+ * until its one retain/release family is named here. */
58
+ export const RUNTIME_RC_STEMS = {
59
+ f64: "",
60
+ date: "",
61
+ string: "scr_str",
62
+ bool: "",
63
+ array: "scr_arr",
64
+ map: "scr_map",
65
+ set: "scr_map",
66
+ regex: "scr_regex",
67
+ bytes: "scr_bytes",
68
+ url: "scr_url",
69
+ searchParams: "scr_sp",
70
+ symbol: "scr_sym",
71
+ stats: "scr_stats",
72
+ fileHandle: "scr_file_handle",
73
+ spawnRes: "scr_spawn_res",
74
+ child: "scr_child",
75
+ netServer: "scr_net_server",
76
+ netSocket: "scr_net_sock",
77
+ http2Session: "scr_http2_session",
78
+ http2Stream: "scr_http2_stream",
79
+ dgramSocket: "scr_dgram",
80
+ testCtx: "scr_testctx",
81
+ httpReq: "scr_http_req",
82
+ httpRes: "scr_http_res",
83
+ httpClientReq: "scr_http_client",
84
+ childStream: "scr_child_stream",
85
+ procStream: "",
86
+ fsWatcher: "scr_watcher",
87
+ secureCtx: "scr_secure_ctx",
88
+ func: "scr_closure",
89
+ object: "",
90
+ classval: "scr_classobj",
91
+ record: "",
92
+ union: "scr_union",
93
+ dyn: "scr_dyn",
94
+ jsval: "scr_jsval",
95
+ caught: "scr_caught",
96
+ promise: "scr_promise",
97
+ generator: "scr_gen",
98
+ undefinedT: "",
99
+ nullT: "",
100
+ void: "",
101
+ };
102
+ /** The runtime-provided RC family for a type, or null when the backend must
103
+ * use an emitted class/record helper (or the type is not refcounted). */
104
+ export function runtimeRcStem(t) {
105
+ if (t.kind === "object") {
106
+ if (RUNTIME_ERROR_CLASSES.has(t.className))
107
+ return "scr_error";
108
+ if (t.className === RUNTIME_EMITTER_CLASS)
109
+ return "scr_emitter";
110
+ if (RUNTIME_STREAM_CLASSES.has(t.className))
111
+ return "scr_stream";
112
+ return null;
113
+ }
114
+ const stem = RUNTIME_RC_STEMS[t.kind];
115
+ return stem === "" ? null : stem;
116
+ }
16
117
  /** The ref kinds whose values are JS OBJECTS for truthiness: always true
17
118
  * ([] and {} included) — toBool accepts them (the operand still evaluates;
18
119
  * the test is constant), and per-union truthiness helpers answer their
@@ -224,6 +325,8 @@ export function unionFuncSetArmsOk(arms) {
224
325
  * canonical) shapeId/unionId, so keys stay finite and comparable. Lives in
225
326
  * the IR (not the frontend) because both ends need it. */
226
327
  export function typeKey(t) {
328
+ if (HANDLE_KINDS.has(t.kind))
329
+ return t.kind;
227
330
  switch (t.kind) {
228
331
  case "f64":
229
332
  case "date":
@@ -233,23 +336,6 @@ export function typeKey(t) {
233
336
  case "url":
234
337
  case "searchParams":
235
338
  case "symbol":
236
- case "stats":
237
- case "fileHandle":
238
- case "spawnRes":
239
- case "child":
240
- case "netServer":
241
- case "netSocket":
242
- case "http2Session":
243
- case "http2Stream":
244
- case "dgramSocket":
245
- case "testCtx":
246
- case "httpReq":
247
- case "httpRes":
248
- case "httpClientReq":
249
- case "secureCtx":
250
- case "fsWatcher":
251
- case "childStream":
252
- case "procStream":
253
339
  case "dyn":
254
340
  case "jsval":
255
341
  case "caught":
@@ -284,7 +370,7 @@ export function typeKey(t) {
284
370
  default: {
285
371
  const _exhaustive = t;
286
372
  void _exhaustive;
287
- throw new Error("unreachable");
373
+ throw new InternalCompilerError("unreachable");
288
374
  }
289
375
  }
290
376
  }
@@ -332,74 +418,7 @@ export function typeEquals(a, b) {
332
418
  * this — adding a refcounted kind must not grow new per-kind checks outside
333
419
  * the type-directed helpers. */
334
420
  export function isRefCounted(t) {
335
- return (t.kind === "string" ||
336
- t.kind === "array" ||
337
- t.kind === "map" ||
338
- t.kind === "set" ||
339
- // Every regex value is an immortal interned literal today, so its
340
- // retains/releases are no-ops — riding the uniform machinery anyway
341
- // means dynamic construction can arrive without a redesign.
342
- t.kind === "regex" ||
343
- // URL, Stats, and spawnSync-result instances are ordinary refcounted
344
- // heap values (immutable, no cycles — strings/scalars inside only).
345
- t.kind === "url" ||
346
- // URLSearchParams lists are ordinary refcounted heap values (strings
347
- // plus at most the owning-URL edge — no cycles).
348
- t.kind === "searchParams" ||
349
- // Symbols are the same story: immutable identity values holding at
350
- // most two strings.
351
- t.kind === "symbol" ||
352
- t.kind === "stats" ||
353
- t.kind === "fileHandle" ||
354
- t.kind === "spawnRes" ||
355
- t.kind === "child" ||
356
- // net handles are refcounted like child (listeners drop at settle,
357
- // so lean allocation — see the IrType comment).
358
- t.kind === "netServer" ||
359
- t.kind === "netSocket" ||
360
- // h2 sessions/streams are refcounted like the net pair (listeners
361
- // drop at settlement; the session→stream↔session cycle breaks there).
362
- t.kind === "http2Session" ||
363
- t.kind === "http2Stream" ||
364
- t.kind === "dgramSocket" ||
365
- // TestContext handles are refcounted like dgramSocket (the runner
366
- // tree owns children; no cycles through the handle).
367
- t.kind === "testCtx" ||
368
- t.kind === "httpReq" ||
369
- t.kind === "httpRes" ||
370
- t.kind === "httpClientReq" ||
371
- // SecureContext handles are refcounted like url/stats (immutable, no
372
- // cycles — parsed cert/key material inside only).
373
- t.kind === "secureCtx" ||
374
- // FSWatcher handles are refcounted like child (listeners drop at
375
- // close, so lean allocation — see the IrType comment).
376
- t.kind === "fsWatcher" ||
377
- // Child-output streams are refcounted like child (listeners drop at
378
- // EOF — see the IrType comment).
379
- t.kind === "childStream" ||
380
- // Typed arrays / Buffers are ordinary refcounted heap values (mutable,
381
- // no cycles — raw bytes inside only).
382
- t.kind === "bytes" ||
383
- t.kind === "func" ||
384
- t.kind === "object" ||
385
- // Every class object is an immortal emitted static, so its
386
- // retains/releases are no-ops — riding the uniform machinery (the
387
- // regex-literal stance) keeps every container and box path unchanged.
388
- t.kind === "classval" ||
389
- t.kind === "record" ||
390
- // The union CONTAINER is heap/refcounted regardless of which arm it
391
- // holds (uniform representation keeps the RC discipline simple).
392
- t.kind === "union" ||
393
- t.kind === "promise" ||
394
- // A generator object is a refcounted handle over its paused fiber and
395
- // typed channel slots (ScrGen — lean allocation, no cycle header).
396
- t.kind === "generator" ||
397
- // A dyn value is a refcounted JSON dyn tree (ScrDyn).
398
- t.kind === "dyn" ||
399
- // An island value is a refcounted cell owning one engine value.
400
- t.kind === "jsval" ||
401
- // A catch binding is a refcounted snapshot box (ScrCaught).
402
- t.kind === "caught");
421
+ return RUNTIME_RC_STEMS[t.kind] !== "" || t.kind === "object" || t.kind === "record";
403
422
  }
404
423
  export function isFfiCallbackParam(param) {
405
424
  return typeof param === "object" && "callback" in param && "id" in param.callback;
@@ -529,6 +548,7 @@ export function shapeHasAccessorSlots(shape) {
529
548
  * exception (rather than the static tier's deliberate index traps). */
530
549
  export const MAY_THROW_ARR_METHODS = new Set([
531
550
  "with",
551
+ "withUndefined",
532
552
  ]);
533
553
  /** The bytesIntrinsic methods that can raise a catchable error — backends'
534
554
  * may-throw analyses seed on these exactly like MAY_THROW_LIB_FNS. */
@@ -618,7 +638,7 @@ export function jsOpResultKind(op) {
618
638
  default: {
619
639
  const _exhaustive = op;
620
640
  void _exhaustive;
621
- throw new Error("unreachable");
641
+ throw new InternalCompilerError("unreachable");
622
642
  }
623
643
  }
624
644
  }
@@ -648,24 +668,28 @@ export function isUndefinedArmedUnion(t, getUnion) {
648
668
  * every reachable constituent is; a cyclic VALUE of such a type throws
649
669
  * Node's circular-structure TypeError at runtime instead. */
650
670
  export function isJsonSafeType(t, getRecord, getUnion) {
651
- return isJsonSafeAt(t, getRecord, getUnion, false, new Set());
652
- }
653
- /** The recursion behind isJsonSafeType. `inRecordField` is the ONE position
654
- * where an undefined arm is JSON-representable: an undefined-armed union as
655
- * a record field (the `a?: T` spelling) serializes by DROPPING the field
656
- * when it holds undefined and validates a MISSING key as the undefined arm
657
- * — both exactly Node. Everywhere else (a bare `T | undefined` value,
658
- * stringified whole or cast to) exactness is unreachable: Node's stringify
659
- * of bare undefined is not a string at all, and JSON text can never contain
660
- * a value that matches the arm. */
661
- function isJsonSafeAt(t, getRecord, getUnion, inRecordField, visiting) {
671
+ return isJsonSafeAt(t, getRecord, getUnion, false, false, new Set());
672
+ }
673
+ /** The JSON.stringify-only domain additionally admits undefined arms in
674
+ * array and tuple positions, where Node emits null. A bare undefined-armed
675
+ * root remains outside the domain because JSON.stringify returns the
676
+ * undefined value instead of a string. */
677
+ export function isJsonStringifySafeType(t, getRecord, getUnion) {
678
+ return isJsonSafeAt(t, getRecord, getUnion, true, false, new Set());
679
+ }
680
+ /** The recursion shared by checked JSON conversion and stringification.
681
+ * Ordinary record fields always admit undefined by dropping the key. Array
682
+ * and tuple slots admit it only for stringification, which writes null. */
683
+ function isJsonSafeAt(t, getRecord, getUnion, stringify, undefinedAllowed, visiting) {
684
+ if (HANDLE_KINDS.has(t.kind))
685
+ return false;
662
686
  switch (t.kind) {
663
687
  case "f64":
664
688
  case "string":
665
689
  case "bool":
666
690
  return true;
667
691
  case "array":
668
- return isJsonSafeAt(t.elem, getRecord, getUnion, false, visiting);
692
+ return isJsonSafeAt(t.elem, getRecord, getUnion, stringify, stringify, visiting);
669
693
  case "record": {
670
694
  const shape = getRecord(t.shapeId);
671
695
  if (!shape)
@@ -676,10 +700,7 @@ function isJsonSafeAt(t, getRecord, getUnion, inRecordField, visiting) {
676
700
  if (visiting.has(t.shapeId))
677
701
  return true;
678
702
  visiting.add(t.shapeId);
679
- // TUPLE positions are array slots, not droppable object keys: an
680
- // undefined-armed position would stringify as `null` in JS (not
681
- // drop), so tuples keep the array rule for their fields.
682
- if (!shape.fields.every((f) => isJsonSafeAt(f.type, getRecord, getUnion, !shape.tuple, visiting))) {
703
+ if (!shape.fields.every((f) => isJsonSafeAt(f.type, getRecord, getUnion, stringify, !shape.tuple || stringify, visiting))) {
683
704
  return false;
684
705
  }
685
706
  // Overflow values sit in record-key position too: dyn is JSON-safe
@@ -687,7 +708,7 @@ function isJsonSafeAt(t, getRecord, getUnion, inRecordField, visiting) {
687
708
  // like any undefined-valued key), everything else follows the
688
709
  // record-field rule.
689
710
  if (shape.indexValue && shape.indexValue.kind !== "dyn") {
690
- return isJsonSafeAt(shape.indexValue, getRecord, getUnion, true, visiting);
711
+ return isJsonSafeAt(shape.indexValue, getRecord, getUnion, stringify, true, visiting);
691
712
  }
692
713
  return true;
693
714
  }
@@ -695,11 +716,11 @@ function isJsonSafeAt(t, getRecord, getUnion, inRecordField, visiting) {
695
716
  const def = getUnion(t.unionId);
696
717
  if (!def)
697
718
  return false;
698
- const key = `${t.unionId}:${inRecordField}`;
719
+ const key = `${t.unionId}:${stringify}:${undefinedAllowed}`;
699
720
  if (visiting.has(key))
700
721
  return true; // the recursive knot, union-flavored
701
722
  visiting.add(key);
702
- return def.arms.every((a) => isJsonSafeAt(a, getRecord, getUnion, inRecordField, visiting));
723
+ return def.arms.every((a) => a.kind === "undefinedT" ? undefinedAllowed : isJsonSafeAt(a, getRecord, getUnion, stringify, undefinedAllowed, visiting));
703
724
  }
704
725
  case "func":
705
726
  case "object":
@@ -728,23 +749,6 @@ function isJsonSafeAt(t, getRecord, getUnion, inRecordField, visiting) {
728
749
  // Buffers as {type:"Buffer",data:[...]} in Node — neither shape is
729
750
  // representable type-directedly; rejected like Maps.
730
751
  case "bytes":
731
- case "stats":
732
- case "fileHandle":
733
- case "spawnRes":
734
- case "child":
735
- case "netServer":
736
- case "netSocket":
737
- case "http2Session":
738
- case "http2Stream":
739
- case "dgramSocket":
740
- case "testCtx":
741
- case "httpReq":
742
- case "httpRes":
743
- case "httpClientReq":
744
- case "secureCtx":
745
- case "fsWatcher":
746
- case "childStream":
747
- case "procStream":
748
752
  case "dyn":
749
753
  case "jsval":
750
754
  case "caught":
@@ -752,12 +756,10 @@ function isJsonSafeAt(t, getRecord, getUnion, inRecordField, visiting) {
752
756
  case "generator":
753
757
  case "void":
754
758
  return false;
755
- // Representable exactly as a union arm in record-field position (the
756
- // optional-field story above); bare undefined-armed unions stay fenced
757
- // out of both stringify and dynCheck (narrow with '!== undefined'
758
- // first, or model absence with a null arm).
759
+ // Record fields drop undefined. Stringification also represents it in
760
+ // array and tuple slots as null; bare roots remain fenced.
759
761
  case "undefinedT":
760
- return inRecordField;
762
+ return undefinedAllowed;
761
763
  // JSON null ↔ the nullT arm: null-armed unions stringify (`null`) and
762
764
  // validate (a JSON null matches exactly the nullT arm).
763
765
  case "nullT":
@@ -765,7 +767,7 @@ function isJsonSafeAt(t, getRecord, getUnion, inRecordField, visiting) {
765
767
  default: {
766
768
  const _exhaustive = t;
767
769
  void _exhaustive;
768
- throw new Error("unreachable");
770
+ throw new InternalCompilerError("unreachable");
769
771
  }
770
772
  }
771
773
  }
@@ -1126,7 +1128,7 @@ export function canExitIslandToType(t, getRecord, getUnion) {
1126
1128
  /** True when the module contains any regex construct — a regexLit /
1127
1129
  * regexIntrinsic node or a regex-typed slot anywhere. This is the link
1128
1130
  * switch that pulls scr_regex.c + the vendored libregexp into the binary
1129
- * (cc.ts); regex-free programs keep the historical command line. A generic
1131
+ * (native-toolchain.ts); regex-free programs keep the historical command line. A generic
1130
1132
  * JSON walk: `kind` discriminants live only on IR objects, so user string
1131
1133
  * VALUES can never false-positive. */
1132
1134
  export function moduleUsesRegex(mod) {
@@ -1182,7 +1184,8 @@ export function moduleUsesCopying(mod) {
1182
1184
  if (node.kind === "arrIntrinsic" &&
1183
1185
  (node.method === "toReversed" ||
1184
1186
  node.method === "toSpliced" ||
1185
- node.method === "with")) {
1187
+ node.method === "with" ||
1188
+ node.method === "withUndefined")) {
1186
1189
  found = true;
1187
1190
  return;
1188
1191
  }
@@ -1249,7 +1252,7 @@ export function moduleUsesFileHandle(mod) {
1249
1252
  }
1250
1253
  /** True when user code lowers static fetch or the embedded npm graph
1251
1254
  * reaches the engine's global fetch — the link switch that pulls scr_fetch.c +
1252
- * its socket/tls/zlib dependencies into the binary (cc.ts) and has the
1255
+ * its socket/tls/zlib dependencies into the binary (native-toolchain.ts) and has the
1253
1256
  * emitted main call scr_fetch_install. The npm graph records the embedded
1254
1257
  * source fact with a parser + binder, so comments, strings, property names,
1255
1258
  * and local `fetch` bindings do not change the link or target capability.
@@ -1301,7 +1304,7 @@ const PROCESS_EVENT_LIB_FNS = new Set([
1301
1304
  ]);
1302
1305
  /** True when the module uses the process-events surface — the link switch
1303
1306
  * that pulls scr_events.c into the binary and has the emitted main call
1304
- * scr_events_install (cc.ts + emitter; the scr_regex/scr_fetch/scr_zlib
1307
+ * scr_events_install (native-toolchain.ts + emitter; the scr_regex/scr_fetch/scr_zlib
1305
1308
  * gating precedent). Event-free programs pay zero bytes and keep their
1306
1309
  * exact link line. Same generic-walk shape as moduleUsesRegex. */
1307
1310
  export function moduleUsesProcessEvents(mod) {
@@ -1326,7 +1329,7 @@ export function moduleUsesProcessEvents(mod) {
1326
1329
  return found;
1327
1330
  }
1328
1331
  /** True when the module uses the node:events EventEmitter surface — the
1329
- * link switch that pulls scr_events_emitter.c into the binary (cc.ts; the
1332
+ * link switch that pulls scr_events_emitter.c into the binary (native-toolchain.ts; the
1330
1333
  * scr_events.c gating precedent, but pure data structure: no install, no
1331
1334
  * loop hooks). Two signals: the `%EventEmitter` class def rides the
1332
1335
  * module (any emitter-typed value or `extends EventEmitter` subclass
@@ -1403,12 +1406,12 @@ export function moduleEmbedsBuiltin(mod, builtin) {
1403
1406
  return mod.embedded !== undefined && mod.embedded.edges.some((e) => e.to === builtin);
1404
1407
  }
1405
1408
  /** Embedded module texts at least this long are DEFLATE-compressed into
1406
- * the emitted C (emit-island.ts; each stays plain when deflate does not
1409
+ * the emitted C (island.ts; each stays plain when deflate does not
1407
1410
  * shrink it) and inflated lazily by the island's module loader at first
1408
1411
  * load. Below it the zlib round trip cannot pay for itself. */
1409
1412
  export const NPM_COMPRESS_MIN = 1024;
1410
1413
  /** True when the emitted npm tables will carry compressed module text —
1411
- * the SAME candidate test emit-island.ts compresses by, so index.ts's
1414
+ * the SAME candidate test island.ts compresses by, so index.ts's
1412
1415
  * zlib link switch and emitter.ts's inflater installation stay in
1413
1416
  * lockstep with the emission (a candidate whose deflate happens not to
1414
1417
  * shrink stays plain; the installed inflater is then just unused). */
@@ -1419,7 +1422,7 @@ export function moduleEmbedsCompressedNpm(mod) {
1419
1422
  /** True when the module contains any zlib libCall (the static lowering)
1420
1423
  * OR the embedded npm graph imports node:zlib (the island shim) — the
1421
1424
  * link switch that pulls scr_zlib.c + the system libz into the binary
1422
- * (cc.ts); zlib-free programs keep their exact link line. Same
1425
+ * (native-toolchain.ts); zlib-free programs keep their exact link line. Same
1423
1426
  * generic-walk shape as moduleUsesRegex: `kind`/`fn` discriminants live
1424
1427
  * only on IR objects. */
1425
1428
  export function moduleUsesZlib(mod) {
@@ -1447,7 +1450,7 @@ export function moduleUsesZlib(mod) {
1447
1450
  }
1448
1451
  /** True when the module contains any dc.* libCall — the link switch that
1449
1452
  * pulls scr_dc.c (the diagnostics_channel registry and pub/sub) into the
1450
- * binary (cc.ts). Channel-free binaries keep their exact size class.
1453
+ * binary (native-toolchain.ts). Channel-free binaries keep their exact size class.
1451
1454
  * Same walk shape as moduleUsesZlib. */
1452
1455
  export function moduleUsesDc(mod) {
1453
1456
  let found = false;
@@ -1471,7 +1474,7 @@ export function moduleUsesDc(mod) {
1471
1474
  return found;
1472
1475
  }
1473
1476
  /** True when the module contains any assert libCall — the link switch
1474
- * that pulls scr_assert.c into the binary (cc.ts). scr_regex.c calls the
1477
+ * that pulls scr_assert.c into the binary (native-toolchain.ts). scr_regex.c calls the
1475
1478
  * assert throw/inspect helpers (assert.match lives there), so the regex
1476
1479
  * switch also pulls scr_assert.c; assert-free, regex-free binaries keep
1477
1480
  * the historical command line and size. Same walk shape as
@@ -1500,7 +1503,7 @@ export function moduleUsesAssert(mod) {
1500
1503
  /** True when the module contains any dynInvoke node or dyn.defineProps
1501
1504
  * libCall — the link switch that pulls scr_dyn_invoke.c (the prototype-
1502
1505
  * method dispatch on dyn receivers, plus scr_dyn_display and
1503
- * scr_dyn_define_props) into the binary (cc.ts; the assert gating
1506
+ * scr_dyn_define_props) into the binary (native-toolchain.ts; the assert gating
1504
1507
  * precedent — dispatch-free binaries keep their exact size class). Same
1505
1508
  * walk shape as moduleUsesZlib. */
1506
1509
  export function moduleUsesDynInvoke(mod) {
@@ -1525,14 +1528,14 @@ export function moduleUsesDynInvoke(mod) {
1525
1528
  return found;
1526
1529
  }
1527
1530
  /** True when the module contains any insp libCall — the link switch that
1528
- * pulls scr_inspect.c into the binary (cc.ts; the assert gating
1531
+ * pulls scr_inspect.c into the binary (native-toolchain.ts; the assert gating
1529
1532
  * precedent — inspect-free binaries keep the historical command line and
1530
1533
  * size class). Same walk shape as moduleUsesZlib. */
1531
1534
  /** True when the module needs scr_async_dyn.c — the checked-dynamic
1532
1535
  * async surfaces (dyn-promise then/catch/finally reactions, await of a
1533
1536
  * dyn value, `new Promise(setImmediate)`, AsyncLocalStorage, the
1534
1537
  * unhandledRejection/warning process events). Also pulled by the
1535
- * dynInvoke and dc gates (their TUs call into this one) — cc.ts. Same
1538
+ * dynInvoke and dc gates (their TUs call into this one) — native-toolchain.ts. Same
1536
1539
  * walk shape as moduleUsesZlib. */
1537
1540
  export function moduleUsesDynAsync(mod) {
1538
1541
  const fns = new Set([
@@ -1593,7 +1596,7 @@ export function moduleUsesInspect(mod) {
1593
1596
  }
1594
1597
  /** True when the module contains any net libCall — the link switch that
1595
1598
  * pulls scr_net.c into the binary and has the emitted main call
1596
- * scr_net_install (cc.ts + emitter; the scr_events gating precedent).
1599
+ * scr_net_install (native-toolchain.ts + emitter; the scr_events gating precedent).
1597
1600
  * Net-free programs pay zero bytes and keep their exact link line. Same
1598
1601
  * generic-walk shape as moduleUsesZlib. */
1599
1602
  export function moduleUsesNet(mod) {
@@ -1636,7 +1639,7 @@ export function moduleUsesNet(mod) {
1636
1639
  }
1637
1640
  /** True when the module contains any sym.* libCall or a symbol-kind type
1638
1641
  * anywhere in the IR — the link switch that pulls scr_symbol.c into the
1639
- * binary (cc.ts; the scr_net gating precedent — no install call, the
1642
+ * binary (native-toolchain.ts; the scr_net gating precedent — no install call, the
1640
1643
  * Symbol.for registry initializes lazily). The TYPE check matters like
1641
1644
  * net's: a symbol-typed local whose initializer compiled to a runtime
1642
1645
  * fence still emits release calls that need the unit linked. Symbol-free
@@ -1755,7 +1758,7 @@ export function moduleUsesParseArgs(mod) {
1755
1758
  }
1756
1759
  /** True when the module contains any fs.watch/watcher.* libCall — the
1757
1760
  * link switch that pulls scr_watch.c into the binary and has the emitted
1758
- * main call scr_watch_install (cc.ts + emitter; the scr_net gating
1761
+ * main call scr_watch_install (native-toolchain.ts + emitter; the scr_net gating
1759
1762
  * precedent). Watch-free programs pay zero bytes and keep their exact
1760
1763
  * link line. Same generic-walk shape as moduleUsesZlib. */
1761
1764
  export function moduleUsesFsWatch(mod) {
@@ -1789,7 +1792,7 @@ export function moduleUsesFsWatch(mod) {
1789
1792
  /** True when the module contains any test.* libCall or a testCtx handle
1790
1793
  * type — the link switch that pulls scr_test.c into the binary and has
1791
1794
  * the emitted main return scr_test_exit_code() after the loop drains
1792
- * (cc.ts + emitter; the moduleUsesDgram shape). Test-free programs pay
1795
+ * (native-toolchain.ts + emitter; the moduleUsesDgram shape). Test-free programs pay
1793
1796
  * zero bytes and keep their exact link line. */
1794
1797
  export function moduleUsesNodeTest(mod) {
1795
1798
  let found = false;
@@ -1820,7 +1823,7 @@ export function moduleUsesNodeTest(mod) {
1820
1823
  }
1821
1824
  /** True when the module contains any dgram.* or dns.* libCall — the
1822
1825
  * link switch that pulls scr_dgram.c into the binary and has the emitted
1823
- * main call scr_dgram_install (cc.ts + emitter; the scr_net gating
1826
+ * main call scr_dgram_install (native-toolchain.ts + emitter; the scr_net gating
1824
1827
  * precedent — dns.lookup lives in the same unit, so either prefix
1825
1828
  * answers). Dgram-free programs pay zero bytes and keep their exact link
1826
1829
  * line. Same generic-walk shape as moduleUsesZlib. */
@@ -1853,7 +1856,7 @@ export function moduleUsesDgram(mod) {
1853
1856
  return found;
1854
1857
  }
1855
1858
  /** True when the module contains any http.* libCall — the link switch
1856
- * that pulls scr_http.c into the binary (cc.ts; moduleUsesNet already
1859
+ * that pulls scr_http.c into the binary (native-toolchain.ts; moduleUsesNet already
1857
1860
  * answers true for these, so scr_net.c comes along). */
1858
1861
  export function moduleUsesHttpServer(mod) {
1859
1862
  let found = false;
@@ -1926,7 +1929,7 @@ export function moduleUsesHttp2(mod) {
1926
1929
  }
1927
1930
  /** True when the module contains any tls.* or https.* libCall — the link
1928
1931
  * switch that pulls scr_tls.c and the vendored mbedTLS archive into the
1929
- * binary (cc.ts; moduleUsesNet and moduleUsesHttpServer already answer
1932
+ * binary (native-toolchain.ts; moduleUsesNet and moduleUsesHttpServer already answer
1930
1933
  * true for these, so scr_net.c and scr_http.c come along). TLS-free
1931
1934
  * programs keep their exact link line and never build mbedTLS. */
1932
1935
  export function moduleUsesTls(mod) {
@@ -1962,7 +1965,7 @@ export function moduleUsesTls(mod) {
1962
1965
  * for scr_tls_ca.c, the CA-store introspection unit (getCACertificates /
1963
1966
  * rootCertificates / setDefaultCACertificates). Deliberately SEPARATE
1964
1967
  * from moduleUsesTls: the unit is plain PEM-block bookkeeping, so a
1965
- * program that only inspects the CA store never pulls mbedTLS. cc.ts
1968
+ * program that only inspects the CA store never pulls mbedTLS. native-toolchain.ts
1966
1969
  * also compiles the unit whenever TLS itself links — scr_tls.c consults
1967
1970
  * the unit's default-set override for its trust anchors. */
1968
1971
  export function moduleUsesTlsCa(mod) {
@@ -2501,6 +2504,7 @@ export const MAY_THROW_LIB_FNS = new Set([
2501
2504
  "fs.statSync",
2502
2505
  "crypto.randomBytesToString",
2503
2506
  "crypto.randomBytes",
2507
+ "buffer.concat",
2504
2508
  "buffer.concatLen",
2505
2509
  // The checked-dynamic compare/equals validators: Node's argument
2506
2510
  // ladders throw ERR_INVALID_ARG_TYPE / ERR_OUT_OF_RANGE catchably.
@@ -2603,4 +2607,4 @@ export const MAY_THROW_LIB_FNS = new Set([
2603
2607
  "crypto.x509ValidTo",
2604
2608
  "crypto.x509ValidToStr",
2605
2609
  ]);
2606
- //# sourceMappingURL=nodes.js.map
2610
+ //# sourceMappingURL=ir.js.map