@scriptc/compiler 0.3.1 → 0.3.3

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 (492) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +832 -55
  2. package/dist/backend/cycle-analysis.js +6 -1
  3. package/dist/backend/cycle-analysis.js.map +1 -1
  4. package/dist/backend/executable-features.js +1 -0
  5. package/dist/backend/executable-features.js.map +1 -1
  6. package/dist/backend/literals.d.ts +7 -0
  7. package/dist/backend/literals.js +32 -0
  8. package/dist/backend/literals.js.map +1 -1
  9. package/dist/backend/literals.test.js +17 -1
  10. package/dist/backend/literals.test.js.map +1 -1
  11. package/dist/backend/llvm/alloc.d.ts +15 -4
  12. package/dist/backend/llvm/alloc.js +63 -25
  13. package/dist/backend/llvm/alloc.js.map +1 -1
  14. package/dist/backend/llvm/alloc.test.js +62 -2
  15. package/dist/backend/llvm/alloc.test.js.map +1 -1
  16. package/dist/backend/llvm/appended-array-literals.d.ts +2 -0
  17. package/dist/backend/llvm/appended-array-literals.js +109 -0
  18. package/dist/backend/llvm/appended-array-literals.js.map +1 -0
  19. package/dist/backend/llvm/appended-array-literals.test.d.ts +1 -0
  20. package/dist/backend/llvm/appended-array-literals.test.js +90 -0
  21. package/dist/backend/llvm/appended-array-literals.test.js.map +1 -0
  22. package/dist/backend/llvm/array-search.d.ts +8 -0
  23. package/dist/backend/llvm/array-search.js +52 -0
  24. package/dist/backend/llvm/array-search.js.map +1 -0
  25. package/dist/backend/llvm/array-search.test.d.ts +1 -0
  26. package/dist/backend/llvm/array-search.test.js +72 -0
  27. package/dist/backend/llvm/array-search.test.js.map +1 -0
  28. package/dist/backend/llvm/call-lifetimes.d.ts +11 -1
  29. package/dist/backend/llvm/call-lifetimes.js +74 -4
  30. package/dist/backend/llvm/call-lifetimes.js.map +1 -1
  31. package/dist/backend/llvm/call-lifetimes.test.js +54 -0
  32. package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
  33. package/dist/backend/llvm/classes.js +97 -38
  34. package/dist/backend/llvm/classes.js.map +1 -1
  35. package/dist/backend/llvm/classes.test.js +2 -2
  36. package/dist/backend/llvm/common.d.ts +1 -1
  37. package/dist/backend/llvm/common.js +1 -1
  38. package/dist/backend/llvm/dense-array-access.d.ts +5 -0
  39. package/dist/backend/llvm/dense-array-access.js +18 -13
  40. package/dist/backend/llvm/dense-array-access.js.map +1 -1
  41. package/dist/backend/llvm/dense-array-access.test.js +15 -2
  42. package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
  43. package/dist/backend/llvm/dyn.d.ts +6 -0
  44. package/dist/backend/llvm/dyn.js +84 -11
  45. package/dist/backend/llvm/dyn.js.map +1 -1
  46. package/dist/backend/llvm/emitter.d.ts +108 -16
  47. package/dist/backend/llvm/emitter.js +598 -108
  48. package/dist/backend/llvm/emitter.js.map +1 -1
  49. package/dist/backend/llvm/emitter.test.js +26 -3
  50. package/dist/backend/llvm/emitter.test.js.map +1 -1
  51. package/dist/backend/llvm/expr-async.js +174 -7
  52. package/dist/backend/llvm/expr-async.js.map +1 -1
  53. package/dist/backend/llvm/expr-bytes.js +11 -0
  54. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  55. package/dist/backend/llvm/expr-callbacks.d.ts +8 -0
  56. package/dist/backend/llvm/expr-callbacks.js +96 -2
  57. package/dist/backend/llvm/expr-callbacks.js.map +1 -1
  58. package/dist/backend/llvm/expr-calls.d.ts +12 -1
  59. package/dist/backend/llvm/expr-calls.js +133 -54
  60. package/dist/backend/llvm/expr-calls.js.map +1 -1
  61. package/dist/backend/llvm/expr-containers.d.ts +7 -0
  62. package/dist/backend/llvm/expr-containers.js +80 -22
  63. package/dist/backend/llvm/expr-containers.js.map +1 -1
  64. package/dist/backend/llvm/expr-context.d.ts +2 -0
  65. package/dist/backend/llvm/expr-control.d.ts +8 -0
  66. package/dist/backend/llvm/expr-control.js +103 -69
  67. package/dist/backend/llvm/expr-control.js.map +1 -1
  68. package/dist/backend/llvm/expr-dynamic.js +21 -10
  69. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  70. package/dist/backend/llvm/expr-primitives.d.ts +7 -0
  71. package/dist/backend/llvm/expr-primitives.js +53 -51
  72. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  73. package/dist/backend/llvm/expr-records.js +19 -5
  74. package/dist/backend/llvm/expr-records.js.map +1 -1
  75. package/dist/backend/llvm/expr-stream-bridges.d.ts +8 -0
  76. package/dist/backend/llvm/expr-stream-bridges.js +111 -39
  77. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  78. package/dist/backend/llvm/expr-stream-bridges.test.js +49 -1
  79. package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
  80. package/dist/backend/llvm/expr-stream-callbacks.d.ts +13 -2
  81. package/dist/backend/llvm/expr-stream-callbacks.js +80 -5
  82. package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
  83. package/dist/backend/llvm/inline-unions.d.ts +48 -0
  84. package/dist/backend/llvm/inline-unions.js +134 -0
  85. package/dist/backend/llvm/inline-unions.js.map +1 -0
  86. package/dist/backend/llvm/inline-unions.test.d.ts +1 -0
  87. package/dist/backend/llvm/inline-unions.test.js +124 -0
  88. package/dist/backend/llvm/inline-unions.test.js.map +1 -0
  89. package/dist/backend/llvm/int32-abi.d.ts +18 -2
  90. package/dist/backend/llvm/int32-abi.js +23 -2
  91. package/dist/backend/llvm/int32-abi.js.map +1 -1
  92. package/dist/backend/llvm/int32-abi.test.js +75 -1
  93. package/dist/backend/llvm/int32-abi.test.js.map +1 -1
  94. package/dist/backend/llvm/integer-remainder.d.ts +28 -5
  95. package/dist/backend/llvm/integer-remainder.js +80 -9
  96. package/dist/backend/llvm/integer-remainder.js.map +1 -1
  97. package/dist/backend/llvm/lib-dispatch.js +170 -28
  98. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  99. package/dist/backend/llvm/lib-filesystem.js +181 -5
  100. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  101. package/dist/backend/llvm/lib-network.js +9 -6
  102. package/dist/backend/llvm/lib-network.js.map +1 -1
  103. package/dist/backend/llvm/lib-process.js +2 -2
  104. package/dist/backend/llvm/lib-process.js.map +1 -1
  105. package/dist/backend/llvm/lib-shared.js +208 -9
  106. package/dist/backend/llvm/lib-shared.js.map +1 -1
  107. package/dist/backend/llvm/lib-stream.js +97 -0
  108. package/dist/backend/llvm/lib-stream.js.map +1 -1
  109. package/dist/backend/llvm/local-array-reads.js +12 -6
  110. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  111. package/dist/backend/llvm/local-array-reads.test.js +6 -3
  112. package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
  113. package/dist/backend/llvm/local-union-storage.d.ts +26 -2
  114. package/dist/backend/llvm/local-union-storage.js +132 -12
  115. package/dist/backend/llvm/local-union-storage.js.map +1 -1
  116. package/dist/backend/llvm/local-union-storage.test.js +107 -1
  117. package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
  118. package/dist/backend/llvm/loop-array-borrows.d.ts +8 -2
  119. package/dist/backend/llvm/loop-array-borrows.js +93 -13
  120. package/dist/backend/llvm/loop-array-borrows.js.map +1 -1
  121. package/dist/backend/llvm/map-number-lookup.d.ts +20 -0
  122. package/dist/backend/llvm/map-number-lookup.js +66 -0
  123. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  124. package/dist/backend/llvm/map-number-lookup.test.d.ts +1 -0
  125. package/dist/backend/llvm/map-number-lookup.test.js +102 -0
  126. package/dist/backend/llvm/map-number-lookup.test.js.map +1 -0
  127. package/dist/backend/llvm/map-read-lifetimes.js +1 -0
  128. package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
  129. package/dist/backend/llvm/publish.d.ts +4 -0
  130. package/dist/backend/llvm/publish.js +3 -1
  131. package/dist/backend/llvm/publish.js.map +1 -1
  132. package/dist/backend/llvm/record-results.d.ts +29 -0
  133. package/dist/backend/llvm/record-results.js +260 -0
  134. package/dist/backend/llvm/record-results.js.map +1 -0
  135. package/dist/backend/llvm/reference-effects.js +15 -0
  136. package/dist/backend/llvm/reference-effects.js.map +1 -1
  137. package/dist/backend/llvm/reference-writes.js +29 -9
  138. package/dist/backend/llvm/reference-writes.js.map +1 -1
  139. package/dist/backend/llvm/regions.d.ts +68 -0
  140. package/dist/backend/llvm/regions.js +314 -0
  141. package/dist/backend/llvm/regions.js.map +1 -0
  142. package/dist/backend/llvm/regions.test.d.ts +1 -0
  143. package/dist/backend/llvm/regions.test.js +173 -0
  144. package/dist/backend/llvm/regions.test.js.map +1 -0
  145. package/dist/backend/llvm/serialized-ir-emission.test.js +2 -0
  146. package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
  147. package/dist/backend/llvm/shapes.d.ts +86 -13
  148. package/dist/backend/llvm/shapes.js +208 -54
  149. package/dist/backend/llvm/shapes.js.map +1 -1
  150. package/dist/backend/llvm/shapes.test.js +68 -9
  151. package/dist/backend/llvm/shapes.test.js.map +1 -1
  152. package/dist/backend/llvm/split-loops.js +1 -1
  153. package/dist/backend/llvm/split-loops.js.map +1 -1
  154. package/dist/backend/llvm/stack-objects.d.ts +29 -0
  155. package/dist/backend/llvm/stack-objects.js +142 -0
  156. package/dist/backend/llvm/stack-objects.js.map +1 -0
  157. package/dist/backend/llvm/stack-objects.test.d.ts +1 -0
  158. package/dist/backend/llvm/stack-objects.test.js +255 -0
  159. package/dist/backend/llvm/stack-objects.test.js.map +1 -0
  160. package/dist/backend/llvm/string-reads.d.ts +4 -1
  161. package/dist/backend/llvm/string-reads.js +89 -9
  162. package/dist/backend/llvm/string-reads.js.map +1 -1
  163. package/dist/backend/llvm/switch-dispatch.js +5 -4
  164. package/dist/backend/llvm/switch-dispatch.js.map +1 -1
  165. package/dist/backend/llvm/walkers.d.ts +13 -0
  166. package/dist/backend/llvm/walkers.js +108 -10
  167. package/dist/backend/llvm/walkers.js.map +1 -1
  168. package/dist/backend/may-throw.js +10 -4
  169. package/dist/backend/may-throw.js.map +1 -1
  170. package/dist/backend/native/contracts.d.ts +7 -2
  171. package/dist/backend/native/executable.js +28 -2
  172. package/dist/backend/native/executable.js.map +1 -1
  173. package/dist/backend/native/library.js +1 -1
  174. package/dist/backend/native/library.js.map +1 -1
  175. package/dist/backend/native/runtime-inputs.d.ts +1 -1
  176. package/dist/backend/native/runtime-inputs.js +3 -0
  177. package/dist/backend/native/runtime-inputs.js.map +1 -1
  178. package/dist/backend/native-link-info-core.d.ts +1 -0
  179. package/dist/backend/native-link-info-core.js.map +1 -1
  180. package/dist/backend/native-toolchain.test.js +1 -1
  181. package/dist/backend/native-toolchain.test.js.map +1 -1
  182. package/dist/backend/runtime-abi.d.ts +2 -2
  183. package/dist/backend/runtime-abi.js +2 -2
  184. package/dist/backend/runtime-pack-core.d.ts +1 -0
  185. package/dist/backend/runtime-pack-core.js +1 -0
  186. package/dist/backend/runtime-pack-core.js.map +1 -1
  187. package/dist/backend/runtime-pack-targets.test.js +1 -1
  188. package/dist/backend/runtime-pack.test.js +1 -1
  189. package/dist/backend/target-diagnostics.js +17 -0
  190. package/dist/backend/target-diagnostics.js.map +1 -1
  191. package/dist/backend/target-diagnostics.test.js +16 -0
  192. package/dist/backend/target-diagnostics.test.js.map +1 -1
  193. package/dist/compat/fetch-profile.js +4 -4
  194. package/dist/compat/fetch-profile.js.map +1 -1
  195. package/dist/contracts/check.js +2 -0
  196. package/dist/contracts/check.js.map +1 -1
  197. package/dist/coverage/report.js +1 -1
  198. package/dist/coverage/report.js.map +1 -1
  199. package/dist/diagnostics/diagnostic.d.ts +6 -5
  200. package/dist/diagnostics/diagnostic.js +7 -6
  201. package/dist/diagnostics/diagnostic.js.map +1 -1
  202. package/dist/executable/executable-cache.d.ts +1 -0
  203. package/dist/executable/executable-cache.js.map +1 -1
  204. package/dist/frontend/builtin-modules.d.ts +1 -1
  205. package/dist/frontend/builtin-modules.js +1 -0
  206. package/dist/frontend/builtin-modules.js.map +1 -1
  207. package/dist/frontend/comptime-node.js +2 -2
  208. package/dist/frontend/comptime-node.js.map +1 -1
  209. package/dist/frontend/experimental-import.d.ts +12 -0
  210. package/dist/frontend/experimental-import.js +63 -0
  211. package/dist/frontend/experimental-import.js.map +1 -0
  212. package/dist/frontend/lowering/binding-analysis.d.ts +1 -1
  213. package/dist/frontend/lowering/binding-analysis.js +1 -1
  214. package/dist/frontend/lowering/builtin-calls.d.ts +6 -1
  215. package/dist/frontend/lowering/builtin-calls.js +36 -0
  216. package/dist/frontend/lowering/builtin-calls.js.map +1 -1
  217. package/dist/frontend/lowering/builtins/arguments.d.ts +4 -0
  218. package/dist/frontend/lowering/builtins/arguments.js +8 -4
  219. package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
  220. package/dist/frontend/lowering/builtins/blob.d.ts +20 -0
  221. package/dist/frontend/lowering/builtins/blob.js +167 -0
  222. package/dist/frontend/lowering/builtins/blob.js.map +1 -0
  223. package/dist/frontend/lowering/builtins/child-process-async.d.ts +2 -2
  224. package/dist/frontend/lowering/builtins/child-process-async.js +2 -2
  225. package/dist/frontend/lowering/builtins/child-process-methods.js +1 -1
  226. package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
  227. package/dist/frontend/lowering/builtins/child-process-sync.js +1 -1
  228. package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
  229. package/dist/frontend/lowering/builtins/compression.js +3 -2
  230. package/dist/frontend/lowering/builtins/compression.js.map +1 -1
  231. package/dist/frontend/lowering/builtins/console.d.ts +16 -6
  232. package/dist/frontend/lowering/builtins/console.js +33 -9
  233. package/dist/frontend/lowering/builtins/console.js.map +1 -1
  234. package/dist/frontend/lowering/builtins/crypto.js +415 -120
  235. package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
  236. package/dist/frontend/lowering/builtins/errors.js +20 -0
  237. package/dist/frontend/lowering/builtins/errors.js.map +1 -1
  238. package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +10 -0
  239. package/dist/frontend/lowering/builtins/filesystem-calls.js +89 -1
  240. package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
  241. package/dist/frontend/lowering/builtins/filesystem.d.ts +16 -7
  242. package/dist/frontend/lowering/builtins/filesystem.js +97 -15
  243. package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
  244. package/dist/frontend/lowering/builtins/fs-glob.d.ts +23 -0
  245. package/dist/frontend/lowering/builtins/fs-glob.js +224 -0
  246. package/dist/frontend/lowering/builtins/fs-glob.js.map +1 -0
  247. package/dist/frontend/lowering/builtins/json.d.ts +2 -2
  248. package/dist/frontend/lowering/builtins/json.js +13 -4
  249. package/dist/frontend/lowering/builtins/json.js.map +1 -1
  250. package/dist/frontend/lowering/builtins/key-object.d.ts +13 -0
  251. package/dist/frontend/lowering/builtins/key-object.js +56 -0
  252. package/dist/frontend/lowering/builtins/key-object.js.map +1 -0
  253. package/dist/frontend/lowering/builtins/module-calls.js +60 -12
  254. package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
  255. package/dist/frontend/lowering/builtins/numbers.d.ts +1 -0
  256. package/dist/frontend/lowering/builtins/numbers.js +17 -0
  257. package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
  258. package/dist/frontend/lowering/builtins/operating-system.d.ts +18 -0
  259. package/dist/frontend/lowering/builtins/operating-system.js +361 -1
  260. package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
  261. package/dist/frontend/lowering/builtins/performance.d.ts +25 -3
  262. package/dist/frontend/lowering/builtins/performance.js +340 -5
  263. package/dist/frontend/lowering/builtins/performance.js.map +1 -1
  264. package/dist/frontend/lowering/builtins/process.d.ts +2 -2
  265. package/dist/frontend/lowering/builtins/process.js +122 -17
  266. package/dist/frontend/lowering/builtins/process.js.map +1 -1
  267. package/dist/frontend/lowering/builtins/promises.js +109 -2
  268. package/dist/frontend/lowering/builtins/promises.js.map +1 -1
  269. package/dist/frontend/lowering/builtins/properties.d.ts +0 -7
  270. package/dist/frontend/lowering/builtins/properties.js +39 -11
  271. package/dist/frontend/lowering/builtins/properties.js.map +1 -1
  272. package/dist/frontend/lowering/builtins/readline.d.ts +23 -8
  273. package/dist/frontend/lowering/builtins/readline.js +266 -90
  274. package/dist/frontend/lowering/builtins/readline.js.map +1 -1
  275. package/dist/frontend/lowering/builtins/text-codecs.d.ts +3 -4
  276. package/dist/frontend/lowering/builtins/text-codecs.js +3 -4
  277. package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
  278. package/dist/frontend/lowering/builtins/url.d.ts +8 -0
  279. package/dist/frontend/lowering/builtins/url.js +36 -0
  280. package/dist/frontend/lowering/builtins/url.js.map +1 -1
  281. package/dist/frontend/lowering/call-arguments.js +1 -1
  282. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  283. package/dist/frontend/lowering/call-signatures.js +20 -2
  284. package/dist/frontend/lowering/call-signatures.js.map +1 -1
  285. package/dist/frontend/lowering/checked-promise-all.d.ts +10 -3
  286. package/dist/frontend/lowering/checked-promise-all.js +52 -6
  287. package/dist/frontend/lowering/checked-promise-all.js.map +1 -1
  288. package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +8 -3
  289. package/dist/frontend/lowering/class-dynamic-dispatch.js +159 -32
  290. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  291. package/dist/frontend/lowering/class-dynamic-dispatch.test.js +1 -0
  292. package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
  293. package/dist/frontend/lowering/class-protocol-dispatch.d.ts +45 -0
  294. package/dist/frontend/lowering/class-protocol-dispatch.js +516 -0
  295. package/dist/frontend/lowering/class-protocol-dispatch.js.map +1 -0
  296. package/dist/frontend/lowering/coercions/structural-plans.js +2 -1
  297. package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
  298. package/dist/frontend/lowering/coercions/structural.js +3 -3
  299. package/dist/frontend/lowering/coercions/structural.js.map +1 -1
  300. package/dist/frontend/lowering/collation-repertoire.js +6 -5
  301. package/dist/frontend/lowering/collation-repertoire.js.map +1 -1
  302. package/dist/frontend/lowering/containers/array-callbacks.js +33 -6
  303. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  304. package/dist/frontend/lowering/containers/array-construction.js +8 -4
  305. package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
  306. package/dist/frontend/lowering/containers/array-methods.d.ts +0 -7
  307. package/dist/frontend/lowering/containers/array-methods.js +43 -2
  308. package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
  309. package/dist/frontend/lowering/containers/array-pipelines.js +1 -1
  310. package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
  311. package/dist/frontend/lowering/containers/bytes.js +38 -26
  312. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  313. package/dist/frontend/lowering/containers/for-of.d.ts +1 -1
  314. package/dist/frontend/lowering/containers/for-of.js +5 -1
  315. package/dist/frontend/lowering/containers/for-of.js.map +1 -1
  316. package/dist/frontend/lowering/containers/indexed-objects.js +1 -1
  317. package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
  318. package/dist/frontend/lowering/containers/string-and-regexp.js +91 -0
  319. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  320. package/dist/frontend/lowering/crypto-tables.d.ts +3 -3
  321. package/dist/frontend/lowering/crypto-tables.js +77 -12
  322. package/dist/frontend/lowering/crypto-tables.js.map +1 -1
  323. package/dist/frontend/lowering/cycle-initialization.d.ts +18 -2
  324. package/dist/frontend/lowering/cycle-initialization.js +166 -12
  325. package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
  326. package/dist/frontend/lowering/deferred-module-initializers.js +7 -2
  327. package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
  328. package/dist/frontend/lowering/deferred-module-initializers.test.js +28 -0
  329. package/dist/frontend/lowering/deferred-module-initializers.test.js.map +1 -1
  330. package/dist/frontend/lowering/expressions/nullish-assignment.js +10 -0
  331. package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
  332. package/dist/frontend/lowering/expressions/object-literals.js +21 -68
  333. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  334. package/dist/frontend/lowering/generator-delegation.d.ts +8 -0
  335. package/dist/frontend/lowering/generator-delegation.js +231 -10
  336. package/dist/frontend/lowering/generator-delegation.js.map +1 -1
  337. package/dist/frontend/lowering/generic-functions.d.ts +2 -2
  338. package/dist/frontend/lowering/generic-functions.js +2 -2
  339. package/dist/frontend/lowering/generic-functions.js.map +1 -1
  340. package/dist/frontend/lowering/http2-constants.js +1 -1
  341. package/dist/frontend/lowering/lifetime-regions.d.ts +11 -0
  342. package/dist/frontend/lowering/lifetime-regions.js +216 -0
  343. package/dist/frontend/lowering/lifetime-regions.js.map +1 -0
  344. package/dist/frontend/lowering/lower-array-sort.d.ts +40 -3
  345. package/dist/frontend/lowering/lower-array-sort.js +661 -194
  346. package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
  347. package/dist/frontend/lowering/lower-array-sort.test.js +103 -4
  348. package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
  349. package/dist/frontend/lowering/lower-assert.js +2 -2
  350. package/dist/frontend/lowering/lower-async-iteration.d.ts +6 -3
  351. package/dist/frontend/lowering/lower-async-iteration.js +248 -2
  352. package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
  353. package/dist/frontend/lowering/lower-calls.js +173 -111
  354. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  355. package/dist/frontend/lowering/lower-classes.d.ts +12 -5
  356. package/dist/frontend/lowering/lower-classes.js +156 -11
  357. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  358. package/dist/frontend/lowering/lower-comptime.d.ts +1 -1
  359. package/dist/frontend/lowering/lower-comptime.js +4 -4
  360. package/dist/frontend/lowering/lower-comptime.js.map +1 -1
  361. package/dist/frontend/lowering/lower-console.d.ts +13 -0
  362. package/dist/frontend/lowering/lower-console.js +460 -4
  363. package/dist/frontend/lowering/lower-console.js.map +1 -1
  364. package/dist/frontend/lowering/lower-event-emitter.d.ts +6 -0
  365. package/dist/frontend/lowering/lower-event-emitter.js +124 -38
  366. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  367. package/dist/frontend/lowering/lower-event-target.d.ts +63 -0
  368. package/dist/frontend/lowering/lower-event-target.js +362 -0
  369. package/dist/frontend/lowering/lower-event-target.js.map +1 -0
  370. package/dist/frontend/lowering/lower-expando.js +2 -2
  371. package/dist/frontend/lowering/lower-exprs.js +247 -42
  372. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  373. package/dist/frontend/lowering/lower-generators.d.ts +15 -7
  374. package/dist/frontend/lowering/lower-generators.js +183 -99
  375. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  376. package/dist/frontend/lowering/lower-inspect.d.ts +8 -1
  377. package/dist/frontend/lowering/lower-inspect.js +247 -28
  378. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  379. package/dist/frontend/lowering/lower-mixins.js +1 -1
  380. package/dist/frontend/lowering/lower-modules.d.ts +1 -1
  381. package/dist/frontend/lowering/lower-modules.js +27 -17
  382. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  383. package/dist/frontend/lowering/lower-namespaces.d.ts +2 -2
  384. package/dist/frontend/lowering/lower-namespaces.js +2 -2
  385. package/dist/frontend/lowering/lower-server.js +39 -14
  386. package/dist/frontend/lowering/lower-server.js.map +1 -1
  387. package/dist/frontend/lowering/lower-stdlib.d.ts +11 -1
  388. package/dist/frontend/lowering/lower-stdlib.js +45 -4
  389. package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
  390. package/dist/frontend/lowering/lower-stmts.d.ts +2 -2
  391. package/dist/frontend/lowering/lower-stmts.js +112 -23
  392. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  393. package/dist/frontend/lowering/lower-stream.js +234 -22
  394. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  395. package/dist/frontend/lowering/lower-timers.js +1 -1
  396. package/dist/frontend/lowering/lowerer.d.ts +45 -6
  397. package/dist/frontend/lowering/lowerer.js +360 -48
  398. package/dist/frontend/lowering/lowerer.js.map +1 -1
  399. package/dist/frontend/lowering/native-ffi.js +2 -2
  400. package/dist/frontend/lowering/native-ffi.js.map +1 -1
  401. package/dist/frontend/lowering/regex-span-reads.d.ts +12 -0
  402. package/dist/frontend/lowering/regex-span-reads.js +164 -0
  403. package/dist/frontend/lowering/regex-span-reads.js.map +1 -0
  404. package/dist/frontend/lowering/runtime-optional-records.d.ts +115 -0
  405. package/dist/frontend/lowering/runtime-optional-records.js +715 -0
  406. package/dist/frontend/lowering/runtime-optional-records.js.map +1 -0
  407. package/dist/frontend/lowering/runtime-optional-records.test.d.ts +1 -0
  408. package/dist/frontend/lowering/runtime-optional-records.test.js +175 -0
  409. package/dist/frontend/lowering/runtime-optional-records.test.js.map +1 -0
  410. package/dist/frontend/lowering/surfaces.d.ts +7 -3
  411. package/dist/frontend/lowering/surfaces.js +385 -32
  412. package/dist/frontend/lowering/surfaces.js.map +1 -1
  413. package/dist/frontend/lowering/var-hoisting.d.ts +3 -0
  414. package/dist/frontend/lowering/var-hoisting.js +261 -0
  415. package/dist/frontend/lowering/var-hoisting.js.map +1 -0
  416. package/dist/frontend/module-syntax.d.ts +1 -1
  417. package/dist/frontend/module-syntax.js +1 -1
  418. package/dist/frontend/npm-static-prune.js +1 -1
  419. package/dist/frontend/npm-static-prune.js.map +1 -1
  420. package/dist/frontend/npm-static-rewrite-syntax.js +4 -3
  421. package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
  422. package/dist/frontend/pipeline.js +6 -4
  423. package/dist/frontend/pipeline.js.map +1 -1
  424. package/dist/frontend/program.d.ts +6 -5
  425. package/dist/frontend/program.js +42 -22
  426. package/dist/frontend/program.js.map +1 -1
  427. package/dist/frontend/program.test.js +13 -0
  428. package/dist/frontend/program.test.js.map +1 -1
  429. package/dist/frontend/resolve.js +1 -1
  430. package/dist/frontend/ts7/adapter.js +1 -1
  431. package/dist/frontend/ts7/ast-bytes.d.ts +1 -1
  432. package/dist/frontend/ts7/ast-bytes.js +1 -1
  433. package/dist/frontend/ts7/semantic-json.d.ts +1 -1
  434. package/dist/frontend/ts7/semantic-json.js +1 -1
  435. package/dist/frontend/ts7/semantic-json.js.map +1 -1
  436. package/dist/frontend/ts7/world-check.js +1 -1
  437. package/dist/frontend/tsc-codes.js +2 -2
  438. package/dist/frontend/tsc-codes.js.map +1 -1
  439. package/dist/frontend/type-mapper.d.ts +28 -1
  440. package/dist/frontend/type-mapper.js +288 -30
  441. package/dist/frontend/type-mapper.js.map +1 -1
  442. package/dist/index.js +6 -4
  443. package/dist/index.js.map +1 -1
  444. package/dist/ir/analysis.d.ts +12 -6
  445. package/dist/ir/analysis.js +26 -10
  446. package/dist/ir/analysis.js.map +1 -1
  447. package/dist/ir/analysis.test.js +15 -3
  448. package/dist/ir/analysis.test.js.map +1 -1
  449. package/dist/ir/builtin-effects.js +108 -2
  450. package/dist/ir/builtin-effects.js.map +1 -1
  451. package/dist/ir/builtin-signatures.d.ts +1 -1
  452. package/dist/ir/builtin-signatures.js +436 -53
  453. package/dist/ir/builtin-signatures.js.map +1 -1
  454. package/dist/ir/function-references.test.js +1 -0
  455. package/dist/ir/function-references.test.js.map +1 -1
  456. package/dist/ir/int32-slots.js +2 -0
  457. package/dist/ir/int32-slots.js.map +1 -1
  458. package/dist/ir/intrinsic-signatures.js +2 -0
  459. package/dist/ir/intrinsic-signatures.js.map +1 -1
  460. package/dist/ir/ir.d.ts +129 -36
  461. package/dist/ir/ir.js +42 -1
  462. package/dist/ir/ir.js.map +1 -1
  463. package/dist/ir/runtime-features.d.ts +1 -0
  464. package/dist/ir/runtime-features.js +116 -5
  465. package/dist/ir/runtime-features.js.map +1 -1
  466. package/dist/ir/scalar-records.js +1 -2
  467. package/dist/ir/scalar-records.js.map +1 -1
  468. package/dist/ir/serialize.js +1 -1
  469. package/dist/ir/serialize.js.map +1 -1
  470. package/dist/ir/traverse.js +1 -0
  471. package/dist/ir/traverse.js.map +1 -1
  472. package/dist/ir/validate.js +250 -34
  473. package/dist/ir/validate.js.map +1 -1
  474. package/dist/ir/validate.test.js +125 -0
  475. package/dist/ir/validate.test.js.map +1 -1
  476. package/dist/library/fence-eval.d.ts +1 -1
  477. package/dist/library/fence-eval.js +5 -4
  478. package/dist/library/fence-eval.js.map +1 -1
  479. package/dist/library/ir-policy.js +11 -4
  480. package/dist/library/ir-policy.js.map +1 -1
  481. package/dist/library/library-profile.js +13 -13
  482. package/dist/library/library-profile.js.map +1 -1
  483. package/dist/library/prepare.js +1 -1
  484. package/dist/library/prepare.js.map +1 -1
  485. package/dist/library/sidecar.js +3 -3
  486. package/dist/library/sidecar.js.map +1 -1
  487. package/dist/native/prepare.js +3 -2
  488. package/dist/native/prepare.js.map +1 -1
  489. package/dist/native/sanitizer.test.js +1 -0
  490. package/dist/native/sanitizer.test.js.map +1 -1
  491. package/package.json +20 -20
  492. package/surface-manifest.json +537 -142
package/dist/ir/ir.d.ts CHANGED
@@ -119,7 +119,8 @@ export type IrType = {
119
119
  * elements (SCR_ELEM_REF identity semantics, the child precedent), and
120
120
  * Set elements (identity hashing, SCR_MAP_KEY_REF — the netServer
121
121
  * precedent); fenced out of map keys/values and JSON (JSON.stringify
122
- * drops symbols in Node — silent divergence banned, reject instead).
122
+ * drops symbols in Node — rejected instead of diverging without a
123
+ * diagnostic).
123
124
  * Property KEYS stay frontend-fenced: static record/class shapes have
124
125
  * no symbol-keyed storage. */
125
126
  | {
@@ -140,6 +141,13 @@ export type IrType = {
140
141
  | {
141
142
  kind: "fileHandle";
142
143
  }
144
+ /** An fs.Dir (opendirSync / fs.promises.opendir): heap, refcounted,
145
+ * MUTABLE — aliases share one directory stream, read an entry at a time;
146
+ * close() closes it for every alias, and the final release closes a
147
+ * still-open stream. Holds no references and cannot be part of a cycle. */
148
+ | {
149
+ kind: "dir";
150
+ }
143
151
  /** A child_process.spawnSync result (scr_child.c): heap, refcounted,
144
152
  * IMMUTABLE — the reaped child's status plus its captured utf8 stdout/
145
153
  * stderr. Holds only strings — never part of a cycle, no trace. Same
@@ -414,13 +422,13 @@ interface IrKindSet<K extends IrType["kind"]> extends ReadonlySet<IrType["kind"]
414
422
  }
415
423
  /** The opaque runtime handle kinds. procStream is the one scalar handle;
416
424
  * every other handle has pointer representation. */
417
- declare const HANDLE_KIND_LIST: readonly ["stats", "fileHandle", "spawnRes", "child", "netServer", "netSocket", "http2Session", "http2Stream", "dgramSocket", "testCtx", "httpReq", "httpRes", "httpClientReq", "secureCtx", "cryptoHash", "cryptoHmac", "fsWatcher", "childStream", "childWriter", "procStream"];
425
+ declare const HANDLE_KIND_LIST: readonly ["stats", "fileHandle", "dir", "spawnRes", "child", "netServer", "netSocket", "http2Session", "http2Stream", "dgramSocket", "testCtx", "httpReq", "httpRes", "httpClientReq", "secureCtx", "cryptoHash", "cryptoHmac", "fsWatcher", "childStream", "childWriter", "procStream"];
418
426
  export type HandleKind = (typeof HANDLE_KIND_LIST)[number];
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">;
427
+ export declare const HANDLE_KINDS: IrKindSet<"child" | "childStream" | "childWriter" | "cryptoHash" | "cryptoHmac" | "dgramSocket" | "dir" | "fileHandle" | "fsWatcher" | "http2Session" | "http2Stream" | "httpClientReq" | "httpReq" | "httpRes" | "netServer" | "netSocket" | "procStream" | "secureCtx" | "spawnRes" | "stats" | "testCtx">;
420
428
  /** The IR kinds represented as pointers in native code. */
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"];
429
+ declare const POINTER_KIND_LIST: readonly ["string", "bigint", "array", "map", "set", "regex", "bytes", "url", "searchParams", "symbol", "stats", "fileHandle", "dir", "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"];
422
430
  export type PointerKind = (typeof POINTER_KIND_LIST)[number];
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">;
431
+ export declare const POINTER_KINDS: IrKindSet<"array" | "bigint" | "bytes" | "caught" | "child" | "childStream" | "childWriter" | "classval" | "cryptoHash" | "cryptoHmac" | "dgramSocket" | "dir" | "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">;
424
432
  /** Runtime RC symbol stem for each IR type kind. An empty stem means the
425
433
  * kind is scalar/unit or uses an emitted per-shape helper (object/record).
426
434
  * Keeping this exhaustive makes a new runtime handle kind a compile error
@@ -446,6 +454,7 @@ export declare const SEARCH_PARAMS_T: IrType;
446
454
  export declare const SYMBOL_T: IrType;
447
455
  export declare const STATS_T: IrType;
448
456
  export declare const FILEHANDLE_T: IrType;
457
+ export declare const DIR_T: IrType;
449
458
  export declare const SPAWNRES_T: IrType;
450
459
  export declare const CHILD_T: IrType;
451
460
  export declare const NETSERVER_T: IrType;
@@ -565,6 +574,10 @@ export interface IrModule {
565
574
  entry: string;
566
575
  /** Executable roots run in isolated native worker contexts. */
567
576
  workers?: boolean;
577
+ /** The program constructs LifetimeRegion (@scriptc/experimental): every
578
+ * ProgramLifetime instance lives in a counted region (the region.*
579
+ * intrinsics; backend/llvm/regions.ts). */
580
+ lifetimeRegions?: true;
568
581
  /** The entry module is CommonJS under Node's classification. Node runs a
569
582
  * CommonJS main synchronously and drains process.nextTick callbacks
570
583
  * before promise jobs at the first checkpoint; an ES-module main's
@@ -754,7 +767,7 @@ export interface IrLibSection {
754
767
  /** The host-callback registration symbol; present exactly when
755
768
  * `callbacks` is (the profile pairs them — SC4001 otherwise). Both
756
769
  * fields stay ABSENT on callback-free profiles so their serialized IR
757
- * and emitted TU are unchanged byte-for-byte. */
770
+ * and emitted TU stay identical. */
758
771
  callbackRegisterSymbol?: string;
759
772
  /** The resolved host-callback channels, slot-ordered. */
760
773
  callbacks?: IrLibCallback[];
@@ -846,6 +859,10 @@ export interface IrClassDef {
846
859
  * `get:<prop>` / `set:<prop>` entries — names no user identifier can
847
860
  * spell — and behave as ordinary methods here. */
848
861
  methods?: string[];
862
+ /** String names of the methods and accessors this class declares on its
863
+ * prototype (not inherited), independent of method reachability. A
864
+ * reflective `in` over an instance seen as `unknown` answers them. */
865
+ prototypeNames?: string[];
849
866
  /** Declared `abstract class` — never instantiated (tsc rejects `new` on
850
867
  * it, including through class values), so its own vtable entries for
851
868
  * abstract slots may stay empty. */
@@ -907,6 +924,18 @@ export declare const RUNTIME_STREAM_CLASSES: ReadonlyMap<string, {
907
924
  base: string;
908
925
  sides: "r" | "w" | "rw";
909
926
  }>;
927
+ /** The runtime-provided EventTarget and Event bases of compiled
928
+ * subclasses (`class Bus extends EventTarget`, `class Ping extends
929
+ * Event`; scr_event_target.c, link-gated with the rest of the EventTarget
930
+ * surface). Plain `new EventTarget()` / `new Event()` values stay
931
+ * checked-dynamic handles; these classes exist only as roots of program
932
+ * hierarchies. Like the emitter, backends emit no struct/RC/vtable for
933
+ * them: subclass structs embed the runtime prefix (the engine-state
934
+ * pointer created by super() and the display-name slot stamped by the
935
+ * emitted allocation), and the instances' checked-dynamic capsules use
936
+ * the runtime RC adapters, which is how the engine recognizes them. */
937
+ export declare const RUNTIME_EVENT_TARGET_CLASS = "%EventTarget";
938
+ export declare const RUNTIME_EVENT_CLASS = "%Event";
910
939
  export interface IrRecordShape {
911
940
  /** Frontend-assigned shape id (`r0`, `r1`, ...). */
912
941
  id: string;
@@ -950,6 +979,9 @@ export interface IrRecordShape {
950
979
  * %dtype) — hidden from every key-order surface, JSON included. */
951
980
  declaredOrder?: string[];
952
981
  }
982
+ /** fs.Dirent rows: the hidden %dtype entry kind (libuv's UV_DIRENT
983
+ * encoding), then name and parentPath (type-mapper's interned shape). */
984
+ export declare function isDirentShape(shape: IrRecordShape): boolean;
953
985
  /** Codec records have private native state, not a structurally checkable
954
986
  * data surface. Reserve the same '%' namespace as other internal slots. */
955
987
  export declare function recordTextCodecClass(shape: IrRecordShape): "TextEncoder" | "TextDecoder" | null;
@@ -1057,6 +1089,9 @@ export interface IrParam {
1057
1089
  localId: string;
1058
1090
  name: string;
1059
1091
  type: IrType;
1092
+ /** Callers pass an owned reference, which the body holds for its whole
1093
+ * run, even when the parameter is never rebound. */
1094
+ owned?: true;
1060
1095
  }
1061
1096
  export interface IrGlobal {
1062
1097
  /** "%g.<qualifier>.<name>" — distinct namespace from local ids. */
@@ -1255,9 +1290,15 @@ export type IrStmt =
1255
1290
  body: IrStmt[];
1256
1291
  labels?: string[];
1257
1292
  loc: SrcLoc;
1258
- } | {
1293
+ }
1294
+ /** `awaited`: a return of an async generator that needs no Await of its
1295
+ * own — its operand's await performed it (`return p` of a promise), or
1296
+ * it has no operand (`return;`). The request settles as the body
1297
+ * completes instead of one microtask turn later. */
1298
+ | {
1259
1299
  kind: "return";
1260
1300
  value: IrExpr | null;
1301
+ awaited?: true;
1261
1302
  loc: SrcLoc;
1262
1303
  }
1263
1304
  /** Field write `obj.f = v` — statement-only, like `assign`/`arraySet`.
@@ -1360,9 +1401,10 @@ export type IrStmt =
1360
1401
  * construct has no static lowering, and JS carries no annotations to
1361
1402
  * change that — so the fence fires when the statement RUNS instead of
1362
1403
  * failing the build (the JS-input design: inference gaps land where
1363
- * `any` lands — honest fences, never silent misbehavior). Executing it
1364
- * throws a catchable Error whose message names the construct and whose
1365
- * `code` carries the SC diagnostic code; unwinds exactly like `throw`.
1404
+ * `any` lands — a runtime fence instead of undiagnosed misbehavior).
1405
+ * Executing it throws a catchable Error whose message names the construct
1406
+ * and whose `code` carries the SC diagnostic code; unwinds exactly like
1407
+ * `throw`.
1366
1408
  * TypeScript sources produce it only as the tsc-unreachable fallthrough
1367
1409
  * trap (appendImplicitUndefinedReturn's SC9002) — their construct fences
1368
1410
  * stay compile errors. */
@@ -1420,7 +1462,13 @@ export type IrArrIntrinsicMethod =
1420
1462
  * arguments are [value count, comparator]. Every slot below the count is
1421
1463
  * a value of an `isSortValuesElement` type; the comparator is invoked
1422
1464
  * with exactly its declared arity. Returns void; comparator exceptions
1423
- * propagate and leave the snapshot unchanged. */
1465
+ * propagate and leave the snapshot unchanged. Optional trailing
1466
+ * arguments [order, key] describe a comparator that orders numbers
1467
+ * ascending (order 1) or descending (-1), a numeric literal: the runtime
1468
+ * may then sort by key without calling it. Number elements are their own
1469
+ * keys; record and class elements pass the capture-free key reader
1470
+ * `(elem) => number` both comparator operands apply. Keys the runtime
1471
+ * does not order directly (NaN, -0) still sort through the comparator. */
1424
1472
  | "sortValues"
1425
1473
  /** Internal stable comparator sort of a dense array in place: arguments
1426
1474
  * are [comparator, owned]. Returns false, without calling the comparator,
@@ -1428,7 +1476,8 @@ export type IrArrIntrinsicMethod =
1428
1476
  * is published; the caller then sorts a compacted snapshot. Otherwise the
1429
1477
  * receiver's values are sorted outside it and written back only after
1430
1478
  * success, as the spec's sort writes them, and it returns true. `owned`
1431
- * (a boolean literal) marks a private copy no user code can reach. */
1479
+ * (a boolean literal) marks a private copy no user code can reach.
1480
+ * Optional trailing arguments [order, key] as for sortValues. */
1432
1481
  | "sortDense" | "length"
1433
1482
  /** Internal ToNumber(a[index]) for f64-backed arrays: one numeric index,
1434
1483
  * returning the stored number or NaN for a hole/undefined/missing key.
@@ -1476,13 +1525,16 @@ export declare function isSortValuesElement(elem: IrType, unionArms?: readonly I
1476
1525
  * members are compiler-internal: no ambient declaration reaches them. */
1477
1526
  export type IrMapIntrinsicMethod =
1478
1527
  /** Internal shallow-copy constructors over builtin collection storage. */
1479
- "clone" | "keySet" | "valueSet" | "get" | "set" | "has" | "delete" | "size" | "clear" | "iterCount" | "iterLive" | "iterKey" | "iterValue" | "iterEnter" | "iterExit";
1528
+ "clone" | "keySet" | "valueSet" | "get" | "set" | "has" | "delete" | "size" | "clear" | "iterCount"
1529
+ /** The first live index, or iterCount when none is live
1530
+ * (scr_map_iter_start). for-of starts its index there. */
1531
+ | "iterStart" | "iterLive" | "iterKey" | "iterValue" | "iterEnter" | "iterExit";
1480
1532
  /** The Set method/property surface — Map's minus get/set/iterValue (there
1481
1533
  * is no value slot; `add` fills set's role) plus `add`. `forEach` desugars
1482
1534
  * in the frontend exactly like Map's, over the same iteration primitives —
1483
1535
  * iterKey doubles as the element read (JS's Set forEach passes the element
1484
1536
  * as both `value` and `key`). */
1485
- export type IrSetIntrinsicMethod = "clone" | "add" | "has" | "delete" | "size" | "clear" | "iterCount" | "iterLive" | "iterKey" | "iterEnter" | "iterExit"
1537
+ export type IrSetIntrinsicMethod = "clone" | "add" | "has" | "delete" | "size" | "clear" | "iterCount" | "iterStart" | "iterLive" | "iterKey" | "iterEnter" | "iterExit"
1486
1538
  /** `[...set]` and friends: drain the live entries into a FRESH elem[]
1487
1539
  * in insertion order (tombstones skipped — the same walk the forEach
1488
1540
  * desugar does, folded into one runtime call; no user code runs during
@@ -1497,7 +1549,7 @@ export type IrSetIntrinsicMethod = "clone" | "add" | "has" | "delete" | "size" |
1497
1549
  * regexIntrinsic): args[0] is the separator and args[1] the numeric limit
1498
1550
  * (an omitted source limit is completed to 2^32-1), result a fresh +1
1499
1551
  * string[] — the empty separator splits per UTF-16 code unit (astral
1500
- * halves become U+FFFD, divergence 2). `padStart`/`padEnd` take (target
1552
+ * halves become lone surrogates). `padStart`/`padEnd` take (target
1501
1553
  * length, fill) — the frontend completes an omitted fill to " ", Node's
1502
1554
  * default. `trimStart`/`trimEnd` are trim's one-sided halves. */
1503
1555
  export type IrStrIntrinsicMethod = "length" | "charCodeAt" | "charAt" | "indexOf" | "includes" | "startsWith" | "endsWith" | "slice" | "substring" | "repeat" | "trim" | "trimStart" | "trimEnd" | "split" | "padStart" | "padEnd" | "toLowerCase" | "toUpperCase" | "normalize" | "isWellFormed" | "toWellFormed" | "cpAt";
@@ -1554,6 +1606,19 @@ export type IrBytesIntrinsicMethod = "buffer" | "length" | "byteLength" | "get"
1554
1606
  /** In-place overlapping copy, [target, start, end] relative indices;
1555
1607
  * returns the receiver (+1). */
1556
1608
  | "copyWithin"
1609
+ /** In-place numeric sort, [order]: a numeric literal 0 for the default
1610
+ * TypedArray order (NaN last, -0 before +0), or 1 / -1 for a recognized
1611
+ * ascending / descending numeric comparator. Returns true when sorted;
1612
+ * a comparator order answers false, having written nothing, for a NaN
1613
+ * or -0 float element, and the caller sorts through the comparator.
1614
+ * Runs no script code. */
1615
+ | "sortNumeric"
1616
+ /** In-place comparator sort, [comparator]: a `(number, number) =>
1617
+ * number` function of at most two parameters, called with the comparison
1618
+ * schedule of Node's typed-array sort over a snapshot that is written
1619
+ * back after the last comparison. Returns void; a comparator exception
1620
+ * propagates and leaves the receiver unwritten. */
1621
+ | "sortCompare"
1557
1622
  /** Fresh Uint8Array copying methods. `with` takes [index, value] and
1558
1623
  * throws a catchable RangeError for an invalid relative index. */
1559
1624
  | "toReversed" | "with"
@@ -1618,7 +1683,16 @@ export type IrRegexIntrinsicMethod = "test" | "match"
1618
1683
  * as read (k < 53). Unmarked captures read as undefined and the result
1619
1684
  * carries no index/input properties; the match, lastIndex transitions
1620
1685
  * and null result are exec's. */
1621
- | "execGroups" | "lastIndex"
1686
+ | "execGroups"
1687
+ /** execGroups whose args[2] (a numeric literal, a subset of args[1])
1688
+ * marks the captures read only through the regex.groupEquals/
1689
+ * groupNumber/groupParseInt libCalls; the runtime may keep those as
1690
+ * spans of the subject rather than strings. */
1691
+ | "execSpans"
1692
+ /** `s.match(re)` read like an execGroups result: a global regex answers
1693
+ * match's whole-match array; otherwise execSpans with args[1], args[2]
1694
+ * (args[2] is 0 until regex span folding marks lazy captures). */
1695
+ | "matchGroups" | "lastIndex"
1622
1696
  /** `s.matchAll(re)` — every match as its honest string[] slice (match's
1623
1697
  * rule), drained EAGERLY into a fresh string[][]: the lazy iterator is
1624
1698
  * unobservable across the lowered surface (strings are immutable; the
@@ -1732,8 +1806,8 @@ export type IrExpr =
1732
1806
  * 0)`. f64 fields compute in place (JS-exact); fieldDyn marks a
1733
1807
  * CHECKED-DYNAMIC field (a JS implicit-any ctor assignment): the number
1734
1808
  * validates OUT of the box (dynCheck's catchable TypeError on
1735
- * non-numbers — the documented dyn arithmetic stance, never a silent
1736
- * ToNumber), computes, and boxes back into the slot (old box released
1809
+ * non-numbers — the documented dyn arithmetic stance, instead of an
1810
+ * implicit ToNumber), computes, and boxes back into the slot (old box released
1737
1811
  * after the unlink, like fieldSet). Type is always f64. */
1738
1812
  | {
1739
1813
  kind: "fieldIncDec";
@@ -2240,11 +2314,14 @@ export type IrExpr =
2240
2314
  * as the GENRET sentinel — pending like an exception, it unwinds
2241
2315
  * through finally blocks but must NOT be taken by catch handlers
2242
2316
  * (backends emit a sentinel re-unwind prologue at catch entry inside
2243
- * generator bodies; scr_exc_genret_pending answers it). */
2317
+ * generator bodies; scr_exc_genret_pending answers it). `delegated`:
2318
+ * only as the `arg` of a `delegate` genResume, which reads the resumed
2319
+ * value and handles a pending throw or return; the yield itself is VOID. */
2244
2320
  | {
2245
2321
  kind: "yieldExpr";
2246
2322
  value: IrExpr | null;
2247
2323
  awaited?: true;
2324
+ delegated?: true;
2248
2325
  captureCompletion?: {
2249
2326
  returnType: IrType;
2250
2327
  };
@@ -2274,13 +2351,27 @@ export type IrExpr =
2274
2351
  * generator (for-of, spread, yield*), which read only `done` and then the
2275
2352
  * yielded value: `step` is a valueless next() answering `done` (BOOL;
2276
2353
  * throws like next); `value` moves the yielded value out, typed as the
2277
- * yield channel (valid only right after a `step` that answered false;
2278
- * never throws); `close` is a valueless return() whose result is dropped
2354
+ * yield channel (valid only right after a `step` or `delegate` that
2355
+ * answered false; never throws), or the completion value typed as the
2356
+ * return channel (once a `delegate` answered true); `close` is a valueless return() whose result is dropped
2279
2357
  * (IteratorClose; VOID; throws like return). All three have a null
2280
- * `arg`. */
2358
+ * `arg`.
2359
+ *
2360
+ * `delegate` drives a sync generator from a `yield*` in a sync generator
2361
+ * body. With a null `arg` it is the delegation's first resume: a
2362
+ * valueless next() on any next channel (a suspended delegate whose next
2363
+ * channel is typed throws an SC1071 fence error instead). Otherwise `arg`
2364
+ * is a `delegated` yieldExpr, and once the body resumes, the consumer's
2365
+ * next(v), return(v), or throw(e) passes to the delegate; the body
2366
+ * itself unwinds only on a delegate exception or when the delegate
2367
+ * completes a forwarded return(). The delegate's next channel is
2368
+ * undefined, dyn, or the body's own. The result is the delegate's
2369
+ * IteratorResult record, or BOOL `done` for a record-free drive (then
2370
+ * `value` reads a yielded value or the completion; an empty completion
2371
+ * on a valued return channel throws an SC1071 fence error). */
2281
2372
  | {
2282
2373
  kind: "genResume";
2283
- mode: "next" | "return" | "throw" | "step" | "value" | "close";
2374
+ mode: "next" | "return" | "throw" | "step" | "value" | "close" | "delegate";
2284
2375
  gen: IrExpr;
2285
2376
  arg: IrExpr | null;
2286
2377
  type: IrType;
@@ -2478,20 +2569,12 @@ export type IrExpr =
2478
2569
  * shape (their values have the shape's indexValue type — dyn included);
2479
2570
  * they insert into the overflow map in list order, interleaved with the
2480
2571
  * declared writes (one list keeps JS source-order evaluation). */
2481
- /** Entries flagged `drop` are fields the shape MAPPING dropped (the
2482
- * PromiseSettledResult honest subset — SEMANTICS.md 46): the value
2483
- * expression still evaluates in its source-order slot (the awaited
2484
- * mapper in `{ status: "fulfilled", value: await fn(...) }` must run and
2485
- * may throw), but nothing is stored — the emitter releases the result
2486
- * with the statement frame. Any value type is legal here, void included
2487
- * (an awaited Promise<void>). */
2488
2572
  | {
2489
2573
  kind: "recordLit";
2490
2574
  fields: {
2491
2575
  name: string;
2492
2576
  value: IrExpr;
2493
2577
  overflow?: true;
2494
- drop?: true;
2495
2578
  }[];
2496
2579
  type: IrType;
2497
2580
  loc: SrcLoc;
@@ -2621,10 +2704,10 @@ export type IrExpr =
2621
2704
  /** Prototype-method DISPATCH on a dyn receiver — `recv.m(...)` where `m`
2622
2705
  * is a name a dyn-representable prototype declares (Array/String/
2623
2706
  * Function shared names: push, slice, join, forEach, map, apply, ...),
2624
- * so a stored-member read would silently mis-answer real methods. The
2707
+ * so a stored-member read would return wrong results for real methods. The
2625
2708
  * runtime (scr_dyn_invoke) dispatches on the receiver's KIND:
2626
2709
  * implemented (kind, name) pairs run JS-exact semantics; a real-but-
2627
- * unimplemented method throws a LOUD "not supported yet" Error; a name
2710
+ * unimplemented method throws a "not supported yet" Error; a name
2628
2711
  * the kind's prototype lacks throws Node's catchable "<calleeName> is
2629
2712
  * not a function"; OBJ receivers call the own member (own properties
2630
2713
  * shadow prototypes in JS too); undefined/null receivers throw Node's
@@ -3083,11 +3166,17 @@ export type IrExpr =
3083
3166
  * promise.race: every arg is a PROMISE (the array literal's
3084
3167
  * entries, lowered individually — the array never materializes), the
3085
3168
  * type is the checker's combined result promise; the backend emits a
3086
- * fresh promise plus one scr_promise_race_add per entry with an
3169
+ * fresh promise plus one scr_promise_race_join per entry with an
3087
3170
  * interned per-(entry-inner → result-inner) adapter (raceAdapterFor) —
3088
3171
  * same-type entries share the runtime's copy adapter, arm entries wrap
3089
3172
  * into the result union, sub-union entries re-tag arm-wise. First
3090
3173
  * settle wins; rejections copy raw and count handled on the entry.
3174
+ * promise.allSettled / promise.any: ONE arg, an array of promises
3175
+ * (Promise.all's countdown machinery). allSettled's type is a promise
3176
+ * of the PromiseSettledResult union array — the backend's per-entry
3177
+ * store adapter builds the fulfilled/rejected record arm; any's type is
3178
+ * the entries' own promise type (the first fulfillment copies through;
3179
+ * exhaustion rejects with an AggregateError of the dyn reasons).
3091
3180
  * promise.reject: one %Error-rooted arg (the reason — rejection
3092
3181
  * payloads share the thrown-Error representation), type is the
3093
3182
  * context-named result promise; the backend mints a fresh promise and
@@ -3105,7 +3194,7 @@ export type IrExpr =
3105
3194
  * (a module binding of an import cycle read before its declaration). */
3106
3195
  | {
3107
3196
  kind: "intrinsic";
3108
- name: "console.log" | "console.error" | "promise.race" | "promise.all" | "promise.reject" | "promise.resolve" | "module.await" | "module.tdzCheck" | "threads.publish";
3197
+ name: "console.log" | "console.error" | "promise.race" | "promise.all" | "promise.allSettled" | "promise.any" | "promise.reject" | "promise.resolve" | "module.await" | "module.tdzCheck" | "threads.publish" | "region.create" | "region.enter" | "region.leave" | "region.release";
3109
3198
  args: IrExpr[];
3110
3199
  type: IrType;
3111
3200
  loc: SrcLoc;
@@ -3134,7 +3223,7 @@ export type IrExpr =
3134
3223
  * type must be JSON-safe (f64/string/bool/record/array/union of those,
3135
3224
  * recursively — validated), and backends emit one serializer per type used
3136
3225
  * in stringify position (interned, like the array-HOF desugars) instead of
3137
- * walking any runtime tag. Output is Node-compatible byte-for-byte with
3226
+ * walking any runtime tag. Output is identical to Node's with
3138
3227
  * ONE documented divergence: record fields serialize in canonical (sorted)
3139
3228
  * order, not insertion order (SEMANTICS.md). NaN/±Infinity stringify as
3140
3229
  * `null` and -0 as `0`, exactly like JS; a record field holding the
@@ -3169,10 +3258,14 @@ export type IrExpr =
3169
3258
  * corrupting memory). `preserveRefs` refuses structural copies of native
3170
3259
  * references, including references nested in newly materialized arrays or
3171
3260
  * tuples; collection seeds use it to preserve key identity. */
3261
+ /** `exact`: the value is known to be a capsule this program boxed from
3262
+ * exactly the class `type` names (a `dyn.typedRefKeyIs` test guards the
3263
+ * expression), so the check is one load of the capsule's instance. */
3172
3264
  | {
3173
3265
  kind: "dynCheck";
3174
3266
  value: IrExpr;
3175
3267
  preserveRefs?: true;
3268
+ exact?: true;
3176
3269
  type: IrType;
3177
3270
  loc: SrcLoc;
3178
3271
  };
package/dist/ir/ir.js CHANGED
@@ -28,6 +28,7 @@ export const BYTES_ELEMENT_NAME = {
28
28
  const POINTER_HANDLE_KINDS = [
29
29
  "stats",
30
30
  "fileHandle",
31
+ "dir",
31
32
  "spawnRes",
32
33
  "child",
33
34
  "netServer",
@@ -98,6 +99,7 @@ export const RUNTIME_RC_STEMS = {
98
99
  symbol: "scr_sym",
99
100
  stats: "scr_stats",
100
101
  fileHandle: "scr_file_handle",
102
+ dir: "scr_dir",
101
103
  spawnRes: "scr_spawn_res",
102
104
  child: "scr_child",
103
105
  netServer: "scr_net_server",
@@ -140,6 +142,10 @@ export function runtimeRcStem(t) {
140
142
  return "scr_emitter";
141
143
  if (RUNTIME_STREAM_CLASSES.has(t.className))
142
144
  return "scr_stream";
145
+ if (t.className === RUNTIME_EVENT_TARGET_CLASS)
146
+ return "scr_event_target_obj";
147
+ if (t.className === RUNTIME_EVENT_CLASS)
148
+ return "scr_event_obj";
143
149
  return null;
144
150
  }
145
151
  const stem = RUNTIME_RC_STEMS[t.kind];
@@ -162,6 +168,7 @@ export const REF_TRUTHY_KINDS = new Set([
162
168
  "searchParams",
163
169
  "stats",
164
170
  "fileHandle",
171
+ "dir",
165
172
  "spawnRes",
166
173
  "child",
167
174
  "netServer",
@@ -204,6 +211,7 @@ export const SEARCH_PARAMS_T = { kind: "searchParams" };
204
211
  export const SYMBOL_T = { kind: "symbol" };
205
212
  export const STATS_T = { kind: "stats" };
206
213
  export const FILEHANDLE_T = { kind: "fileHandle" };
214
+ export const DIR_T = { kind: "dir" };
207
215
  export const SPAWNRES_T = { kind: "spawnRes" };
208
216
  export const CHILD_T = { kind: "child" };
209
217
  export const NETSERVER_T = { kind: "netServer" };
@@ -590,6 +598,11 @@ export const RUNTIME_ERROR_CLASSES = new Map([
590
598
  ["%ReferenceError", { lib: "ReferenceError", kind: 5, base: "%Error" }],
591
599
  ["%EvalError", { lib: "EvalError", kind: 6, base: "%Error" }],
592
600
  ["%URIError", { lib: "URIError", kind: 7, base: "%Error" }],
601
+ // AggregateError — Promise.any's rejection and its own constructor. Its
602
+ // `errors` list lives in a runtime-side slot beyond the ScrError prefix
603
+ // (the DOMException arrangement), read through error.aggregateErrors, so
604
+ // user `extends AggregateError` is fenced too.
605
+ ["%AggregateError", { lib: "AggregateError", kind: 8, base: "%Error" }],
593
606
  ]);
594
607
  /** The runtime-provided node:events EventEmitter class (ScrEmitter /
595
608
  * scr_emitter_*, scr_events_emitter.c — link-gated by moduleUsesEmitter,
@@ -623,6 +636,31 @@ export const RUNTIME_STREAM_CLASSES = new Map([
623
636
  ["%Transform", { lib: "Transform", base: "%Duplex", sides: "rw" }],
624
637
  ["%PassThrough", { lib: "PassThrough", base: "%Transform", sides: "rw" }],
625
638
  ]);
639
+ /** The runtime-provided EventTarget and Event bases of compiled
640
+ * subclasses (`class Bus extends EventTarget`, `class Ping extends
641
+ * Event`; scr_event_target.c, link-gated with the rest of the EventTarget
642
+ * surface). Plain `new EventTarget()` / `new Event()` values stay
643
+ * checked-dynamic handles; these classes exist only as roots of program
644
+ * hierarchies. Like the emitter, backends emit no struct/RC/vtable for
645
+ * them: subclass structs embed the runtime prefix (the engine-state
646
+ * pointer created by super() and the display-name slot stamped by the
647
+ * emitted allocation), and the instances' checked-dynamic capsules use
648
+ * the runtime RC adapters, which is how the engine recognizes them. */
649
+ export const RUNTIME_EVENT_TARGET_CLASS = "%EventTarget";
650
+ export const RUNTIME_EVENT_CLASS = "%Event";
651
+ /** fs.Dirent rows: the hidden %dtype entry kind (libuv's UV_DIRENT
652
+ * encoding), then name and parentPath (type-mapper's interned shape). */
653
+ export function isDirentShape(shape) {
654
+ return (!shape.tuple &&
655
+ shape.indexValue === undefined &&
656
+ shape.fields.length === 3 &&
657
+ shape.fields[0].name === "%dtype" &&
658
+ shape.fields[0].type.kind === "f64" &&
659
+ shape.fields[1].name === "name" &&
660
+ shape.fields[1].type.kind === "string" &&
661
+ shape.fields[2].name === "parentPath" &&
662
+ shape.fields[2].type.kind === "string");
663
+ }
626
664
  /** Codec records have private native state, not a structurally checkable
627
665
  * data surface. Reserve the same '%' namespace as other internal slots. */
628
666
  export function recordTextCodecClass(shape) {
@@ -680,6 +718,7 @@ export function isSortValuesElement(elem, unionArms) {
680
718
  /** The bytesIntrinsic methods that can raise a catchable error — backends'
681
719
  * may-throw analyses seed on these exactly like MAY_THROW_LIB_FNS. */
682
720
  export const MAY_THROW_BYTES_METHODS = new Set([
721
+ "sortCompare",
683
722
  "toStringVar",
684
723
  "with",
685
724
  "setFrom",
@@ -839,7 +878,8 @@ function isJsonSafeAt(t, getRecord, getUnion, stringify, undefinedAllowed, visit
839
878
  // sp.toString() instead.
840
879
  case "searchParams":
841
880
  // Symbols are DROPPED by Node's stringify (undefined at the top level,
842
- // omitted as object values) — silent divergence banned; rejected.
881
+ // omitted as object values) — rejected instead of diverging without a
882
+ // diagnostic.
843
883
  case "symbol":
844
884
  case "caught":
845
885
  case "promise":
@@ -909,6 +949,7 @@ export const DYN_HANDLE_KINDS = new Map([
909
949
  ["http2Session", { tag: "SCR_DYNH_H2_SESSION", cls: "Http2Session" }],
910
950
  ["http2Stream", { tag: "SCR_DYNH_H2_STREAM", cls: "Http2Stream" }],
911
951
  ["httpClientReq", { tag: "SCR_DYNH_HTTP_CLIENT", cls: "ClientRequest" }],
952
+ ["dir", { tag: "SCR_DYNH_DIR", cls: "Dir" }],
912
953
  ]);
913
954
  /** A class value that crosses an `unknown` slot as a compiler-owned typed
914
955
  * reference. %Error keeps its dedicated error encoding; every other class