@scriptc/compiler 0.2.9 → 0.3.0

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 (505) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +2 -36
  2. package/ambient/scriptc-overrides.d.ts +1 -25
  3. package/ambient/scriptc.d.ts +1 -9
  4. package/dist/backend/cycle-analysis.d.ts +56 -0
  5. package/dist/backend/cycle-analysis.js +175 -14
  6. package/dist/backend/cycle-analysis.js.map +1 -1
  7. package/dist/backend/cycle-analysis.test.js +95 -2
  8. package/dist/backend/cycle-analysis.test.js.map +1 -1
  9. package/dist/backend/cycle-mutability.d.ts +3 -7
  10. package/dist/backend/cycle-mutability.js +4 -30
  11. package/dist/backend/cycle-mutability.js.map +1 -1
  12. package/dist/backend/executable-features.d.ts +1 -1
  13. package/dist/backend/executable-features.js +3 -8
  14. package/dist/backend/executable-features.js.map +1 -1
  15. package/dist/backend/immutability.d.ts +57 -0
  16. package/dist/backend/immutability.js +178 -0
  17. package/dist/backend/immutability.js.map +1 -0
  18. package/dist/backend/immutability.test.js +131 -0
  19. package/dist/backend/immutability.test.js.map +1 -0
  20. package/dist/backend/library-pack.js +0 -2
  21. package/dist/backend/library-pack.js.map +1 -1
  22. package/dist/backend/linker.js +1 -1
  23. package/dist/backend/linker.js.map +1 -1
  24. package/dist/backend/llvm/borrowed-inputs.d.ts +9 -2
  25. package/dist/backend/llvm/borrowed-inputs.js +31 -3
  26. package/dist/backend/llvm/borrowed-inputs.js.map +1 -1
  27. package/dist/backend/llvm/checked-narrows.test.js +1 -1
  28. package/dist/backend/llvm/classes.d.ts +28 -0
  29. package/dist/backend/llvm/classes.js +48 -14
  30. package/dist/backend/llvm/classes.js.map +1 -1
  31. package/dist/backend/llvm/classes.test.js +134 -6
  32. package/dist/backend/llvm/classes.test.js.map +1 -1
  33. package/dist/backend/llvm/common.d.ts +13 -0
  34. package/dist/backend/llvm/common.js +13 -0
  35. package/dist/backend/llvm/common.js.map +1 -1
  36. package/dist/backend/llvm/constant-callbacks.d.ts +1 -1
  37. package/dist/backend/llvm/constant-callbacks.js +3 -3
  38. package/dist/backend/llvm/constant-callbacks.js.map +1 -1
  39. package/dist/backend/llvm/constant-callbacks.test.js +1 -1
  40. package/dist/backend/llvm/dense-array-access.js +5 -4
  41. package/dist/backend/llvm/dense-array-access.js.map +1 -1
  42. package/dist/backend/llvm/dense-array-access.test.js +10 -2
  43. package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
  44. package/dist/backend/llvm/dyn.d.ts +2 -1
  45. package/dist/backend/llvm/dyn.js +3 -76
  46. package/dist/backend/llvm/dyn.js.map +1 -1
  47. package/dist/backend/llvm/emitter.d.ts +67 -19
  48. package/dist/backend/llvm/emitter.js +443 -226
  49. package/dist/backend/llvm/emitter.js.map +1 -1
  50. package/dist/backend/llvm/emitter.test.js +21 -3
  51. package/dist/backend/llvm/emitter.test.js.map +1 -1
  52. package/dist/backend/llvm/expr-async.test.js +1 -1
  53. package/dist/backend/llvm/expr-calls.js +14 -6
  54. package/dist/backend/llvm/expr-calls.js.map +1 -1
  55. package/dist/backend/llvm/expr-containers.js +41 -14
  56. package/dist/backend/llvm/expr-containers.js.map +1 -1
  57. package/dist/backend/llvm/expr-control.js +4 -107
  58. package/dist/backend/llvm/expr-control.js.map +1 -1
  59. package/dist/backend/llvm/expr-dispatch.d.ts +1 -2
  60. package/dist/backend/llvm/expr-dispatch.js +0 -41
  61. package/dist/backend/llvm/expr-dispatch.js.map +1 -1
  62. package/dist/backend/llvm/expr-dynamic.d.ts +1 -1
  63. package/dist/backend/llvm/expr-dynamic.js +13 -27
  64. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  65. package/dist/backend/llvm/expr-primitives.js +30 -3
  66. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  67. package/dist/backend/llvm/expr-primitives.test.js +55 -2
  68. package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
  69. package/dist/backend/llvm/expr-stream-bridges.js +4 -4
  70. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  71. package/dist/backend/llvm/expr-stream-bridges.test.js +1 -1
  72. package/dist/backend/llvm/lib-dispatch.js +0 -1
  73. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  74. package/dist/backend/llvm/lib-filesystem.js +0 -13
  75. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  76. package/dist/backend/llvm/lib-shared.js +0 -8
  77. package/dist/backend/llvm/lib-shared.js.map +1 -1
  78. package/dist/backend/llvm/local-array-reads.js +3 -3
  79. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  80. package/dist/backend/llvm/local-array-reads.test.js +1 -1
  81. package/dist/backend/llvm/local-union-storage.test.js +1 -1
  82. package/dist/backend/llvm/loop-array-borrows.d.ts +5 -2
  83. package/dist/backend/llvm/loop-array-borrows.js +27 -8
  84. package/dist/backend/llvm/loop-array-borrows.js.map +1 -1
  85. package/dist/backend/llvm/map-number-lookup.d.ts +14 -0
  86. package/dist/backend/llvm/map-number-lookup.js +33 -2
  87. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  88. package/dist/backend/llvm/map-read-lifetimes.d.ts +5 -0
  89. package/dist/backend/llvm/map-read-lifetimes.js +20 -4
  90. package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
  91. package/dist/backend/llvm/map-read-lifetimes.test.js +25 -3
  92. package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
  93. package/dist/backend/llvm/reference-writes.d.ts +124 -0
  94. package/dist/backend/llvm/reference-writes.js +1090 -0
  95. package/dist/backend/llvm/reference-writes.js.map +1 -0
  96. package/dist/backend/llvm/shapes.d.ts +8 -5
  97. package/dist/backend/llvm/shapes.js +37 -13
  98. package/dist/backend/llvm/shapes.js.map +1 -1
  99. package/dist/backend/llvm/shapes.test.js +3 -3
  100. package/dist/backend/llvm/stack-unions.test.js +1 -1
  101. package/dist/backend/llvm/string-construction.test.js +1 -1
  102. package/dist/backend/llvm/string-lifetimes.test.js +40 -11
  103. package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
  104. package/dist/backend/llvm/string-reads.d.ts +3 -0
  105. package/dist/backend/llvm/string-reads.js +31 -0
  106. package/dist/backend/llvm/string-reads.js.map +1 -1
  107. package/dist/backend/llvm/switch-dispatch.d.ts +2 -2
  108. package/dist/backend/llvm/switch-dispatch.js +35 -22
  109. package/dist/backend/llvm/switch-dispatch.js.map +1 -1
  110. package/dist/backend/llvm/switch-dispatch.test.js +29 -11
  111. package/dist/backend/llvm/switch-dispatch.test.js.map +1 -1
  112. package/dist/backend/llvm/walk-borrows.d.ts +8 -1
  113. package/dist/backend/llvm/walk-borrows.js +15 -4
  114. package/dist/backend/llvm/walk-borrows.js.map +1 -1
  115. package/dist/backend/may-throw.d.ts +36 -2
  116. package/dist/backend/may-throw.js +308 -21
  117. package/dist/backend/may-throw.js.map +1 -1
  118. package/dist/backend/may-throw.test.js +147 -2
  119. package/dist/backend/may-throw.test.js.map +1 -1
  120. package/dist/backend/native/artifact-stamps.js +0 -2
  121. package/dist/backend/native/artifact-stamps.js.map +1 -1
  122. package/dist/backend/native/cache-warm.d.ts +1 -1
  123. package/dist/backend/native/cache-warm.js +2 -3
  124. package/dist/backend/native/cache-warm.js.map +1 -1
  125. package/dist/backend/native/compiler-fingerprint.d.ts +1 -1
  126. package/dist/backend/native/compiler-fingerprint.js +4 -7
  127. package/dist/backend/native/compiler-fingerprint.js.map +1 -1
  128. package/dist/backend/native/contracts.d.ts +3 -28
  129. package/dist/backend/native/driver.js +1 -3
  130. package/dist/backend/native/driver.js.map +1 -1
  131. package/dist/backend/native/executable.d.ts +0 -15
  132. package/dist/backend/native/executable.js +17 -172
  133. package/dist/backend/native/executable.js.map +1 -1
  134. package/dist/backend/native/tool-identity.js +0 -1
  135. package/dist/backend/native/tool-identity.js.map +1 -1
  136. package/dist/backend/native/vendor.d.ts +1 -1
  137. package/dist/backend/native/vendor.js +1 -1
  138. package/dist/backend/native/vendor.js.map +1 -1
  139. package/dist/backend/native-link-info-core.d.ts +0 -2
  140. package/dist/backend/native-link-info-core.js.map +1 -1
  141. package/dist/backend/native-toolchain.test.js +23 -33
  142. package/dist/backend/native-toolchain.test.js.map +1 -1
  143. package/dist/backend/publication.d.ts +5 -0
  144. package/dist/backend/publication.js +10 -0
  145. package/dist/backend/publication.js.map +1 -1
  146. package/dist/backend/publication.test.js +1 -1
  147. package/dist/backend/runtime-abi.d.ts +2 -2
  148. package/dist/backend/runtime-abi.js +2 -2
  149. package/dist/backend/runtime-pack-core.d.ts +1 -2
  150. package/dist/backend/runtime-pack-core.js +5 -14
  151. package/dist/backend/runtime-pack-core.js.map +1 -1
  152. package/dist/backend/runtime-pack-targets.test.js +3 -8
  153. package/dist/backend/runtime-pack-targets.test.js.map +1 -1
  154. package/dist/backend/runtime-pack.test.js +22 -19
  155. package/dist/backend/runtime-pack.test.js.map +1 -1
  156. package/dist/backend/target-diagnostics.d.ts +0 -5
  157. package/dist/backend/target-diagnostics.js +1 -11
  158. package/dist/backend/target-diagnostics.js.map +1 -1
  159. package/dist/backend/target-diagnostics.test.js +1 -1
  160. package/dist/backend/vendor-archives.d.ts +1 -7
  161. package/dist/backend/vendor-archives.js +9 -189
  162. package/dist/backend/vendor-archives.js.map +1 -1
  163. package/dist/backend/vendor-inputs.d.ts +0 -1
  164. package/dist/backend/vendor-inputs.js +0 -1
  165. package/dist/backend/vendor-inputs.js.map +1 -1
  166. package/dist/backend/warm-cache.js +3 -5
  167. package/dist/backend/warm-cache.js.map +1 -1
  168. package/dist/cli/command.js +4 -8
  169. package/dist/cli/command.js.map +1 -1
  170. package/dist/cli/host.d.ts +1 -1
  171. package/dist/cli/usage.d.ts +1 -5
  172. package/dist/cli/usage.js +4 -9
  173. package/dist/cli/usage.js.map +1 -1
  174. package/dist/compat/fetch-profile.d.ts +2 -2
  175. package/dist/compat/fetch-profile.js +16 -25
  176. package/dist/compat/fetch-profile.js.map +1 -1
  177. package/dist/compile-types.d.ts +2 -17
  178. package/dist/contracts/check.d.ts +8 -0
  179. package/dist/contracts/check.js +1573 -0
  180. package/dist/contracts/check.js.map +1 -0
  181. package/dist/coverage/report.d.ts +5 -22
  182. package/dist/coverage/report.js +12 -76
  183. package/dist/coverage/report.js.map +1 -1
  184. package/dist/coverage/surface-manifest.d.ts +3 -3
  185. package/dist/coverage/surface-manifest.js +22 -27
  186. package/dist/coverage/surface-manifest.js.map +1 -1
  187. package/dist/coverage/verdict-cache.d.ts +1 -3
  188. package/dist/coverage/verdict-cache.js +2 -7
  189. package/dist/coverage/verdict-cache.js.map +1 -1
  190. package/dist/diagnostics/diagnostic.d.ts +11 -60
  191. package/dist/diagnostics/diagnostic.js +39 -118
  192. package/dist/diagnostics/diagnostic.js.map +1 -1
  193. package/dist/diagnostics/envelope.d.ts +3 -4
  194. package/dist/diagnostics/envelope.js +0 -9
  195. package/dist/diagnostics/envelope.js.map +1 -1
  196. package/dist/diagnostics/envelope.test.js +1 -1
  197. package/dist/diagnostics/envelope.test.js.map +1 -1
  198. package/dist/executable/executable-cache.d.ts +0 -3
  199. package/dist/executable/executable-cache.js +2 -4
  200. package/dist/executable/executable-cache.js.map +1 -1
  201. package/dist/executable/executable-cache.test.js +0 -4
  202. package/dist/executable/executable-cache.test.js.map +1 -1
  203. package/dist/executable/prepare.js +14 -2
  204. package/dist/executable/prepare.js.map +1 -1
  205. package/dist/frontend/analysis.js +10 -10
  206. package/dist/frontend/analysis.js.map +1 -1
  207. package/dist/frontend/cjs-syntax.js +0 -88
  208. package/dist/frontend/cjs-syntax.js.map +1 -1
  209. package/dist/frontend/contract-types.d.ts +50 -0
  210. package/dist/frontend/contract-types.js +232 -0
  211. package/dist/frontend/contract-types.js.map +1 -0
  212. package/dist/frontend/dts-paths.d.ts +1 -1
  213. package/dist/frontend/dts-paths.js +1 -1
  214. package/dist/frontend/lowering/abstract-equality.js +1 -4
  215. package/dist/frontend/lowering/abstract-equality.js.map +1 -1
  216. package/dist/frontend/lowering/array-values.js +4 -11
  217. package/dist/frontend/lowering/array-values.js.map +1 -1
  218. package/dist/frontend/lowering/builtins/arguments.js +0 -13
  219. package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
  220. package/dist/frontend/lowering/builtins/crypto.d.ts +0 -4
  221. package/dist/frontend/lowering/builtins/crypto.js +0 -4
  222. package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
  223. package/dist/frontend/lowering/builtins/json.js +1 -39
  224. package/dist/frontend/lowering/builtins/json.js.map +1 -1
  225. package/dist/frontend/lowering/builtins/module-resolution.d.ts +0 -15
  226. package/dist/frontend/lowering/builtins/module-resolution.js +5 -44
  227. package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
  228. package/dist/frontend/lowering/builtins/numbers.d.ts +0 -6
  229. package/dist/frontend/lowering/builtins/numbers.js +6 -57
  230. package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
  231. package/dist/frontend/lowering/builtins/promises.js +4 -67
  232. package/dist/frontend/lowering/builtins/promises.js.map +1 -1
  233. package/dist/frontend/lowering/builtins/workers.js +1 -1
  234. package/dist/frontend/lowering/builtins/workers.js.map +1 -1
  235. package/dist/frontend/lowering/call-arguments.d.ts +1 -37
  236. package/dist/frontend/lowering/call-arguments.js +11 -94
  237. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  238. package/dist/frontend/lowering/call-signatures.d.ts +1 -6
  239. package/dist/frontend/lowering/call-signatures.js +16 -68
  240. package/dist/frontend/lowering/call-signatures.js.map +1 -1
  241. package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +19 -4
  242. package/dist/frontend/lowering/class-dynamic-dispatch.js +168 -98
  243. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  244. package/dist/frontend/lowering/class-dynamic-dispatch.test.js +44 -4
  245. package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
  246. package/dist/frontend/lowering/class-method-mutations.js +0 -2
  247. package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
  248. package/dist/frontend/lowering/class-protocols.js +1 -1
  249. package/dist/frontend/lowering/class-protocols.js.map +1 -1
  250. package/dist/frontend/lowering/coercions/function-adapters.js +5 -35
  251. package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
  252. package/dist/frontend/lowering/coercions/state.d.ts +0 -1
  253. package/dist/frontend/lowering/coercions/state.js +0 -1
  254. package/dist/frontend/lowering/coercions/state.js.map +1 -1
  255. package/dist/frontend/lowering/coercions/structural-plans.js +2 -4
  256. package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
  257. package/dist/frontend/lowering/coercions/structural.js +2 -12
  258. package/dist/frontend/lowering/coercions/structural.js.map +1 -1
  259. package/dist/frontend/lowering/coercions/unions.d.ts +12 -0
  260. package/dist/frontend/lowering/coercions/unions.js +63 -1
  261. package/dist/frontend/lowering/coercions/unions.js.map +1 -1
  262. package/dist/frontend/lowering/containers/array-callbacks.js +9 -28
  263. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  264. package/dist/frontend/lowering/containers/array-construction.js +2 -3
  265. package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
  266. package/dist/frontend/lowering/containers/array-methods.js +10 -54
  267. package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
  268. package/dist/frontend/lowering/containers/bytes.js +0 -1
  269. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  270. package/dist/frontend/lowering/containers/callback-arguments.js +2 -10
  271. package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
  272. package/dist/frontend/lowering/containers/collection-methods.js +1 -6
  273. package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
  274. package/dist/frontend/lowering/containers/indexed-objects.js +0 -2
  275. package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
  276. package/dist/frontend/lowering/containers/string-and-regexp.d.ts +0 -6
  277. package/dist/frontend/lowering/containers/string-and-regexp.js +2 -10
  278. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  279. package/dist/frontend/lowering/expressions/evaluation-safety.js +0 -3
  280. package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -1
  281. package/dist/frontend/lowering/expressions/native-proxy.js +1 -1
  282. package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
  283. package/dist/frontend/lowering/expressions/nullish-assignment.js +0 -1
  284. package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
  285. package/dist/frontend/lowering/expressions/object-literals.d.ts +0 -8
  286. package/dist/frontend/lowering/expressions/object-literals.js +8 -35
  287. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  288. package/dist/frontend/lowering/expressions/optional-chains.d.ts +0 -4
  289. package/dist/frontend/lowering/expressions/optional-chains.js +7 -67
  290. package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
  291. package/dist/frontend/lowering/function-context.js +0 -1
  292. package/dist/frontend/lowering/function-context.js.map +1 -1
  293. package/dist/frontend/lowering/generic-functions.js +0 -1
  294. package/dist/frontend/lowering/generic-functions.js.map +1 -1
  295. package/dist/frontend/lowering/lib-boundary.js +10 -77
  296. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  297. package/dist/frontend/lowering/lower-array-sort.js +1 -10
  298. package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
  299. package/dist/frontend/lowering/lower-array-sort.test.js +2 -2
  300. package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
  301. package/dist/frontend/lowering/lower-assert.js +2 -3
  302. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  303. package/dist/frontend/lowering/lower-async-iteration.js +1 -1
  304. package/dist/frontend/lowering/lower-calls.d.ts +2 -27
  305. package/dist/frontend/lowering/lower-calls.js +56 -465
  306. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  307. package/dist/frontend/lowering/lower-classes.js +11 -49
  308. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  309. package/dist/frontend/lowering/lower-comptime.js +2 -3
  310. package/dist/frontend/lowering/lower-comptime.js.map +1 -1
  311. package/dist/frontend/lowering/lower-enums.js +5 -8
  312. package/dist/frontend/lowering/lower-enums.js.map +1 -1
  313. package/dist/frontend/lowering/lower-event-emitter.js +3 -4
  314. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  315. package/dist/frontend/lowering/lower-expando.js +3 -5
  316. package/dist/frontend/lowering/lower-expando.js.map +1 -1
  317. package/dist/frontend/lowering/lower-exprs.d.ts +0 -8
  318. package/dist/frontend/lowering/lower-exprs.js +133 -908
  319. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  320. package/dist/frontend/lowering/lower-functions.js +2 -5
  321. package/dist/frontend/lowering/lower-functions.js.map +1 -1
  322. package/dist/frontend/lowering/lower-inspect.js +1 -50
  323. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  324. package/dist/frontend/lowering/lower-modules.d.ts +0 -43
  325. package/dist/frontend/lowering/lower-modules.js +25 -329
  326. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  327. package/dist/frontend/lowering/lower-modules.test.js +5 -5
  328. package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
  329. package/dist/frontend/lowering/lower-server.js +0 -30
  330. package/dist/frontend/lowering/lower-server.js.map +1 -1
  331. package/dist/frontend/lowering/lower-stdlib.d.ts +98 -0
  332. package/dist/frontend/lowering/{lower-island.js → lower-stdlib.js} +97 -1160
  333. package/dist/frontend/lowering/lower-stdlib.js.map +1 -0
  334. package/dist/frontend/lowering/lower-stmts.d.ts +0 -16
  335. package/dist/frontend/lowering/lower-stmts.js +58 -1016
  336. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  337. package/dist/frontend/lowering/lower-stmts.test.js +1 -1
  338. package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
  339. package/dist/frontend/lowering/lower-stream.js +1 -3
  340. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  341. package/dist/frontend/lowering/lowerer.d.ts +26 -151
  342. package/dist/frontend/lowering/lowerer.js +120 -770
  343. package/dist/frontend/lowering/lowerer.js.map +1 -1
  344. package/dist/frontend/lowering/lowerer.test.js +4 -51
  345. package/dist/frontend/lowering/lowerer.test.js.map +1 -1
  346. package/dist/frontend/lowering/narrowing-stability.d.ts +100 -0
  347. package/dist/frontend/lowering/narrowing-stability.js +1174 -0
  348. package/dist/frontend/lowering/narrowing-stability.js.map +1 -0
  349. package/dist/frontend/lowering/narrowing-stability.test.js +150 -0
  350. package/dist/frontend/lowering/narrowing-stability.test.js.map +1 -0
  351. package/dist/frontend/lowering/optional-arguments.js +0 -2
  352. package/dist/frontend/lowering/optional-arguments.js.map +1 -1
  353. package/dist/frontend/lowering/sanitize-class-types.test.js +2 -2
  354. package/dist/frontend/lowering/strict-equality.js +1 -1
  355. package/dist/frontend/lowering/strict-equality.js.map +1 -1
  356. package/dist/frontend/lowering/surfaces.d.ts +6 -45
  357. package/dist/frontend/lowering/surfaces.js +5 -65
  358. package/dist/frontend/lowering/surfaces.js.map +1 -1
  359. package/dist/frontend/module-syntax.d.ts +0 -3
  360. package/dist/frontend/module-syntax.js.map +1 -1
  361. package/dist/frontend/npm-node.d.ts +0 -7
  362. package/dist/frontend/npm-node.js +0 -7
  363. package/dist/frontend/npm-node.js.map +1 -1
  364. package/dist/frontend/npm-static-rewrite-syntax.d.ts +1 -1
  365. package/dist/frontend/npm-static-rewrite-syntax.js +6 -82
  366. package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
  367. package/dist/frontend/npm-static.d.ts +1 -1
  368. package/dist/frontend/npm-static.js +6 -71
  369. package/dist/frontend/npm-static.js.map +1 -1
  370. package/dist/frontend/npm.d.ts +3 -319
  371. package/dist/frontend/npm.js +6 -1007
  372. package/dist/frontend/npm.js.map +1 -1
  373. package/dist/frontend/npm.test.js +2 -197
  374. package/dist/frontend/npm.test.js.map +1 -1
  375. package/dist/frontend/pipeline-native.js +1 -2
  376. package/dist/frontend/pipeline-native.js.map +1 -1
  377. package/dist/frontend/pipeline.d.ts +3 -11
  378. package/dist/frontend/pipeline.js +37 -56
  379. package/dist/frontend/pipeline.js.map +1 -1
  380. package/dist/frontend/pipeline.test.js +12 -6
  381. package/dist/frontend/pipeline.test.js.map +1 -1
  382. package/dist/frontend/program.d.ts +0 -34
  383. package/dist/frontend/program.js +13 -98
  384. package/dist/frontend/program.js.map +1 -1
  385. package/dist/frontend/provenance-core.d.ts +0 -4
  386. package/dist/frontend/provenance-core.js +4 -37
  387. package/dist/frontend/provenance-core.js.map +1 -1
  388. package/dist/frontend/provenance-registry.d.ts +0 -4
  389. package/dist/frontend/provenance-registry.js +0 -20
  390. package/dist/frontend/provenance-registry.js.map +1 -1
  391. package/dist/frontend/resolve.d.ts +0 -12
  392. package/dist/frontend/resolve.js +0 -34
  393. package/dist/frontend/resolve.js.map +1 -1
  394. package/dist/frontend/runtime-resolve.js +2 -2
  395. package/dist/frontend/runtime-resolve.js.map +1 -1
  396. package/dist/frontend/services-node.js +2 -3
  397. package/dist/frontend/services-node.js.map +1 -1
  398. package/dist/frontend/services.d.ts +1 -8
  399. package/dist/frontend/services.js +2 -22
  400. package/dist/frontend/services.js.map +1 -1
  401. package/dist/frontend/services.test.js +0 -38
  402. package/dist/frontend/services.test.js.map +1 -1
  403. package/dist/frontend/tsc-codes.js +0 -11
  404. package/dist/frontend/tsc-codes.js.map +1 -1
  405. package/dist/frontend/type-mapper.d.ts +2 -27
  406. package/dist/frontend/type-mapper.js +85 -153
  407. package/dist/frontend/type-mapper.js.map +1 -1
  408. package/dist/index.d.ts +1 -1
  409. package/dist/index.js +7 -10
  410. package/dist/index.js.map +1 -1
  411. package/dist/ir/api.d.ts +1 -1
  412. package/dist/ir/api.js +1 -1
  413. package/dist/ir/api.js.map +1 -1
  414. package/dist/ir/builtin-effects.js +0 -5
  415. package/dist/ir/builtin-effects.js.map +1 -1
  416. package/dist/ir/builtin-signatures.d.ts +1 -1
  417. package/dist/ir/builtin-signatures.js +1 -55
  418. package/dist/ir/builtin-signatures.js.map +1 -1
  419. package/dist/ir/constant-globals.test.js +1 -1
  420. package/dist/ir/constant-tables.test.js +1 -1
  421. package/dist/ir/final-fields.test.js +1 -1
  422. package/dist/ir/initializer-bindings.test.js +1 -1
  423. package/dist/ir/int32-slots.d.ts +29 -3
  424. package/dist/ir/int32-slots.js +152 -66
  425. package/dist/ir/int32-slots.js.map +1 -1
  426. package/dist/ir/int32-slots.test.js +1 -1
  427. package/dist/ir/integer-loops.js +3 -0
  428. package/dist/ir/integer-loops.js.map +1 -1
  429. package/dist/ir/integer-loops.test.js +26 -1
  430. package/dist/ir/integer-loops.test.js.map +1 -1
  431. package/dist/ir/integer-ranges.d.ts +20 -0
  432. package/dist/ir/integer-ranges.js +178 -21
  433. package/dist/ir/integer-ranges.js.map +1 -1
  434. package/dist/ir/integer-ranges.test.js +148 -3
  435. package/dist/ir/integer-ranges.test.js.map +1 -1
  436. package/dist/ir/ir.d.ts +44 -284
  437. package/dist/ir/ir.js +10 -259
  438. package/dist/ir/ir.js.map +1 -1
  439. package/dist/ir/ir.test.js +2 -7
  440. package/dist/ir/ir.test.js.map +1 -1
  441. package/dist/ir/runtime-features.d.ts +3 -30
  442. package/dist/ir/runtime-features.js +5 -41
  443. package/dist/ir/runtime-features.js.map +1 -1
  444. package/dist/ir/scalar-records.test.js +1 -1
  445. package/dist/ir/serialize.d.ts +6 -2
  446. package/dist/ir/serialize.js +11 -3
  447. package/dist/ir/serialize.js.map +1 -1
  448. package/dist/ir/traverse.js +0 -21
  449. package/dist/ir/traverse.js.map +1 -1
  450. package/dist/ir/unshare.d.ts +14 -0
  451. package/dist/ir/unshare.js +60 -0
  452. package/dist/ir/unshare.js.map +1 -0
  453. package/dist/ir/unshare.test.js +115 -0
  454. package/dist/ir/unshare.test.js.map +1 -0
  455. package/dist/ir/validate.js +9 -207
  456. package/dist/ir/validate.js.map +1 -1
  457. package/dist/ir/validate.test.js +6 -6
  458. package/dist/library/fence-eval.test.js +1 -1
  459. package/dist/library/int-infer.test.js +4 -4
  460. package/dist/library/library-cache.test.js +5 -5
  461. package/dist/library/prepare.js +14 -20
  462. package/dist/library/prepare.js.map +1 -1
  463. package/dist/native/cli.js +0 -2
  464. package/dist/native/cli.js.map +1 -1
  465. package/dist/native/compiler.test.js +2 -4
  466. package/dist/native/compiler.test.js.map +1 -1
  467. package/dist/native/prepare.js +2 -4
  468. package/dist/native/prepare.js.map +1 -1
  469. package/dist/native/sanitizer.js +2 -16
  470. package/dist/native/sanitizer.js.map +1 -1
  471. package/dist/native/sanitizer.test.js +0 -3
  472. package/dist/native/sanitizer.test.js.map +1 -1
  473. package/dist/startup-cache.js +0 -2
  474. package/dist/startup-cache.js.map +1 -1
  475. package/package.json +20 -20
  476. package/surface-manifest.json +80 -88
  477. package/dist/backend/llvm/expr-island.d.ts +0 -15
  478. package/dist/backend/llvm/expr-island.js +0 -709
  479. package/dist/backend/llvm/expr-island.js.map +0 -1
  480. package/dist/frontend/lowering/coercions/island.d.ts +0 -37
  481. package/dist/frontend/lowering/coercions/island.js +0 -350
  482. package/dist/frontend/lowering/coercions/island.js.map +0 -1
  483. package/dist/frontend/lowering/lower-island.d.ts +0 -229
  484. package/dist/frontend/lowering/lower-island.js.map +0 -1
  485. package/dist/frontend/lowering/lower-island.test.js +0 -56
  486. package/dist/frontend/lowering/lower-island.test.js.map +0 -1
  487. package/dist/frontend/npm-fetch-analysis.d.ts +0 -17
  488. package/dist/frontend/npm-fetch-analysis.js +0 -109
  489. package/dist/frontend/npm-fetch-analysis.js.map +0 -1
  490. package/dist/frontend/npm-fetch-analysis.test.js +0 -130
  491. package/dist/frontend/npm-fetch-analysis.test.js.map +0 -1
  492. package/dist/frontend/npm-fetch-node.d.ts +0 -2
  493. package/dist/frontend/npm-fetch-node.js +0 -12
  494. package/dist/frontend/npm-fetch-node.js.map +0 -1
  495. package/dist/frontend/npm-fetch-syntax.d.ts +0 -6
  496. package/dist/frontend/npm-fetch-syntax.js +0 -202
  497. package/dist/frontend/npm-fetch-syntax.js.map +0 -1
  498. package/dist/native/runtime-typescript.d.ts +0 -4
  499. package/dist/native/runtime-typescript.js +0 -74
  500. package/dist/native/runtime-typescript.js.map +0 -1
  501. package/dist/native/runtime-typescript.test.js +0 -41
  502. package/dist/native/runtime-typescript.test.js.map +0 -1
  503. /package/dist/{frontend/lowering/lower-island.test.d.ts → backend/immutability.test.d.ts} +0 -0
  504. /package/dist/frontend/{npm-fetch-analysis.test.d.ts → lowering/narrowing-stability.test.d.ts} +0 -0
  505. /package/dist/{native/runtime-typescript.test.d.ts → ir/unshare.test.d.ts} +0 -0
package/dist/ir/ir.d.ts CHANGED
@@ -275,8 +275,7 @@ export type IrType = {
275
275
  /** Heap, refcounted closure. `rest` marks a variadic function value.
276
276
  * `restAbi: "typed"` spells one trailing typed array in `params`; static
277
277
  * call sites pack their surplus arguments into it before `callValue`.
278
- * `restAbi: "jsval"` similarly spells one trailing engine array for an
279
- * island host callback. An absent `restAbi` is the legacy checked-dynamic
278
+ * An absent `restAbi` is the checked-dynamic
280
279
  * JS form: `params` stays the declared non-rest list and the lifted
281
280
  * function has one hidden trailing ScrDyn array filled by its boxed call
282
281
  * thunk. `argumentsAll` keeps that hidden ABI but fills it with every
@@ -288,7 +287,7 @@ export type IrType = {
288
287
  params: IrType[];
289
288
  ret: IrType;
290
289
  rest?: true;
291
- restAbi?: "jsval" | "typed";
290
+ restAbi?: "typed";
292
291
  argumentsAll?: true;
293
292
  } | {
294
293
  kind: "object";
@@ -306,7 +305,7 @@ export type IrType = {
306
305
  * completion against C's one signature sound. Allowed in locals,
307
306
  * globals, params, returns, class/record fields, capture boxes, array
308
307
  * elements, Map VALUES, and union arms; fenced out of Map keys, Set
309
- * elements, JSON, jsval conversion, and ToString. Unknown slots retain
308
+ * elements, JSON, and ToString. Unknown slots retain
310
309
  * class identity and allow an exact typed constructor round trip. */
311
310
  | {
312
311
  kind: "classval";
@@ -354,16 +353,6 @@ export type IrType = {
354
353
  | {
355
354
  kind: "dyn";
356
355
  }
357
- /** An island value handle — the type of `any` under --dynamic. Runtime
358
- * representation is a refcounted cell (ScrJsval) owning one embedded-
359
- * engine value. It can live in locals, globals, parameters, returns,
360
- * arrays, class fields, and ambient AbortSignal/AbortController record
361
- * fields. Operations on jsval compile to engine calls (jsOp) with
362
- * JS-exact semantics; exits back to static types are validated (jsExit).
363
- * This kind exists only with the dynamic option. */
364
- | {
365
- kind: "jsval";
366
- }
367
356
  /** A catch binding or its closure capture (never parameters, returns,
368
357
  * fields, arms or elements). The one global form is a module's recorded
369
358
  * evaluation error, written only from that module's catch binding and
@@ -429,9 +418,9 @@ declare const HANDLE_KIND_LIST: readonly ["stats", "fileHandle", "spawnRes", "ch
429
418
  export type HandleKind = (typeof HANDLE_KIND_LIST)[number];
430
419
  export declare const HANDLE_KINDS: IrKindSet<"child" | "childStream" | "childWriter" | "cryptoHash" | "cryptoHmac" | "dgramSocket" | "fileHandle" | "fsWatcher" | "http2Session" | "http2Stream" | "httpClientReq" | "httpReq" | "httpRes" | "netServer" | "netSocket" | "procStream" | "secureCtx" | "spawnRes" | "stats" | "testCtx">;
431
420
  /** The IR kinds represented as pointers in native code. */
432
- declare const POINTER_KIND_LIST: readonly ["string", "bigint", "array", "map", "set", "regex", "bytes", "url", "searchParams", "symbol", "stats", "fileHandle", "spawnRes", "child", "netServer", "netSocket", "http2Session", "http2Stream", "dgramSocket", "testCtx", "httpReq", "httpRes", "httpClientReq", "secureCtx", "cryptoHash", "cryptoHmac", "fsWatcher", "childStream", "childWriter", "func", "object", "classval", "moduleNs", "record", "union", "dyn", "jsval", "caught", "promise", "generator"];
421
+ declare const POINTER_KIND_LIST: readonly ["string", "bigint", "array", "map", "set", "regex", "bytes", "url", "searchParams", "symbol", "stats", "fileHandle", "spawnRes", "child", "netServer", "netSocket", "http2Session", "http2Stream", "dgramSocket", "testCtx", "httpReq", "httpRes", "httpClientReq", "secureCtx", "cryptoHash", "cryptoHmac", "fsWatcher", "childStream", "childWriter", "func", "object", "classval", "moduleNs", "record", "union", "dyn", "caught", "promise", "generator"];
433
422
  export type PointerKind = (typeof POINTER_KIND_LIST)[number];
434
- export declare const POINTER_KINDS: IrKindSet<"array" | "bigint" | "bytes" | "caught" | "child" | "childStream" | "childWriter" | "classval" | "cryptoHash" | "cryptoHmac" | "dgramSocket" | "dyn" | "fileHandle" | "fsWatcher" | "func" | "generator" | "http2Session" | "http2Stream" | "httpClientReq" | "httpReq" | "httpRes" | "jsval" | "map" | "moduleNs" | "netServer" | "netSocket" | "object" | "promise" | "record" | "regex" | "searchParams" | "secureCtx" | "set" | "spawnRes" | "stats" | "string" | "symbol" | "testCtx" | "union" | "url">;
423
+ export declare const POINTER_KINDS: IrKindSet<"array" | "bigint" | "bytes" | "caught" | "child" | "childStream" | "childWriter" | "classval" | "cryptoHash" | "cryptoHmac" | "dgramSocket" | "dyn" | "fileHandle" | "fsWatcher" | "func" | "generator" | "http2Session" | "http2Stream" | "httpClientReq" | "httpReq" | "httpRes" | "map" | "moduleNs" | "netServer" | "netSocket" | "object" | "promise" | "record" | "regex" | "searchParams" | "secureCtx" | "set" | "spawnRes" | "stats" | "string" | "symbol" | "testCtx" | "union" | "url">;
435
424
  /** Runtime RC symbol stem for each IR type kind. An empty stem means the
436
425
  * kind is scalar/unit or uses an emitted per-shape helper (object/record).
437
426
  * Keeping this exhaustive makes a new runtime handle kind a compile error
@@ -477,7 +466,6 @@ export declare const CHILDWRITER_T: IrType;
477
466
  export declare const PROCSTREAM_T: IrType;
478
467
  export declare const VOID: IrType;
479
468
  export declare const DYN: IrType;
480
- export declare const JSVAL: IrType;
481
469
  export declare const CAUGHT: IrType;
482
470
  export declare const UNDEFINED_T: IrType;
483
471
  export declare const NULL_T: IrType;
@@ -508,7 +496,7 @@ export declare function isSupportedMapKey(t: IrType, unionArms?: IrType[]): bool
508
496
  /** Set elements and Map keys share storage, equality and ownership rules. */
509
497
  export declare function isSupportedSetElem(t: IrType, unionArms?: IrType[]): boolean;
510
498
  /** The Map VALUE fence: scalars, supported native references and checked
511
- * values. Functions require checked-value boxing; jsval has no native slot.
499
+ * values. Functions require checked-value boxing.
512
500
  * Record/object/union values can point back at the map holding them, which
513
501
  * is exactly why ref-valued maps are cycle-capable (see the backend's
514
502
  * cycle analysis and docs/memory.md). Shared frontend/validator. */
@@ -544,7 +532,7 @@ export declare function typeEquals(a: IrType, b: IrType): boolean;
544
532
  export declare function isRefCounted(t: IrType): boolean;
545
533
  export interface IrModule {
546
534
  /** Bumped on any breaking IR change; serialize.ts refuses mismatches. */
547
- irVersion: 15;
535
+ irVersion: 16;
548
536
  sourceFile: string;
549
537
  functions: IrFunction[];
550
538
  /** Class shapes. Constructors and methods are ordinary module functions
@@ -560,36 +548,6 @@ export interface IrModule {
560
548
  * per-file `%init.<i>` functions; ids live in a distinct "%g." namespace so
561
549
  * they can never collide with function-local ids. */
562
550
  globals?: IrGlobal[];
563
- /** The embedded npm runtime graph (--dynamic builds with npm imports):
564
- * every reached module's SOURCE, keyed by resolved path, plus the
565
- * (importer, specifier) → target edges the island's module loader and
566
- * require shim resolve against. Emitted as static strings — binaries
567
- * never read node_modules at runtime. Edge targets are module keys or
568
- * "node:*" builtins (island-shimmed). */
569
- embedded?: {
570
- /** `esm` (CommonJS modules only) is the synthesized ESM facade the
571
- * island loader evaluates when an ES module imports the CJS file:
572
- * default plus the named exports LEXED from the source at build time
573
- * (cjs-lexer.ts — the compiler's port of Node's vendored CJS lexer). */
574
- modules: {
575
- key: string;
576
- source: string;
577
- format: "esm" | "cjs" | "json";
578
- esm?: string;
579
- /** Parsed/bound embedded source reaches the engine's global fetch. */
580
- usesFetch?: true;
581
- }[];
582
- /** `kind` picks Node's "exports" condition set per CALL FORM: one
583
- * (from, specifier) can name a dual package's ESM entry behind an
584
- * "import" edge AND its CJS entry behind a "require" edge; "any"
585
- * serves both lookups (relative files, builtins). */
586
- edges: {
587
- from: string;
588
- specifier: string;
589
- to: string;
590
- kind: "any" | "import" | "require";
591
- }[];
592
- };
593
551
  /** Record shapes, in first-seen (`r0`, `r1`, ...) order. Fields are in
594
552
  * CANONICAL order (sorted by name) — the shape's identity; a `recordLit`'s
595
553
  * fields stay in source order (evaluation order) independently. The
@@ -624,6 +582,38 @@ export interface IrModule {
624
582
  * emissions stay conformance-identical by construction. Absent on every
625
583
  * executable build (the backends emit main() exactly as always). */
626
584
  lib?: IrLibSection;
585
+ /** Contract types (@scriptc/types) the frontend verified against every
586
+ * write in the program (ir/contract-check.ts). Backends may rely on them
587
+ * unconditionally. Absent when the program writes no contract. */
588
+ contracts?: IrContracts;
589
+ }
590
+ /** Verified contract facts, keyed by IR names. */
591
+ export interface IrContracts {
592
+ /** Int32 class field families: `${topmost declaring class}\0${field}`. */
593
+ int32Fields?: string[];
594
+ /** Int32 parameters: `${function}\0${localId}`. */
595
+ int32Params?: string[];
596
+ /** Functions whose every return is an int32. */
597
+ int32Returns?: string[];
598
+ /** Int32 locals (`${function}\0${localId}`, including every capture of a
599
+ * captured binding) and module globals (`\0${globalId}`). */
600
+ int32Locals?: string[];
601
+ /** Functions that cannot throw (NoThrow). */
602
+ noThrow?: string[];
603
+ /** Acyclic classes and object types, as cycle-analysis units
604
+ * (`object:<class>`, `record:<id>`, `union:<id>`): proven unable to lie
605
+ * on a reference cycle, so they carry no cycle header. */
606
+ acyclic?: string[];
607
+ /** Immutable module constants built from fresh literals: the backend
608
+ * makes their graphs immortal once initialized, and reads through them
609
+ * need no reference counting. */
610
+ immortalGlobals?: string[];
611
+ /** Root classes declared `implements ProgramLifetime`: instances of every
612
+ * class in their hierarchies are never freed (no collector header, a
613
+ * reference count that publication alone turns into SIZE_MAX), their
614
+ * static reference counting is elided, and the cycle analysis treats them
615
+ * as leaves. */
616
+ programLifetime?: string[];
627
617
  }
628
618
  export type IrFfiValueParamClass = "f64" | "f32" | "bool" | "u8" | "i8" | "u16" | "i16" | "u32" | "i32" | "i64" | "u64" | "pointer" | "string" | "bytes" | "mutable-bytes";
629
619
  export type IrFfiCallbackParamClass = "f64" | "f32" | "bool" | "u8" | "i8" | "u16" | "i16" | "u32" | "i32" | "i64" | "u64" | "pointer" | "cstring" | "string" | "bytes";
@@ -1464,7 +1454,7 @@ export declare const MAY_THROW_ARR_METHODS: ReadonlySet<IrArrIntrinsicMethod>;
1464
1454
  /** Element types whose comparator sort can run in the runtime over raw
1465
1455
  * slots: numbers, and reference-counted values passed to the comparator by
1466
1456
  * pointer. Unions with an undefined arm order undefined last without a
1467
- * comparator call, and checked or island values have their own ABI; those
1457
+ * comparator call, and checked values have their own ABI; those
1468
1458
  * keep the IR sort helper. */
1469
1459
  export declare function isSortValuesElement(elem: IrType, unionArms?: readonly IrType[]): boolean;
1470
1460
  /** The Map method/property surface (mirrors ambient/scriptc.d.ts) plus the
@@ -1758,8 +1748,7 @@ export type IrExpr =
1758
1748
  * dyn asks its runtime kind. The other operand form is a UNION — the ARM
1759
1749
  * value's ToBoolean via a per-union interned helper (unit arms false;
1760
1750
  * f64/string/bool arms per-value; ref arms — arrays, records, objects,
1761
- * functions, maps, sets, promises, ... — always true; jsval arms ask the
1762
- * engine). Result is bool. */
1751
+ * functions, maps, sets, promises, ... — always true). Result is bool. */
1763
1752
  | {
1764
1753
  kind: "toBool";
1765
1754
  operand: IrExpr;
@@ -2562,23 +2551,6 @@ export type IrExpr =
2562
2551
  type: IrType;
2563
2552
  loc: SrcLoc;
2564
2553
  }
2565
- /** Island value → dyn conversion (`type` is always dyn; the operand
2566
- * is always jsval): the jsval→dyn crossing — an 'any'-typed engine
2567
- * value flowing into an 'unknown'/'object'/JS-residue slot wraps BY
2568
- * REFERENCE as the checked-dynamic tree's SCR_DYN_JSVAL kind (scr_dyn_from_jsval).
2569
- * Engine scalars (number/string/boolean/null/undefined) normalize to
2570
- * the native dyn kinds at wrap time, so wrapped nodes only ever hold
2571
- * engine objects/arrays/functions; typeof/truthiness/String()/=== on
2572
- * the wrapped node route to the engine, un-armed dyn walks fence
2573
- * loudly, and scr_jsval_from_dyn unwraps the SAME engine value back
2574
- * (identity round trip). The operand is borrowed; the result is owned
2575
- * (+1). Never throws. */
2576
- | {
2577
- kind: "dynFromJsval";
2578
- value: IrExpr;
2579
- type: IrType;
2580
- loc: SrcLoc;
2581
- }
2582
2554
  /** CALLING a dyn value — `fn(a, b)` where fn is checked-dynamic (an
2583
2555
  * implicit-any JS binding, a dyn record member, a dynKeyGet result).
2584
2556
  * Arguments are ALREADY dyn-typed (typed values box through dynFrom at
@@ -2791,8 +2763,7 @@ export type IrExpr =
2791
2763
  * 'FIRSTPROP' of 'SPELLING' …" when `firstProp` is set (V8 names the
2792
2764
  * pattern's first property) — and yields the value unchanged otherwise.
2793
2765
  * `spelling` is the RHS's compile-time source spelling. Value and type
2794
- * are dyn (the dyn helper) or jsval (the island's prelude guard —
2795
- * engine-thrown, catchable like every boundary throw). */
2766
+ * are dyn; the helper throws a catchable error. */
2796
2767
  | {
2797
2768
  kind: "dynDestrCheck";
2798
2769
  value: IrExpr;
@@ -2805,10 +2776,7 @@ export type IrExpr =
2805
2776
  * it. Over a dyn value: arrays step by index, strings by code point,
2806
2777
  * Buffers by byte; everything else throws V8's exact "<desc> is not
2807
2778
  * iterable (cannot read property Symbol(Symbol.iterator))" TypeError.
2808
- * Over an island (jsval) value the engine runs the REAL iterator
2809
- * protocol (user iterables included, IteratorClose per spec) behind the
2810
- * same V8 message for non-iterables. The result is a FRESH array (dyn
2811
- * or engine, matching the operand) of exactly `count` elements
2779
+ * The result is a fresh dyn array of exactly `count` elements
2812
2780
  * (undefined-padded past the end) — the empty pattern passes count 0
2813
2781
  * and uses only the validation. Value is borrowed; the result is owned
2814
2782
  * (+1). */
@@ -3161,144 +3129,7 @@ export type IrExpr =
3161
3129
  preserveRefs?: true;
3162
3130
  type: IrType;
3163
3131
  loc: SrcLoc;
3164
- }
3165
- /** Static → island marshal (--dynamic builds only). `value`'s type is
3166
- * f64/string/bool (marshaled by value) or a JSON-safe composite
3167
- * (record/array/union — marshaled as a DEEP COPY through the emitted
3168
- * type-directed JSON serializer and the engine's JSON parser; the
3169
- * aliasing divergence is documented in SEMANTICS.md). Result is an
3170
- * owned (+1) jsval; the operand is borrowed. Never throws. */
3171
- | {
3172
- kind: "jsMarshal";
3173
- value: IrExpr;
3174
- type: IrType;
3175
- loc: SrcLoc;
3176
- }
3177
- /** An operation on island values (--dynamic builds only), executed by
3178
- * the embedded engine with JS-exact semantics (coercions come from
3179
- * pinned prelude closures, not C reimplementations). `args` are
3180
- * jsval-typed and borrowed. Result `type` per op: arithmetic
3181
- * (add/sub/mul/div/mod/pow), unary neg/plus, getProp/getIdx,
3182
- * callMethod/callFn/callFnThis/globalGet → jsval (+1); comparisons
3183
- * (lt/le/gt/ge/eq/neq), truthy, not → bool; typeof, toStr → string (+1);
3184
- * setProp/setIdx → void. `name` carries the property/method identifier
3185
- * for getProp/setProp/callMethod/globalGet, absent otherwise. MAY THROW
3186
- * (engine
3187
- * exceptions bridge into the exception cell, catchably) — backends'
3188
- * may-throw analyses must seed on every jsOp like a `throw`. */
3189
- | {
3190
- kind: "jsOp";
3191
- op: IrJsOp;
3192
- name?: string;
3193
- args: IrExpr[];
3194
- type: IrType;
3195
- loc: SrcLoc;
3196
- }
3197
- /** Island → static validated exit (--dynamic builds only): `value` is
3198
- * jsval-typed, `type` is the static target. STRICT for primitives (a
3199
- * non-number refuses to exit as number — no coercion); composite
3200
- * targets round-trip through the engine's JSON.stringify and the
3201
- * existing dynCheck walker for the target (width-tolerant records,
3202
- * path-annotated failures — identical semantics to `dyn as T`). MAY
3203
- * THROW a catchable TypeError-shaped string. The operand is borrowed;
3204
- * the result is owned (+1) for refcounted targets. */
3205
- | {
3206
- kind: "jsExit";
3207
- value: IrExpr;
3208
- type: IrType;
3209
- loc: SrcLoc;
3210
- }
3211
- /** Island → static PROMISE bridge (--dynamic builds only): `value` is a
3212
- * jsval whose declared type is Promise<T> (a package call's promise —
3213
- * it lives in the engine); the result is a fresh pending static promise
3214
- * the engine promise settles. `type` is promise-of-jsval (the settled
3215
- * engine value crosses as a retained handle; typed uses exit like any
3216
- * jsval) or promise-of-void (T mapped to void — nothing to carry).
3217
- * Fulfillment wakes parked awaiters through the ready queue; rejection
3218
- * crosses like a bridged exception (engine Errors become real static
3219
- * Errors) and re-throws at the await or enters the unhandled ledger.
3220
- * Bridging one engine promise twice makes two independent static
3221
- * observers of the same settlement — semantically equivalent, slightly
3222
- * redundant (SEMANTICS.md). Operand borrowed; result +1. MAY THROW
3223
- * only on an engine-level surprise minting the subscription — backends
3224
- * seed may-throw and emit the pending check like other island ops. */
3225
- | {
3226
- kind: "jsBridgePromise";
3227
- value: IrExpr;
3228
- type: IrType;
3229
- loc: SrcLoc;
3230
3132
  };
3231
- /** The island operation set. Grouped by result type — see the jsOp node
3232
- * doc. A closed union: every member has a lowering rule in the frontend,
3233
- * a validation rule, and a scr_jsval_* implementation in scr_island.c. */
3234
- export type IrJsOp = "add" | "sub" | "mul" | "div" | "mod" | "pow" | "neg" | "plus" | "lt" | "le" | "gt" | "ge" | "eq" | "neq"
3235
- /** `v instanceof C` where BOTH sides are island values (a package-
3236
- * exported class as the RHS): the spec's InstanceofOperator in the
3237
- * engine, Symbol.hasInstance included; a non-object RHS throws the
3238
- * engine's own TypeError, bridged catchably. */
3239
- | "instanceOf" | "truthy" | "not" | "typeof" | "toStr" | "getProp" | "setProp" | "getIdx" | "setIdx" | "callMethod" | "callFn"
3240
- /** Calls an already-resolved island function with an explicit receiver.
3241
- * Args are (callee, receiver, ...arguments); this preserves computed
3242
- * method evaluation order without reading a getter twice. */
3243
- | "callFnThis"
3244
- /** Spread application on an island callee — `f(...pre, ...s)`, the
3245
- * rest-forwarding idiom (`(...args) => g(...args)` under --dynamic).
3246
- * Args are exactly (callee, pre, spread): `pre` is the engine array of
3247
- * leading fixed arguments (jsOp arrLit), `spread` the spread source;
3248
- * `name` carries the spread expression's source spelling (V8's nullish
3249
- * spread-call TypeError spells it). The prelude helper uses REAL spread
3250
- * syntax, so iterator protocols are the engine's own, with guards
3251
- * front-running V8's exact spread-call TypeError texts. May throw. */
3252
- | "callSpread"
3253
- /** `new X(...)` where X is jsval-typed (package-declared classes):
3254
- * JS_CallConstructor — args are the callee then the constructor
3255
- * arguments, mirroring callFn. */
3256
- | "construct"
3257
- /** A member of the engine's global object by name (Math, parseFloat, ...)
3258
- * — the receiver/callee for the island-backed ambient surface. Zero args;
3259
- * `name` carries the global's identifier. May-throw for uniformity with
3260
- * the other engine entries (the emitter's pending check runs after it). */
3261
- | "globalGet"
3262
- /** Island-native literals: an object literal / array literal whose
3263
- * contextual type is `any` builds directly in the engine — objLit args
3264
- * are alternating key/value jsvals (keys are marshaled strings), arrLit
3265
- * args are the elements. Never throw. */
3266
- | "objLit" | "arrLit"
3267
- /** The engine-native TemplateStringsArray for an ISLAND TAG call: args
3268
- * are 2n marshaled strings — n cooked then n raw — building a fresh
3269
- * engine array whose `.raw` carries the raw spellings (tags dispatch on
3270
- * it). Never throws. */
3271
- | "tplStrings"
3272
- /** Spread completion for an island-native object literal: copies
3273
- * args[1]'s own enumerable properties onto args[0] (the spec's
3274
- * CopyDataProperties — the engine's own Object.assign; null/undefined
3275
- * sources spread nothing) and answers args[0] for chaining. May throw
3276
- * (getters run). */
3277
- | "objSpread"
3278
- /** Accessor completion for an island-native object literal: defines a
3279
- * GETTER property on args[0] (the object) — args are (obj, key string
3280
- * marshal, getter function handle) — and answers the same object (the
3281
- * chainable spelling: `defineGetter(objLit(...), k, f)`). The
3282
- * self-referential doc-printer root-indent shape. Never throws. */
3283
- | "defineGetter"
3284
- /** The engine's own undefined / null as island values (zero args, never
3285
- * throw): the unit arms of a union marshaling IN (`string | undefined`
3286
- * into an 'any' slot — the undefined arm IS the engine undefined), and
3287
- * conceptually the unit path of `x?.y` on 'any' (the emitter inlines
3288
- * that one). */
3289
- | "undefLit" | "nullLit"
3290
- /** GetIterator over an island value — the for-of head over 'any' (the
3291
- * engine's own protocol lookup; V8's not-iterable TypeError on refusal).
3292
- * The loop drives next() through callMethod and reads value/done with
3293
- * getProp/truthy. */
3294
- | "iterNew"
3295
- /** `o.name?.(...)` — the optional METHOD call on an island receiver: a
3296
- * nullish member answers the engine's undefined, anything else calls
3297
- * with `this = o` (JS-exact; non-callables throw in the engine). */
3298
- | "optCallMethod";
3299
- /** Result-type rule for each island op (the validator enforces it; the
3300
- * frontend constructs nodes with exactly these). */
3301
- export declare function jsOpResultKind(op: IrJsOp): "jsval" | "bool" | "string" | "void";
3302
3133
  /** True when a type is a union with an undefined arm — the optional-flavored
3303
3134
  * slot marker shared by the frontend (record literals may omit such fields)
3304
3135
  * and backends (JSON serializers DROP such fields when they hold undefined,
@@ -3328,60 +3159,9 @@ export declare function isJsonStringifySafeType(t: IrType, getRecord: (shapeId:
3328
3159
  /** A JSON-shaped container with unknown payloads needs the runtime JSON
3329
3160
  * traversal. Its declared structure can be boxed, but payloads may carry
3330
3161
  * omitted values, toJSON methods, or cycles. This predicate does not widen
3331
- * the type-directed serializer, checked-island boundary, or root-undefined
3162
+ * the type-directed serializer, checked-value boundary, or root-undefined
3332
3163
  * contract; callers must select the checked runtime traversal explicitly. */
3333
3164
  export declare function isJsonStringifyDynamicType(t: IrType, getRecord: (shapeId: string) => IrRecordShape | undefined, getUnion: (unionId: string) => IrUnionDef | undefined): boolean;
3334
- /** THE island boundary predicate: true when a static type can cross into
3335
- * the island (jsMarshal — primitives by value, composites as deep JSON
3336
- * copies) and back out (jsExit — strict primitive extraction, composites
3337
- * through the dynCheck walker). Primitives are JSON-safe, so the rule
3338
- * coincides with isJsonSafeType; it has its own name because the boundary
3339
- * is its own concept — the frontend's implicit coercions, the explicit-cast
3340
- * lowering, and the validator's jsMarshal/jsExit rules all ask this ONE
3341
- * question, and the boundary rejection messages describe exactly this set. */
3342
- export declare function canCrossIslandBoundary(t: IrType, getRecord: (shapeId: string) => IrRecordShape | undefined, getUnion: (unionId: string) => IrUnionDef | undefined): boolean;
3343
- /** True for a closure type that can cross INTO the island as a host
3344
- * function: every parameter jsval (the engine's arguments pass through as
3345
- * handles — no per-type extraction exists inside a host call) and the
3346
- * result jsval, void, or a primitive (which marshals back by value —
3347
- * `(x) => x * 2` on an 'any' x infers a number return). Contextual typing
3348
- * produces exactly this shape for callbacks passed to package APIs
3349
- * (`.action((a, b) => ...)` against `(...args: any[]) => void`). Arity is
3350
- * capped by the runtime's host-call argument buffer (scr_island.c). */
3351
- export declare const MAX_ISLAND_CALLBACK_ARITY = 16;
3352
- export declare function canMarshalFuncIntoIsland(t: IrType): boolean;
3353
- /** Parameter types a TYPED closure may declare when it crosses INTO the
3354
- * island as a host function: jsval params take the engine argument as a
3355
- * handle (the all-'any' shape above); dyn params normalize scalars or retain
3356
- * engine objects by reference. Every other admitted type converts
3357
- * AT CALL TIME through the validated-exit machinery — strict primitives,
3358
- * JSON round-trip composites (the dynCheck walker: width-tolerant records,
3359
- * path-annotated failures). On top of the jsExit set, a bare `T | undefined`
3360
- * union is admitted here — an absent or undefined engine argument takes the
3361
- * undefined arm, exactly the missing-optional-field rule (and exactly the
3362
- * commander case: `.action((text: string | undefined, opts) => ...)` sees
3363
- * undefined when the command argument is omitted). */
3364
- export declare function isIslandCallbackParamType(t: IrType, getRecord: (shapeId: string) => IrRecordShape | undefined, getUnion: (unionId: string) => IrUnionDef | undefined): boolean;
3365
- /** Classify a typed island callback's RETURN for adapter synthesis: sync
3366
- * kinds marshal back by value ('void'|'jsval'|'f64'|'bool'|'string' — the
3367
- * canMarshalFuncIntoIsland set), 'json' marshals a JSON-safe composite
3368
- * through the type-directed serializer + engine parse (the jsMarshal
3369
- * composite path — commander's option-argument collectors return arrays
3370
- * this way), and a Promise of the by-value kinds wraps as an engine
3371
- * promise settled when the scriptc promise settles (async callbacks —
3372
- * the `.action(async ...)` case). Null for anything else (Promise of
3373
- * composites: still fenced). */
3374
- export declare function islandCallbackRet(t: IrType, getRecord: (shapeId: string) => IrRecordShape | undefined, getUnion: (unionId: string) => IrUnionDef | undefined): {
3375
- async: boolean;
3376
- tag: "void" | "jsval" | "f64" | "bool" | "string" | "json" | "dyn";
3377
- } | null;
3378
- /** The TYPED extension of canMarshalFuncIntoIsland (a strict superset):
3379
- * closures whose params are per-argument-convertible at call time
3380
- * (isIslandCallbackParamType) and whose return classifies
3381
- * (islandCallbackRet). Same arity cap — the runtime's host-call argument
3382
- * buffer. Statically typed closure parameters stay fenced; unknown values
3383
- * enter as checked-dynamic values and are validated at each typed use. */
3384
- export declare function canMarshalTypedFuncIntoIsland(t: IrType, getRecord: (shapeId: string) => IrRecordShape | undefined, getUnion: (unionId: string) => IrUnionDef | undefined): boolean;
3385
3165
  /** The runtime HANDLE kinds that cross the checked-dynamic boundary as
3386
3166
  * the checked-dynamic tree's HANDLE kind (SCR_DYN_HANDLE): boxed by REFERENCE (identity —
3387
3167
  * stateful I/O objects never copy), unboxed by tag check, members
@@ -3438,23 +3218,3 @@ export declare function canBoxFuncIntoDyn(t: IrType, getRecord: (shapeId: string
3438
3218
  * dyn), return void, dyn, or dynCheckable (the adapter validates the dyn
3439
3219
  * result). */
3440
3220
  export declare function canAdaptDynFuncTo(t: IrType, getRecord: (shapeId: string) => IrRecordShape | undefined, getUnion: (unionId: string) => IrUnionDef | undefined, visiting?: Set<string>): boolean;
3441
- /** The MARSHAL-direction boundary (jsMarshal): everything that can cross
3442
- * out and back (canCrossIslandBoundary) plus qualifying closures — those
3443
- * enter as host functions but never EXIT (jsExit keeps the narrower
3444
- * predicate). */
3445
- export declare function canMarshalIntoIsland(t: IrType, getRecord: (shapeId: string) => IrRecordShape | undefined, getUnion: (unionId: string) => IrUnionDef | undefined): boolean;
3446
- /** The EXIT-direction boundary (jsExit): everything round-trippable
3447
- * (canCrossIslandBoundary) plus BARE undefined/null-armed unions whose
3448
- * data arms are all JSON-safe — the engine's undefined takes the
3449
- * undefined arm before the JSON detour (JSON cannot spell undefined, and
3450
- * bare undefined-armed unions are JSON-unsafe for exactly that reason),
3451
- * null and data ride the round trip into the union's dynCheck. The
3452
- * package-API shape `result.headers` : `Record<string, string> |
3453
- * undefined` is the motivating case. */
3454
- /** The static-promise→engine bridge's payload domain: the fulfillment
3455
- * types a scriptc promise may deliver INTO the island as a real engine
3456
- * thenable (scr_jsval_from_promise — the async-callback return bridge,
3457
- * reused by promise VALUES crossing at jsvalIn edges and the island
3458
- * Promise.all arm). Null = outside the domain (the boundary fence). */
3459
- export declare function islandPromisePayloadTag(inner: IrType): "void" | "f64" | "bool" | "string" | "jsval" | "jsvalArr" | null;
3460
- export declare function canExitIslandToType(t: IrType, getRecord: (shapeId: string) => IrRecordShape | undefined, getUnion: (unionId: string) => IrUnionDef | undefined): boolean;