@geastack/compiler 1.0.27 → 1.0.30

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 (956) hide show
  1. package/dist/cli-coverage.js +2 -2
  2. package/dist/cli-emit.js +36 -12
  3. package/dist/compiler.d.ts +11 -9
  4. package/dist/compiler.js +264 -43
  5. package/dist/conversion/algebra.d.ts +84 -4
  6. package/dist/conversion/algebra.js +39 -0
  7. package/dist/conversion/array-view.d.ts +63 -0
  8. package/dist/conversion/array-view.js +186 -0
  9. package/dist/conversion/build.d.ts +8 -8
  10. package/dist/conversion/build.js +56 -50
  11. package/dist/conversion/certified-iterator-object-view.d.ts +13 -0
  12. package/dist/conversion/certified-iterator-object-view.js +31 -0
  13. package/dist/conversion/certified-iterator-protocols.d.ts +23 -0
  14. package/dist/conversion/certified-iterator-protocols.js +50 -0
  15. package/dist/conversion/checked-native-field-read.d.ts +7 -0
  16. package/dist/conversion/checked-native-field-read.js +36 -0
  17. package/dist/conversion/constructor-identity-family.d.ts +6 -6
  18. package/dist/conversion/constructor-identity-family.js +3 -3
  19. package/dist/conversion/derive.js +11 -8
  20. package/dist/conversion/dictionary-view.d.ts +114 -0
  21. package/dist/conversion/dictionary-view.js +293 -0
  22. package/dist/conversion/document-record-view.d.ts +89 -0
  23. package/dist/conversion/document-record-view.js +269 -0
  24. package/dist/conversion/dynamic-result-carriers.d.ts +6 -0
  25. package/dist/conversion/dynamic-result-carriers.js +43 -0
  26. package/dist/conversion/dynamic-wrapper.d.ts +57 -0
  27. package/dist/conversion/dynamic-wrapper.js +85 -0
  28. package/dist/conversion/impossible-field-read.d.ts +9 -0
  29. package/dist/conversion/impossible-field-read.js +28 -0
  30. package/dist/conversion/iterable-object-view.d.ts +1 -1
  31. package/dist/conversion/iterator-object-view.d.ts +2 -2
  32. package/dist/conversion/native-absence.d.ts +4 -0
  33. package/dist/conversion/native-absence.js +4 -0
  34. package/dist/conversion/native-buffer-method.d.ts +16 -0
  35. package/dist/conversion/native-buffer-method.js +37 -0
  36. package/dist/conversion/native-callable-adapter.d.ts +13 -0
  37. package/dist/conversion/native-callable-adapter.js +73 -0
  38. package/dist/conversion/native-descriptor-snapshot.d.ts +30 -0
  39. package/dist/conversion/native-descriptor-snapshot.js +75 -0
  40. package/dist/conversion/native-entry-writer.d.ts +21 -0
  41. package/dist/conversion/native-entry-writer.js +32 -0
  42. package/dist/conversion/native-field-view.d.ts +42 -0
  43. package/dist/conversion/native-field-view.js +145 -0
  44. package/dist/conversion/native-logical-receiver.d.ts +11 -0
  45. package/dist/conversion/native-logical-receiver.js +19 -0
  46. package/dist/conversion/native-method.d.ts +43 -0
  47. package/dist/conversion/native-method.js +56 -0
  48. package/dist/conversion/native-object-sample.d.ts +30 -0
  49. package/dist/conversion/native-object-sample.js +37 -0
  50. package/dist/conversion/native-payload-transport.d.ts +1 -1
  51. package/dist/conversion/native-payload-transport.js +1 -1
  52. package/dist/conversion/native-record-products.d.ts +15 -0
  53. package/dist/conversion/native-record-products.js +73 -0
  54. package/dist/conversion/native-selection.d.ts +18 -1
  55. package/dist/conversion/native-selection.js +117 -4
  56. package/dist/conversion/native-sum.d.ts +27 -0
  57. package/dist/conversion/native-sum.js +74 -9
  58. package/dist/conversion/native-view-origins.d.ts +12 -0
  59. package/dist/conversion/native-view-origins.js +97 -0
  60. package/dist/conversion/nodes.d.ts +75 -7
  61. package/dist/conversion/nodes.js +694 -19
  62. package/dist/conversion/number-storage.d.ts +8 -0
  63. package/dist/conversion/number-storage.js +8 -0
  64. package/dist/conversion/operand-view.js +10 -1
  65. package/dist/conversion/promise-adoption.d.ts +15 -0
  66. package/dist/conversion/promise-adoption.js +29 -0
  67. package/dist/conversion/protocol-iterator.d.ts +3 -3
  68. package/dist/conversion/recipe-closure.d.ts +14 -0
  69. package/dist/conversion/recipe-closure.js +135 -0
  70. package/dist/conversion/record-view.d.ts +51 -26
  71. package/dist/conversion/record-view.js +160 -97
  72. package/dist/conversion/registry.d.ts +18 -2
  73. package/dist/conversion/sibling-class.d.ts +4 -0
  74. package/dist/conversion/sibling-class.js +7 -0
  75. package/dist/conversion/structural-plan.d.ts +87 -0
  76. package/dist/conversion/structural-plan.js +487 -0
  77. package/dist/ir/absent-class-arm.d.ts +5 -1
  78. package/dist/ir/absent-class-arm.js +51 -3
  79. package/dist/ir/async-result-conventions.d.ts +15 -0
  80. package/dist/ir/async-result-conventions.js +140 -0
  81. package/dist/ir/borrowed-call-arguments.d.ts +3 -3
  82. package/dist/ir/borrowed-call-arguments.js +9 -9
  83. package/dist/ir/build.d.ts +20 -29
  84. package/dist/ir/build.js +116 -19
  85. package/dist/ir/call-dispatch.js +153 -40
  86. package/dist/ir/call-entry.d.ts +14 -3
  87. package/dist/ir/call-entry.js +72 -5
  88. package/dist/ir/callable-class-flow.d.ts +48 -3
  89. package/dist/ir/callable-class-flow.js +1509 -81
  90. package/dist/ir/callable-flow-candidates.d.ts +25 -0
  91. package/dist/ir/callable-flow-candidates.js +135 -0
  92. package/dist/ir/callable-identity-demand.d.ts +2 -2
  93. package/dist/ir/callable-identity-demand.js +33 -1
  94. package/dist/ir/callable-member-candidates.d.ts +1 -1
  95. package/dist/ir/callable-member-candidates.js +2 -2
  96. package/dist/ir/callable-records.js +1 -0
  97. package/dist/ir/callable-site-escape.js +3 -4
  98. package/dist/ir/captures.js +1 -1
  99. package/dist/ir/certificate.d.ts +1 -0
  100. package/dist/ir/certificate.js +2 -1
  101. package/dist/ir/certify/carrier-keys.d.ts +2 -2
  102. package/dist/ir/certify/carrier-keys.js +4 -4
  103. package/dist/ir/certify/has-property-key.d.ts +3 -3
  104. package/dist/ir/certify/has-property-key.js +3 -3
  105. package/dist/ir/certify/parallel-region.d.ts +26 -0
  106. package/dist/ir/certify/parallel-region.js +1331 -0
  107. package/dist/ir/certify/property-access-keys.d.ts +11 -11
  108. package/dist/ir/certify/property-access-keys.js +11 -11
  109. package/dist/ir/certify/property-access.js +7 -9
  110. package/dist/ir/certify.d.ts +66 -3
  111. package/dist/ir/certify.js +1209 -37
  112. package/dist/ir/class-allocation-domain.d.ts +9 -0
  113. package/dist/ir/class-allocation-domain.js +158 -0
  114. package/dist/ir/class-evaluation.d.ts +2 -3
  115. package/dist/ir/class-evaluation.js +2 -3
  116. package/dist/ir/class-static-fields.d.ts +12 -1
  117. package/dist/ir/class-static-fields.js +25 -0
  118. package/dist/ir/closed-normal-results.d.ts +18 -0
  119. package/dist/ir/closed-normal-results.js +208 -0
  120. package/dist/ir/construct-entry.js +1 -0
  121. package/dist/ir/construction-only-fields.d.ts +20 -1
  122. package/dist/ir/construction-only-fields.js +95 -9
  123. package/dist/ir/convert-carriers.d.ts +7 -0
  124. package/dist/ir/convert-carriers.js +12 -0
  125. package/dist/ir/coroutine-bodies.d.ts +74 -0
  126. package/dist/ir/coroutine-bodies.js +93 -0
  127. package/dist/ir/dead-logical-merge.d.ts +7 -0
  128. package/dist/ir/dead-logical-merge.js +84 -0
  129. package/dist/ir/dead-values.d.ts +7 -5
  130. package/dist/ir/dead-values.js +34 -5
  131. package/dist/ir/deferral.d.ts +3 -1
  132. package/dist/ir/deferral.js +19 -6
  133. package/dist/ir/dense-loops.d.ts +96 -7
  134. package/dist/ir/dense-loops.js +333 -17
  135. package/dist/ir/descriptor-own-protocol.d.ts +12 -0
  136. package/dist/ir/descriptor-own-protocol.js +35 -0
  137. package/dist/ir/dynamic-constructor-conversions.d.ts +17 -0
  138. package/dist/ir/dynamic-constructor-conversions.js +52 -0
  139. package/dist/ir/emission-representations.js +44 -2
  140. package/dist/ir/facts.d.ts +14 -2
  141. package/dist/ir/facts.js +23 -9
  142. package/dist/ir/fixed-data-definition-attributes.d.ts +10 -0
  143. package/dist/ir/fixed-data-definition-attributes.js +200 -0
  144. package/dist/ir/fixed-data-definition.d.ts +23 -5
  145. package/dist/ir/fixed-data-definition.js +80 -2
  146. package/dist/ir/function-reflection-demand.d.ts +11 -0
  147. package/dist/ir/function-reflection-demand.js +71 -0
  148. package/dist/ir/generic-call-entry.d.ts +18 -0
  149. package/dist/ir/generic-call-entry.js +94 -0
  150. package/dist/ir/hoist.d.ts +16 -3
  151. package/dist/ir/hoist.js +121 -8
  152. package/dist/ir/host-method-aliases.d.ts +15 -0
  153. package/dist/ir/host-method-aliases.js +61 -0
  154. package/dist/ir/host-namespace-reads.d.ts +24 -0
  155. package/dist/ir/host-namespace-reads.js +151 -0
  156. package/dist/ir/host-promise-conversions.d.ts +5 -0
  157. package/dist/ir/host-promise-conversions.js +61 -0
  158. package/dist/ir/host-template-conversions.d.ts +34 -0
  159. package/dist/ir/host-template-conversions.js +357 -0
  160. package/dist/ir/instance-reparenting.d.ts +3 -4
  161. package/dist/ir/instantiation.d.ts +1 -1
  162. package/dist/ir/instantiation.js +1 -1
  163. package/dist/ir/integer-storage.d.ts +19 -9
  164. package/dist/ir/integer-storage.js +158 -44
  165. package/dist/ir/integers.d.ts +34 -7
  166. package/dist/ir/integers.js +240 -7
  167. package/dist/ir/integrity-restrictions.d.ts +4 -4
  168. package/dist/ir/integrity-restrictions.js +7 -4
  169. package/dist/ir/internal-operation-conversions.d.ts +7 -0
  170. package/dist/ir/internal-operation-conversions.js +195 -0
  171. package/dist/ir/intrinsic-call-facts.d.ts +40 -0
  172. package/dist/ir/intrinsic-call-facts.js +176 -0
  173. package/dist/ir/key-order-observation.d.ts +1 -1
  174. package/dist/ir/key-order-observation.js +3 -0
  175. package/dist/ir/lazy-splits.d.ts +20 -0
  176. package/dist/ir/lazy-splits.js +58 -0
  177. package/dist/ir/literal-set-membership.d.ts +2 -2
  178. package/dist/ir/literal-set-membership.js +2 -2
  179. package/dist/ir/logical-receivers.d.ts +15 -0
  180. package/dist/ir/logical-receivers.js +98 -0
  181. package/dist/ir/lower-allocation.js +16 -13
  182. package/dist/ir/lower-destructuring.js +7 -6
  183. package/dist/ir/lower-graph.d.ts +4 -4
  184. package/dist/ir/lower-graph.js +2 -2
  185. package/dist/ir/lower-invocation.d.ts +2 -2
  186. package/dist/ir/lower-invocation.js +99 -57
  187. package/dist/ir/lower-narrow.js +35 -13
  188. package/dist/ir/lower-operands.d.ts +40 -11
  189. package/dist/ir/lower-operands.js +206 -87
  190. package/dist/ir/lower-property.js +31 -8
  191. package/dist/ir/lower.js +9 -9
  192. package/dist/ir/merge-conversions.d.ts +18 -0
  193. package/dist/ir/merge-conversions.js +106 -0
  194. package/dist/ir/model.d.ts +138 -28
  195. package/dist/ir/native-accessor-definition.d.ts +104 -0
  196. package/dist/ir/native-accessor-definition.js +735 -0
  197. package/dist/ir/native-array-descriptor-snapshot.d.ts +45 -0
  198. package/dist/ir/native-array-descriptor-snapshot.js +380 -0
  199. package/dist/ir/native-array-insertion.d.ts +16 -0
  200. package/dist/ir/native-array-insertion.js +42 -0
  201. package/dist/ir/native-array-transport.js +37 -3
  202. package/dist/ir/native-callable-argument.d.ts +38 -0
  203. package/dist/ir/native-callable-argument.js +128 -0
  204. package/dist/ir/native-callable-data-flow.d.ts +9 -0
  205. package/dist/ir/native-callable-data-flow.js +59 -0
  206. package/dist/ir/native-callable-data-owner.d.ts +45 -0
  207. package/dist/ir/native-callable-data-owner.js +755 -0
  208. package/dist/ir/native-callable-data-reads.d.ts +45 -0
  209. package/dist/ir/native-callable-data-reads.js +282 -0
  210. package/dist/ir/native-callable-data-slots.d.ts +78 -0
  211. package/dist/ir/native-callable-data-slots.js +403 -0
  212. package/dist/ir/native-callable-data-write.d.ts +58 -0
  213. package/dist/ir/native-callable-data-write.js +254 -0
  214. package/dist/ir/native-callable-integrity.d.ts +23 -0
  215. package/dist/ir/native-callable-integrity.js +77 -0
  216. package/dist/ir/native-callable-own-property.d.ts +42 -0
  217. package/dist/ir/native-callable-own-property.js +505 -0
  218. package/dist/ir/native-callable-prototype.d.ts +38 -0
  219. package/dist/ir/native-callable-prototype.js +307 -0
  220. package/dist/ir/native-callable-readonly-set.d.ts +25 -0
  221. package/dist/ir/native-callable-readonly-set.js +238 -0
  222. package/dist/ir/native-class-accessor.d.ts +3 -3
  223. package/dist/ir/native-class-accessor.js +3 -3
  224. package/dist/ir/native-class-construction.js +2 -2
  225. package/dist/ir/native-constructor-reads.d.ts +15 -0
  226. package/dist/ir/native-constructor-reads.js +156 -0
  227. package/dist/ir/native-constructor-static.d.ts +18 -0
  228. package/dist/ir/native-constructor-static.js +61 -0
  229. package/dist/ir/native-data-definition.d.ts +43 -0
  230. package/dist/ir/native-data-definition.js +222 -0
  231. package/dist/ir/native-document-array-entries.d.ts +15 -0
  232. package/dist/ir/native-document-array-entries.js +37 -0
  233. package/dist/ir/native-document-entries.d.ts +21 -0
  234. package/dist/ir/native-document-entries.js +74 -0
  235. package/dist/ir/native-entry-field-views.d.ts +18 -0
  236. package/dist/ir/native-entry-field-views.js +62 -0
  237. package/dist/ir/native-field-view-domains.d.ts +50 -0
  238. package/dist/ir/native-field-view-domains.js +325 -0
  239. package/dist/ir/native-field-view-facts.d.ts +97 -0
  240. package/dist/ir/native-field-view-facts.js +354 -0
  241. package/dist/ir/native-fixed-layout.js +1 -1
  242. package/dist/ir/native-host-construction.d.ts +4 -6
  243. package/dist/ir/native-host-construction.js +4 -6
  244. package/dist/ir/native-host-method-reads.d.ts +13 -0
  245. package/dist/ir/native-host-method-reads.js +53 -0
  246. package/dist/ir/native-iterator-field-views.d.ts +15 -0
  247. package/dist/ir/native-iterator-field-views.js +39 -0
  248. package/dist/ir/native-iterator-receivers.d.ts +8 -0
  249. package/dist/ir/native-iterator-receivers.js +59 -0
  250. package/dist/ir/native-key-query.js +5 -2
  251. package/dist/ir/native-logical-receiver-body.d.ts +8 -0
  252. package/dist/ir/native-logical-receiver-body.js +23 -0
  253. package/dist/ir/native-method-frames.d.ts +18 -0
  254. package/dist/ir/native-method-frames.js +127 -0
  255. package/dist/ir/native-method-read-source.d.ts +16 -0
  256. package/dist/ir/native-method-read-source.js +61 -0
  257. package/dist/ir/native-object-data-slots.d.ts +60 -0
  258. package/dist/ir/native-object-data-slots.js +493 -0
  259. package/dist/ir/native-object-sample.d.ts +32 -0
  260. package/dist/ir/native-object-sample.js +113 -0
  261. package/dist/ir/native-own-assignment.d.ts +123 -0
  262. package/dist/ir/native-own-assignment.js +529 -0
  263. package/dist/ir/native-property-coercibility.d.ts +3 -0
  264. package/dist/ir/native-property-coercibility.js +10 -0
  265. package/dist/ir/native-property-key-texts.d.ts +11 -0
  266. package/dist/ir/native-property-key-texts.js +41 -0
  267. package/dist/ir/native-property-presence-effects.d.ts +11 -0
  268. package/dist/ir/native-property-presence-effects.js +19 -0
  269. package/dist/ir/native-property-presence.d.ts +27 -0
  270. package/dist/ir/native-property-presence.js +275 -0
  271. package/dist/ir/native-prototype-calls.d.ts +19 -0
  272. package/dist/ir/native-prototype-calls.js +53 -0
  273. package/dist/ir/native-prototype-conversions.d.ts +5 -0
  274. package/dist/ir/native-prototype-conversions.js +46 -0
  275. package/dist/ir/native-prototype-presence-demand.d.ts +9 -0
  276. package/dist/ir/native-prototype-presence-demand.js +58 -0
  277. package/dist/ir/native-record-index.d.ts +1 -1
  278. package/dist/ir/native-union-method-targets.d.ts +8 -0
  279. package/dist/ir/native-union-method-targets.js +69 -0
  280. package/dist/ir/no-normal-call-completion.d.ts +15 -0
  281. package/dist/ir/no-normal-call-completion.js +184 -0
  282. package/dist/ir/non-normal-receiver.d.ts +39 -0
  283. package/dist/ir/non-normal-receiver.js +253 -0
  284. package/dist/ir/operation-conversions.d.ts +29 -0
  285. package/dist/ir/operation-conversions.js +490 -0
  286. package/dist/ir/operation-index.d.ts +1 -1
  287. package/dist/ir/presence-proof.d.ts +1 -1
  288. package/dist/ir/presence-proof.js +1 -0
  289. package/dist/ir/program-conversions.d.ts +48 -0
  290. package/dist/ir/program-conversions.js +229 -0
  291. package/dist/ir/program-facts.d.ts +4 -1
  292. package/dist/ir/program-facts.js +9 -7
  293. package/dist/ir/promise-reaction-conversions.d.ts +6 -0
  294. package/dist/ir/promise-reaction-conversions.js +92 -0
  295. package/dist/ir/property-read-conversions.d.ts +10 -0
  296. package/dist/ir/property-read-conversions.js +124 -0
  297. package/dist/ir/proven-branches.d.ts +2 -1
  298. package/dist/ir/proven-branches.js +97 -10
  299. package/dist/ir/publish-conversion-recipes.d.ts +27 -0
  300. package/dist/ir/publish-conversion-recipes.js +246 -0
  301. package/dist/ir/publish-native-field-view-facts.d.ts +17 -0
  302. package/dist/ir/publish-native-field-view-facts.js +119 -0
  303. package/dist/ir/queries.js +42 -4
  304. package/dist/ir/read-only-dictionary.d.ts +38 -0
  305. package/dist/ir/read-only-dictionary.js +281 -0
  306. package/dist/ir/reflection-demand.d.ts +2 -0
  307. package/dist/ir/reflection-demand.js +840 -71
  308. package/dist/ir/shake.d.ts +3 -0
  309. package/dist/ir/shake.js +39 -15
  310. package/dist/ir/shared-empty-records.js +1 -1
  311. package/dist/ir/short-circuit-threading.d.ts +23 -0
  312. package/dist/ir/short-circuit-threading.js +133 -0
  313. package/dist/ir/spread-conversions.d.ts +27 -0
  314. package/dist/ir/spread-conversions.js +134 -0
  315. package/dist/ir/spread-copy-elision.d.ts +2 -2
  316. package/dist/ir/spread-copy-elision.js +7 -4
  317. package/dist/ir/string-layout-reuse.d.ts +9 -8
  318. package/dist/ir/string-layout-reuse.js +8 -16
  319. package/dist/ir/string-length-reuse.d.ts +20 -4
  320. package/dist/ir/string-length-reuse.js +57 -13
  321. package/dist/ir/transfer.d.ts +5 -5
  322. package/dist/ir/transfer.js +53 -31
  323. package/dist/ir/typed-property-access.d.ts +2 -0
  324. package/dist/ir/typed-property-access.js +21 -8
  325. package/dist/ir/virtual-call-frames.d.ts +7 -0
  326. package/dist/ir/virtual-call-frames.js +8 -0
  327. package/dist/native-signatures.d.ts +45 -0
  328. package/dist/native-signatures.js +368 -0
  329. package/dist/plugins/gea/host.d.ts +6 -1
  330. package/dist/plugins/gea/host.js +30 -1
  331. package/dist/plugins/gea/lower.js +9 -3
  332. package/dist/plugins/gea/members.js +1 -1
  333. package/dist/plugins/gea/plugin.js +2 -1
  334. package/dist/plugins/gea/prelude.d.ts +1 -1
  335. package/dist/plugins/gea/prelude.js +1 -1
  336. package/dist/plugins/gea/reactive-slots.js +6 -6
  337. package/dist/plugins/gea/render-bridge.js +5 -6
  338. package/dist/plugins/gea/user-agent-styles.js +1 -1
  339. package/dist/plugins/installed.d.ts +2 -2
  340. package/dist/plugins/installed.js +2 -2
  341. package/dist/plugins/load.js +1 -1
  342. package/dist/plugins/model.d.ts +21 -36
  343. package/dist/plugins/webgl/host.d.ts +23 -23
  344. package/dist/plugins/webgl/host.js +25 -26
  345. package/dist/plugins/webgl/plugin.d.ts +16 -19
  346. package/dist/plugins/webgl/plugin.js +16 -23
  347. package/dist/project-preparation.js +12 -14
  348. package/dist/projection/abi.js +13 -10
  349. package/dist/projection/bindings.d.ts +8 -0
  350. package/dist/projection/bindings.js +36 -5
  351. package/dist/projection/callee.d.ts +17 -15
  352. package/dist/projection/callee.js +108 -81
  353. package/dist/projection/class-property-presence.d.ts +1 -1
  354. package/dist/projection/class-property-presence.js +1 -1
  355. package/dist/projection/classes.d.ts +2 -0
  356. package/dist/projection/classes.js +4 -1
  357. package/dist/projection/dispatch.d.ts +19 -3
  358. package/dist/projection/dispatch.js +39 -16
  359. package/dist/projection/fields.d.ts +14 -2
  360. package/dist/projection/fields.js +100 -38
  361. package/dist/projection/function-source.d.ts +5 -0
  362. package/dist/projection/function-source.js +15 -0
  363. package/dist/projection/immediate-callees.d.ts +12 -0
  364. package/dist/projection/immediate-callees.js +36 -0
  365. package/dist/projection/index-protocols.d.ts +12 -0
  366. package/dist/projection/index-protocols.js +39 -0
  367. package/dist/projection/instance-test.d.ts +8 -0
  368. package/dist/projection/instance-test.js +3 -1
  369. package/dist/projection/method-values.d.ts +7 -0
  370. package/dist/projection/method-values.js +29 -0
  371. package/dist/projection/native-accessor-access.d.ts +26 -0
  372. package/dist/projection/native-accessor-access.js +18 -0
  373. package/dist/projection/native-callable-data.d.ts +24 -0
  374. package/dist/projection/native-callable-data.js +101 -0
  375. package/dist/projection/native-expando.d.ts +3 -0
  376. package/dist/projection/native-expando.js +13 -0
  377. package/dist/projection/native-object-data.d.ts +47 -0
  378. package/dist/projection/native-object-data.js +203 -0
  379. package/dist/projection/native-prototype-methods.d.ts +22 -0
  380. package/dist/projection/native-prototype-methods.js +161 -0
  381. package/dist/projection/regexp-fields.d.ts +35 -0
  382. package/dist/projection/regexp-fields.js +80 -0
  383. package/dist/projection/slots.d.ts +5 -1
  384. package/dist/projection/slots.js +89 -10
  385. package/dist/representation/derive.d.ts +5 -7
  386. package/dist/representation/derive.js +78 -78
  387. package/dist/representation/difference.js +1 -1
  388. package/dist/representation/host-abi.d.ts +2 -2
  389. package/dist/representation/host-abi.js +4 -5
  390. package/dist/representation/host-templates.d.ts +7 -3
  391. package/dist/representation/host-templates.js +13 -5
  392. package/dist/representation/intersection.d.ts +3 -3
  393. package/dist/representation/intersection.js +3 -3
  394. package/dist/representation/merge.js +1 -1
  395. package/dist/representation/model.d.ts +27 -22
  396. package/dist/representation/model.js +35 -22
  397. package/dist/representation/native-callable-data-storage.d.ts +85 -0
  398. package/dist/representation/native-callable-data-storage.js +398 -0
  399. package/dist/representation/native-data-properties.d.ts +14 -0
  400. package/dist/representation/native-data-properties.js +52 -0
  401. package/dist/representation/native-logical-receiver.d.ts +36 -0
  402. package/dist/representation/native-logical-receiver.js +92 -0
  403. package/dist/representation/object-shape.d.ts +1 -1
  404. package/dist/representation/object-shape.js +1 -1
  405. package/dist/representation/optional.js +2 -2
  406. package/dist/representation/physical-carrier.d.ts +25 -0
  407. package/dist/representation/physical-carrier.js +153 -0
  408. package/dist/representation/policies.d.ts +16 -10
  409. package/dist/representation/policies.js +5 -1
  410. package/dist/representation/primitives.js +3 -0
  411. package/dist/representation/promise-resolution.d.ts +19 -0
  412. package/dist/representation/promise-resolution.js +50 -0
  413. package/dist/representation/prototype-domains.d.ts +43 -0
  414. package/dist/representation/prototype-domains.js +226 -0
  415. package/dist/representation/proxy-carriers.d.ts +3 -3
  416. package/dist/representation/proxy-carriers.js +2 -3
  417. package/dist/representation/publish.d.ts +4 -0
  418. package/dist/representation/publish.js +73 -42
  419. package/dist/representation/record-fields.d.ts +2 -2
  420. package/dist/representation/record-fields.js +2 -2
  421. package/dist/representation/static-field-cells.d.ts +1 -1
  422. package/dist/representation/structural-method-abi.d.ts +6 -0
  423. package/dist/representation/structural-method-abi.js +13 -0
  424. package/dist/representation/unassigned-binding-cells.d.ts +3 -3
  425. package/dist/representation/union.js +19 -4
  426. package/dist/representation/unwritten-record-members.d.ts +6 -6
  427. package/dist/representation/unwritten-record-members.js +1 -1
  428. package/dist/representation/value-records.js +77 -5
  429. package/dist/representation/verify.js +1 -1
  430. package/dist/representation/well-known-symbols.d.ts +3 -0
  431. package/dist/representation/well-known-symbols.js +11 -0
  432. package/dist/semantics/alias-this-field-declaration-transform.js +3 -3
  433. package/dist/semantics/ambient-type-realization-transform.d.ts +19 -20
  434. package/dist/semantics/ambient-type-realization-transform.js +20 -12
  435. package/dist/semantics/ambient.d.ts +13 -13
  436. package/dist/semantics/ambient.js +12 -12
  437. package/dist/semantics/borrowed-builtin-call-bind-source-transform.d.ts +5 -0
  438. package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +110 -52
  439. package/dist/semantics/borrowed-method-receiver-copy-source-transform.d.ts +4 -4
  440. package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +4 -4
  441. package/dist/semantics/call-invalidated-narrowing.js +2 -2
  442. package/dist/semantics/callable-origins.d.ts +49 -1
  443. package/dist/semantics/callable-origins.js +148 -32
  444. package/dist/semantics/callable-own-data-slots.d.ts +122 -0
  445. package/dist/semantics/callable-own-data-slots.js +421 -0
  446. package/dist/semantics/class-alias.d.ts +4 -4
  447. package/dist/semantics/class-alias.js +4 -4
  448. package/dist/semantics/class-heritage.d.ts +8 -7
  449. package/dist/semantics/class-heritage.js +8 -7
  450. package/dist/semantics/commonjs-wrapper.js +5 -2
  451. package/dist/semantics/constructor-function-class-source-transform.js +2 -3
  452. package/dist/semantics/constructor-slot-subclasses.d.ts +1 -1
  453. package/dist/semantics/constructor-slot-subclasses.js +5 -5
  454. package/dist/semantics/declaration-overlay-transform.d.ts +9 -12
  455. package/dist/semantics/declaration-overlay-transform.js +135 -142
  456. package/dist/semantics/declared-integers.d.ts +24 -0
  457. package/dist/semantics/declared-integers.js +34 -0
  458. package/dist/semantics/define-property-source-transform.js +21 -8
  459. package/dist/semantics/dynamic-fallback.d.ts +1 -1
  460. package/dist/semantics/dynamic-fallback.js +1 -1
  461. package/dist/semantics/frontend.d.ts +12 -16
  462. package/dist/semantics/frontend.js +187 -75
  463. package/dist/semantics/host-methods.d.ts +3 -3
  464. package/dist/semantics/host-methods.js +1 -1
  465. package/dist/semantics/host-protocols.d.ts +3 -3
  466. package/dist/semantics/host-protocols.js +26 -26
  467. package/dist/semantics/interface-families.d.ts +2 -2
  468. package/dist/semantics/interface-families.js +46 -47
  469. package/dist/semantics/interface-implementors.d.ts +12 -15
  470. package/dist/semantics/interface-implementors.js +12 -15
  471. package/dist/semantics/jsdoc-namepath-transform.js +7 -7
  472. package/dist/semantics/model/operands.d.ts +18 -3
  473. package/dist/semantics/model/operands.js +41 -0
  474. package/dist/semantics/model/operations.d.ts +82 -1
  475. package/dist/semantics/model/selected-signature.d.ts +24 -3
  476. package/dist/semantics/model/structural-type-table.js +24 -6
  477. package/dist/semantics/model/structural-types.d.ts +10 -8
  478. package/dist/semantics/model/structural-types.js +7 -5
  479. package/dist/semantics/module-resolution.js +3 -2
  480. package/dist/semantics/native-callable-readonly-set.d.ts +17 -0
  481. package/dist/semantics/native-callable-readonly-set.js +1 -0
  482. package/dist/semantics/native-function-signatures.d.ts +14 -0
  483. package/dist/semantics/native-function-signatures.js +96 -0
  484. package/dist/semantics/native-object-data-slots.d.ts +72 -0
  485. package/dist/semantics/native-object-data-slots.js +679 -0
  486. package/dist/semantics/native-own-assignment.d.ts +62 -0
  487. package/dist/semantics/native-own-assignment.js +1 -0
  488. package/dist/semantics/normalize/absent-globals.d.ts +8 -8
  489. package/dist/semantics/normalize/absent-globals.js +5 -5
  490. package/dist/semantics/normalize/any-cast-member-call.d.ts +36 -0
  491. package/dist/semantics/normalize/any-cast-member-call.js +55 -0
  492. package/dist/semantics/normalize/arguments-objects.d.ts +3 -1
  493. package/dist/semantics/normalize/arguments-objects.js +1 -1
  494. package/dist/semantics/normalize/asserted-argument-arms.d.ts +7 -7
  495. package/dist/semantics/normalize/asserted-arm-absence.d.ts +1 -2
  496. package/dist/semantics/normalize/asserted-arm-absence.js +1 -2
  497. package/dist/semantics/normalize/binding-fixpoint.js +3 -3
  498. package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +2 -2
  499. package/dist/semantics/normalize/bivariant-slot-parameter.js +6 -6
  500. package/dist/semantics/normalize/callable-data-write.d.ts +46 -0
  501. package/dist/semantics/normalize/callable-data-write.js +182 -0
  502. package/dist/semantics/normalize/census.js +5 -5
  503. package/dist/semantics/normalize/class-instance-record-statement.d.ts +1 -1
  504. package/dist/semantics/normalize/class-instance-record-statement.js +1 -1
  505. package/dist/semantics/normalize/collection-bindings.d.ts +11 -13
  506. package/dist/semantics/normalize/collection-bindings.js +60 -33
  507. package/dist/semantics/normalize/commonjs-module-record.d.ts +7 -4
  508. package/dist/semantics/normalize/commonjs-module-record.js +93 -4
  509. package/dist/semantics/normalize/contribution.js +4 -4
  510. package/dist/semantics/normalize/dead-method-copies.d.ts +5 -5
  511. package/dist/semantics/normalize/dead-typeof-guards.d.ts +2 -2
  512. package/dist/semantics/normalize/dead-typeof-guards.js +6 -6
  513. package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +22 -13
  514. package/dist/semantics/normalize/deferred-intrinsic-protocols.js +85 -13
  515. package/dist/semantics/normalize/derived-expression-type.d.ts +129 -91
  516. package/dist/semantics/normalize/derived-expression-type.js +459 -192
  517. package/dist/semantics/normalize/field-bindings.d.ts +4 -4
  518. package/dist/semantics/normalize/field-bindings.js +334 -67
  519. package/dist/semantics/normalize/flow/array-element-continuation.d.ts +2 -2
  520. package/dist/semantics/normalize/flow/array-element-continuation.js +35 -18
  521. package/dist/semantics/normalize/flow/callable-array-origins.d.ts +1 -1
  522. package/dist/semantics/normalize/flow/callable-array-origins.js +3 -3
  523. package/dist/semantics/normalize/flow/callable-completions.d.ts +2 -2
  524. package/dist/semantics/normalize/flow/callable-completions.js +2 -2
  525. package/dist/semantics/normalize/flow/callable-reach.d.ts +19 -6
  526. package/dist/semantics/normalize/flow/callable-reach.js +755 -289
  527. package/dist/semantics/normalize/flow/class-family-member-read.js +24 -29
  528. package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +2 -2
  529. package/dist/semantics/normalize/flow/collection-value-continuation.js +2 -2
  530. package/dist/semantics/normalize/flow/component-solver.d.ts +19 -16
  531. package/dist/semantics/normalize/flow/component-solver.js +138 -69
  532. package/dist/semantics/normalize/flow/computed-key-set.d.ts +6 -7
  533. package/dist/semantics/normalize/flow/computed-key-set.js +20 -1
  534. package/dist/semantics/normalize/flow/export-importers.js +4 -4
  535. package/dist/semantics/normalize/flow/host-text-sink.d.ts +3 -2
  536. package/dist/semantics/normalize/flow/host-text-sink.js +4 -3
  537. package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +3 -2
  538. package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +2 -2
  539. package/dist/semantics/normalize/flow/intrinsic-data-definition.js +3 -3
  540. package/dist/semantics/normalize/flow/invocation-facts.d.ts +3 -2
  541. package/dist/semantics/normalize/flow/invocation-facts.js +3 -3
  542. package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +12 -6
  543. package/dist/semantics/normalize/flow/member-call-forwarding.js +94 -21
  544. package/dist/semantics/normalize/flow/model.d.ts +5 -5
  545. package/dist/semantics/normalize/flow/model.js +11 -11
  546. package/dist/semantics/normalize/flow/node-path-token.js +3 -3
  547. package/dist/semantics/normalize/flow/origin-authority.d.ts +3 -3
  548. package/dist/semantics/normalize/flow/owned-class-receivers.js +8 -7
  549. package/dist/semantics/normalize/flow/parameter-values.js +6 -6
  550. package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +30 -4
  551. package/dist/semantics/normalize/flow/proof-hypotheses.js +56 -5
  552. package/dist/semantics/normalize/flow/proof-memo-settlement.d.ts +21 -0
  553. package/dist/semantics/normalize/flow/proof-memo-settlement.js +32 -0
  554. package/dist/semantics/normalize/flow/record-alias-closure.d.ts +1 -1
  555. package/dist/semantics/normalize/flow/record-alias-closure.js +1 -1
  556. package/dist/semantics/normalize/flow/seeded-origins.d.ts +4 -4
  557. package/dist/semantics/normalize/flow/seeded-origins.js +4 -4
  558. package/dist/semantics/normalize/flow/source-accessor-descriptor.d.ts +22 -0
  559. package/dist/semantics/normalize/flow/source-accessor-descriptor.js +210 -0
  560. package/dist/semantics/normalize/flow/source-callable-own-data.d.ts +33 -0
  561. package/dist/semantics/normalize/flow/source-callable-own-data.js +238 -0
  562. package/dist/semantics/normalize/flow/source-callable-readonly-set.d.ts +26 -0
  563. package/dist/semantics/normalize/flow/source-callable-readonly-set.js +337 -0
  564. package/dist/semantics/normalize/flow/source-class-data.d.ts +7 -7
  565. package/dist/semantics/normalize/flow/source-class-data.js +25 -26
  566. package/dist/semantics/normalize/flow/source-class-static-data.d.ts +2 -2
  567. package/dist/semantics/normalize/flow/source-class-static-data.js +2 -2
  568. package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +15 -0
  569. package/dist/semantics/normalize/flow/source-commonjs-exports.js +7 -0
  570. package/dist/semantics/normalize/flow/source-descriptor-protocol.d.ts +20 -0
  571. package/dist/semantics/normalize/flow/source-descriptor-protocol.js +75 -0
  572. package/dist/semantics/normalize/flow/source-executing-parameter-values.d.ts +8 -0
  573. package/dist/semantics/normalize/flow/source-executing-parameter-values.js +93 -0
  574. package/dist/semantics/normalize/flow/source-global-binding.d.ts +13 -0
  575. package/dist/semantics/normalize/flow/source-global-binding.js +42 -0
  576. package/dist/semantics/normalize/flow/source-intrinsic-member-data.d.ts +27 -0
  577. package/dist/semantics/normalize/flow/source-intrinsic-member-data.js +178 -0
  578. package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +1 -1
  579. package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +31 -11
  580. package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +7 -3
  581. package/dist/semantics/normalize/flow/source-invocation-receiver.js +30 -2
  582. package/dist/semantics/normalize/flow/source-native-class-alias.d.ts +7 -0
  583. package/dist/semantics/normalize/flow/source-native-class-alias.js +91 -0
  584. package/dist/semantics/normalize/flow/source-normal-predecessor.d.ts +10 -0
  585. package/dist/semantics/normalize/flow/source-normal-predecessor.js +90 -0
  586. package/dist/semantics/normalize/flow/source-property-key.d.ts +3 -0
  587. package/dist/semantics/normalize/flow/source-property-key.js +7 -0
  588. package/dist/semantics/normalize/flow/source-read-protocol.d.ts +20 -0
  589. package/dist/semantics/normalize/flow/source-read-protocol.js +108 -0
  590. package/dist/semantics/normalize/flow/source-record-data.js +31 -30
  591. package/dist/semantics/normalize/flow/source-value-session.d.ts +106 -3
  592. package/dist/semantics/normalize/flow/source-value-session.js +1172 -218
  593. package/dist/semantics/normalize/flow/standard-prototype-method-source.d.ts +16 -0
  594. package/dist/semantics/normalize/flow/standard-prototype-method-source.js +64 -0
  595. package/dist/semantics/normalize/flow/targets.d.ts +13 -14
  596. package/dist/semantics/normalize/flow/targets.js +20 -23
  597. package/dist/semantics/normalize/flow/value-flow.d.ts +2 -4
  598. package/dist/semantics/normalize/flow/value-flow.js +4 -13
  599. package/dist/semantics/normalize/flow/value-provenance.d.ts +23 -3
  600. package/dist/semantics/normalize/flow/value-provenance.js +44 -4
  601. package/dist/semantics/normalize/fresh-dictionary-storage.d.ts +34 -0
  602. package/dist/semantics/normalize/fresh-dictionary-storage.js +637 -0
  603. package/dist/semantics/normalize/fresh-indexed-storage.d.ts +43 -0
  604. package/dist/semantics/normalize/fresh-indexed-storage.js +88 -0
  605. package/dist/semantics/normalize/fresh-ordinary-object.d.ts +8 -0
  606. package/dist/semantics/normalize/fresh-ordinary-object.js +27 -0
  607. package/dist/semantics/normalize/gating.js +2 -2
  608. package/dist/semantics/normalize/global-host-mutations.js +770 -261
  609. package/dist/semantics/normalize/host-effect-contracts.d.ts +1 -1
  610. package/dist/semantics/normalize/host-effect-contracts.js +1 -1
  611. package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +2 -2
  612. package/dist/semantics/normalize/host-mutation-computed-keys.js +8 -0
  613. package/dist/semantics/normalize/host-mutation-key-reader.d.ts +6 -11
  614. package/dist/semantics/normalize/host-mutation-key-reader.js +11 -28
  615. package/dist/semantics/normalize/host-mutation-keys.d.ts +11 -7
  616. package/dist/semantics/normalize/host-mutation-keys.js +26 -15
  617. package/dist/semantics/normalize/identities.js +20 -17
  618. package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +8 -3
  619. package/dist/semantics/normalize/implicit-arguments-tuple.js +21 -4
  620. package/dist/semantics/normalize/installed-global-properties.d.ts +17 -0
  621. package/dist/semantics/normalize/installed-global-properties.js +214 -0
  622. package/dist/semantics/normalize/instantiation.js +6 -6
  623. package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +1 -1
  624. package/dist/semantics/normalize/intrinsic-property-call.d.ts +6 -1
  625. package/dist/semantics/normalize/intrinsic-property-call.js +19 -0
  626. package/dist/semantics/normalize/intrinsic-prototype.d.ts +7 -0
  627. package/dist/semantics/normalize/intrinsic-prototype.js +10 -0
  628. package/dist/semantics/normalize/intrinsic-return-identity.d.ts +5 -0
  629. package/dist/semantics/normalize/intrinsic-return-identity.js +29 -0
  630. package/dist/semantics/normalize/jsdoc-type-names.js +59 -63
  631. package/dist/semantics/normalize/keyof.js +3 -3
  632. package/dist/semantics/normalize/local-bindings.d.ts +4 -4
  633. package/dist/semantics/normalize/local-bindings.js +68 -62
  634. package/dist/semantics/normalize/logical-object-truthiness.d.ts +8 -0
  635. package/dist/semantics/normalize/logical-object-truthiness.js +20 -0
  636. package/dist/semantics/normalize/merged-declaration.d.ts +3 -3
  637. package/dist/semantics/normalize/merged-declaration.js +3 -3
  638. package/dist/semantics/normalize/never-override-result.d.ts +2 -3
  639. package/dist/semantics/normalize/never-override-result.js +2 -3
  640. package/dist/semantics/normalize/null-blind-parameter.d.ts +2 -2
  641. package/dist/semantics/normalize/null-blind-parameter.js +2 -2
  642. package/dist/semantics/normalize/object-bag-bindings.d.ts +19 -19
  643. package/dist/semantics/normalize/object-bag-bindings.js +334 -141
  644. package/dist/semantics/normalize/omitted-stated-parameter.d.ts +8 -8
  645. package/dist/semantics/normalize/omitted-stated-parameter.js +8 -9
  646. package/dist/semantics/normalize/override-field-arms.d.ts +3 -3
  647. package/dist/semantics/normalize/override-field-arms.js +15 -16
  648. package/dist/semantics/normalize/parameter-bindings.d.ts +13 -12
  649. package/dist/semantics/normalize/parameter-bindings.js +173 -139
  650. package/dist/semantics/normalize/parameter-slot.d.ts +9 -10
  651. package/dist/semantics/normalize/parameter-slot.js +16 -17
  652. package/dist/semantics/normalize/physical-overload-result.d.ts +8 -8
  653. package/dist/semantics/normalize/physical-overload-result.js +10 -10
  654. package/dist/semantics/normalize/producer-context.d.ts +27 -12
  655. package/dist/semantics/normalize/producers/allocations.js +5 -1
  656. package/dist/semantics/normalize/producers/bindings.js +8 -7
  657. package/dist/semantics/normalize/producers/boundary.js +3 -22
  658. package/dist/semantics/normalize/producers/cited-value-type.d.ts +19 -0
  659. package/dist/semantics/normalize/producers/cited-value-type.js +38 -0
  660. package/dist/semantics/normalize/producers/class-lifecycle.js +52 -7
  661. package/dist/semantics/normalize/producers/computations.js +59 -14
  662. package/dist/semantics/normalize/producers/control.js +5 -5
  663. package/dist/semantics/normalize/producers/declaration-lifecycle.js +4 -4
  664. package/dist/semantics/normalize/producers/destructuring.js +10 -5
  665. package/dist/semantics/normalize/producers/erasure.d.ts +9 -0
  666. package/dist/semantics/normalize/producers/erasure.js +22 -0
  667. package/dist/semantics/normalize/producers/invocations.d.ts +1 -1
  668. package/dist/semantics/normalize/producers/invocations.js +210 -55
  669. package/dist/semantics/normalize/producers/logical-merge-type.d.ts +2 -2
  670. package/dist/semantics/normalize/producers/logical-merge-type.js +12 -12
  671. package/dist/semantics/normalize/producers/native-callable-readonly-set.d.ts +6 -0
  672. package/dist/semantics/normalize/producers/native-callable-readonly-set.js +24 -0
  673. package/dist/semantics/normalize/producers/native-own-assignment.d.ts +14 -0
  674. package/dist/semantics/normalize/producers/native-own-assignment.js +153 -0
  675. package/dist/semantics/normalize/producers/properties.js +153 -20
  676. package/dist/semantics/normalize/producers/protocol.js +4 -4
  677. package/dist/semantics/normalize/producers/references.js +21 -19
  678. package/dist/semantics/normalize/producers/shared.d.ts +1 -1
  679. package/dist/semantics/normalize/producers/shared.js +59 -58
  680. package/dist/semantics/normalize/producers/spread-arguments.js +7 -3
  681. package/dist/semantics/normalize/producers/tuple-spread.d.ts +2 -2
  682. package/dist/semantics/normalize/producers/tuple-spread.js +5 -5
  683. package/dist/semantics/normalize/property-key-domain.d.ts +6 -6
  684. package/dist/semantics/normalize/property-key-domain.js +7 -7
  685. package/dist/semantics/normalize/reachability.d.ts +6 -7
  686. package/dist/semantics/normalize/reachability.js +60 -62
  687. package/dist/semantics/normalize/record-home-arms.js +2 -3
  688. package/dist/semantics/normalize/record-link-families.d.ts +1 -1
  689. package/dist/semantics/normalize/record-link-families.js +1 -1
  690. package/dist/semantics/normalize/record-stand-in-arms.d.ts +4 -5
  691. package/dist/semantics/normalize/return-bindings.d.ts +19 -9
  692. package/dist/semantics/normalize/return-bindings.js +96 -42
  693. package/dist/semantics/normalize/script-global-redefinition.d.ts +1 -1
  694. package/dist/semantics/normalize/script-global-redefinition.js +1 -1
  695. package/dist/semantics/normalize/shared-array-storage.d.ts +4 -5
  696. package/dist/semantics/normalize/shared-array-storage.js +7 -8
  697. package/dist/semantics/normalize/sloppy-absence.d.ts +6 -3
  698. package/dist/semantics/normalize/sloppy-absence.js +7 -3
  699. package/dist/semantics/normalize/source-object-prototype-absence.d.ts +7 -0
  700. package/dist/semantics/normalize/source-object-prototype-absence.js +19 -0
  701. package/dist/semantics/normalize/specialization.d.ts +10 -10
  702. package/dist/semantics/normalize/specialization.js +107 -112
  703. package/dist/semantics/normalize/specialized-source-frames.d.ts +11 -0
  704. package/dist/semantics/normalize/specialized-source-frames.js +41 -0
  705. package/dist/semantics/normalize/structural-any-binding-consumer.d.ts +34 -0
  706. package/dist/semantics/normalize/structural-any-binding-consumer.js +208 -0
  707. package/dist/semantics/normalize/structural-array-element.d.ts +5 -5
  708. package/dist/semantics/normalize/structural-array-element.js +40 -39
  709. package/dist/semantics/normalize/structural-array-read.js +3 -3
  710. package/dist/semantics/normalize/structural-callable.d.ts +15 -1
  711. package/dist/semantics/normalize/structural-callable.js +35 -3
  712. package/dist/semantics/normalize/structural-creation-order.d.ts +2 -2
  713. package/dist/semantics/normalize/structural-declarations.d.ts +22 -21
  714. package/dist/semantics/normalize/structural-declarations.js +52 -43
  715. package/dist/semantics/normalize/structural-declared-body.js +10 -11
  716. package/dist/semantics/normalize/structural-indexed-access.js +2 -2
  717. package/dist/semantics/normalize/structural-instantiated-member.d.ts +9 -10
  718. package/dist/semantics/normalize/structural-instantiated-member.js +43 -30
  719. package/dist/semantics/normalize/structural-joins.d.ts +4 -16
  720. package/dist/semantics/normalize/structural-joins.js +5 -65
  721. package/dist/semantics/normalize/structural-layout-relevance.d.ts +5 -5
  722. package/dist/semantics/normalize/structural-layout-relevance.js +22 -23
  723. package/dist/semantics/normalize/structural-layout-type.d.ts +1 -1
  724. package/dist/semantics/normalize/structural-layout-type.js +140 -107
  725. package/dist/semantics/normalize/structural-local-union.d.ts +1 -1
  726. package/dist/semantics/normalize/structural-local-union.js +38 -12
  727. package/dist/semantics/normalize/structural-mutable-field.d.ts +9 -0
  728. package/dist/semantics/normalize/structural-mutable-field.js +152 -0
  729. package/dist/semantics/normalize/structural-parts.d.ts +6 -0
  730. package/dist/semantics/normalize/structural-parts.js +35 -32
  731. package/dist/semantics/normalize/structural-receiver.d.ts +3 -3
  732. package/dist/semantics/normalize/structural-receiver.js +12 -13
  733. package/dist/semantics/normalize/structural-self-reference.d.ts +12 -11
  734. package/dist/semantics/normalize/structural-self-reference.js +24 -25
  735. package/dist/semantics/normalize/structural.d.ts +15 -3
  736. package/dist/semantics/normalize/structural.js +440 -201
  737. package/dist/semantics/normalize/suppressed-write-arms.d.ts +10 -11
  738. package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +6 -6
  739. package/dist/semantics/normalize/symbol-keyed-this-slots.js +4 -4
  740. package/dist/semantics/normalize/unresolvable-names.d.ts +2 -3
  741. package/dist/semantics/normalize/unresolvable-names.js +2 -2
  742. package/dist/semantics/normalize/unshared-array-result.d.ts +4 -4
  743. package/dist/semantics/normalize/unshared-array-result.js +4 -4
  744. package/dist/semantics/package-sources.js +2 -3
  745. package/dist/semantics/program.d.ts +10 -13
  746. package/dist/semantics/program.js +80 -26
  747. package/dist/semantics/property-key.d.ts +9 -0
  748. package/dist/semantics/property-key.js +25 -0
  749. package/dist/semantics/prototype-object-class-source-transform.js +2 -2
  750. package/dist/semantics/prototype-reparenting.d.ts +1 -1
  751. package/dist/semantics/prototype-reparenting.js +1 -1
  752. package/dist/semantics/shared-declaration-files.d.ts +6 -1
  753. package/dist/semantics/shared-declaration-files.js +2 -2
  754. package/dist/semantics/source-transform-protocol.d.ts +26 -0
  755. package/dist/semantics/source-transform-protocol.js +1 -0
  756. package/dist/semantics/stable-checker.js +9 -13
  757. package/dist/semantics/subclass-member-overlay-transform.d.ts +2 -2
  758. package/dist/semantics/subclass-member-overlay-transform.js +89 -88
  759. package/dist/semantics/this-constructor-source-transform.js +2 -2
  760. package/dist/semantics/unchecked-guard-argument-copies.d.ts +3 -3
  761. package/dist/semantics/unchecked-write-member-declarations.d.ts +9 -11
  762. package/dist/semantics/unchecked-write-member-declarations.js +11 -13
  763. package/dist/semantics/uninstantiable-classes.d.ts +1 -1
  764. package/dist/semantics/uninstantiable-classes.js +1 -1
  765. package/dist/targets/cpp/balanced-units.d.ts +1 -1
  766. package/dist/targets/cpp/balanced-units.js +1 -1
  767. package/dist/targets/cpp/borrowed-arm-projections.d.ts +2 -3
  768. package/dist/targets/cpp/borrowed-arm-projections.js +2 -3
  769. package/dist/targets/cpp/borrowed-call-entry.js +3 -3
  770. package/dist/targets/cpp/captures.d.ts +2 -2
  771. package/dist/targets/cpp/captures.js +4 -4
  772. package/dist/targets/cpp/char-code-buffers.d.ts +1 -1
  773. package/dist/targets/cpp/char-code-buffers.js +4 -1
  774. package/dist/targets/cpp/class-layout.d.ts +7 -17
  775. package/dist/targets/cpp/class-layout.js +6 -13
  776. package/dist/targets/cpp/class-properties/computed-method-value.d.ts +1 -1
  777. package/dist/targets/cpp/class-properties/computed-method-value.js +5 -27
  778. package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +49 -59
  779. package/dist/targets/cpp/class-properties/emit-class-properties.js +68 -232
  780. package/dist/targets/cpp/class-properties/native-method-read.d.ts +5 -0
  781. package/dist/targets/cpp/class-properties/native-method-read.js +60 -0
  782. package/dist/targets/cpp/class-properties/native-prototype.d.ts +3 -1
  783. package/dist/targets/cpp/class-properties/native-prototype.js +5 -6
  784. package/dist/targets/cpp/class-ref-transport.d.ts +1 -11
  785. package/dist/targets/cpp/class-ref-transport.js +1 -9
  786. package/dist/targets/cpp/conversions.js +633 -252
  787. package/dist/targets/cpp/coroutine-bodies.d.ts +1 -97
  788. package/dist/targets/cpp/coroutine-bodies.js +1 -187
  789. package/dist/targets/cpp/document.js +1 -1
  790. package/dist/targets/cpp/emit-allocation.d.ts +0 -38
  791. package/dist/targets/cpp/emit-allocation.js +63 -88
  792. package/dist/targets/cpp/emit-array-view.d.ts +7 -0
  793. package/dist/targets/cpp/emit-array-view.js +47 -0
  794. package/dist/targets/cpp/emit-arrays.d.ts +9 -52
  795. package/dist/targets/cpp/emit-arrays.js +177 -113
  796. package/dist/targets/cpp/emit-binding-reference.d.ts +10 -0
  797. package/dist/targets/cpp/emit-binding-reference.js +19 -1
  798. package/dist/targets/cpp/emit-bindings.js +19 -24
  799. package/dist/targets/cpp/emit-buffers.d.ts +8 -4
  800. package/dist/targets/cpp/emit-buffers.js +88 -47
  801. package/dist/targets/cpp/emit-callable-view.d.ts +6 -0
  802. package/dist/targets/cpp/emit-callable-view.js +133 -0
  803. package/dist/targets/cpp/emit-callable.d.ts +11 -1
  804. package/dist/targets/cpp/emit-callable.js +225 -266
  805. package/dist/targets/cpp/emit-carrier-members.d.ts +2 -2
  806. package/dist/targets/cpp/emit-carrier-members.js +42 -35
  807. package/dist/targets/cpp/emit-certified-conversion.d.ts +7 -0
  808. package/dist/targets/cpp/emit-certified-conversion.js +27 -0
  809. package/dist/targets/cpp/emit-context.d.ts +123 -64
  810. package/dist/targets/cpp/emit-context.js +147 -44
  811. package/dist/targets/cpp/emit-descriptor-snapshot.d.ts +10 -0
  812. package/dist/targets/cpp/emit-descriptor-snapshot.js +60 -0
  813. package/dist/targets/cpp/emit-dictionary-view.d.ts +6 -0
  814. package/dist/targets/cpp/emit-dictionary-view.js +102 -0
  815. package/dist/targets/cpp/emit-document-record-view.d.ts +3 -0
  816. package/dist/targets/cpp/emit-document-record-view.js +104 -0
  817. package/dist/targets/cpp/emit-dynamic-properties.d.ts +42 -17
  818. package/dist/targets/cpp/emit-dynamic-properties.js +118 -72
  819. package/dist/targets/cpp/emit-equality.d.ts +2 -1
  820. package/dist/targets/cpp/emit-equality.js +65 -45
  821. package/dist/targets/cpp/emit-exceptions.js +1 -1
  822. package/dist/targets/cpp/emit-in.js +22 -11
  823. package/dist/targets/cpp/emit-instanceof.js +15 -14
  824. package/dist/targets/cpp/emit-integers.d.ts +40 -3
  825. package/dist/targets/cpp/emit-integers.js +76 -5
  826. package/dist/targets/cpp/emit-iterable-object-view.d.ts +2 -0
  827. package/dist/targets/cpp/emit-iterable-object-view.js +15 -11
  828. package/dist/targets/cpp/emit-iterator-object-view.d.ts +2 -0
  829. package/dist/targets/cpp/emit-iterator-object-view.js +24 -16
  830. package/dist/targets/cpp/emit-iterator.d.ts +2 -0
  831. package/dist/targets/cpp/emit-iterator.js +115 -43
  832. package/dist/targets/cpp/emit-json.js +6 -6
  833. package/dist/targets/cpp/emit-jsx.js +2 -2
  834. package/dist/targets/cpp/emit-live-field-view.d.ts +26 -0
  835. package/dist/targets/cpp/emit-live-field-view.js +50 -0
  836. package/dist/targets/cpp/emit-narrowing.d.ts +60 -139
  837. package/dist/targets/cpp/emit-narrowing.js +715 -624
  838. package/dist/targets/cpp/emit-native-accessor-definition.d.ts +10 -0
  839. package/dist/targets/cpp/emit-native-accessor-definition.js +94 -0
  840. package/dist/targets/cpp/emit-native-callable-data.d.ts +23 -0
  841. package/dist/targets/cpp/emit-native-callable-data.js +117 -0
  842. package/dist/targets/cpp/emit-native-document-entry.d.ts +4 -0
  843. package/dist/targets/cpp/emit-native-document-entry.js +52 -0
  844. package/dist/targets/cpp/emit-native-field-view.d.ts +26 -0
  845. package/dist/targets/cpp/emit-native-field-view.js +235 -0
  846. package/dist/targets/cpp/emit-native-method.d.ts +16 -0
  847. package/dist/targets/cpp/emit-native-method.js +90 -0
  848. package/dist/targets/cpp/emit-native-object-data.d.ts +7 -0
  849. package/dist/targets/cpp/emit-native-object-data.js +66 -0
  850. package/dist/targets/cpp/emit-native-object-sample.d.ts +8 -0
  851. package/dist/targets/cpp/emit-native-object-sample.js +34 -0
  852. package/dist/targets/cpp/emit-native-own-assignment.d.ts +7 -0
  853. package/dist/targets/cpp/emit-native-own-assignment.js +119 -0
  854. package/dist/targets/cpp/emit-native-selection.d.ts +2 -2
  855. package/dist/targets/cpp/emit-native-selection.js +14 -5
  856. package/dist/targets/cpp/emit-number-storage.d.ts +2 -0
  857. package/dist/targets/cpp/emit-number-storage.js +1 -0
  858. package/dist/targets/cpp/emit-presence.d.ts +3 -4
  859. package/dist/targets/cpp/emit-presence.js +43 -21
  860. package/dist/targets/cpp/emit-properties.js +224 -111
  861. package/dist/targets/cpp/emit-protocol-iterator.d.ts +2 -0
  862. package/dist/targets/cpp/emit-protocol-iterator.js +45 -23
  863. package/dist/targets/cpp/emit-record-view.d.ts +5 -10
  864. package/dist/targets/cpp/emit-record-view.js +223 -269
  865. package/dist/targets/cpp/emit-return.js +33 -8
  866. package/dist/targets/cpp/emit-scopes.d.ts +2 -2
  867. package/dist/targets/cpp/emit-sum-widening.js +13 -5
  868. package/dist/targets/cpp/emit-tonumber.d.ts +1 -1
  869. package/dist/targets/cpp/emit-tonumber.js +3 -3
  870. package/dist/targets/cpp/emit-tostring.d.ts +20 -2
  871. package/dist/targets/cpp/emit-tostring.js +131 -28
  872. package/dist/targets/cpp/emit-typeof.d.ts +4 -0
  873. package/dist/targets/cpp/emit-typeof.js +29 -1
  874. package/dist/targets/cpp/emit-union-properties.d.ts +6 -23
  875. package/dist/targets/cpp/emit-union-properties.js +136 -237
  876. package/dist/targets/cpp/emit.d.ts +4 -1
  877. package/dist/targets/cpp/emit.js +336 -119
  878. package/dist/targets/cpp/error-types.d.ts +1 -3
  879. package/dist/targets/cpp/error-types.js +1 -2
  880. package/dist/targets/cpp/evaluated-once.d.ts +4 -4
  881. package/dist/targets/cpp/evaluated-once.js +5 -5
  882. package/dist/targets/cpp/function-source-reads.d.ts +2 -15
  883. package/dist/targets/cpp/function-source-reads.js +3 -38
  884. package/dist/targets/cpp/host/core-globals.d.ts +5 -0
  885. package/dist/targets/cpp/host/core-globals.js +10 -0
  886. package/dist/targets/cpp/host/emit-host-arity.js +1 -1
  887. package/dist/targets/cpp/host/emit-host-invoke.js +73 -23
  888. package/dist/targets/cpp/host/emit-host-object.d.ts +2 -1
  889. package/dist/targets/cpp/host/emit-host-object.js +329 -146
  890. package/dist/targets/cpp/host/emit-host-properties.js +4 -6
  891. package/dist/targets/cpp/host/emit-host-reflect.js +29 -5
  892. package/dist/targets/cpp/host/emit-host-value.d.ts +1 -1
  893. package/dist/targets/cpp/host/emit-host-value.js +2 -2
  894. package/dist/targets/cpp/host/host-members.d.ts +11 -0
  895. package/dist/targets/cpp/host/host-members.js +27 -5
  896. package/dist/targets/cpp/host/host-method-aliases.d.ts +1 -30
  897. package/dist/targets/cpp/host/host-method-aliases.js +1 -76
  898. package/dist/targets/cpp/host/native-protocols.js +1 -1
  899. package/dist/targets/cpp/host/object-protocol.d.ts +1 -1
  900. package/dist/targets/cpp/host/object-protocol.js +24 -24
  901. package/dist/targets/cpp/host-namespace-reads.d.ts +1 -83
  902. package/dist/targets/cpp/host-namespace-reads.js +1 -113
  903. package/dist/targets/cpp/manifest/capabilities.js +33 -33
  904. package/dist/targets/cpp/manifest.d.ts +5 -0
  905. package/dist/targets/cpp/manifest.js +38 -14
  906. package/dist/targets/cpp/native-collection-base.js +7 -6
  907. package/dist/targets/cpp/native-debug-source.d.ts +15 -0
  908. package/dist/targets/cpp/native-debug-source.js +21 -0
  909. package/dist/targets/cpp/native-error-base.d.ts +1 -1
  910. package/dist/targets/cpp/native-error-base.js +1 -1
  911. package/dist/targets/cpp/native-narrowing-transport.d.ts +2 -0
  912. package/dist/targets/cpp/native-narrowing-transport.js +25 -5
  913. package/dist/targets/cpp/native-view-targets.d.ts +3 -0
  914. package/dist/targets/cpp/native-view-targets.js +5 -0
  915. package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +3 -33
  916. package/dist/targets/cpp/prototype/emit-prototype-array.js +40 -22
  917. package/dist/targets/cpp/prototype/emit-prototype-date.d.ts +1 -58
  918. package/dist/targets/cpp/prototype/emit-prototype-date.js +14 -97
  919. package/dist/targets/cpp/prototype/emit-prototype-error.d.ts +20 -0
  920. package/dist/targets/cpp/prototype/emit-prototype-error.js +2 -2
  921. package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +3 -27
  922. package/dist/targets/cpp/prototype/emit-prototype-invoke.js +60 -52
  923. package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +1 -41
  924. package/dist/targets/cpp/prototype/emit-prototype-iterator.js +4 -43
  925. package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +2 -13
  926. package/dist/targets/cpp/prototype/emit-prototype-promise.js +10 -58
  927. package/dist/targets/cpp/prototype/emit-prototype-regexp.d.ts +4 -25
  928. package/dist/targets/cpp/prototype/emit-prototype-regexp.js +16 -81
  929. package/dist/targets/cpp/prototype/emit-prototype-string.d.ts +1 -1
  930. package/dist/targets/cpp/prototype/emit-prototype-string.js +17 -28
  931. package/dist/targets/cpp/prototype/prototype-method-reads.js +4 -80
  932. package/dist/targets/cpp/reactive-dependencies.d.ts +12 -6
  933. package/dist/targets/cpp/reactive-dependencies.js +62 -42
  934. package/dist/targets/cpp/reactive-origins.js +12 -0
  935. package/dist/targets/cpp/records.d.ts +133 -14
  936. package/dist/targets/cpp/records.js +345 -153
  937. package/dist/targets/cpp/regexp-types.d.ts +1 -26
  938. package/dist/targets/cpp/regexp-types.js +4 -29
  939. package/dist/targets/cpp/segment-scopes.d.ts +30 -0
  940. package/dist/targets/cpp/segment-scopes.js +294 -0
  941. package/dist/targets/cpp/translation-unit.d.ts +21 -2
  942. package/dist/targets/cpp/translation-unit.js +121 -276
  943. package/dist/targets/cpp/types.d.ts +8 -3
  944. package/dist/targets/cpp/types.js +30 -6
  945. package/dist/targets/cpp/virtual-callees.d.ts +18 -0
  946. package/dist/targets/cpp/virtual-callees.js +27 -0
  947. package/dist/targets/cpp/virtual-methods.d.ts +7 -7
  948. package/dist/targets/cpp/virtual-methods.js +213 -58
  949. package/package.json +8 -3
  950. package/src/targets/cpp/runtime/gea_dictionary_view.h +204 -0
  951. package/src/targets/cpp/runtime/gea_document_view.h +845 -0
  952. package/src/targets/cpp/runtime/gea_dynamic_proxy.h +66 -23
  953. package/src/targets/cpp/runtime/gea_eval.h +6 -6
  954. package/src/targets/cpp/runtime/gea_runtime.h +7587 -1166
  955. package/dist/targets/cpp/direct-call-receivers.d.ts +0 -37
  956. package/dist/targets/cpp/direct-call-receivers.js +0 -79
@@ -1,25 +1,35 @@
1
+ import { nativeLogicalReceiverProtocolOf, nativeLogicalReceiverProtocolSupported } from '../../representation/native-logical-receiver.js';
1
2
  import { coercionText } from './emit-coercion.js';
2
3
  import { classRefTransportKind, constructorFamilyUpcastMembers, constructorUpcastMember, nativeRecordBaseTransportKind } from './class-ref-transport.js';
3
- import { chainFieldProtocolUnused, nativeSumNarrowingTransports } from './native-narrowing-transport.js';
4
- import { classRefDomainsOverlap, classifierDomainsOverlap } from '../../conversion/algebra.js';
5
- import { recordCastableToArray } from './emit-arrays.js';
4
+ import { callablePayloadPlan, callableViewPlan, certifiedRecordViewPlan, recordToArrayPlan } from '../../conversion/structural-plan.js';
5
+ import { recipeClosureOf } from '../../conversion/recipe-closure.js';
6
+ import { nativeFieldViewPlanIsLive } from '../../conversion/native-field-view.js';
7
+ import { promiseAdoptionPlanOf } from '../../conversion/promise-adoption.js';
8
+ import { composedDictionaryViewPlan } from '../../conversion/dictionary-view.js';
9
+ import { nativeArrayViewBasePlanOf, nativeArrayViewSourceIsBoxed, nativeArrayViewWithObservation, nativeArrayViewWithOwnerObservation } from '../../conversion/array-view.js';
10
+ import { composedDocumentRecordViewPlanOf } from '../../conversion/document-record-view.js';
11
+ import { certifiedIteratorObjectViewPlan } from '../../conversion/certified-iterator-object-view.js';
12
+ import { chainFieldProtocolUnused, chainPayloadNeedsSourceGuard, nativeSumNarrowingTransports } from './native-narrowing-transport.js';
13
+ import { classRefDomainsOverlap, classifierDomainsOverlap, conversionNeedsPriorSourceGuard, conversionRequiresSourceGuard, transfersNativeStorage } from '../../conversion/algebra.js';
6
14
  import { emptyConversionRegistry, narrowingReachesTarget, narrowsToDescendantClassUnion } from '../../conversion/build.js';
7
15
  import { defaultRecordLayoutPolicy } from '../../representation/policies.js';
8
16
  import { abiKey, arrayExtensionKey, representationKey, carriesUndefined, containsUnresolved, isOpenDocument } from '../../representation/model.js';
9
- import { isSpellable, callableObjectAbi, resultAdapterTransportOf, adaptsConstructorIntoDispatch, boxDiscriminantsOfArm, conversionRecipeOf, boxedAssertionText, classDocumentViewText, dropsAllParametersIntoResultArm, dropsUnboundParameters, dynamicTagFor, promisePayloadConvertible, rebasesRestOverLeadingParameters, dictionaryCastableToDictionary, CONSTRUCTOR_STATIC_VIEW, constructorStaticViewAdmitted, DYNAMIC_DICTIONARY_TO_NAMED_RECORD, dynamicDictionaryToNamedRecordAdmitted, indexedRecordCastableToDictionary, indexedRecordDictionaryArmOf, indexedRecordViewOf, INDEXED_RECORD_INTO_DICTIONARY_ARM, INDEXED_RECORD_TO_DICTIONARY, recordCastableToDictionary, recordRecastCrossesDynamic, recordsRecastable, sameArrayUpToExtension, sumIntoPayloadText, widensResultIntoArm, resultAdaptedCallableText, tryCandidateText, VIEW_ADAPTED_CALLABLE, CHECKED_ARM_NARROWING, checkedArmNarrowingText } from './emit-narrowing.js';
10
- import { cppTypeOf } from './types.js';
11
- import { nativeSumWidenable } from '../../conversion/native-sum.js';
12
- import { nativeSelectionRecipeOf, nativeTotalSelectionRecipeOf } from '../../conversion/native-selection.js';
17
+ import { isSpellable, callableObjectAbi, resultAdapterTransportOf, adaptsConstructorIntoDispatch, boxDiscriminantsOfArm, conversionRecipeOf, boxedAssertionText, classDocumentViewText, documentViewable, dropsAllParametersIntoResultArm, dropsUnboundParameters, dynamicTagFor, promisePayloadConvertible, rebasesRestOverLeadingParameters, CONSTRUCTOR_STATIC_VIEW, constructorStaticViewAdmitted, DYNAMIC_DICTIONARY_TO_NAMED_RECORD, dynamicDictionaryToNamedRecordAdmitted, indexedRecordCastableToDictionary, indexedRecordDictionaryArmOf, indexedRecordViewOf, INDEXED_RECORD_INTO_DICTIONARY_ARM, INDEXED_RECORD_TO_DICTIONARY, recordCastableToDictionary, recordRecastCrossesDynamic, recordsRecastable, sameArrayUpToExtension, sumIntoPayloadText, widensResultIntoArm, resultAdaptedCallableText, tryCandidateText, VIEW_ADAPTED_CALLABLE, CHECKED_ARM_NARROWING, checkedArmNarrowingText } from './emit-narrowing.js';
18
+ import { NATIVE_SUM_CLASSIFIER, NATIVE_SUM_MATERIALIZER, nativeSumPlan, nativeSumPreservesPayload } from '../../conversion/native-sum.js';
19
+ import { NATIVE_REFERENCE_ABSENCE, nativeReferenceAbsenceOf } from '../../conversion/native-absence.js';
20
+ import { nativeSelectionGuardContractOf, nativeSelectionPreservesPayload, nativeSelectionRecipeOf, nativeSubsetSelectionRecipeOf, nativeTotalSelectionRecipeOf } from '../../conversion/native-selection.js';
13
21
  import { nativeClassReferenceIdentityOf } from '../../conversion/native-class-reference.js';
14
- import { isRecordViewTarget, ownedRecordMaterializationPlan, recordViewDispatchesArms, recordViewIndirectReads, recordViewResidualReflection, recordViewUsesOnlyDirectFields } from '../../conversion/record-view.js';
22
+ import { certifiedIterableObjectViewPlan, certifiedProtocolIteratorPlan } from '../../conversion/certified-iterator-protocols.js';
23
+ import { isRecordViewTarget, ownedRecordMaterializationPlan, recordViewDispatchesArms, recordViewResidualReflection, recordViewUsesOnlyDirectFields } from '../../conversion/record-view.js';
15
24
  import { cppStringObjectNativeType } from './regexp-types.js';
16
- import { familyMemberViewPlanFor, viewPlanFor } from './emit-record-view.js';
25
+ import { viewPlanFor } from './emit-record-view.js';
17
26
  import { FAMILY_MEMBER_VIEW_MATERIALIZER } from '../../conversion/nodes.js';
18
27
  import { PROTOCOL_ITERATOR, protocolIteratorPlanFor } from './emit-protocol-iterator.js';
19
28
  import { ITERABLE_OBJECT_VIEW, iterableObjectViewPlanFor } from './emit-iterable-object-view.js';
20
29
  import { ITERATOR_OBJECT_VIEW, iteratorObjectViewPlanFor } from './emit-iterator-object-view.js';
21
30
  import { CONSTRUCTOR_DISPATCH_FAMILY, CONSTRUCTOR_IDENTITY_FAMILY } from './emit-constructor-identity-family.js';
22
31
  import { proxyArmWithoutHome } from '../../representation/proxy-carriers.js';
32
+ import { samePhysicalCarrier } from '../../representation/physical-carrier.js';
23
33
  import { constructorDispatchFamilyPlan, constructorIdentityFamilyPlan } from '../../conversion/constructor-identity-family.js';
24
34
  /** Called only after the native converting-constructor predicate has selected this pair. */
25
35
  const nativeClassPresence = (value) => {
@@ -37,17 +47,18 @@ const nativeCallableTransport = (source, target) => {
37
47
  : { nativeFieldProtocol: 'unused', callableAdapter: { from, to }, callableIdentityTransport: 'preserved' };
38
48
  };
39
49
  const nativeSumConversion = (source, target) => {
40
- if (!nativeSumWidenable(source, target))
50
+ const plan = nativeSumPlan(source, target);
51
+ if (plan === null)
41
52
  return null;
42
53
  const domain = `sum-widen:${representationKey(source)}->${representationKey(target)}`;
43
54
  return {
44
- classifier: { id: 'gea::native-sum::live-alternative', domain },
55
+ classifier: { id: NATIVE_SUM_CLASSIFIER, domain },
45
56
  materializer: {
46
- id: 'gea::native-sum::inject-alternative',
57
+ id: NATIVE_SUM_MATERIALIZER,
47
58
  domain,
48
59
  allocates: false,
49
60
  nativeFieldProtocol: 'unused',
50
- nativePayloadTransport: 'preserved',
61
+ ...(nativeSumPreservesPayload(plan) ? { nativePayloadTransport: 'preserved' } : {}),
51
62
  ...nativeClassReferenceIdentityOf(source, target)
52
63
  }
53
64
  };
@@ -60,9 +71,11 @@ const nativeSelectionConversion = (source, target, nativeSelection) => {
60
71
  id: 'gea::native-sum::select',
61
72
  domain,
62
73
  allocates: false,
74
+ armSelection: 'native-sum',
63
75
  nativeFieldProtocol: 'unused',
64
- nativePayloadTransport: 'preserved',
76
+ ...(nativeSelectionPreservesPayload(nativeSelection) ? { nativePayloadTransport: 'preserved' } : {}),
65
77
  nativeSelection,
78
+ ...nativeSelectionGuardContractOf(nativeSelection),
66
79
  ...nativeClassReferenceIdentityOf(source, target)
67
80
  }
68
81
  };
@@ -140,13 +153,13 @@ const nativeSelectionConversion = (source, target, nativeSelection) => {
140
153
  * carriers, exactly as `emit-narrowing.ts`'s `widenedStoreText` recurses when
141
154
  * it RENDERS the store. Asked as one predicate rather than restated per
142
155
  * branch, because the branch that restated it read only one level and refused
143
- * `tagged-union(record | optional(callable))`: hono's `compose` builds that
144
- * carrier for its `handler`, and the render was ready for it.
156
+ * `tagged-union(record | optional(callable))`: a middleware-composition
157
+ * function builds that carrier for its handler, and the render was ready for it.
145
158
  */
146
159
  const boxable = (representation) => {
147
160
  // Already a box. `dynamicTagFor` answers `null` for it -- a box holds
148
161
  // whichever tag its value carries, not one fixed tag -- and reading that as
149
- // "cannot be boxed" refused hono's `compose` handler,
162
+ // "cannot be boxed" refused a composed handler typed
150
163
  // `tagged-union(dynamic | optional(callable))`, whose first arm is one.
151
164
  if (representation.kind === 'dynamic')
152
165
  return true;
@@ -158,7 +171,7 @@ const boxable = (representation) => {
158
171
  };
159
172
  const exactTagRead = (tag) => ({
160
173
  classifier: { id: 'gea::Value::tag', domain: `tag:${tag}` },
161
- materializer: { id: 'gea::detail::unboxValue', domain: `tag:${tag}`, allocates: false }
174
+ materializer: { id: 'gea::detail::unboxValue', domain: `tag:${tag}`, allocates: false, wrapperKind: 'unbox-tag', boxTag: tag }
162
175
  });
163
176
  /**
164
177
  * A derived class-ref stored into a base class-ref cell.
@@ -182,8 +195,8 @@ const upcastsToBase = (source, target) => classRefTransportKind(source, target)
182
195
  * The exact mirror: a BASE class-ref read at one of its descendants, which is
183
196
  * what `instanceof` narrows and what `upcastsToBase` above cannot express.
184
197
  *
185
- * `Object3D.traverse( part => { if ( part instanceof Mesh ) part.castShadow =
186
- * true } )` is the shape, and it is the one `instanceof` exists for -- the
198
+ * `node.visit( part => { if ( part instanceof Derived ) part.flag = true } )`
199
+ * is the shape, and it is the one `instanceof` exists for -- the
187
200
  * handle is declared at the base and the guard proves the object is a
188
201
  * descendant. Nothing had ever PROPOSED the pair (`conversion/build.ts`'s
189
202
  * class-ref loop asked only `widening`), so the reads past the guard carried
@@ -200,8 +213,8 @@ const downcastsToDerived = (source, target) => classRefTransportKind(source, tar
200
213
  /** Exactly one class arm inside `target` accepts `source` by inheritance. */
201
214
  const hasSingleClassUpcastHome = (source, target) => {
202
215
  // A class extending the intrinsic `Error` reaches an `Error` arm by the same
203
- // pointer upcast a bare `Error` slot takes: mongodb hands every
204
- // `MongoNetworkError` to an `(err?: Error | null)` callback.
216
+ // pointer upcast a bare `Error` slot takes: a program hands its own error
217
+ // subclass to an `(err?: Error | null)` callback.
205
218
  if (upcastsToBase(source, target) || (target.kind !== source.kind && nativeRecordBaseTransportKind(source, target) === 'upcast'))
206
219
  return true;
207
220
  if (target.kind === 'optional')
@@ -237,7 +250,7 @@ const genericFunctionSetPair = (source, target) => {
237
250
  const domain = `generic-function-set:${representationKey(source)}->${representationKey(target)}`;
238
251
  return {
239
252
  classifier: { id: 'generic-function-set::index', domain },
240
- materializer: { id: 'generic-function-set::remap', domain, allocates: false }
253
+ materializer: { id: 'generic-function-set::remap', domain, allocates: false, nativeFieldProtocol: 'unused' }
241
254
  };
242
255
  };
243
256
  /**
@@ -335,7 +348,11 @@ const cppTaggedUnionArmClassifier = (arm) => {
335
348
  if (discriminants === null || discriminants.length === 0)
336
349
  return null;
337
350
  if (arm.runtimeDiscriminator.kind === 'record-literal') {
338
- return { id: 'gea::detail::dynamicRecordDiscriminator', domain: `record-literal:${JSON.stringify(arm.runtimeDiscriminator)}` };
351
+ return {
352
+ id: 'gea::detail::dynamicRecordDiscriminator',
353
+ domain: `record-literal:${JSON.stringify(arm.runtimeDiscriminator)}`,
354
+ recordDiscriminator: arm.runtimeDiscriminator
355
+ };
339
356
  }
340
357
  if (arm.runtimeDiscriminator.kind === 'callable-tag') {
341
358
  return {
@@ -443,26 +460,77 @@ const dynamicCarrierSupported = (representation, seen = new Set()) => {
443
460
  return false;
444
461
  }
445
462
  };
446
- const dynamicCallableAbiSupported = (abi, seen = new Set()) => {
463
+ const dynamicCallableAbiSupported = (abi, seen = new Set(), argument = dynamicCarrierSupported) => {
447
464
  if (abi.receiver !== null && !dynamicCarrierSupported(abi.receiver, seen))
448
465
  return false;
449
466
  if (abi.result.kind !== 'void' && !dynamicCarrierSupported(abi.result, seen))
450
467
  return false;
451
- if (!abi.parameters.every((parameter) => dynamicCarrierSupported(parameter.value, seen)))
468
+ if (!abi.parameters.every((parameter) => argument(parameter.value, seen)))
452
469
  return false;
453
470
  if (abi.restFrom === null)
454
471
  return true;
455
472
  const rest = abi.parameters[abi.restFrom]?.value;
456
- return (abi.restFrom === abi.parameters.length - 1 &&
457
- rest?.kind === 'array-object' &&
458
- rest.ownership === 'shared-refcount' &&
459
- dynamicCarrierSupported(rest.element, seen));
473
+ if (abi.restFrom !== abi.parameters.length - 1 || rest === undefined)
474
+ return false;
475
+ if (rest.kind === 'array-object')
476
+ return rest.ownership === 'shared-refcount' && dynamicCarrierSupported(rest.element, seen);
477
+ return dynamicRestTupleSupported(rest, seen);
460
478
  };
479
+ /**
480
+ * A rest slot carried as a closed tuple record, not an Array: a function that
481
+ * forwards `arguments` to a fixed-arity call (a wrapper written as
482
+ * `function f() { target.f( ...arguments ) }`) lowers
483
+ * its argument list to a record whose own keys are the canonical indexes. The
484
+ * runtime's `DynamicRestArgument<Ref<T>>` spreads its present index keys in
485
+ * order and packs incoming arguments by index, through the record's own field
486
+ * table -- so the record must be nothing but those index slots.
487
+ */
488
+ const dynamicRestTupleSupported = (rest, seen) => rest.kind === 'record' &&
489
+ rest.ownership === 'shared-refcount' &&
490
+ rest.accessors.length === 0 &&
491
+ rest.fields.every((field, index) => field.key === String(index) && dynamicCarrierSupported(field.value, seen));
492
+ /**
493
+ * What a checked adapter over a dynamic function does with an argument: it
494
+ * only boxes it OUT (`adapt` in gea_runtime.h); only the result is read back
495
+ * in. A union argument therefore needs every arm boxable, which is exactly
496
+ * `DynamicCallableCarrier<TaggedUnion>::supported` -- not the disjoint arm
497
+ * classifiers that reading one back from a Value needs. A property-bag
498
+ * `update(object, key, value)` takes `value` as the union of everything the
499
+ * bag holds -- itself a union nested inside the absences -- whose class arms
500
+ * share a family, beside typed string-keyed tables.
501
+ */
502
+ const dynamicArgumentCarrierSupported = (representation, seen) => representation.kind === 'tagged-union'
503
+ ? representation.arms.every((arm) => dynamicArgumentCarrierSupported(arm.value, seen))
504
+ : // A typed `Record<string, V>` table boxes out as itself
505
+ // (`DynamicCarrier<Ref<T>>::out`); only reading one back in needs the
506
+ // entry-checking view a bare frame position has no recipe for.
507
+ (representation.kind === 'dictionary' && representation.ownership === 'shared-refcount') ||
508
+ dynamicCarrierSupported(representation, seen);
461
509
  const dynamicCallablePair = (target) => {
462
510
  const domain = `dynamic-callable:${representationKey(target)}`;
463
511
  return {
464
512
  classifier: { id: 'gea::Value::tag', domain },
465
- materializer: { id: 'gea::detail::DynamicCarrier::in', domain, allocates: true }
513
+ materializer: {
514
+ id: 'gea::detail::DynamicCarrier::in',
515
+ domain,
516
+ allocates: true,
517
+ callableIdentityTransport: 'preserved',
518
+ wrapperKind: 'dynamic-carrier-in'
519
+ }
520
+ };
521
+ };
522
+ // A reader's physical receiver uses its separately sealed native factory.
523
+ // Positional/result Optional carriers retain the ordinary dynamic-frame
524
+ // restrictions; the factory alone supplies null/undefined receiver policy.
525
+ const dynamicCallableReadAbiSupported = (abi) => dynamicCallableAbiSupported({ ...abi, receiver: null }, new Set(), dynamicArgumentCarrierSupported) &&
526
+ (abi.receiver === null || nativeLogicalReceiverProtocolSupported(nativeLogicalReceiverProtocolOf(abi.receiver)));
527
+ /** Record/array construction immediately performs every cited payload conversion. */
528
+ const sourceGuardsOf = (nodes, resolve) => {
529
+ if (!nodes.some((node) => conversionRequiresSourceGuard(node.capability, resolve)))
530
+ return {};
531
+ return {
532
+ requiresSourceGuard: true,
533
+ ...(!nodes.some((node) => conversionNeedsPriorSourceGuard(node.capability, resolve)) ? { executesSourceGuard: true } : {})
466
534
  };
467
535
  };
468
536
  /**
@@ -472,17 +540,17 @@ const dynamicCallablePair = (target) => {
472
540
  * Nothing in the program proves that arm dead: an interface-typed slot holds
473
541
  * whatever object the program put there (`semantics/interface-implementors.ts`),
474
542
  * and a class this cannot view as the record is still a value the slot can be
475
- * handed -- skytail's `const ctx: AudioContextLike | null = Ctor ? new Ctor()
476
- * : createNativeAudioContext()`, whose `NativeAudioContext` carries class-typed
477
- * fields and a promise the view cannot rebuild. Selecting the record arm
543
+ * handed -- `const x: SomeInterface | null = Ctor ? new Ctor() : createOther()`,
544
+ * where the other class carries class-typed fields and a promise the view
545
+ * cannot rebuild. Selecting the record arm
478
546
  * there read the class instance's bytes as the record and crashed at launch,
479
547
  * certified. A record arm beside the exact one is the opposite case: a record
480
548
  * the view cannot rebuild as the target is not assignable to it either, so the
481
549
  * checker's own narrowing is what put the pair here, and the selection stands.
482
550
  *
483
- * Asked by every table that could answer the pair -- `narrowing` and
484
- * `staticRecipe` -- so the census refuses it outright rather than one table
485
- * declining and the next selecting.
551
+ * Asked by every table that could answer the pair -- `narrowing`,
552
+ * `structuralRecipe` and `staticRecipe` -- so the census refuses it outright
553
+ * rather than one table declining and the next selecting.
486
554
  */
487
555
  const classArmWithoutHome = (layouts, source, target) => {
488
556
  const union = source.kind === 'optional' ? source.payload : source;
@@ -500,7 +568,10 @@ export const createCppConversionRegistry = (layouts = defaultRecordLayoutPolicy)
500
568
  // A sum narrowing's contract is composed from the contracts this same
501
569
  // registry states for its leaf pairs (`native-narrowing-transport.ts`), so
502
570
  // the tables are handed a view of the finished registry.
503
- const registry = cppConversionTables(layouts, (source, target) => nativeSumNarrowingTransports(registry, source, target) ? { nativeFieldProtocol: 'unused', nativePayloadTransport: 'preserved' } : {}, (source, payload) => (chainFieldProtocolUnused(registry, source, payload) ? { nativeFieldProtocol: 'unused' } : {}));
571
+ const registry = cppConversionTables(layouts, (source, target) => nativeSumNarrowingTransports(registry, source, target) ? { nativeFieldProtocol: 'unused', nativePayloadTransport: 'preserved' } : {}, (source, payload) => ({
572
+ ...(chainFieldProtocolUnused(registry, source, payload) ? { nativeFieldProtocol: 'unused' } : {}),
573
+ ...(chainPayloadNeedsSourceGuard(registry, source, payload) ? { requiresSourceGuard: true } : {})
574
+ }));
504
575
  return registry;
505
576
  };
506
577
  /**
@@ -577,22 +648,56 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
577
648
  *
578
649
  * Install only the ABI presently proved end to end: a receiver-less,
579
650
  * fixed-arity numeric comparator whose arguments are themselves dynamic
580
- * values. This is Three's public `Function | null` sort hook. Broadening the
651
+ * values -- the shape of a public `Function | null` sort hook. Broadening the
581
652
  * predicate requires matching `DynamicCarrier<T>::supported` for every new
582
653
  * parameter/result carrier; guessing there would move an honest preflight
583
654
  * refusal into a C++ template failure.
584
655
  */
585
656
  functionValueDispatchMaterializer: (abi) => {
586
657
  const target = { kind: 'function-value-dispatch', abi };
587
- return dynamicCallableAbiSupported(abi) ? dynamicCallablePair(target) : null;
658
+ return dynamicCallableReadAbiSupported(abi) ? dynamicCallablePair(target) : null;
659
+ },
660
+ /**
661
+ * `DynamicCarrier<ConstructorObject<R(A...)>>::readWith`: an exact payload
662
+ * is the constructor itself; any other box is constructed through
663
+ * `Value::construct`, which throws the language's `TypeError` for a value
664
+ * with no `[[Construct]]`, and the object it returns is read by the
665
+ * census's own reader (`constructedResult`, nodes.ts). Only a frame with
666
+ * no receiver and no rest slot is a construct frame `readWith` adapts, and
667
+ * each argument only boxes out, as the callable adapter's do.
668
+ */
669
+ constructorValueDispatchMaterializer: (abi) => {
670
+ if (abi.receiver !== null || abi.restFrom !== null || abi.argumentsFrame !== undefined || abi.overloadJoined)
671
+ return null;
672
+ if (abi.result.kind === 'void' || !abi.parameters.every((parameter) => dynamicArgumentCarrierSupported(parameter.value, new Set())))
673
+ return null;
674
+ const domain = `dynamic-constructor:${representationKey({ kind: 'constructor-value-dispatch', abi })}`;
675
+ return {
676
+ classifier: { id: 'gea::Value::tag', domain },
677
+ // An adapted read shares one environment per Function object, which is
678
+ // a constructor's identity, so every read hands back the same one.
679
+ materializer: {
680
+ id: 'gea::detail::DynamicCarrier::readWith',
681
+ domain,
682
+ allocates: true,
683
+ callableIdentityTransport: 'preserved',
684
+ wrapperKind: 'dynamic-constructor-in'
685
+ }
686
+ };
588
687
  },
589
688
  functionMaterializer: (functionId, abi) => {
590
- if (!dynamicCallableAbiSupported(abi))
689
+ if (!dynamicCallableReadAbiSupported(abi))
591
690
  return null;
592
691
  const domain = `dynamic-callable-identity:${functionId}:${representationKey({ kind: 'function', functionId, abi })}`;
593
692
  return {
594
693
  classifier: { id: 'gea::Value::callableDeclarationIdentity', domain },
595
- materializer: { id: 'gea::detail::DynamicCarrier::in', domain, allocates: true }
694
+ materializer: {
695
+ id: 'gea::detail::DynamicCarrier::in',
696
+ domain,
697
+ allocates: true,
698
+ callableIdentityTransport: 'preserved',
699
+ wrapperKind: 'dynamic-carrier-in'
700
+ }
596
701
  };
597
702
  },
598
703
  /**
@@ -613,8 +718,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
613
718
  *
614
719
  * The cost of its absence was not one conversion: `deriveTaggedUnion`
615
720
  * derives one arm at a time and a single `never` arm makes the whole sum
616
- * `never`, so EVERY nullable tagged-union read out of a box was refused --
617
- * 15 of the three.js app's 74 unmet obligations, all on this one arm.
721
+ * `never`, so EVERY nullable tagged-union read out of a box was refused.
618
722
  */
619
723
  nullMaterializer: () => ({
620
724
  classifier: { id: 'gea::Value::tag', domain: 'tag:Null' },
@@ -697,7 +801,13 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
697
801
  const domain = `class-family:${declaration}:${ownership}`;
698
802
  return {
699
803
  classifier: { id: 'gea::Value::classIdentity', domain },
700
- materializer: { id: 'gea::detail::unboxClassRef', domain, allocates: false }
804
+ materializer: {
805
+ id: 'gea::detail::unboxClassRef',
806
+ domain,
807
+ allocates: false,
808
+ nativeFieldProtocol: 'unused',
809
+ nativePayloadTransport: 'preserved'
810
+ }
701
811
  };
702
812
  },
703
813
  // The compiler's own opaque host carrier is `NativeHandle<protocol>`: its
@@ -713,7 +823,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
713
823
  const domain = `opaque-native-handle:${protocol}@${version}`;
714
824
  return {
715
825
  classifier: { id: 'gea::Value::payloadType', domain },
716
- materializer: { id: 'gea::detail::unboxValue', domain, allocates: false }
826
+ materializer: { id: 'gea::detail::unboxValue', domain, allocates: false, wrapperKind: 'unbox-payload' }
717
827
  };
718
828
  },
719
829
  // Compiler-owned records have a closed field census, so a dynamic object can
@@ -771,13 +881,18 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
771
881
  * type, and `owned` spells a bare `Foo` whose copy-constructibility is
772
882
  * unchecked.
773
883
  *
774
- * `record`/`native-record-ref`/`class-ref`/`array-object` are deliberately
775
- * NOT routed here even though they would qualify -- each already has its own
776
- * entry with its own reasoning, and a second answer to the same question is
777
- * how two authorities drift apart.
884
+ * An accessor-bearing record cannot be reconstructed as a product: doing
885
+ * so would discard its accessor environments or run user code during a
886
+ * classifier. Its one admissible read is this authenticated payload
887
+ * recovery, retaining the exact object and its getters. Plain records
888
+ * keep their product entry; native records, classes and arrays keep their
889
+ * existing dedicated entries.
778
890
  */
779
891
  boxedIdentityMaterializer: (target) => {
780
- const eligible = (target.kind === 'dictionary' || target.kind === 'record-with-index' || target.kind === 'typed-array') &&
892
+ const eligible = (target.kind === 'dictionary' ||
893
+ target.kind === 'record-with-index' ||
894
+ target.kind === 'typed-array' ||
895
+ (target.kind === 'record' && target.accessors.length > 0)) &&
781
896
  target.ownership === 'shared-refcount';
782
897
  if (!eligible && target.kind !== 'array-buffer' && target.kind !== 'shared-array-buffer' && target.kind !== 'data-view')
783
898
  return null;
@@ -786,7 +901,26 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
786
901
  const domain = `boxed-identity:${representationKey(target)}`;
787
902
  return {
788
903
  classifier: { id: 'gea::Value::payloadType', domain },
789
- materializer: { id: 'gea::detail::unboxValue', domain, allocates: false }
904
+ materializer: {
905
+ id: 'gea::detail::unboxValue',
906
+ domain,
907
+ allocates: false,
908
+ wrapperKind: 'unbox-payload',
909
+ ...((target.kind === 'typed-array' ||
910
+ target.kind === 'array-buffer' ||
911
+ target.kind === 'shared-array-buffer' ||
912
+ target.kind === 'data-view') &&
913
+ target.ownership === 'shared-refcount'
914
+ ? { nativeFieldProtocol: 'unused', nativePayloadTransport: 'preserved' }
915
+ : {}),
916
+ ...(target.kind === 'record' && target.accessors.length > 0
917
+ ? {
918
+ nativeAccessorPayload: 'preserved',
919
+ nativeFieldProtocol: 'unused',
920
+ nativePayloadTransport: 'preserved'
921
+ }
922
+ : {})
923
+ }
790
924
  };
791
925
  },
792
926
  dynamicPromiseAdoptionMaterializer: (target) => {
@@ -795,7 +929,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
795
929
  const domain = `dynamic-promise-adoption:${representationKey(target)}`;
796
930
  return {
797
931
  classifier: { id: 'gea::detail::adoptBoxedPromise', domain },
798
- materializer: { id: 'gea::detail::promiseFromDynamic', domain, allocates: true }
932
+ materializer: { id: 'gea::detail::promiseFromDynamic', domain, allocates: true, wrapperKind: 'promise-from-dynamic' }
799
933
  };
800
934
  },
801
935
  dynamicMapViewMaterializer: (target) => {
@@ -817,7 +951,15 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
817
951
  const domain = `record-payload:${shapeId}:${ownership}`;
818
952
  return {
819
953
  classifier: { id: 'gea::Value::payloadType', domain },
820
- materializer: { id: 'gea::detail::unboxValue', domain, allocates: false }
954
+ materializer: {
955
+ id: 'gea::detail::unboxValue',
956
+ domain,
957
+ allocates: false,
958
+ wrapperKind: 'unbox-payload',
959
+ nativeFieldProtocol: 'unused',
960
+ nativePayloadTransport: 'preserved',
961
+ ...((layouts.accessorsForShape(shapeId)?.length ?? 0) > 0 ? { nativeAccessorPayload: 'preserved' } : {})
962
+ }
821
963
  };
822
964
  },
823
965
  /**
@@ -876,6 +1018,10 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
876
1018
  // checker-only semantic type into a fake runtime domain.
877
1019
  taggedUnionArmClassifier: cppTaggedUnionArmClassifier,
878
1020
  narrowing: (source, target) => {
1021
+ // An open Document accepts every native object arm. Its live alias
1022
+ // recipe must run before an exact-tag subset drops those objects.
1023
+ if (isOpenDocument(target) && documentViewable(source))
1024
+ return null;
879
1025
  // Presence loads and native class casts below inspect tags/allocation
880
1026
  // identity, never a property's reflection protocol. State that on the
881
1027
  // installed materializer, where the implementation is known; the IR
@@ -936,6 +1082,17 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
936
1082
  }
937
1083
  };
938
1084
  }
1085
+ // The same absent read of a cell whose own carrier encodes absence: a
1086
+ // shared class reference IS `C | null` (a null `shared_ptr`), so `let x:
1087
+ // C | null = null` read where the guard proved it holds nothing -- the
1088
+ // flow type is `null` -- answers the constant, exactly as the optional
1089
+ // pair above does.
1090
+ if (source.kind === 'class-ref' && source.ownership === 'shared-refcount' && target.kind === 'null') {
1091
+ return {
1092
+ classifier: { id: 'gea::Optional::has_value', domain: 'absent-class-ref:null' },
1093
+ materializer: { id: 'gea::constant', domain: 'absent-class-ref:null', allocates: false, nativeFieldProtocol: 'unused' }
1094
+ };
1095
+ }
939
1096
  // A structural value read as an instance of a class nothing can
940
1097
  // instantiate. No such instance exists, so a guard that narrowed to it --
941
1098
  // `incoming instanceof Http2ServerRequest` -- never passes, and the
@@ -951,13 +1108,19 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
951
1108
  const domain = `uninstantiable-class:${representationKey(target)}`;
952
1109
  return {
953
1110
  classifier: { id: 'gea::host::neverInstance', domain },
954
- materializer: { id: 'gea::host::unreachableValue', domain, allocates: false, nativeFieldProtocol: 'unused' }
1111
+ materializer: {
1112
+ id: 'gea::host::unreachableValue',
1113
+ domain,
1114
+ allocates: false,
1115
+ nativeFieldProtocol: 'unused',
1116
+ normalCompletion: 'never'
1117
+ }
955
1118
  };
956
1119
  }
957
1120
  // A shared structural view read as a class, under the `instanceof` that
958
1121
  // proved it was built from one: the view remembers its origin
959
- // (`gea::record::viewOrigin`) and the origin is narrowed like any boxed
960
- // class instance, checked. An optional view is the same read of its
1122
+ // (`gea::record::viewOrigin`) and authenticates that native allocation's
1123
+ // class layout. An optional view is the same read of its
961
1124
  // payload, which the test proved present.
962
1125
  // An open `any` document may view an instance too (`classDocumentViewText`).
963
1126
  const sharedView = (value) => ((value.kind === 'record' || value.kind === 'record-with-index' || (value.kind === 'native-record-ref' && value.native === null)) &&
@@ -969,7 +1132,14 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
969
1132
  const domain = `view-origin:${representationKey(target)}`;
970
1133
  return {
971
1134
  classifier: { id: 'gea::record::viewOriginIs', domain },
972
- materializer: { id: 'gea::record::viewOrigin', domain, allocates: false, nativeFieldProtocol: 'unused' }
1135
+ materializer: {
1136
+ id: 'gea::record::viewOrigin',
1137
+ domain,
1138
+ allocates: false,
1139
+ nativeFieldProtocol: 'unused',
1140
+ requiresSourceGuard: true,
1141
+ executesSourceGuard: true
1142
+ }
973
1143
  };
974
1144
  }
975
1145
  // A base class-ref read at a descendant -- see `downcastsToDerived` above.
@@ -983,14 +1153,15 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
983
1153
  id: 'gea::host::downcastClassRef',
984
1154
  domain: `class-descendant:${representationKey(target)}`,
985
1155
  allocates: false,
1156
+ requiresSourceGuard: true,
986
1157
  nativeFieldProtocol: 'unused',
987
1158
  nativePayloadTransport: 'preserved',
988
1159
  ...nativeClassReferenceIdentityOf(source, target)
989
1160
  }
990
1161
  };
991
1162
  }
992
- // The same handle read at a UNION of descendants -- `object instanceof Mesh
993
- // || object instanceof Line || object instanceof Points`. The physical
1163
+ // The same handle read at a UNION of descendants -- `object instanceof A
1164
+ // || object instanceof B || object instanceof C`. The physical
994
1165
  // carrier stays one `Ref<Base>`; allocation identity is the discriminant,
995
1166
  // so the classifier is the same family test and the materializer the same
996
1167
  // checked downcast, applied per arm by `emit-narrowing.ts`'s
@@ -1003,6 +1174,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1003
1174
  id: 'gea::host::downcastClassRef',
1004
1175
  domain: `class-descendant-union:${representationKey(target)}`,
1005
1176
  allocates: false,
1177
+ requiresSourceGuard: true,
1006
1178
  nativeFieldProtocol: 'unused',
1007
1179
  // Each arm is `ofArm<I>(downcastClassRef<D>(held))`: one pointee,
1008
1180
  // injected into the target union (and its optional, if any).
@@ -1029,9 +1201,10 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1029
1201
  id: 'gea::host::downcastClassRef',
1030
1202
  domain: `class-descendant-sum:${representationKey(target)}`,
1031
1203
  allocates: false,
1204
+ requiresSourceGuard: true,
1032
1205
  // Presence and sum selection over native class handles never reads
1033
1206
  // field values. Mixed sums retain their general converting protocol.
1034
- // A mixed sum (`Error | MongoError` narrowed by `instanceof`) composes
1207
+ // A mixed sum (`Error | CustomError` narrowed by `instanceof`) composes
1035
1208
  // its leaves' contracts, as the exact-arm narrowing below does.
1036
1209
  ...(nativeClassPresence(source)
1037
1210
  ? { nativeFieldProtocol: 'unused', ...nativeClassReferenceIdentityOf(source, target) }
@@ -1086,6 +1259,9 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1086
1259
  downcastsToDerived(candidate.value, arm.value)));
1087
1260
  if (!installed)
1088
1261
  return null;
1262
+ const selection = nativeSubsetSelectionRecipeOf(source, target);
1263
+ if (selection)
1264
+ return nativeSelectionConversion(source, target, selection);
1089
1265
  return {
1090
1266
  classifier: { id: 'gea::TaggedUnion::is', domain: `live-arm-subset:${targetKey}` },
1091
1267
  materializer: {
@@ -1098,6 +1274,18 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1098
1274
  }
1099
1275
  };
1100
1276
  }
1277
+ // The same admitted tag selection can load one exact opaque record arm.
1278
+ // It rejects every omitted tag; composing a possible structural rebuild
1279
+ // from those tags would lose the selected allocation's storage identity.
1280
+ // Only a structural target can be reached by a rebuild of another arm; a
1281
+ // guard-proven load of any other arm keeps the unchecked `get<k>()`
1282
+ // below, and an `as` assertion takes `assertedUnionFor`'s checked
1283
+ // projection instead.
1284
+ const exactSelection = isRecordViewTarget(selected) || selected.kind === 'record-with-index' || selected.kind === 'dictionary'
1285
+ ? nativeSubsetSelectionRecipeOf(source, target)
1286
+ : null;
1287
+ if (exactSelection)
1288
+ return nativeSelectionConversion(source, target, exactSelection);
1101
1289
  // A target OPTIONAL whose payload is one of the union's arms, where the
1102
1290
  // union carries no bare absent arm at all -- absence living inside another
1103
1291
  // arm's own optional. `emit-narrowing.ts`'s `narrowedLoadText` renders the
@@ -1109,13 +1297,14 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1109
1297
  id: 'gea::TaggedUnion::get',
1110
1298
  domain: `live-arm-optional:${targetKey}`,
1111
1299
  allocates: false,
1300
+ armSelection: 'guarded-load',
1112
1301
  ...nativeNarrowing(source, target)
1113
1302
  }
1114
1303
  };
1115
1304
  }
1116
1305
  if (!union.arms.some((arm) => representationKey(arm.value) === targetKey)) {
1117
1306
  // An arm the target lives INSIDE, not one that equals it. A narrowing
1118
- // does not stop at the top level: three's `?(string|number|boolean)`
1307
+ // does not stop at the top level: a `?(string|number|boolean)`
1119
1308
  // field is `undefined | null | (string|number|boolean)`, and a guard past
1120
1309
  // the two absences lands on one of the inner arms -- two steps, and this
1121
1310
  // test saw only one. `narrowingReachesTarget` (`conversion/build.ts`) is
@@ -1131,13 +1320,20 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1131
1320
  id: 'gea::TaggedUnion::get',
1132
1321
  domain: `live-arm-nested:${targetKey}`,
1133
1322
  allocates: false,
1323
+ armSelection: 'guarded-load',
1134
1324
  ...nativeNarrowing(source, target)
1135
1325
  }
1136
1326
  };
1137
1327
  }
1138
1328
  return {
1139
1329
  classifier: { id: 'gea::TaggedUnion::is', domain: `live-arm:${targetKey}` },
1140
- materializer: { id: 'gea::TaggedUnion::get', domain: `live-arm:${targetKey}`, allocates: false, ...nativeNarrowing(source, target) }
1330
+ materializer: {
1331
+ id: 'gea::TaggedUnion::get',
1332
+ domain: `live-arm:${targetKey}`,
1333
+ allocates: false,
1334
+ armSelection: 'guarded-load',
1335
+ ...nativeNarrowing(source, target)
1336
+ }
1141
1337
  };
1142
1338
  },
1143
1339
  // The mirror of `narrowing`: a plain value taking the place of the tagged
@@ -1152,6 +1348,19 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1152
1348
  widening: (source, target) => {
1153
1349
  if (!isSpellable(target))
1154
1350
  return null;
1351
+ const nativeAbsence = nativeReferenceAbsenceOf(source, target);
1352
+ if (nativeAbsence !== null)
1353
+ return {
1354
+ classifier: { id: NATIVE_REFERENCE_ABSENCE, domain: `absence:${nativeAbsence}` },
1355
+ materializer: {
1356
+ id: NATIVE_REFERENCE_ABSENCE,
1357
+ domain: `absence:${nativeAbsence}`,
1358
+ allocates: false,
1359
+ nativeFieldProtocol: 'unused',
1360
+ nativePayloadTransport: 'preserved',
1361
+ ...nativeClassReferenceIdentityOf(source, target)
1362
+ }
1363
+ };
1155
1364
  const nativeSum = nativeSumConversion(source, target);
1156
1365
  if (nativeSum)
1157
1366
  return nativeSum;
@@ -1178,7 +1387,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1178
1387
  if (source.kind === 'dynamic' &&
1179
1388
  source.reason === 'untyped-callable' &&
1180
1389
  target.kind === 'function-value-dispatch' &&
1181
- dynamicCallableAbiSupported(target.abi)) {
1390
+ dynamicCallableReadAbiSupported(target.abi)) {
1182
1391
  return dynamicCallablePair(target);
1183
1392
  }
1184
1393
  // A callable declaring a type-matching PREFIX of the target's own
@@ -1390,6 +1599,10 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1390
1599
  id: 'gea::Value::box',
1391
1600
  domain: `box:${tag}`,
1392
1601
  allocates: !absent,
1602
+ ...(['scalar', 'string', 'symbol', 'null', 'undefined'].includes(source.kind)
1603
+ ? { primitiveIdentityTransport: 'preserved' }
1604
+ : {}),
1605
+ ...(callableObjectAbi(source) === null ? {} : { callableIdentityTransport: 'preserved' }),
1393
1606
  ...(absent ? { nativeFieldProtocol: 'unused' } : {})
1394
1607
  }
1395
1608
  };
@@ -1411,6 +1624,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1411
1624
  domain: `absence:${target.absence}`,
1412
1625
  allocates: false,
1413
1626
  nativeFieldProtocol: 'unused',
1627
+ nativePayloadTransport: 'preserved',
1414
1628
  ...nativeClassReferenceIdentityOf(source, target)
1415
1629
  }
1416
1630
  };
@@ -1484,6 +1698,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1484
1698
  domain: `payload:${sourceKey}`,
1485
1699
  allocates: false,
1486
1700
  nativeFieldProtocol: 'unused',
1701
+ nativePayloadTransport: 'preserved',
1487
1702
  ...nativeClassReferenceIdentityOf(source, target)
1488
1703
  }
1489
1704
  };
@@ -1492,8 +1707,8 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1492
1707
  // `gea::CallableObject` converting constructors above. Every one of those
1493
1708
  // was installed only for a BARE callable target, so
1494
1709
  // `((gl, v) => void)` returned where `((gl, v, textures) => void) |
1495
- // undefined` is expected -- three's `getSingularSetter`, 30 returns of
1496
- // exactly that shape -- refused for a pair whose two halves this backend
1710
+ // undefined` is expected -- a setter-selecting function with many returns
1711
+ // of exactly that shape -- refused for a pair whose two halves this backend
1497
1712
  // performs individually. The same four authorities are asked here, one
1498
1713
  // optional layer down, so the graph and the emitter cannot disagree about
1499
1714
  // which pairs the runtime accepts.
@@ -1595,9 +1810,9 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1595
1810
  };
1596
1811
  }
1597
1812
  // A hand-written iterator object read as the cursor its declared type
1598
- // names -- mongodb's `onData` literal, `return this` out of its own
1599
- // `[Symbol.asyncIterator]()` (`conversion/protocol-iterator.ts`).
1600
- // `Connection.dataEvents` holds it as `AsyncGenerator<Buffer> | null`.
1813
+ // names -- an object literal whose `[Symbol.asyncIterator]()` does
1814
+ // `return this` (`conversion/protocol-iterator.ts`), held by a field
1815
+ // declared `AsyncGenerator<T> | null`.
1601
1816
  const cursor = target.kind === 'optional' ? target.payload : target;
1602
1817
  if ((cursor.kind === 'iterator' || cursor.kind === 'async-generator') && protocolIteratorPlanFor(layouts, source, cursor) !== null) {
1603
1818
  const domain = `protocol-iterator:${representationKey(source)}->${representationKey(target)}`;
@@ -1607,8 +1822,8 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1607
1822
  };
1608
1823
  }
1609
1824
  // The reverse: a native cursor read as the iterator OBJECT an interface
1610
- // declares -- `mongodb-connection-string-url`'s `keys():
1611
- // IterableIterator<K> { return super.keys() as IterableIterator<K> }`
1825
+ // declares -- a subclass's `keys(): IterableIterator<K> { return
1826
+ // super.keys() as IterableIterator<K> }`
1612
1827
  // over a generator-backed `URLSearchParams.keys()`
1613
1828
  // (`conversion/iterator-object-view.ts`).
1614
1829
  // `x.constructor` stored where a constructor family is declared
@@ -1658,7 +1873,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1658
1873
  }
1659
1874
  // Built on demand, never up front: this function is asked about EVERY
1660
1875
  // ordered pair of recastable carriers (`conversion/build.ts`), hundreds
1661
- // of millions on TypeScript's own compiler, and almost every pair leaves
1876
+ // of millions on a large program, and almost every pair leaves
1662
1877
  // through an early `null` without ever needing its key. Concatenating
1663
1878
  // it first was one string allocation per pair and a collector busy
1664
1879
  // reclaiming them -- the same cost `build.ts`'s own loop already paid once.
@@ -1672,7 +1887,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1672
1887
  source.native !== null &&
1673
1888
  source.native === target.native &&
1674
1889
  source.ownership === target.ownership &&
1675
- cppTypeOf(source) === cppTypeOf(target)) {
1890
+ samePhysicalCarrier(source, target)) {
1676
1891
  return {
1677
1892
  classifier: { id: 'gea::native-record::identity', domain: `native-identity:${source.native}:${source.ownership}` },
1678
1893
  materializer: {
@@ -1703,10 +1918,10 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1703
1918
  };
1704
1919
  }
1705
1920
  // The plain array and the array an interface extended with typed fields
1706
- // (`NodeArray<T> extends ReadonlyArray<T>`, `array-object.extension`) are
1921
+ // (`List<T> extends ReadonlyArray<T>`, `array-object.extension`) are
1707
1922
  // ONE `gea::ArrayObject<E>`: the fields live in the object's own
1708
- // extension sidecar, so `elements.slice() as MutableNodeArray<T>` is the
1709
- // same object gaining fields on their first write, and a `NodeArray<T>`
1923
+ // extension sidecar, so `elements.slice() as MutableList<T>` is the
1924
+ // same object gaining fields on their first write, and a `List<T>`
1710
1925
  // handed to a `readonly T[]` parameter is that object read as the array
1711
1926
  // it is. Same element, same ownership, and only the extension differs;
1712
1927
  // the identity spelling `convertedValueText` already renders for two
@@ -1718,13 +1933,20 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1718
1933
  arrayExtensionKey(source.extension) !== arrayExtensionKey(target.extension)) {
1719
1934
  return {
1720
1935
  classifier: { id: 'gea::ArrayObject::identity', domain: `array-extension:${pairKey()}` },
1721
- materializer: { id: 'gea::ArrayObject::identity', domain: `array-extension:${pairKey()}`, allocates: false }
1936
+ // The extension is a typed native sidecar struct, never the field
1937
+ // protocol: the elements and the fields cross unchanged.
1938
+ materializer: {
1939
+ id: 'gea::ArrayObject::identity',
1940
+ domain: `array-extension:${pairKey()}`,
1941
+ allocates: false,
1942
+ nativeFieldProtocol: 'unused',
1943
+ nativePayloadTransport: 'preserved'
1944
+ }
1722
1945
  };
1723
1946
  }
1724
- // `never[]` into `E[]`: THE empty array of `E`, by identity. tsc's
1725
- // `emptyArray: never[]` is a sentinel the program compares by identity
1726
- // (`type.resolvedBaseTypes = emptyArray` marks a circular resolution in
1727
- // progress; `=== emptyArray` detects it), so a fresh `[]` is a silently
1947
+ // `never[]` into `E[]`: THE empty array of `E`, by identity. A shared
1948
+ // `emptyArray: never[]` is a sentinel a program can compare by identity
1949
+ // (storing it marks a state; `=== emptyArray` detects it), so a fresh `[]` is a silently
1728
1950
  // wrong answer and a boxed one a refusal; `gea::emptyArraySentinel<E>()`
1729
1951
  // is one object per element type, so every `never[]` that reaches an
1730
1952
  // `E[]` slot is the same one and compares equal to itself. The carrier
@@ -1751,10 +1973,9 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1751
1973
  // can still reach is a mutable reference, so a fresh array silently drops
1752
1974
  // every later write through the other name and loses identity outright.
1753
1975
  // `gea::ArrayObject::recastElements` did exactly that at a call argument
1754
- // in three's `getProgramCacheKey`: the two helpers pushed ~60 values into
1755
- // the COPY, so every material's cache key came out identical, one shader
1756
- // program served the whole scene, and every HUD glyph rendered as a solid
1757
- // rectangle. A compile refusal is the correct outcome here, and the fix
1976
+ // where two helpers pushed their values into the COPY, so every key the
1977
+ // caller built from the array came out identical and every cache lookup
1978
+ // keyed on it collided -- silently wrong output. A compile refusal is the correct outcome here, and the fix
1758
1979
  // for a disagreement is to make the two authorities agree -- which is
1759
1980
  // where `structural-array-element.ts`'s `unstatedNeverArray` parameter
1760
1981
  // form and `structural.ts`'s `refusedArrayParameterTypeAt` now put it.
@@ -1840,11 +2061,11 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1840
2061
  // the view remembers boxed is read back only by `instanceof` and
1841
2062
  // by the `gea::record::viewOrigin` narrowing to the class, never by
1842
2063
  // program code that could write through it. Without it
1843
- // the reflection census read node-compat's `emitter as unknown as
1844
- // PausableEmitterMethods` as an unknown boundary, promoted every
2064
+ // the reflection census read an `emitter as unknown as
2065
+ // SomeMethodsInterface` cast as an unknown boundary, promoted every
1845
2066
  // emitter subclass and everything their fields reach to full
1846
- // reflection, and refused each `this.method.bind(this)` in mongodb
1847
- // as `call-abi:bind-shadowable`.
2067
+ // reflection, and refused each `this.method.bind(this)` in those
2068
+ // subclasses as `call-abi:bind-shadowable`.
1848
2069
  const plan = conversionRecipeOf(source, target)?.renders === true ? null : viewPlanFor(layouts, source, target);
1849
2070
  return {
1850
2071
  classifier: { id: 'gea::record::classStructuralView', domain: `class-view:${pairKey()}` },
@@ -1865,8 +2086,8 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1865
2086
  // `emit-narrowing.ts`'s `convertedValueText` renders it; installed here so
1866
2087
  // the merge that needs it is certified rather than emitted uncertified.
1867
2088
  // The same for an open record whose every declared field is optional:
1868
- // mongodb's `deleteOne(filter: Filter<TSchema> = {})` defaults a query
1869
- // document to the empty literal, and the value-initialized struct IS that
2089
+ // `f(filter: Filter<T> = {})` defaults an all-optional parameter to the
2090
+ // empty literal, and the value-initialized struct IS that
1870
2091
  // object -- every presence bit off, an empty index sidecar.
1871
2092
  if (source.kind === 'record' &&
1872
2093
  source.fields.length === 0 &&
@@ -1879,7 +2100,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1879
2100
  }
1880
2101
  if (source.kind === 'record-with-index' && target.kind === 'native-record-ref' && target.native === null) {
1881
2102
  const targetFields = layouts.forShape(target.shapeId);
1882
- const targetIndexes = layouts.indexesForShape?.(target.shapeId) ?? [];
2103
+ const targetIndexes = layouts.indexesForShape(target.shapeId);
1883
2104
  const sourceFields = {
1884
2105
  kind: 'record',
1885
2106
  shapeId: source.shapeId,
@@ -1911,8 +2132,9 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1911
2132
  // A closed named interface may receive an open record at runtime even
1912
2133
  // though the interface itself declares no index signature. TypeScript's
1913
2134
  // structural assignment permits that value, and JavaScript keeps the
1914
- // extra own properties: BSON's `Object.assign(o, this.fields)` returns a
1915
- // `DBRefLike` whose user fields must still enumerate and serialize.
2135
+ // extra own properties: `Object.assign(o, this.fields)` returned as a
2136
+ // closed interface still carries user fields that must enumerate and
2137
+ // serialize.
1916
2138
  //
1917
2139
  // The target does not need an inline index member. Every shared native
1918
2140
  // record already has the identity-keyed expando table implemented by
@@ -1938,10 +2160,10 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1938
2160
  };
1939
2161
  }
1940
2162
  }
1941
- // A class viewed as a record of its own properties: mongodb's
1942
- // `defineAspects(AggregateOperation, ...)` takes the class as
1943
- // `{ aspects?: Set<symbol> }`, and `hasAspect` reads
1944
- // `(this.constructor as { aspects?: Set<symbol> }).aspects`. The view is
2163
+ // A class viewed as a record of its own properties: a helper takes the
2164
+ // class itself as `{ tags?: Set<symbol> }` and writes a static, and an
2165
+ // instance method reads `(this.constructor as { tags?: Set<symbol> }).tags`.
2166
+ // The view is
1945
2167
  // the class evaluation's own record for the shape, so a write through one
1946
2168
  // view is every later view's read (`gea::constructorStaticView`).
1947
2169
  if (constructorStaticViewAdmitted(source, target, target.kind === 'native-record-ref' ? layouts.forShape(target.shapeId) : null)) {
@@ -1950,23 +2172,16 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1950
2172
  materializer: { id: CONSTRUCTOR_STATIC_VIEW, domain: `constructor-view:${pairKey()}`, allocates: true }
1951
2173
  };
1952
2174
  }
1953
- // An open `any` document read as a named interface: mongodb's
1954
- // `new MongoServerError(document)` hands a `Document` to a parameter typed
1955
- // `ErrorDescription`. The same checked rebuild `dictionary-to-record`
1956
- // performs for an anonymous record, over the layout the name resolves to;
1957
- // a string index sidecar of `any` keeps every key the fields do not name.
1958
- // `emit-narrowing.ts`'s `documentAdoptionText` renders it, and the
1959
- // Document then views the record rather than leaving a copy beside it.
1960
- // `DbOptions` in mongodb's `new Db(client, name, options?)` is the
1961
- // optional case: `filterOptions` returns a Document.
2175
+ // The provisional layout pair is sealed into exact deferred field routes
2176
+ // by structuralRecipe; no shared document migration is rendered here.
1962
2177
  const named = target.kind === 'optional' ? target.payload : target;
1963
- // Lifted through an optional of the same absence: mongodb's
1964
- // `this.statements.find((o: Document) => o.hint)` answers
1965
- // `Document | undefined` where `DeleteStatement | undefined` is carried.
2178
+ // Lifted through an optional of the same absence: `items.find((o:
2179
+ // Document) => o.flag)` answers `Document | undefined` where a named
2180
+ // `Item | undefined` is carried.
1966
2181
  const document = source.kind === 'optional' && target.kind === 'optional' && source.absence === target.absence ? source.payload : source;
1967
2182
  if (document.kind === 'dictionary' &&
1968
2183
  named.kind === 'native-record-ref' &&
1969
- dynamicDictionaryToNamedRecordAdmitted(document, named, layouts.forShape(named.shapeId), layouts.indexesForShape?.(named.shapeId) ?? [])) {
2184
+ dynamicDictionaryToNamedRecordAdmitted(document, named, layouts.forShape(named.shapeId), layouts.indexesForShape(named.shapeId))) {
1970
2185
  return {
1971
2186
  classifier: { id: DYNAMIC_DICTIONARY_TO_NAMED_RECORD, domain: `dictionary-record:${pairKey()}` },
1972
2187
  materializer: { id: DYNAMIC_DICTIONARY_TO_NAMED_RECORD, domain: `dictionary-record:${pairKey()}`, allocates: true }
@@ -1994,8 +2209,8 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
1994
2209
  }
1995
2210
  // The arm the value belongs in, written as a DIFFERENT shape id than the
1996
2211
  // arm declares. A tuple literal returned into a union of tuple types is
1997
- // the case -- hono's `PatternRouter.match` writes `[handlers]` against
1998
- // `Result<T> = [[T, Params][]] | [[T, ParamIndexMap][], ParamStash]` --
2212
+ // the case -- a method writes `[items]` against
2213
+ // `Result<T> = [[T, A][]] | [[T, B][], C]` --
1999
2214
  // and an exact-key search cannot see it, because the literal's own shape
2000
2215
  // id is minted at the literal and the arm's at the declaration. It is
2001
2216
  // still the same shape: `recordsRecastable` is the one authority on that,
@@ -2019,24 +2234,6 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
2019
2234
  }
2020
2235
  };
2021
2236
  }
2022
- // The same admission for a dictionary whose values widen into ONE
2023
- // dictionary arm of the union -- the string dictionary `@hono/node-server`
2024
- // merges into `[string, string][] | OutgoingHttpHeaders`. Only a SOLE
2025
- // castable arm, for the same reason as the record rule: two would make
2026
- // the choice of arm a guess. `emit-narrowing.ts`'s `widenedStoreText`
2027
- // renders it through `recastedDictionaryText` at the arm it finds first,
2028
- // which under this admission is the only one.
2029
- if (source.kind === 'dictionary' && target.kind === 'tagged-union') {
2030
- const recastable = target.arms
2031
- .map((arm) => arm.value)
2032
- .filter((arm) => arm.kind === 'dictionary' && dictionaryCastableToDictionary(source, arm));
2033
- if (recastable.length !== 1)
2034
- return null;
2035
- return {
2036
- classifier: { id: 'gea::TaggedUnion::ofArm', domain: `arm-recast:${pairKey()}` },
2037
- materializer: { id: 'gea::TaggedUnion::ofArm', domain: `arm-recast:${pairKey()}`, allocates: true, nativeFieldProtocol: 'unused' }
2038
- };
2039
- }
2040
2237
  if (source.kind === 'record' && target.kind === 'record') {
2041
2238
  if (!recordsRecastable(source, target))
2042
2239
  return null;
@@ -2065,10 +2262,10 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
2065
2262
  // `emit-narrowing.ts`'s `recordCastableToDictionary` is the one authority
2066
2263
  // for which pairs actually rebuild, asked here rather than restated.
2067
2264
  // A named interface is the same closed field list, resolved through the
2068
- // layout it names (`asRecord`): mongodb builds `OIDCCommand` and hands it
2069
- // to `connection.command(ns, cmd: Document)`.
2070
- // A record that also carries an open string index -- mongodb's
2071
- // `Filter<TSchema>`, or a named interface whose layout declares one --
2265
+ // layout it names (`asRecord`): a program builds a named interface value
2266
+ // and hands it to a parameter typed `Document`.
2267
+ // A record that also carries an open string index -- a mapped
2268
+ // `Filter<T>`, or a named interface whose layout declares one --
2072
2269
  // poured into an open string dictionary, or into the ONE dictionary arm of
2073
2270
  // a union (`Document | Document[]`): the named fields, then every
2074
2271
  // enumerable index entry (`indexedRecordCastableToDictionary`). Ahead of
@@ -2104,31 +2301,12 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
2104
2301
  materializer: { id: 'gea::record::recastToDictionary', domain: `recast:${pairKey()}`, allocates: true }
2105
2302
  };
2106
2303
  }
2107
- // One shape wider: an open dictionary's values widened into another open
2108
- // dictionary's -- `Record<string, string>` reaching `OutgoingHttpHeaders`.
2109
- // `emit-narrowing.ts`'s `dictionaryCastableToDictionary` is the one
2110
- // authority for which pairs rebuild, asked here rather than restated.
2111
- if (source.kind === 'dictionary' && target.kind === 'dictionary') {
2112
- if (!dictionaryCastableToDictionary(source, target))
2113
- return null;
2114
- return {
2115
- classifier: { id: 'gea::dictionary::recastValues', domain: `recast:${pairKey()}` },
2116
- materializer: { id: 'gea::dictionary::recastValues', domain: `recast:${pairKey()}`, allocates: true }
2117
- };
2118
- }
2119
- // A third recast at the same distance: a closed, contiguous-numeric-keyed
2120
- // record -- an unannotated rest parameter's open-arity tuple view, from
2121
- // `semantics/normalize/structural.ts`'s `restParameterArrayElementAt` --
2122
- // poured into the array it physically is. `emit-narrowing.ts`'s
2123
- // `recordCastableToArray` is the one authority for which pairs rebuild.
2124
- if (source.kind === 'record' && target.kind === 'array-object') {
2125
- if (!recordCastableToArray(source, target))
2126
- return null;
2127
- return {
2128
- classifier: { id: 'gea::record::recastToArray', domain: `recast:${pairKey()}` },
2129
- materializer: { id: 'gea::record::recastToArray', domain: `recast:${pairKey()}`, allocates: true }
2130
- };
2131
- }
2304
+ // Structural recipes publish live dictionary views with checked reads
2305
+ // and total writes. This widening table must not replace that shared
2306
+ // storage with an entry-by-entry copy. Exact identity and native-sum
2307
+ // transport are handled by their ordinary authorities.
2308
+ if (source.kind === 'dictionary' && target.kind === 'dictionary')
2309
+ return null;
2132
2310
  // Two optionals over the IDENTICAL payload that disagree only on which
2133
2311
  // falsy JS value spends the absence -- `string | null` widened into a
2134
2312
  // `string | undefined` slot (`request.ts`'s `this.raw.headers.get(name) ??
@@ -2161,7 +2339,7 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
2161
2339
  // The payload is a record recast one level in: `return toSearchResult(
2162
2340
  // undefined)` where the copy at `T = undefined` returns `{ value:
2163
2341
  // undefined } | undefined` into a slot declared `SearchResult<Resolved>`
2164
- // (13 rows on tsc's moduleNameResolver.ts). The bare pair is already
2342
+ // (13 rows from one module). The bare pair is already
2165
2343
  // admitted just below (`gea::record::recast`); the presence bit adds
2166
2344
  // nothing to convert, only a branch to render, so the admission is the
2167
2345
  // same question asked of the payloads. Same absence on both sides, as
@@ -2181,29 +2359,6 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
2181
2359
  }
2182
2360
  };
2183
2361
  }
2184
- // The payload is a dictionary reaching the one wider dictionary arm of
2185
- // the target's union, still wrapped in its presence bit: `cache[2] ||
2186
- // (... ? undefined : { 'content-type': ... })` merged as `optional(
2187
- // dictionary(string, string))` into `optional([string, string][] |
2188
- // OutgoingHttpHeaders)`. The bare pair is the arm-recast admission just
2189
- // above; the presence bit adds only the branch `emit-narrowing.ts`'s
2190
- // `optional-payload-convert` already renders around any converted
2191
- // payload. Same absence on both sides, as for every optional pair here.
2192
- const sourceDictionary = source.payload.kind === 'dictionary' ? source.payload : null;
2193
- if (sourceDictionary !== null &&
2194
- target.payload.kind === 'tagged-union' &&
2195
- source.absence === target.absence &&
2196
- target.payload.arms.filter((arm) => arm.value.kind === 'dictionary' && dictionaryCastableToDictionary(sourceDictionary, arm.value)).length === 1) {
2197
- return {
2198
- classifier: { id: 'gea::Optional::has_value', domain: `recast:${pairKey()}` },
2199
- materializer: {
2200
- id: 'gea::Optional::recastPayloadArm',
2201
- domain: `recast:${pairKey()}`,
2202
- allocates: true,
2203
- nativeFieldProtocol: 'unused'
2204
- }
2205
- };
2206
- }
2207
2362
  // The payload itself is a union recast one level in -- `optional(string |
2208
2363
  // boolean, undefined)` merged against `optional(boolean | string,
2209
2364
  // undefined)`, the two branches of a control-flow merge each arriving
@@ -2235,9 +2390,9 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
2235
2390
  }
2236
2391
  // A sum every arm of which reaches ONE payload, wrapped in the presence
2237
2392
  // bit: `fn === undefined ? node : fn(node, ...)` returned as `T |
2238
- // undefined` from tsc's `visitEachChild<T>` -- `tagged-union(
2393
+ // undefined` from a generic visitor `visit<T>` -- `tagged-union(
2239
2394
  // native-record-ref | dynamic)` into `optional(native-record-ref)`, 74
2240
- // rows from one site on the self-compile, one per instantiation. The
2395
+ // rows from one site, one per instantiation. The
2241
2396
  // typed arm is the payload and the dynamic arm is the checked unbox, and
2242
2397
  // `emit-narrowing.ts`'s `sumIntoPayloadText` is asked here so the pair is
2243
2398
  // admitted on exactly the render that will spell it.
@@ -2285,28 +2440,273 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
2285
2440
  domain: `coercion:${operation}:${representationKey(source)}`,
2286
2441
  allocates: operation === 'ToString'
2287
2442
  },
2288
- staticRecipe: (source, target) => {
2443
+ nativeArrayViewRecipe: (source, target, lookup, read, resolve) => {
2444
+ const base = nativeArrayViewBasePlanOf(source, target, lookup, read, resolve);
2445
+ if (base === null)
2446
+ return null;
2447
+ const observationTarget = { kind: 'dynamic', reason: 'declared-any-never-narrowed' };
2448
+ const observed = nativeArrayViewWithObservation(base, lookup(base.storage.element, observationTarget), resolve);
2449
+ const plan = observed !== null && source.kind === 'array-object' && observed.write.kind === 'conversion'
2450
+ ? nativeArrayViewWithOwnerObservation(observed, lookup(observed.storage, observationTarget), resolve)
2451
+ : observed;
2452
+ if (plan === null)
2453
+ return null;
2454
+ // An open Document is checked as the object it views, exactly as a box is.
2455
+ const boxed = nativeArrayViewSourceIsBoxed(source);
2456
+ const domain = boxed
2457
+ ? `any-of:array-payload:${representationKey(plan.storage)}|array-payload:${representationKey(plan.target)}`
2458
+ : `native-array-view:${representationKey(source)}->${representationKey(target)}`;
2459
+ return {
2460
+ classifier: { id: boxed ? 'gea::detail::nativeArrayViewAccepts' : 'gea::ArrayObject::identity', domain },
2461
+ materializer: {
2462
+ id: boxed ? 'gea::detail::checkedNativeArrayView' : 'gea::makeNativeArrayView',
2463
+ domain,
2464
+ allocates: true,
2465
+ nativeFieldProtocol: 'unused',
2466
+ nativePayloadTransport: 'preserved',
2467
+ ...(boxed ? { requiresSourceGuard: true, executesSourceGuard: true } : {}),
2468
+ nativeArrayView: plan,
2469
+ dependencies: plan.dependencies
2470
+ }
2471
+ };
2472
+ },
2473
+ dictionaryReadRecipe: (conversion) => {
2474
+ const { source, target, capability } = conversion;
2475
+ if (capability.kind === 'atom' || capability.kind === 'static') {
2476
+ if (capability.materializer.documentRecordView !== undefined || capability.materializer.nativeArrayView !== undefined)
2477
+ return null;
2478
+ const selection = capability.materializer.nativeSelection;
2479
+ if (selection !== undefined)
2480
+ return {
2481
+ id: 'view:checked-dictionary-entry',
2482
+ domain: 'static:checked-dictionary-entry',
2483
+ allocates: false,
2484
+ requiresSourceGuard: true,
2485
+ executesSourceGuard: true,
2486
+ dictionaryRead: { kind: 'native-selection', conversion, selection },
2487
+ dependencies: [conversion]
2488
+ };
2489
+ }
2490
+ if (source.kind !== 'dynamic' || target.kind === 'dynamic')
2491
+ return null;
2492
+ if (target.kind === 'null' || target.kind === 'undefined')
2493
+ return {
2494
+ id: 'view:checked-dictionary-entry',
2495
+ domain: 'static:checked-dictionary-entry',
2496
+ allocates: false,
2497
+ requiresSourceGuard: true,
2498
+ executesSourceGuard: true,
2499
+ dictionaryRead: { kind: 'dynamic-absence', conversion, absence: target.kind },
2500
+ dependencies: [conversion]
2501
+ };
2502
+ if (target.kind === 'class-ref' && target.ownership === 'shared-refcount')
2503
+ return {
2504
+ id: 'view:checked-dictionary-entry',
2505
+ domain: 'static:checked-dictionary-entry',
2506
+ allocates: false,
2507
+ requiresSourceGuard: true,
2508
+ executesSourceGuard: true,
2509
+ dictionaryRead: { kind: 'dynamic-class', conversion, target },
2510
+ dependencies: [conversion]
2511
+ };
2512
+ // A construct-frame entry reads through its own adapter too: the exact
2513
+ // payload check below would refuse a constructor boxed at another frame.
2514
+ if (callableObjectAbi(target) !== null || target.kind === 'constructor-value-dispatch')
2515
+ return {
2516
+ id: 'view:checked-dictionary-entry',
2517
+ domain: 'static:checked-dictionary-entry',
2518
+ // The adapter may build a native frame around the same function.
2519
+ allocates: 'materializer' in capability && capability.materializer.allocates,
2520
+ requiresSourceGuard: true,
2521
+ executesSourceGuard: true,
2522
+ dictionaryRead: { kind: 'dynamic-callable', conversion },
2523
+ dependencies: [conversion]
2524
+ };
2525
+ const tag = dynamicTagFor(target);
2526
+ if (tag === null || target.kind === 'optional' || target.kind === 'record' || target.kind === 'record-with-index')
2527
+ return null;
2528
+ return {
2529
+ id: 'view:checked-dictionary-entry',
2530
+ domain: 'static:checked-dictionary-entry',
2531
+ allocates: false,
2532
+ requiresSourceGuard: true,
2533
+ executesSourceGuard: true,
2534
+ dictionaryRead: { kind: 'dynamic-payload', conversion, target, tag },
2535
+ dependencies: [conversion]
2536
+ };
2537
+ },
2538
+ readOnlyDictionaryRecipe: (source, target, lookup, resolve, read) => {
2539
+ const plan = composedDictionaryViewPlan(source, target, 'read-only', lookup, resolve, read);
2540
+ return plan === null
2541
+ ? null
2542
+ : {
2543
+ id: 'view:read-only-dictionary',
2544
+ domain: 'static:read-only-dictionary',
2545
+ allocates: true,
2546
+ readOnlyDictionary: plan,
2547
+ dependencies: plan.dependencies
2548
+ };
2549
+ },
2550
+ structuralRecipe: (source, target, lookup, members, nativeMethod, resolve, dictionaryRead, classDowncast) => {
2289
2551
  if (!isSpellable(source) || !isSpellable(target))
2290
2552
  return null;
2291
2553
  if (classArmWithoutHome(layouts, source, target))
2292
2554
  return null;
2293
2555
  if (proxyArmWithoutHome(source, target))
2294
2556
  return null;
2295
- // A sum some arm of which reaches the record-shaped target only through
2296
- // the structural view is that view's `dispatch` plan, asked BEFORE the
2297
- // chain: the chain answers the pair too, by selecting the exact arm, and
2298
- // that selection is the narrowing this table's `narrowing` entry has
2299
- // already declined for the pair (`recordViewDispatchesArms`). The
2300
- // printer renders in the same order (`emit-narrowing.ts`'s `recipeText`).
2301
- const dispatching = viewPlanFor(layouts, source, target);
2302
- if (dispatching !== null && recordViewDispatchesArms(dispatching))
2557
+ const accepted = (from, into) => {
2558
+ const node = lookup(from, into);
2559
+ return node.capability.kind === 'never' ? null : node;
2560
+ };
2561
+ const nativeDependencies = (nodes) => [...recipeClosureOf(nodes, resolve).values()].every((node) => transfersNativeStorage(node.capability));
2562
+ // `writeDocumentNativeEntry` stores through `nativeDocumentSetNative`,
2563
+ // which checks an Array owner's element lane before an index store.
2564
+ const documentRecordView = composedDocumentRecordViewPlanOf(source, target, layouts, accepted, dictionaryRead ?? accepted, resolve, {
2565
+ laneChecked: true
2566
+ });
2567
+ if (documentRecordView !== null)
2568
+ return {
2569
+ id: 'view:document-record',
2570
+ domain: 'static:document-record',
2571
+ allocates: true,
2572
+ documentRecordView,
2573
+ nativeFieldViewProtocol: 'live',
2574
+ dependencies: documentRecordView.dependencies
2575
+ };
2576
+ const dictionaryView = composedDictionaryViewPlan(source, target, 'mutable', accepted, resolve, dictionaryRead);
2577
+ if (dictionaryView !== null)
2303
2578
  return {
2304
- id: 'view:structural-record',
2305
- domain: 'static:structural-record-view',
2579
+ id: 'view:mutable-dictionary',
2580
+ domain: 'static:mutable-dictionary',
2306
2581
  allocates: true,
2307
- ...viewProtocolOf(dispatching)
2582
+ dictionaryView,
2583
+ dependencies: dictionaryView.dependencies
2308
2584
  };
2585
+ const callablePayload = callablePayloadPlan(source, target, accepted, resolve);
2586
+ if (callablePayload !== null)
2587
+ return {
2588
+ id: 'view:callable-payload',
2589
+ domain: 'static:callable-payload',
2590
+ allocates: true,
2591
+ callablePayload,
2592
+ dependencies: [callablePayload.payload],
2593
+ ...(nativeDependencies([callablePayload.payload]) ? { nativeFieldProtocol: 'unused' } : {}),
2594
+ ...(callablePayload.mode === 'unwrap' ? { requiresSourceGuard: true, executesSourceGuard: true } : {})
2595
+ };
2596
+ if (source.kind === 'record' && target.kind === 'array-object') {
2597
+ const plan = recordToArrayPlan(source, target, accepted);
2598
+ return plan === null
2599
+ ? null
2600
+ : {
2601
+ id: 'gea::record::recastToArray',
2602
+ domain: `recast:${representationKey(source)}->${representationKey(target)}`,
2603
+ allocates: true,
2604
+ recordToArray: plan,
2605
+ ...sourceGuardsOf(plan.fields.map((field) => field.conversion), resolve)
2606
+ };
2607
+ }
2608
+ if (source.kind === 'promise' && target.kind === 'promise') {
2609
+ const plan = promiseAdoptionPlanOf(source, target, lookup, resolve);
2610
+ return plan === null
2611
+ ? null
2612
+ : {
2613
+ id: 'gea::Promise::adopt-converted',
2614
+ domain: `promise-state-adoption:${representationKey(source)}->${representationKey(target)}`,
2615
+ allocates: true,
2616
+ promiseAdoption: plan,
2617
+ ...(plan.kind === 'payload-transfer' ? { dependencies: [plan.conversion] } : {})
2618
+ };
2619
+ }
2620
+ const protocol = certifiedProtocolIteratorPlan(layouts, source, target, accepted, resolve);
2621
+ if (protocol !== null)
2622
+ return {
2623
+ id: PROTOCOL_ITERATOR,
2624
+ domain: `protocol-iterator:${representationKey(source)}->${representationKey(target)}`,
2625
+ allocates: true,
2626
+ protocolIterator: protocol,
2627
+ dependencies: [...protocol.leaves.values()]
2628
+ };
2629
+ if (source.kind === 'array-object' || source.kind === 'keyed-collection') {
2630
+ const plan = certifiedIterableObjectViewPlan(layouts, source, target, accepted, resolve);
2631
+ if (plan !== null)
2632
+ return {
2633
+ id: ITERABLE_OBJECT_VIEW,
2634
+ domain: `iterable-object-view:${representationKey(source)}->${representationKey(target)}`,
2635
+ allocates: true,
2636
+ iterableObjectView: plan,
2637
+ dependencies: [...plan.leaves.values()]
2638
+ };
2639
+ }
2640
+ if (source.kind === 'iterator' || source.kind === 'async-generator') {
2641
+ const plan = certifiedIteratorObjectViewPlan(layouts, source, target, accepted, resolve);
2642
+ if (plan !== null)
2643
+ return {
2644
+ id: ITERATOR_OBJECT_VIEW,
2645
+ domain: `iterator-object-view:${representationKey(source)}->${representationKey(target)}`,
2646
+ allocates: true,
2647
+ iteratorObjectView: plan,
2648
+ dependencies: [...plan.leaves.values()]
2649
+ };
2650
+ }
2651
+ const sourceCallable = callableObjectAbi(source);
2652
+ const targetCallable = callableObjectAbi(target);
2653
+ if (sourceCallable !== null && targetCallable !== null) {
2654
+ const plan = callableViewPlan(source, target, accepted, resolve, classDowncast);
2655
+ if (plan !== null) {
2656
+ const dependencies = [
2657
+ ...(plan.logicalReceiver?.materializers ?? []),
2658
+ ...(plan.receiver === null ? [] : [plan.receiver]),
2659
+ ...plan.parameters,
2660
+ ...(plan.omittedArguments ?? []),
2661
+ ...(plan.restPacking?.elements ?? []),
2662
+ ...(plan.restUnpacking?.elements.flatMap((element) => element.absent === null ? [element.present] : [element.present, element.absent]) ?? []),
2663
+ ...(plan.result === null ? [] : [plan.result])
2664
+ ];
2665
+ return {
2666
+ id: VIEW_ADAPTED_CALLABLE,
2667
+ domain: 'static:adapted-callable',
2668
+ allocates: true,
2669
+ callableView: plan,
2670
+ dependencies,
2671
+ // adaptSourceWithReceiver shares the original Function identity.
2672
+ // Executable native frames are a separate claim, authenticated by
2673
+ // every sealed leaf rather than inherited from a provisional atom.
2674
+ callableIdentityTransport: 'preserved',
2675
+ ...(nativeDependencies(dependencies)
2676
+ ? { nativeFieldProtocol: 'unused', callableAdapter: { from: sourceCallable, to: targetCallable } }
2677
+ : {})
2678
+ };
2679
+ }
2680
+ }
2681
+ const plan = certifiedRecordViewPlan(layouts, source, target, accepted, members, nativeMethod, resolve);
2682
+ return plan === null
2683
+ ? null
2684
+ : {
2685
+ id: members === undefined ? 'view:structural-record' : FAMILY_MEMBER_VIEW_MATERIALIZER,
2686
+ domain: members === undefined ? 'static:structural-record-view' : 'static:family-member-record-view',
2687
+ allocates: true,
2688
+ recordView: plan,
2689
+ ...(nativeFieldViewPlanIsLive(plan) ? { nativeFieldViewProtocol: 'live' } : {}),
2690
+ dependencies: [...plan.leaves.values()],
2691
+ ...viewProtocolOf(plan.view),
2692
+ ...sourceGuardsOf([...plan.leaves.values()], resolve)
2693
+ };
2694
+ },
2695
+ staticRecipe: (source, target) => {
2696
+ if (!isSpellable(source) || !isSpellable(target))
2697
+ return null;
2698
+ if (classArmWithoutHome(layouts, source, target))
2699
+ return null;
2700
+ if (proxyArmWithoutHome(source, target))
2701
+ return null;
2309
2702
  const recipe = conversionRecipeOf(source, target);
2703
+ // An element the chain converts inline (`convertedValueText`) is
2704
+ // spelled by the chain's own recipe for that pair: a `narrowed-load`
2705
+ // out of a sum is the native arm read (`.get<N>()`) whose contract
2706
+ // `nativeNarrowing` states, anything else the wrapped-payload claim.
2707
+ const elementPairUnused = (from, to) => conversionRecipeOf(from, to)?.id === 'narrowed-load' && (from.kind === 'optional' || from.kind === 'tagged-union')
2708
+ ? nativeNarrowing(from, to).nativeFieldProtocol === 'unused'
2709
+ : heldPairUnusedOf(nativeWrappedPayload)(from, to);
2310
2710
  if (recipe !== null && recipe.renders) {
2311
2711
  // `unreachable-value` spells either `unreachableValue<T>()` (a throw that
2312
2712
  // reads nothing) or a discard into `undefined`: no field is read and no
@@ -2318,38 +2718,39 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
2318
2718
  // `optional-wrap-converted` spells `Optional<P>{P{inner}}` around the
2319
2719
  // chain's own text for (source, payload), so it reads a field table
2320
2720
  // exactly when that inner conversion does (`nativeWrappedPayload`).
2321
- const native = recipe.id === 'unreachable-value' || recipe.id === 'same-cpp-type'
2322
- ? { nativeFieldProtocol: 'unused', nativePayloadTransport: 'preserved' }
2323
- : recipe.id === 'narrowed-load' && (source.kind === 'optional' || source.kind === 'tagged-union')
2324
- ? nativeNarrowing(source, target)
2325
- : recipe.id === 'optional-wrap-converted' && target.kind === 'optional'
2326
- ? nativeWrappedPayload(source, target.payload)
2327
- : // `optional-payload-convert` spells `has_value() ? T{P{convert(*x)}} : T{}`,
2328
- // the same shape around the payload's own conversion.
2329
- recipe.id === 'optional-payload-convert' && source.kind === 'optional' && target.kind === 'optional'
2330
- ? nativeWrappedPayload(source.payload, target.payload)
2331
- : {};
2332
- return { id: `chain:${recipe.id}`, domain: `static:${recipe.id}`, allocates: allocatingRecipes.has(recipe.id), ...native };
2333
- }
2334
- // After the chain, as the printer asks (`emit.ts`'s `emitConvert`): a
2335
- // record rebuilt as another shape it satisfies, decided by the plan the
2336
- // printer renders from (`conversion/record-view.ts`). `viewPlanFor`
2337
- // caches this build so the printer's later render of the same node
2338
- // (`emit-record-view.ts`'s `structuralRecordViewText`) reads the plan
2339
- // this existence check already built rather than rebuilding it.
2340
- const view = viewPlanFor(layouts, source, target);
2341
- if (view !== null) {
2342
- const heldUnused = heldPairUnusedOf(nativeWrappedPayload);
2343
- if (process.env.GEA_REFLECTION_DEBUG !== undefined) {
2344
- const indirect = recordViewIndirectReads(view, heldUnused);
2345
- if (indirect.length > 0)
2346
- console.error(`[VIEW-INDIRECT] ${representationKey(source).slice(0, 100)} -> ${representationKey(target).slice(0, 100)} reads=${indirect.join(',').slice(0, 300)}`);
2347
- }
2721
+ const native = recipe.id === 'unreachable-value'
2722
+ ? { nativeFieldProtocol: 'unused', ...(source.kind === 'undefined' ? { nativePayloadTransport: 'preserved' } : {}) }
2723
+ : recipe.id === 'same-cpp-type'
2724
+ ? { nativeFieldProtocol: 'unused', nativePayloadTransport: 'preserved' }
2725
+ : recipe.id === 'narrowed-load' && (source.kind === 'optional' || source.kind === 'tagged-union')
2726
+ ? nativeNarrowing(source, target)
2727
+ : recipe.id === 'optional-wrap-converted' && target.kind === 'optional'
2728
+ ? nativeWrappedPayload(source, target.payload)
2729
+ : // `optional-payload-convert` spells `has_value() ? T{P{convert(*x)}} : T{}`,
2730
+ // the same shape around the payload's own conversion.
2731
+ recipe.id === 'optional-payload-convert' && source.kind === 'optional' && target.kind === 'optional'
2732
+ ? nativeWrappedPayload(source.payload, target.payload)
2733
+ : // `array-to-tuple` reads each position by index
2734
+ // (`readElement`) and `array-copy-recast` copies by
2735
+ // `appendRangeConverted`; neither touches a field
2736
+ // table, so each reads one exactly when its element
2737
+ // conversions do.
2738
+ recipe.id === 'array-to-tuple' && source.kind === 'array-object' && target.kind === 'record'
2739
+ ? target.fields.every((field) => elementPairUnused(source.element, field.value))
2740
+ ? { nativeFieldProtocol: 'unused' }
2741
+ : {}
2742
+ : recipe.id === 'array-copy-recast' && source.kind === 'array-object' && target.kind === 'array-object'
2743
+ ? elementPairUnused(source.element, target.element)
2744
+ ? { nativeFieldProtocol: 'unused' }
2745
+ : {}
2746
+ : {};
2348
2747
  return {
2349
- id: 'view:structural-record',
2350
- domain: 'static:structural-record-view',
2351
- allocates: true,
2352
- ...viewProtocolOf(view)
2748
+ id: `chain:${recipe.id}`,
2749
+ domain: `static:${recipe.id}`,
2750
+ allocates: allocatingRecipes.has(recipe.id),
2751
+ ...(recipe.id === 'narrowed-load' ? { armSelection: 'guarded-load' } : {}),
2752
+ ...native,
2753
+ ...(recipe.id === 'unreachable-value' && source.kind === 'undefined' ? { normalCompletion: 'never' } : {})
2353
2754
  };
2354
2755
  }
2355
2756
  // A callable whose parameter reaches the source's only through a record
@@ -2360,34 +2761,14 @@ const cppConversionTables = (layouts, nativeNarrowing, nativeWrappedPayload) =>
2360
2761
  !containsUnresolved(source) &&
2361
2762
  !containsUnresolved(target) &&
2362
2763
  tryCandidateText(() => resultAdaptedCallableText(source, target, 'gea_conversion_probe', (from, to, text) => viewPlanFor(layouts, from, to) === null ? null : `gea_view(${text})`)) !== null)
2363
- return { id: VIEW_ADAPTED_CALLABLE, domain: 'static:adapted-callable', allocates: true };
2764
+ return { id: VIEW_ADAPTED_CALLABLE, domain: 'static:adapted-callable', allocates: true, staticRecipeFallback: true };
2364
2765
  // Some arms homed, some with no home anywhere (`CHECKED_ARM_NARROWING`).
2365
2766
  if (checkedArmNarrowingText(source, target, 'gea_conversion_probe') !== null)
2366
- return { id: CHECKED_ARM_NARROWING, domain: 'static:checked-arm-narrowing', allocates: false };
2767
+ return { id: CHECKED_ARM_NARROWING, domain: 'static:checked-arm-narrowing', allocates: false, staticRecipeFallback: true };
2367
2768
  // The printer's own last resort behind the view (`structuralRecordViewText`).
2368
2769
  if (boxedAssertionText(source, target, 'gea_conversion_probe') !== null)
2369
- return { id: 'view:boxed-assertion', domain: 'static:boxed-assertion', allocates: true };
2770
+ return { id: 'view:boxed-assertion', domain: 'static:boxed-assertion', allocates: true, staticRecipeFallback: true };
2370
2771
  return null;
2371
- },
2372
- // The same view, knowing which family members the site named; rendered by
2373
- // `emit-record-view.ts`'s `familyMemberViewText` from the node's own
2374
- // `familyMembers`. No boxed fallback: a pair this plan refuses stays refused.
2375
- familyMemberView: (source, target, members) => {
2376
- if (!isSpellable(source) || !isSpellable(target))
2377
- return null;
2378
- if (classArmWithoutHome(layouts, source, target))
2379
- return null;
2380
- if (proxyArmWithoutHome(source, target))
2381
- return null;
2382
- const view = familyMemberViewPlanFor(layouts, source, target, members);
2383
- if (view === null)
2384
- return null;
2385
- return {
2386
- id: FAMILY_MEMBER_VIEW_MATERIALIZER,
2387
- domain: 'static:family-member-record-view',
2388
- allocates: true,
2389
- ...viewProtocolOf(view)
2390
- };
2391
2772
  }
2392
2773
  };
2393
2774
  };