@geastack/compiler 1.0.37 → 1.0.38

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 (536) hide show
  1. package/dist/cli-emit.js +5 -0
  2. package/dist/cli.js +10 -0
  3. package/dist/compiler.d.ts +10 -3
  4. package/dist/compiler.js +364 -224
  5. package/dist/conversion/build.d.ts +13 -1
  6. package/dist/conversion/build.js +336 -141
  7. package/dist/conversion/graph-validation.d.ts +7 -2
  8. package/dist/conversion/graph-validation.js +36 -22
  9. package/dist/conversion/native-sum.js +106 -17
  10. package/dist/diagnostics/sweep.js +1 -1
  11. package/dist/ir/callable-class-flow.d.ts +0 -11
  12. package/dist/ir/callable-class-flow.js +970 -169
  13. package/dist/ir/certificate.d.ts +1 -1
  14. package/dist/ir/certificate.js +12 -1
  15. package/dist/ir/certify/carrier-keys.d.ts +17 -1
  16. package/dist/ir/certify/carrier-keys.js +35 -2
  17. package/dist/ir/certify/function-source.js +2 -1
  18. package/dist/ir/certify/has-property-key.d.ts +6 -0
  19. package/dist/ir/certify/has-property-key.js +8 -1
  20. package/dist/ir/certify/property-access-keys.js +2 -1
  21. package/dist/ir/certify/runtime-helper.js +2 -1
  22. package/dist/ir/emission-representations.d.ts +2 -2
  23. package/dist/ir/emission-representations.js +9 -3
  24. package/dist/ir/generic-call-entry.d.ts +3 -1
  25. package/dist/ir/logical-receivers.js +29 -1
  26. package/dist/ir/lower-completion.js +11 -6
  27. package/dist/ir/lower-destructuring.js +3 -2
  28. package/dist/ir/native-host-method-reads.d.ts +5 -0
  29. package/dist/ir/native-host-method-reads.js +30 -21
  30. package/dist/ir/operation-conversions.js +4 -1
  31. package/dist/ir/publish-conversion-recipes.js +12 -1
  32. package/dist/plugins/apple/jsx.js +1 -1
  33. package/dist/plugins/gea/component-classes.js +1 -1
  34. package/dist/plugins/gea/component-inline.js +1 -1
  35. package/dist/plugins/gea/contract.d.ts +1 -1
  36. package/dist/plugins/gea/contract.js +1 -1
  37. package/dist/plugins/gea/host.js +27 -1
  38. package/dist/plugins/gea/lower.js +8 -1
  39. package/dist/plugins/gea/producer.js +1 -1
  40. package/dist/plugins/gea/reactive-slots.d.ts +1 -1
  41. package/dist/plugins/gea/reactive-slots.js +1 -1
  42. package/dist/plugins/load.js +51 -22
  43. package/dist/preflight/run.d.ts +12 -1
  44. package/dist/preflight/run.js +65 -29
  45. package/dist/projection/native-callable-data.js +2 -1
  46. package/dist/representation/plan.js +102 -4
  47. package/dist/semantics/alias-this-field-declaration-transform.js +1 -1
  48. package/dist/semantics/ambient-type-realization-transform.js +1 -1
  49. package/dist/semantics/ambient.d.ts +1 -1
  50. package/dist/semantics/ambient.js +1 -1
  51. package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +1 -1
  52. package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +1 -1
  53. package/dist/semantics/call-invalidated-narrowing.d.ts +1 -1
  54. package/dist/semantics/call-invalidated-narrowing.js +4 -2
  55. package/dist/semantics/callable-own-data-slots.d.ts +6 -0
  56. package/dist/semantics/callable-own-data-slots.js +177 -101
  57. package/dist/semantics/class-alias.d.ts +1 -1
  58. package/dist/semantics/class-alias.js +1 -1
  59. package/dist/semantics/class-heritage.d.ts +1 -1
  60. package/dist/semantics/class-heritage.js +1 -1
  61. package/dist/semantics/commonjs-wrapper.d.ts +4 -3
  62. package/dist/semantics/commonjs-wrapper.js +50 -7
  63. package/dist/semantics/constructor-function-class-source-transform.js +1 -1
  64. package/dist/semantics/constructor-slot-subclasses.d.ts +1 -1
  65. package/dist/semantics/constructor-slot-subclasses.js +1 -1
  66. package/dist/semantics/declaration-overlay-transform.js +3 -2
  67. package/dist/semantics/declared-integers.d.ts +1 -1
  68. package/dist/semantics/declared-integers.js +1 -1
  69. package/dist/semantics/define-property-source-transform.js +1 -1
  70. package/dist/semantics/diagnostic-source-preparation.d.ts +1 -1
  71. package/dist/semantics/documentation-ranges.d.ts +1 -1
  72. package/dist/semantics/documentation-ranges.js +1 -1
  73. package/dist/semantics/dynamic-fallback.d.ts +1 -1
  74. package/dist/semantics/dynamic-fallback.js +1 -1
  75. package/dist/semantics/frontend-timing.js +19 -0
  76. package/dist/semantics/frontend.d.ts +2 -2
  77. package/dist/semantics/frontend.js +127 -54
  78. package/dist/semantics/host-declaration-provenance.d.ts +1 -1
  79. package/dist/semantics/host-methods.d.ts +1 -1
  80. package/dist/semantics/host-methods.js +1 -1
  81. package/dist/semantics/host-protocols.d.ts +1 -1
  82. package/dist/semantics/host-protocols.js +1 -1
  83. package/dist/semantics/inherited-accessor.d.ts +1 -1
  84. package/dist/semantics/inherited-accessor.js +1 -1
  85. package/dist/semantics/interface-families.d.ts +1 -1
  86. package/dist/semantics/interface-families.js +1 -1
  87. package/dist/semantics/interface-implementors.d.ts +1 -1
  88. package/dist/semantics/interface-implementors.js +1 -1
  89. package/dist/semantics/jsdoc-namepath-transform.js +1 -1
  90. package/dist/semantics/jsx-runtime-provider.d.ts +1 -1
  91. package/dist/semantics/jsx-runtime-provider.js +1 -1
  92. package/dist/semantics/known-caller-predicate-parameters.d.ts +1 -1
  93. package/dist/semantics/known-caller-predicate-parameters.js +1 -1
  94. package/dist/semantics/model/edges.d.ts +124 -0
  95. package/dist/semantics/model/edges.js +192 -0
  96. package/dist/semantics/model/graph.d.ts +26 -2
  97. package/dist/semantics/model/graph.js +54 -0
  98. package/dist/semantics/model/sealed-facts.d.ts +19 -0
  99. package/dist/semantics/model/sealed-facts.js +221 -0
  100. package/dist/semantics/model/selected-signature.d.ts +1 -1
  101. package/dist/semantics/model/selected-signature.js +1 -1
  102. package/dist/semantics/module-resolution.d.ts +1 -1
  103. package/dist/semantics/module-resolution.js +1 -1
  104. package/dist/semantics/native-function-signatures.d.ts +1 -1
  105. package/dist/semantics/native-function-signatures.js +1 -1
  106. package/dist/semantics/native-object-data-slots.js +20 -4
  107. package/dist/semantics/new-callee-class-tag-source-transform.js +1 -1
  108. package/dist/semantics/node-project.d.ts +1 -1
  109. package/dist/semantics/node-project.js +1 -1
  110. package/dist/semantics/node-source-hooks.js +1 -1
  111. package/dist/semantics/normalize/absent-globals.d.ts +1 -1
  112. package/dist/semantics/normalize/absent-globals.js +1 -1
  113. package/dist/semantics/normalize/any-cast-member-call.d.ts +1 -1
  114. package/dist/semantics/normalize/any-cast-member-call.js +1 -1
  115. package/dist/semantics/normalize/arguments-objects.d.ts +1 -1
  116. package/dist/semantics/normalize/arguments-objects.js +1 -1
  117. package/dist/semantics/normalize/asserted-argument-arms.d.ts +1 -1
  118. package/dist/semantics/normalize/asserted-argument-arms.js +1 -1
  119. package/dist/semantics/normalize/asserted-arm-absence.d.ts +1 -1
  120. package/dist/semantics/normalize/asserted-arm-absence.js +1 -1
  121. package/dist/semantics/normalize/assignment-patterns.d.ts +1 -1
  122. package/dist/semantics/normalize/assignment-patterns.js +1 -1
  123. package/dist/semantics/normalize/bag-absence.d.ts +1 -1
  124. package/dist/semantics/normalize/bag-absence.js +1 -1
  125. package/dist/semantics/normalize/binding-fixpoint.js +9 -2
  126. package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +1 -1
  127. package/dist/semantics/normalize/bivariant-slot-parameter.js +1 -1
  128. package/dist/semantics/normalize/callable-data-write.d.ts +1 -1
  129. package/dist/semantics/normalize/callable-data-write.js +1 -1
  130. package/dist/semantics/normalize/callback-parameter-contracts.d.ts +1 -1
  131. package/dist/semantics/normalize/callback-parameter-contracts.js +1 -1
  132. package/dist/semantics/normalize/cells/agreement.d.ts +18 -1
  133. package/dist/semantics/normalize/cells/agreement.js +8 -0
  134. package/dist/semantics/normalize/cells/candidates.d.ts +1 -1
  135. package/dist/semantics/normalize/cells/candidates.js +1 -1
  136. package/dist/semantics/normalize/cells/facts.d.ts +1 -1
  137. package/dist/semantics/normalize/cells/facts.js +1 -1
  138. package/dist/semantics/normalize/cells/index.d.ts +2 -2
  139. package/dist/semantics/normalize/cells/index.js +1 -1
  140. package/dist/semantics/normalize/cells/model.d.ts +1 -1
  141. package/dist/semantics/normalize/cells/policies/bag.d.ts +1 -1
  142. package/dist/semantics/normalize/cells/policies/collection.d.ts +1 -1
  143. package/dist/semantics/normalize/cells/policies/collection.js +1 -1
  144. package/dist/semantics/normalize/cells/policies/field.d.ts +1 -1
  145. package/dist/semantics/normalize/cells/policies/field.js +1 -1
  146. package/dist/semantics/normalize/cells/policies/index.d.ts +1 -1
  147. package/dist/semantics/normalize/cells/policies/local.d.ts +1 -1
  148. package/dist/semantics/normalize/cells/policies/local.js +1 -1
  149. package/dist/semantics/normalize/cells/policies/parameter.d.ts +1 -1
  150. package/dist/semantics/normalize/cells/policies/parameter.js +1 -1
  151. package/dist/semantics/normalize/cells/policies/return.d.ts +1 -1
  152. package/dist/semantics/normalize/cells/policies/return.js +1 -1
  153. package/dist/semantics/normalize/cells/policies/shared.d.ts +1 -1
  154. package/dist/semantics/normalize/cells/policy.d.ts +1 -1
  155. package/dist/semantics/normalize/census.d.ts +1 -1
  156. package/dist/semantics/normalize/census.js +45 -12
  157. package/dist/semantics/normalize/class-instance-record-statement.d.ts +1 -1
  158. package/dist/semantics/normalize/class-instance-record-statement.js +1 -1
  159. package/dist/semantics/normalize/collection-bindings.d.ts +1 -1
  160. package/dist/semantics/normalize/collection-bindings.js +1 -1
  161. package/dist/semantics/normalize/commonjs-module-record.d.ts +1 -1
  162. package/dist/semantics/normalize/commonjs-module-record.js +1 -1
  163. package/dist/semantics/normalize/commonjs-require.d.ts +1 -1
  164. package/dist/semantics/normalize/commonjs-require.js +1 -1
  165. package/dist/semantics/normalize/contribution.d.ts +4 -3
  166. package/dist/semantics/normalize/contribution.js +145 -42
  167. package/dist/semantics/normalize/dead-event-emissions.d.ts +1 -1
  168. package/dist/semantics/normalize/dead-event-emissions.js +1 -1
  169. package/dist/semantics/normalize/dead-method-copies.d.ts +1 -1
  170. package/dist/semantics/normalize/dead-method-copies.js +1 -1
  171. package/dist/semantics/normalize/dead-typeof-guards.d.ts +1 -1
  172. package/dist/semantics/normalize/dead-typeof-guards.js +1 -1
  173. package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +1 -1
  174. package/dist/semantics/normalize/deferred-intrinsic-protocols.js +1 -1
  175. package/dist/semantics/normalize/derived-expression-type.d.ts +1 -1
  176. package/dist/semantics/normalize/derived-expression-type.js +4 -4
  177. package/dist/semantics/normalize/evaluation-order.d.ts +1 -1
  178. package/dist/semantics/normalize/evaluation-order.js +1 -1
  179. package/dist/semantics/normalize/field-bindings.d.ts +1 -1
  180. package/dist/semantics/normalize/field-bindings.js +4 -3
  181. package/dist/semantics/normalize/flow/array-element-continuation.d.ts +1 -1
  182. package/dist/semantics/normalize/flow/array-element-continuation.js +3 -3
  183. package/dist/semantics/normalize/flow/callable-array-origins.d.ts +1 -1
  184. package/dist/semantics/normalize/flow/callable-array-origins.js +1 -1
  185. package/dist/semantics/normalize/flow/callable-completions.d.ts +1 -1
  186. package/dist/semantics/normalize/flow/callable-completions.js +1 -1
  187. package/dist/semantics/normalize/flow/callable-reach.d.ts +1 -1
  188. package/dist/semantics/normalize/flow/callable-reach.js +73 -52
  189. package/dist/semantics/normalize/flow/class-family-member-read.d.ts +1 -1
  190. package/dist/semantics/normalize/flow/class-family-member-read.js +3 -3
  191. package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +1 -1
  192. package/dist/semantics/normalize/flow/collection-value-continuation.js +1 -1
  193. package/dist/semantics/normalize/flow/component-solver.d.ts +181 -3
  194. package/dist/semantics/normalize/flow/component-solver.js +705 -164
  195. package/dist/semantics/normalize/flow/computed-key-set.d.ts +1 -1
  196. package/dist/semantics/normalize/flow/computed-key-set.js +1 -1
  197. package/dist/semantics/normalize/flow/export-importers.d.ts +1 -1
  198. package/dist/semantics/normalize/flow/export-importers.js +13 -3
  199. package/dist/semantics/normalize/flow/host-text-sink.d.ts +1 -1
  200. package/dist/semantics/normalize/flow/host-text-sink.js +1 -1
  201. package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.d.ts +1 -1
  202. package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +1 -1
  203. package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +1 -1
  204. package/dist/semantics/normalize/flow/intrinsic-data-definition.js +1 -1
  205. package/dist/semantics/normalize/flow/invocation-facts.d.ts +1 -1
  206. package/dist/semantics/normalize/flow/invocation-facts.js +1 -1
  207. package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +1 -1
  208. package/dist/semantics/normalize/flow/member-call-forwarding.js +1 -1
  209. package/dist/semantics/normalize/flow/model.d.ts +1 -1
  210. package/dist/semantics/normalize/flow/model.js +5 -1
  211. package/dist/semantics/normalize/flow/native-collection-protocol.d.ts +1 -1
  212. package/dist/semantics/normalize/flow/native-collection-protocol.js +1 -1
  213. package/dist/semantics/normalize/flow/node-path-token.d.ts +1 -1
  214. package/dist/semantics/normalize/flow/object-binding-continuation.d.ts +1 -1
  215. package/dist/semantics/normalize/flow/object-binding-continuation.js +1 -1
  216. package/dist/semantics/normalize/flow/origin-authority.d.ts +1 -1
  217. package/dist/semantics/normalize/flow/owned-class-receivers.d.ts +1 -1
  218. package/dist/semantics/normalize/flow/owned-class-receivers.js +1 -1
  219. package/dist/semantics/normalize/flow/parameter-values.d.ts +1 -1
  220. package/dist/semantics/normalize/flow/parameter-values.js +1 -1
  221. package/dist/semantics/normalize/flow/record-alias-closure.d.ts +1 -1
  222. package/dist/semantics/normalize/flow/record-alias-closure.js +1 -1
  223. package/dist/semantics/normalize/flow/seeded-origins.d.ts +1 -1
  224. package/dist/semantics/normalize/flow/seeded-origins.js +1 -1
  225. package/dist/semantics/normalize/flow/source-accessor-descriptor.d.ts +1 -1
  226. package/dist/semantics/normalize/flow/source-accessor-descriptor.js +1 -1
  227. package/dist/semantics/normalize/flow/source-callable-own-data.d.ts +1 -1
  228. package/dist/semantics/normalize/flow/source-callable-own-data.js +1 -1
  229. package/dist/semantics/normalize/flow/source-callable-readonly-set.d.ts +1 -1
  230. package/dist/semantics/normalize/flow/source-callable-readonly-set.js +1 -1
  231. package/dist/semantics/normalize/flow/source-class-data.d.ts +1 -1
  232. package/dist/semantics/normalize/flow/source-class-data.js +1 -1
  233. package/dist/semantics/normalize/flow/source-class-instanceof.d.ts +1 -1
  234. package/dist/semantics/normalize/flow/source-class-instanceof.js +1 -1
  235. package/dist/semantics/normalize/flow/source-class-static-data.d.ts +1 -1
  236. package/dist/semantics/normalize/flow/source-class-static-data.js +1 -1
  237. package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +1 -1
  238. package/dist/semantics/normalize/flow/source-construction-frames.d.ts +1 -1
  239. package/dist/semantics/normalize/flow/source-construction-frames.js +1 -1
  240. package/dist/semantics/normalize/flow/source-descriptor-protocol.d.ts +1 -1
  241. package/dist/semantics/normalize/flow/source-descriptor-protocol.js +1 -1
  242. package/dist/semantics/normalize/flow/source-executing-parameter-values.d.ts +1 -1
  243. package/dist/semantics/normalize/flow/source-executing-parameter-values.js +1 -1
  244. package/dist/semantics/normalize/flow/source-global-binding.d.ts +1 -1
  245. package/dist/semantics/normalize/flow/source-global-binding.js +1 -1
  246. package/dist/semantics/normalize/flow/source-intrinsic-member-data.d.ts +1 -1
  247. package/dist/semantics/normalize/flow/source-intrinsic-member-data.js +1 -1
  248. package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +1 -1
  249. package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +24 -32
  250. package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +1 -1
  251. package/dist/semantics/normalize/flow/source-invocation-receiver.js +1 -1
  252. package/dist/semantics/normalize/flow/source-native-class-alias.d.ts +1 -1
  253. package/dist/semantics/normalize/flow/source-native-class-alias.js +1 -1
  254. package/dist/semantics/normalize/flow/source-native-iterable-integrity.d.ts +1 -1
  255. package/dist/semantics/normalize/flow/source-native-iterable-integrity.js +1 -1
  256. package/dist/semantics/normalize/flow/source-native-origin.d.ts +1 -1
  257. package/dist/semantics/normalize/flow/source-native-origin.js +1 -1
  258. package/dist/semantics/normalize/flow/source-normal-predecessor.d.ts +1 -1
  259. package/dist/semantics/normalize/flow/source-normal-predecessor.js +1 -1
  260. package/dist/semantics/normalize/flow/source-property-key.d.ts +1 -1
  261. package/dist/semantics/normalize/flow/source-property-key.js +1 -1
  262. package/dist/semantics/normalize/flow/source-prototype-method-identity.d.ts +1 -1
  263. package/dist/semantics/normalize/flow/source-prototype-method-identity.js +1 -1
  264. package/dist/semantics/normalize/flow/source-proxy-operation.d.ts +1 -1
  265. package/dist/semantics/normalize/flow/source-proxy-operation.js +1 -1
  266. package/dist/semantics/normalize/flow/source-raw-constructor-entry.d.ts +1 -1
  267. package/dist/semantics/normalize/flow/source-raw-constructor-entry.js +1 -1
  268. package/dist/semantics/normalize/flow/source-read-protocol.d.ts +1 -1
  269. package/dist/semantics/normalize/flow/source-read-protocol.js +1 -1
  270. package/dist/semantics/normalize/flow/source-record-data.d.ts +1 -1
  271. package/dist/semantics/normalize/flow/source-record-data.js +1 -1
  272. package/dist/semantics/normalize/flow/source-value-session.d.ts +33 -3
  273. package/dist/semantics/normalize/flow/source-value-session.js +381 -173
  274. package/dist/semantics/normalize/flow/standard-prototype-method-source.d.ts +1 -1
  275. package/dist/semantics/normalize/flow/standard-prototype-method-source.js +1 -1
  276. package/dist/semantics/normalize/flow/targets.d.ts +1 -1
  277. package/dist/semantics/normalize/flow/targets.js +1 -1
  278. package/dist/semantics/normalize/flow/value-flow.d.ts +1 -1
  279. package/dist/semantics/normalize/flow/value-flow.js +243 -52
  280. package/dist/semantics/normalize/flow/value-provenance.d.ts +1 -1
  281. package/dist/semantics/normalize/flow/value-provenance.js +1 -1
  282. package/dist/semantics/normalize/fresh-dictionary-storage.d.ts +1 -1
  283. package/dist/semantics/normalize/fresh-dictionary-storage.js +1 -1
  284. package/dist/semantics/normalize/fresh-ordinary-object.d.ts +1 -1
  285. package/dist/semantics/normalize/fresh-ordinary-object.js +1 -1
  286. package/dist/semantics/normalize/fresh-table-last-use.d.ts +1 -1
  287. package/dist/semantics/normalize/fresh-table-last-use.js +1 -1
  288. package/dist/semantics/normalize/gating.d.ts +3 -3
  289. package/dist/semantics/normalize/gating.js +17 -20
  290. package/dist/semantics/normalize/generic-function-choice.d.ts +1 -1
  291. package/dist/semantics/normalize/generic-function-choice.js +1 -1
  292. package/dist/semantics/normalize/global-host-mutations.d.ts +1 -1
  293. package/dist/semantics/normalize/global-host-mutations.js +420 -138
  294. package/dist/semantics/normalize/host-effect-contracts.d.ts +1 -1
  295. package/dist/semantics/normalize/host-effect-contracts.js +1 -1
  296. package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +1 -1
  297. package/dist/semantics/normalize/host-mutation-key-reader.d.ts +1 -1
  298. package/dist/semantics/normalize/host-mutation-key-reader.js +1 -1
  299. package/dist/semantics/normalize/identities.d.ts +41 -1
  300. package/dist/semantics/normalize/identities.js +75 -9
  301. package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +1 -1
  302. package/dist/semantics/normalize/implicit-arguments-tuple.js +1 -1
  303. package/dist/semantics/normalize/implicit-arguments.d.ts +1 -1
  304. package/dist/semantics/normalize/implicit-arguments.js +1 -1
  305. package/dist/semantics/normalize/installed-global-properties.d.ts +1 -1
  306. package/dist/semantics/normalize/installed-global-properties.js +1 -1
  307. package/dist/semantics/normalize/instantiation.d.ts +1 -1
  308. package/dist/semantics/normalize/instantiation.js +1 -1
  309. package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +1 -1
  310. package/dist/semantics/normalize/intrinsic-accessor-getter.js +1 -1
  311. package/dist/semantics/normalize/intrinsic-property-call.d.ts +1 -1
  312. package/dist/semantics/normalize/intrinsic-property-call.js +1 -1
  313. package/dist/semantics/normalize/intrinsic-prototype.d.ts +1 -1
  314. package/dist/semantics/normalize/intrinsic-prototype.js +1 -1
  315. package/dist/semantics/normalize/intrinsic-return-identity.d.ts +1 -1
  316. package/dist/semantics/normalize/intrinsic-return-identity.js +1 -1
  317. package/dist/semantics/normalize/intrinsic-static-member.d.ts +1 -1
  318. package/dist/semantics/normalize/jsdoc-type-names.d.ts +1 -1
  319. package/dist/semantics/normalize/jsdoc-type-names.js +1 -1
  320. package/dist/semantics/normalize/local-bindings.d.ts +1 -1
  321. package/dist/semantics/normalize/local-bindings.js +3 -2
  322. package/dist/semantics/normalize/logical-object-truthiness.d.ts +1 -1
  323. package/dist/semantics/normalize/logical-object-truthiness.js +1 -1
  324. package/dist/semantics/normalize/logical-result-type.d.ts +1 -1
  325. package/dist/semantics/normalize/logical-result-type.js +1 -1
  326. package/dist/semantics/normalize/merged-declaration.d.ts +1 -1
  327. package/dist/semantics/normalize/merged-declaration.js +1 -1
  328. package/dist/semantics/normalize/namespace-paths.d.ts +1 -1
  329. package/dist/semantics/normalize/namespace-paths.js +1 -1
  330. package/dist/semantics/normalize/never-override-result.d.ts +1 -1
  331. package/dist/semantics/normalize/never-override-result.js +1 -1
  332. package/dist/semantics/normalize/normalize.d.ts +23 -4
  333. package/dist/semantics/normalize/normalize.js +125 -15
  334. package/dist/semantics/normalize/null-blind-parameter.d.ts +1 -1
  335. package/dist/semantics/normalize/null-blind-parameter.js +1 -1
  336. package/dist/semantics/normalize/nullable-memo.d.ts +28 -0
  337. package/dist/semantics/normalize/nullable-memo.js +99 -0
  338. package/dist/semantics/normalize/object-bag-bindings.d.ts +1 -1
  339. package/dist/semantics/normalize/object-bag-bindings.js +15 -4
  340. package/dist/semantics/normalize/omitted-stated-parameter.d.ts +1 -1
  341. package/dist/semantics/normalize/omitted-stated-parameter.js +1 -1
  342. package/dist/semantics/normalize/open-type-form.d.ts +1 -1
  343. package/dist/semantics/normalize/open-type-form.js +1 -1
  344. package/dist/semantics/normalize/override-field-arms.d.ts +1 -1
  345. package/dist/semantics/normalize/override-field-arms.js +1 -1
  346. package/dist/semantics/normalize/parameter-bindings.d.ts +1 -52
  347. package/dist/semantics/normalize/parameter-bindings.js +105 -10
  348. package/dist/semantics/normalize/parameter-slot.d.ts +1 -1
  349. package/dist/semantics/normalize/parameter-slot.js +1 -1
  350. package/dist/semantics/normalize/physical-overload-result.d.ts +1 -1
  351. package/dist/semantics/normalize/physical-overload-result.js +1 -1
  352. package/dist/semantics/normalize/primitive-property-absence.d.ts +1 -1
  353. package/dist/semantics/normalize/producer-context.d.ts +1 -1
  354. package/dist/semantics/normalize/producers/allocations.d.ts +1 -1
  355. package/dist/semantics/normalize/producers/allocations.js +1 -1
  356. package/dist/semantics/normalize/producers/binding-kind.d.ts +1 -1
  357. package/dist/semantics/normalize/producers/binding-kind.js +1 -1
  358. package/dist/semantics/normalize/producers/bindings.d.ts +1 -1
  359. package/dist/semantics/normalize/producers/bindings.js +1 -1
  360. package/dist/semantics/normalize/producers/boundary.d.ts +1 -1
  361. package/dist/semantics/normalize/producers/boundary.js +1 -1
  362. package/dist/semantics/normalize/producers/cited-value-type.d.ts +1 -1
  363. package/dist/semantics/normalize/producers/cited-value-type.js +1 -1
  364. package/dist/semantics/normalize/producers/class-lifecycle.js +1 -1
  365. package/dist/semantics/normalize/producers/computations.js +1 -1
  366. package/dist/semantics/normalize/producers/conditional-guard.d.ts +1 -1
  367. package/dist/semantics/normalize/producers/control-loops.d.ts +1 -1
  368. package/dist/semantics/normalize/producers/control-loops.js +1 -1
  369. package/dist/semantics/normalize/producers/control.d.ts +1 -1
  370. package/dist/semantics/normalize/producers/control.js +1 -1
  371. package/dist/semantics/normalize/producers/declaration-lifecycle.js +1 -1
  372. package/dist/semantics/normalize/producers/destructuring.d.ts +1 -1
  373. package/dist/semantics/normalize/producers/destructuring.js +1 -1
  374. package/dist/semantics/normalize/producers/dynamic-language.js +1 -1
  375. package/dist/semantics/normalize/producers/enums.d.ts +1 -1
  376. package/dist/semantics/normalize/producers/enums.js +1 -1
  377. package/dist/semantics/normalize/producers/erasure.d.ts +1 -1
  378. package/dist/semantics/normalize/producers/erasure.js +1 -1
  379. package/dist/semantics/normalize/producers/exact-arms.d.ts +1 -1
  380. package/dist/semantics/normalize/producers/exact-arms.js +1 -1
  381. package/dist/semantics/normalize/producers/intrinsic-accessor-getter.d.ts +1 -1
  382. package/dist/semantics/normalize/producers/invocations.d.ts +1 -1
  383. package/dist/semantics/normalize/producers/invocations.js +1 -1
  384. package/dist/semantics/normalize/producers/iteration-yield.d.ts +1 -1
  385. package/dist/semantics/normalize/producers/iteration-yield.js +1 -1
  386. package/dist/semantics/normalize/producers/jsx.js +1 -1
  387. package/dist/semantics/normalize/producers/logical-merge-type.d.ts +1 -1
  388. package/dist/semantics/normalize/producers/logical-merge-type.js +1 -1
  389. package/dist/semantics/normalize/producers/mint.js +88 -5
  390. package/dist/semantics/normalize/producers/native-callable-readonly-set.d.ts +1 -1
  391. package/dist/semantics/normalize/producers/native-own-assignment.d.ts +1 -1
  392. package/dist/semantics/normalize/producers/native-own-assignment.js +1 -1
  393. package/dist/semantics/normalize/producers/nullish.d.ts +1 -1
  394. package/dist/semantics/normalize/producers/nullish.js +1 -1
  395. package/dist/semantics/normalize/producers/object-assignment.d.ts +1 -1
  396. package/dist/semantics/normalize/producers/object-assignment.js +1 -1
  397. package/dist/semantics/normalize/producers/object-tag.d.ts +1 -1
  398. package/dist/semantics/normalize/producers/object-tag.js +1 -1
  399. package/dist/semantics/normalize/producers/optional-chain.d.ts +1 -1
  400. package/dist/semantics/normalize/producers/optional-chain.js +1 -1
  401. package/dist/semantics/normalize/producers/properties.d.ts +1 -1
  402. package/dist/semantics/normalize/producers/properties.js +1 -1
  403. package/dist/semantics/normalize/producers/protocol.d.ts +1 -1
  404. package/dist/semantics/normalize/producers/protocol.js +1 -1
  405. package/dist/semantics/normalize/producers/references.d.ts +1 -1
  406. package/dist/semantics/normalize/producers/references.js +1 -1
  407. package/dist/semantics/normalize/producers/shared.d.ts +1 -1
  408. package/dist/semantics/normalize/producers/shared.js +1 -1
  409. package/dist/semantics/normalize/producers/spread-arguments.d.ts +1 -1
  410. package/dist/semantics/normalize/producers/spread-arguments.js +1 -1
  411. package/dist/semantics/normalize/producers/tagged-template.d.ts +1 -1
  412. package/dist/semantics/normalize/producers/tagged-template.js +1 -1
  413. package/dist/semantics/normalize/producers/tuple-spread.d.ts +1 -1
  414. package/dist/semantics/normalize/producers/tuple-spread.js +1 -1
  415. package/dist/semantics/normalize/property-key-domain.d.ts +8 -1
  416. package/dist/semantics/normalize/property-key-domain.js +74 -47
  417. package/dist/semantics/normalize/reachability.d.ts +1 -1
  418. package/dist/semantics/normalize/reachability.js +3 -2
  419. package/dist/semantics/normalize/reassigned-bindings.d.ts +1 -1
  420. package/dist/semantics/normalize/record-home-arms.d.ts +1 -1
  421. package/dist/semantics/normalize/record-home-arms.js +1 -1
  422. package/dist/semantics/normalize/record-link-families.d.ts +1 -1
  423. package/dist/semantics/normalize/record-link-families.js +1 -1
  424. package/dist/semantics/normalize/record-stand-in-arms.d.ts +1 -1
  425. package/dist/semantics/normalize/record-stand-in-arms.js +1 -1
  426. package/dist/semantics/normalize/record-storage-families.d.ts +1 -1
  427. package/dist/semantics/normalize/record-storage-families.js +1 -1
  428. package/dist/semantics/normalize/return-bindings.d.ts +1 -1
  429. package/dist/semantics/normalize/return-bindings.js +1 -1
  430. package/dist/semantics/normalize/return-paths.d.ts +1 -1
  431. package/dist/semantics/normalize/return-paths.js +1 -1
  432. package/dist/semantics/normalize/round-tables.d.ts +21 -0
  433. package/dist/semantics/normalize/round-tables.js +59 -0
  434. package/dist/semantics/normalize/script-global-redefinition.d.ts +1 -1
  435. package/dist/semantics/normalize/script-global-redefinition.js +1 -1
  436. package/dist/semantics/normalize/shared-array-storage.d.ts +1 -1
  437. package/dist/semantics/normalize/shared-array-storage.js +1 -1
  438. package/dist/semantics/normalize/sloppy-absence.d.ts +1 -1
  439. package/dist/semantics/normalize/sloppy-absence.js +1 -1
  440. package/dist/semantics/normalize/source-native-iterable.d.ts +2 -2
  441. package/dist/semantics/normalize/source-native-iterable.js +4 -2
  442. package/dist/semantics/normalize/source-object-prototype-absence.d.ts +1 -1
  443. package/dist/semantics/normalize/source-object-prototype-absence.js +1 -1
  444. package/dist/semantics/normalize/specialization.d.ts +1 -1
  445. package/dist/semantics/normalize/specialization.js +1 -1
  446. package/dist/semantics/normalize/specialized-source-frames.d.ts +1 -1
  447. package/dist/semantics/normalize/specialized-source-frames.js +12 -4
  448. package/dist/semantics/normalize/structural-any-binding-consumer.d.ts +1 -1
  449. package/dist/semantics/normalize/structural-any-binding-consumer.js +1 -1
  450. package/dist/semantics/normalize/structural-array-element.d.ts +1 -1
  451. package/dist/semantics/normalize/structural-array-element.js +1 -1
  452. package/dist/semantics/normalize/structural-array-read.d.ts +1 -1
  453. package/dist/semantics/normalize/structural-array-read.js +1 -1
  454. package/dist/semantics/normalize/structural-callable.d.ts +1 -1
  455. package/dist/semantics/normalize/structural-callable.js +1 -1
  456. package/dist/semantics/normalize/structural-creation-order.d.ts +1 -1
  457. package/dist/semantics/normalize/structural-creation-order.js +1 -1
  458. package/dist/semantics/normalize/structural-declarations.d.ts +1 -1
  459. package/dist/semantics/normalize/structural-declarations.js +1 -1
  460. package/dist/semantics/normalize/structural-declared-body.d.ts +1 -1
  461. package/dist/semantics/normalize/structural-declared-body.js +1 -1
  462. package/dist/semantics/normalize/structural-generics.d.ts +1 -1
  463. package/dist/semantics/normalize/structural-generics.js +1 -1
  464. package/dist/semantics/normalize/structural-indexed-access.d.ts +1 -1
  465. package/dist/semantics/normalize/structural-indexed-access.js +1 -1
  466. package/dist/semantics/normalize/structural-instantiated-member.d.ts +1 -1
  467. package/dist/semantics/normalize/structural-instantiated-member.js +199 -68
  468. package/dist/semantics/normalize/structural-joins.d.ts +1 -1
  469. package/dist/semantics/normalize/structural-layout-relevance.d.ts +1 -1
  470. package/dist/semantics/normalize/structural-layout-relevance.js +1 -1
  471. package/dist/semantics/normalize/structural-layout-type.d.ts +1 -1
  472. package/dist/semantics/normalize/structural-layout-type.js +14 -2
  473. package/dist/semantics/normalize/structural-leaves.d.ts +1 -1
  474. package/dist/semantics/normalize/structural-leaves.js +1 -1
  475. package/dist/semantics/normalize/structural-local-union.d.ts +1 -1
  476. package/dist/semantics/normalize/structural-local-union.js +21 -16
  477. package/dist/semantics/normalize/structural-members.d.ts +1 -1
  478. package/dist/semantics/normalize/structural-members.js +1 -1
  479. package/dist/semantics/normalize/structural-mutable-field.d.ts +1 -2
  480. package/dist/semantics/normalize/structural-mutable-field.js +17 -4
  481. package/dist/semantics/normalize/structural-mutable-method.d.ts +1 -1
  482. package/dist/semantics/normalize/structural-mutable-method.js +1 -1
  483. package/dist/semantics/normalize/structural-parts.d.ts +1 -1
  484. package/dist/semantics/normalize/structural-parts.js +1 -1
  485. package/dist/semantics/normalize/structural-receiver.d.ts +1 -1
  486. package/dist/semantics/normalize/structural-receiver.js +1 -1
  487. package/dist/semantics/normalize/structural-rules.d.ts +4 -4
  488. package/dist/semantics/normalize/structural-rules.js +30 -12
  489. package/dist/semantics/normalize/structural-self-reference.d.ts +1 -1
  490. package/dist/semantics/normalize/structural-self-reference.js +1 -1
  491. package/dist/semantics/normalize/structural.d.ts +1 -1
  492. package/dist/semantics/normalize/structural.js +2467 -2239
  493. package/dist/semantics/normalize/suppressed-write-arms.d.ts +1 -1
  494. package/dist/semantics/normalize/suppressed-write-arms.js +1 -1
  495. package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +1 -1
  496. package/dist/semantics/normalize/symbol-keyed-this-slots.js +1 -1
  497. package/dist/semantics/normalize/unreduced-type-form.d.ts +1 -1
  498. package/dist/semantics/normalize/unreduced-type-form.js +1 -1
  499. package/dist/semantics/normalize/unresolvable-names.d.ts +1 -1
  500. package/dist/semantics/normalize/unresolvable-names.js +1 -1
  501. package/dist/semantics/normalize/unshared-array-result.d.ts +1 -1
  502. package/dist/semantics/normalize/unshared-array-result.js +1 -1
  503. package/dist/semantics/package-sources.d.ts +1 -1
  504. package/dist/semantics/package-sources.js +1 -1
  505. package/dist/semantics/program.d.ts +1 -1
  506. package/dist/semantics/program.js +11 -5
  507. package/dist/semantics/prototype-install-source-transform.js +1 -1
  508. package/dist/semantics/prototype-object-class-source-transform.js +1 -1
  509. package/dist/semantics/prototype-reparenting.d.ts +1 -1
  510. package/dist/semantics/prototype-reparenting.js +1 -1
  511. package/dist/semantics/shared-declaration-files.d.ts +1 -1
  512. package/dist/semantics/source-transform-exports.js +1 -1
  513. package/dist/semantics/stable-checker.d.ts +9 -1
  514. package/dist/semantics/stable-checker.js +21 -5
  515. package/dist/semantics/subclass-member-overlay-transform.js +46 -5
  516. package/dist/semantics/symbol-keyed-expando-source-transform.js +1 -1
  517. package/dist/semantics/this-constructor-source-transform.js +1 -1
  518. package/dist/semantics/typescript.d.ts +12 -0
  519. package/dist/semantics/typescript.js +12 -0
  520. package/dist/semantics/uncached-jsdoc-tags.d.ts +16 -0
  521. package/dist/semantics/uncached-jsdoc-tags.js +23 -0
  522. package/dist/semantics/unchecked-guard-argument-copies.d.ts +1 -1
  523. package/dist/semantics/unchecked-guard-argument-copies.js +1 -1
  524. package/dist/semantics/unchecked-write-member-declarations.d.ts +1 -1
  525. package/dist/semantics/unchecked-write-member-declarations.js +1 -1
  526. package/dist/semantics/uninstantiable-classes.d.ts +1 -1
  527. package/dist/semantics/uninstantiable-classes.js +1 -1
  528. package/dist/targets/cpp/conversions.js +137 -87
  529. package/dist/targets/cpp/emit-in.js +2 -1
  530. package/dist/targets/cpp/emit-iterator.d.ts +6 -5
  531. package/dist/targets/cpp/emit-iterator.js +23 -13
  532. package/dist/targets/cpp/emit-narrowing.d.ts +8 -0
  533. package/dist/targets/cpp/emit-narrowing.js +11 -1
  534. package/dist/targets/cpp/emit-record-view.d.ts +9 -0
  535. package/dist/targets/cpp/emit-record-view.js +12 -1
  536. package/package.json +7 -1
@@ -246,9 +246,8 @@ const buildNarrowingClosure = (source) => {
246
246
  * keeps recursive representations finite. This one predicate is shared by
247
247
  * graph proposal and backend admission so they cannot disagree.
248
248
  */
249
- const reachesMemo = new Map();
250
249
  /**
251
- * Forgets both narrowing memos. "A pure function of the representation" holds
250
+ * Forgets the narrowing-closure memo. "A pure function of the representation" holds
252
251
  * only within one program: `representationKey` names a class by its
253
252
  * declaration id (`class-ref(decl|f168|20,...)`), and every single-file program
254
253
  * numbers its file the same, so the next compile in this process reads another
@@ -260,19 +259,21 @@ const reachesMemo = new Map();
260
259
  */
261
260
  export const resetNarrowingMemos = () => {
262
261
  narrowingClosures.clear();
263
- reachesMemo.clear();
264
262
  };
265
263
  export const narrowingReachesTarget = (source, target) => {
266
264
  const targetKey = representationKey(target);
267
265
  if (narrowingClosureKeysOf(source).has(targetKey))
268
266
  return true;
269
- // Module level for the same reason `narrowingClosureOf`'s cache above is:
270
- // `reaches(from, to)` is a pure structural question about two immutable
271
- // representations, so the answer is the same for every caller, and a memo
272
- // minted per call throws away the whole table between questions that
273
- // overwhelmingly repeat. `active` stays per call -- it is the cycle guard for
274
- // THIS descent, not a fact about the graph, and sharing it would let one
275
- // call's in-progress pair read as a settled `false` in another.
267
+ // Per call, not per compile: on a large application the questions did not
268
+ // repeat -- 740,400 of 786,717 pair lookups during lowering were misses, and
269
+ // after lowering the predicate is asked a few dozen times in all -- so a
270
+ // module-level table held about 40 MB of answers to the end of the compile
271
+ // that nothing read again. Within one descent the memo still keeps a
272
+ // recursive sum's repeated sub-pairs from being re-derived. `active` is the
273
+ // cycle guard for THIS descent, never a settled answer. Keyed by the two
274
+ // representation keys in turn rather than by one joined string, which
275
+ // would mint a fresh string per pair for a table whose two keys exist.
276
+ const reachesMemo = new Map();
276
277
  const active = new Set();
277
278
  const reaches = (from, to) => {
278
279
  const fromKey = representationKey(from);
@@ -281,15 +282,22 @@ export const narrowingReachesTarget = (source, target) => {
281
282
  return true;
282
283
  if (narrowingClosureKeysOf(from).has(toKey))
283
284
  return true;
284
- const pair = `${fromKey}->${toKey}`;
285
- const known = reachesMemo.get(pair);
285
+ // Only an optional or a tagged union recurses; any other source answers
286
+ // directly, and memoizing those answers was most of the table.
287
+ if (from.kind !== 'optional' && from.kind !== 'tagged-union')
288
+ return (from.kind === 'class-ref' && to.kind === 'class-ref' && from.ownership === to.ownership && to.ancestors.includes(from.declaration));
289
+ let fromAnswers = reachesMemo.get(fromKey);
290
+ if (fromAnswers === undefined)
291
+ reachesMemo.set(fromKey, (fromAnswers = new Map()));
292
+ const known = fromAnswers.get(toKey);
286
293
  if (known !== undefined)
287
294
  return known;
295
+ const pair = `${fromKey}->${toKey}`;
288
296
  if (active.has(pair))
289
297
  return false;
290
298
  active.add(pair);
291
- let result = from.kind === 'class-ref' && to.kind === 'class-ref' && from.ownership === to.ownership && to.ancestors.includes(from.declaration);
292
- if (!result && from.kind === 'optional') {
299
+ let result = false;
300
+ if (from.kind === 'optional') {
293
301
  result = to.kind === 'optional' && from.absence === to.absence ? reaches(from.payload, to.payload) : reaches(from.payload, to);
294
302
  }
295
303
  if (!result && from.kind === 'tagged-union') {
@@ -301,7 +309,7 @@ export const narrowingReachesTarget = (source, target) => {
301
309
  : from.arms.some((arm) => reaches(arm.value, to));
302
310
  }
303
311
  active.delete(pair);
304
- reachesMemo.set(pair, result);
312
+ fromAnswers.set(toKey, result);
305
313
  return result;
306
314
  };
307
315
  return reaches(source, target);
@@ -853,17 +861,292 @@ const referencedRepresentations = (plan, constants) => {
853
861
  }
854
862
  return known;
855
863
  };
864
+ /**
865
+ * An `atom` whose classifier and materializer differ from pair to pair only in
866
+ * the domain they share, `${prefix}${source key}->${target key}`.
867
+ *
868
+ * Nearly every pair the graph mints is one: a structural recast, a class read
869
+ * as a record, a record stored as a union arm. A large application minted a
870
+ * quarter of a million of them, and each kept its own node, capability,
871
+ * classifier, materializer, joined id and joined domain alive to the end of
872
+ * the compile -- about 75 MB, for pairs almost none of which anything asks
873
+ * about again. The parts that are not the pair's own are kept once here, and
874
+ * the node is built when it is first looked up.
875
+ *
876
+ * Every other field must be a primitive, so a rebuilt half is
877
+ * indistinguishable from the one the registry returned; and the domain names
878
+ * the pair, so that object was never shared with another node.
879
+ */
880
+ class PairAtomShape {
881
+ prefix;
882
+ classifier;
883
+ materializer;
884
+ constructor(prefix, classifier, materializer) {
885
+ this.prefix = prefix;
886
+ this.classifier = classifier;
887
+ this.materializer = materializer;
888
+ }
889
+ matches(prefix, classifier, materializer) {
890
+ return this.prefix === prefix && sameFields(this.classifier, classifier) && sameFields(this.materializer, materializer);
891
+ }
892
+ capabilityFor(id) {
893
+ const domain = `${this.prefix}${id}`;
894
+ return {
895
+ kind: 'atom',
896
+ classifier: withDomain(this.classifier, domain),
897
+ materializer: withDomain(this.materializer, domain)
898
+ };
899
+ }
900
+ }
901
+ const sameFields = (left, right) => left.length === right.length && left.every(([key, value], index) => right[index]?.[0] === key && Object.is(right[index]?.[1], value));
902
+ const withDomain = (fields, domain) => {
903
+ const rebuilt = {};
904
+ for (const [key, value] of fields)
905
+ rebuilt[key] = key === 'domain' ? domain : value;
906
+ return rebuilt;
907
+ };
908
+ /**
909
+ * The fields of a plain data object, in order, when each is an ordinary
910
+ * primitive data property and `domain` holds the domain given; else `null`.
911
+ * The domain's own slot keeps its position and is filled in on rebuild.
912
+ */
913
+ const plainFieldsOf = (value, domain) => {
914
+ if (Object.getPrototypeOf(value) !== Object.prototype)
915
+ return null;
916
+ const fields = [];
917
+ for (const key of Reflect.ownKeys(value)) {
918
+ if (typeof key !== 'string')
919
+ return null;
920
+ const property = Object.getOwnPropertyDescriptor(value, key);
921
+ if (property === undefined || !('value' in property) || !property.writable || !property.enumerable || !property.configurable)
922
+ return null;
923
+ if (key === 'domain') {
924
+ if (property.value !== domain)
925
+ return null;
926
+ fields.push([key, undefined]);
927
+ continue;
928
+ }
929
+ const field = property.value;
930
+ if (field !== null && (typeof field === 'object' || typeof field === 'function'))
931
+ return null;
932
+ fields.push([key, field]);
933
+ }
934
+ return fields.some(([key]) => key === 'domain') ? fields : null;
935
+ };
936
+ /**
937
+ * The eager graph's node table: a `Map` from node id to node, stored by the
938
+ * two carrier keys of each pair rather than by the joined id.
939
+ *
940
+ * A string used as a `Map` key is flattened and internalized, so a table keyed
941
+ * by `${source}->${target}` held one flat copy of every id -- two carrier keys
942
+ * of a couple of hundred characters each, for every one of a quarter of a
943
+ * million pairs on a large application, about 60 MB alive to the end of the
944
+ * compile. Keyed by the parts, which are the memoized carrier keys every
945
+ * other table already holds, a node's `id` is the concatenation it was built
946
+ * as and is only flattened if something looks it up by its text. Reads and
947
+ * iteration answer exactly what the joined-key `Map` answered, in its
948
+ * insertion order.
949
+ *
950
+ * A pair whose capability is a `PairAtomShape` is stored as that shape and its
951
+ * two carriers, and its node is built on first lookup and then kept, so every
952
+ * lookup of one id answers the same object, as a stored node would.
953
+ */
954
+ class ConversionNodeTable extends Map {
955
+ #order = [];
956
+ /** The two carriers of each entry stored as a shape; unused for a stored node. */
957
+ #sources = [];
958
+ #targets = [];
959
+ /** Nodes built from a shape, by position, once something has looked them up. */
960
+ #built = new Map();
961
+ /** The shapes in use, keyed by prefix and both identities; a short list shares a key only when a field differs. */
962
+ #shapes = new Map();
963
+ #pairs = new Map();
964
+ /** The dynamic-source nodes, keyed by their target alone. */
965
+ #sole = new Map();
966
+ hasPair(sourceKey, targetKey) {
967
+ return this.#pairs.get(sourceKey)?.has(targetKey) === true;
968
+ }
969
+ hasSole(targetKey) {
970
+ return this.#sole.has(targetKey);
971
+ }
972
+ /** Adds the pair's node, or replaces it in place, as `Map.prototype.set` does. */
973
+ putPair(sourceKey, targetKey, source, target, capability) {
974
+ // A shape's node is rebuilt from its carriers, so their own keys must be the
975
+ // ones it is stored under.
976
+ const shape = capability.kind === 'atom' && representationKey(source) === sourceKey && representationKey(target) === targetKey
977
+ ? this.#shapeOf(sourceKey, targetKey, capability)
978
+ : null;
979
+ let targets = this.#pairs.get(sourceKey);
980
+ if (targets === undefined) {
981
+ targets = new Map();
982
+ this.#pairs.set(sourceKey, targets);
983
+ }
984
+ let at = targets.get(targetKey);
985
+ if (at === undefined) {
986
+ at = this.#order.length;
987
+ targets.set(targetKey, at);
988
+ }
989
+ this.#store(at, shape ?? { id: `${sourceKey}->${targetKey}`, source, target, capability });
990
+ if (shape === null)
991
+ return;
992
+ this.#sources[at] = source;
993
+ this.#targets[at] = target;
994
+ }
995
+ /** `putPair` with the plain `atom` an installed classifier/materializer pair is. */
996
+ putAtom(sourceKey, targetKey, source, target, installed) {
997
+ this.putPair(sourceKey, targetKey, source, target, {
998
+ kind: 'atom',
999
+ classifier: installed.classifier,
1000
+ materializer: installed.materializer
1001
+ });
1002
+ }
1003
+ putSole(targetKey, node) {
1004
+ let at = this.#sole.get(targetKey);
1005
+ if (at === undefined) {
1006
+ at = this.#order.length;
1007
+ this.#sole.set(targetKey, at);
1008
+ }
1009
+ this.#store(at, node);
1010
+ }
1011
+ #store(at, entry) {
1012
+ this.#built.delete(at);
1013
+ this.#order[at] = entry;
1014
+ this.#sources[at] = undefined;
1015
+ this.#targets[at] = undefined;
1016
+ }
1017
+ #shapeOf(sourceKey, targetKey, capability) {
1018
+ if (Reflect.ownKeys(capability).join() !== 'kind,classifier,materializer')
1019
+ return null;
1020
+ const domain = capability.classifier.domain;
1021
+ if (typeof domain !== 'string' || capability.materializer.domain !== domain)
1022
+ return null;
1023
+ const prefixLength = domain.length - sourceKey.length - 2 - targetKey.length;
1024
+ if (prefixLength < 0)
1025
+ return null;
1026
+ const prefix = domain.slice(0, prefixLength);
1027
+ if (domain !== `${prefix}${sourceKey}->${targetKey}`)
1028
+ return null;
1029
+ const classifier = plainFieldsOf(capability.classifier, domain);
1030
+ const materializer = classifier && plainFieldsOf(capability.materializer, domain);
1031
+ if (classifier === null || materializer === null)
1032
+ return null;
1033
+ const key = `${prefix}\u0000${String(capability.classifier.id)}\u0000${String(capability.materializer.id)}`;
1034
+ let candidates = this.#shapes.get(key);
1035
+ if (candidates === undefined) {
1036
+ candidates = [];
1037
+ this.#shapes.set(key, candidates);
1038
+ }
1039
+ const known = candidates.find((one) => one.matches(prefix, classifier, materializer));
1040
+ if (known !== undefined)
1041
+ return known;
1042
+ const shape = new PairAtomShape(prefix, classifier, materializer);
1043
+ candidates.push(shape);
1044
+ return shape;
1045
+ }
1046
+ #nodeAt(at) {
1047
+ const entry = this.#order[at];
1048
+ if (entry === undefined)
1049
+ throw new Error(`conversion node table has no entry ${at}`);
1050
+ if (!(entry instanceof PairAtomShape))
1051
+ return entry;
1052
+ const built = this.#built.get(at);
1053
+ if (built !== undefined)
1054
+ return built;
1055
+ const source = this.#sources[at];
1056
+ const target = this.#targets[at];
1057
+ if (source === undefined || target === undefined)
1058
+ throw new Error(`conversion node table entry ${at} lost its carriers`);
1059
+ const id = `${representationKey(source)}->${representationKey(target)}`;
1060
+ const node = { id, source, target, capability: entry.capabilityFor(id) };
1061
+ this.#built.set(at, node);
1062
+ return node;
1063
+ }
1064
+ *pairKeys() {
1065
+ for (const [sourceKey, targets] of this.#pairs)
1066
+ for (const targetKey of targets.keys())
1067
+ yield [sourceKey, targetKey];
1068
+ }
1069
+ /**
1070
+ * What the whole-graph check needs, without building a node per shape: the
1071
+ * nodes stored whole, and which ids are shapes. A shape is an `atom` whose
1072
+ * two domains agree, so it passes `validateCapability` and reaches a
1073
+ * materializer by itself, and nothing in it refers to another node.
1074
+ */
1075
+ storedNodes() {
1076
+ return this.#order.filter((entry) => !(entry instanceof PairAtomShape));
1077
+ }
1078
+ storedNodeOf(id) {
1079
+ const at = this.#indexOf(id);
1080
+ const entry = at === undefined ? undefined : this.#order[at];
1081
+ return entry instanceof PairAtomShape ? undefined : entry;
1082
+ }
1083
+ isShaped(id) {
1084
+ const at = this.#indexOf(id);
1085
+ return at !== undefined && this.#order[at] instanceof PairAtomShape;
1086
+ }
1087
+ // A joined id is split back into its parts at each `->` it contains, left to
1088
+ // right; a carrier key spells `->` only inside its own parentheses, so at
1089
+ // most one split names a stored pair.
1090
+ #indexOf(id) {
1091
+ for (let split = id.indexOf('->'); split !== -1; split = id.indexOf('->', split + 2)) {
1092
+ const at = this.#pairs.get(id.slice(0, split))?.get(id.slice(split + 2));
1093
+ if (at !== undefined)
1094
+ return at;
1095
+ }
1096
+ return this.#sole.get(id);
1097
+ }
1098
+ get size() {
1099
+ return this.#order.length;
1100
+ }
1101
+ get(id) {
1102
+ const at = this.#indexOf(id);
1103
+ return at === undefined ? undefined : this.#nodeAt(at);
1104
+ }
1105
+ has(id) {
1106
+ return this.#indexOf(id) !== undefined;
1107
+ }
1108
+ *entries() {
1109
+ for (let at = 0; at < this.#order.length; at++) {
1110
+ const node = this.#nodeAt(at);
1111
+ yield [node.id, node];
1112
+ }
1113
+ }
1114
+ *keys() {
1115
+ for (const [id] of this.entries())
1116
+ yield id;
1117
+ }
1118
+ *values() {
1119
+ for (let at = 0; at < this.#order.length; at++)
1120
+ yield this.#nodeAt(at);
1121
+ }
1122
+ [Symbol.iterator]() {
1123
+ return this.entries();
1124
+ }
1125
+ forEach(visit, thisArg) {
1126
+ for (const [id, node] of this.entries())
1127
+ visit.call(thisArg, node, id, this);
1128
+ }
1129
+ set() {
1130
+ throw new Error('the conversion node table is written only while the graph is built');
1131
+ }
1132
+ delete() {
1133
+ throw new Error('the conversion node table is read-only');
1134
+ }
1135
+ clear() {
1136
+ throw new Error('the conversion node table is read-only');
1137
+ }
1138
+ }
856
1139
  export const buildConversionGraph = (plan, registry = emptyConversionRegistry, constants = []) => {
857
1140
  const context = createConversionDerivationContext(registry);
858
- const nodes = new Map();
1141
+ const nodes = new ConversionNodeTable();
859
1142
  const referenced = referencedRepresentations(plan, constants);
860
1143
  const genericDynamicSource = { kind: 'dynamic', reason: 'declared-any-never-narrowed' };
861
1144
  const genericDynamicKey = representationKey(genericDynamicSource);
862
1145
  for (const representation of referenced.values()) {
863
1146
  const id = representationKey(representation);
864
- if (nodes.has(id))
1147
+ if (nodes.hasSole(id))
865
1148
  continue;
866
- nodes.set(id, {
1149
+ nodes.putSole(id, {
867
1150
  id,
868
1151
  // Conversion always starts from the dynamic carrier: it is the only
869
1152
  // source that needs classifying at all. A statically typed value already
@@ -903,8 +1186,7 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
903
1186
  // native array entry could no longer cite its identity storage).
904
1187
  if (sourceKey === targetKey || !referencedKeys.has(targetKey))
905
1188
  continue;
906
- const id = `${sourceKey}->${targetKey}`;
907
- if (nodes.has(id))
1189
+ if (nodes.hasPair(sourceKey, targetKey))
908
1190
  continue;
909
1191
  const installed = registry.narrowing(representation, target);
910
1192
  // The same order `conversion/nodes.ts`'s `capabilityOf` asks in: an
@@ -918,18 +1200,13 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
918
1200
  // would mint for it, which the array rule then refuses.
919
1201
  const recast = installed ? null : (registry.widening(representation, target) ?? registry.recasting(representation, target));
920
1202
  const recipe = installed || recast ? null : registry.staticRecipe(representation, target);
921
- nodes.set(id, {
922
- id,
923
- source: representation,
924
- target,
925
- capability: installed
926
- ? narrowingCapabilityFor(representation, target, installed)
927
- : recast
928
- ? { kind: 'atom', classifier: recast.classifier, materializer: recast.materializer }
929
- : recipe
930
- ? { kind: 'static', materializer: recipe }
931
- : { kind: 'never', reason: `no runtime narrowing is installed from ${sourceKey} to ${targetKey}` }
932
- });
1203
+ nodes.putPair(sourceKey, targetKey, representation, target, installed
1204
+ ? narrowingCapabilityFor(representation, target, installed)
1205
+ : recast
1206
+ ? { kind: 'atom', classifier: recast.classifier, materializer: recast.materializer }
1207
+ : recipe
1208
+ ? { kind: 'static', materializer: recipe }
1209
+ : { kind: 'never', reason: `no runtime narrowing is installed from ${sourceKey} to ${targetKey}` });
933
1210
  }
934
1211
  }
935
1212
  // An absent array proven present and then read as the interface that
@@ -950,18 +1227,12 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
950
1227
  continue;
951
1228
  if (arrayExtensionKey(target.extension) === arrayExtensionKey(payload.extension))
952
1229
  continue;
953
- const id = `${sourceKey}->${targetKey}`;
954
- if (nodes.has(id))
1230
+ if (nodes.hasPair(sourceKey, targetKey))
955
1231
  continue;
956
1232
  const installed = registry.narrowing(source, target);
957
1233
  if (!installed)
958
1234
  continue;
959
- nodes.set(id, {
960
- id,
961
- source,
962
- target,
963
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
964
- });
1235
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
965
1236
  }
966
1237
  }
967
1238
  // A sum arm holding a base-class Ref can narrow directly to a referenced
@@ -975,18 +1246,12 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
975
1246
  for (const [targetKey, target] of descendantClassTargets) {
976
1247
  if (!narrowingReachesTarget(source, target))
977
1248
  continue;
978
- const id = `${sourceKey}->${targetKey}`;
979
- if (nodes.has(id))
1249
+ if (nodes.hasPair(sourceKey, targetKey))
980
1250
  continue;
981
1251
  const installed = registry.narrowing(source, target);
982
1252
  if (!installed)
983
1253
  continue;
984
- nodes.set(id, {
985
- id,
986
- source,
987
- target,
988
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
989
- });
1254
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
990
1255
  }
991
1256
  }
992
1257
  // Widening stores, the mirror of the narrowing read above: `const x: boolean
@@ -1003,18 +1268,12 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1003
1268
  const sourceKey = representationKey(source);
1004
1269
  if (!referencedKeys.has(sourceKey))
1005
1270
  continue;
1006
- const id = `${sourceKey}->${targetKey}`;
1007
- if (nodes.has(id))
1271
+ if (nodes.hasPair(sourceKey, targetKey))
1008
1272
  continue;
1009
1273
  const installed = registry.widening(source, target);
1010
1274
  if (!installed)
1011
1275
  continue;
1012
- nodes.set(id, {
1013
- id,
1014
- source,
1015
- target,
1016
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
1017
- });
1276
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
1018
1277
  }
1019
1278
  }
1020
1279
  // A sum source is not derivable from a sum target: the target describes its
@@ -1029,18 +1288,12 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1029
1288
  for (const [sourceKey, source] of sumCarriers) {
1030
1289
  if (sourceKey === targetKey)
1031
1290
  continue;
1032
- const id = `${sourceKey}->${targetKey}`;
1033
- if (nodes.has(id))
1291
+ if (nodes.hasPair(sourceKey, targetKey))
1034
1292
  continue;
1035
1293
  const installed = registry.widening(source, target);
1036
1294
  if (!installed)
1037
1295
  continue;
1038
- nodes.set(id, {
1039
- id,
1040
- source,
1041
- target,
1042
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
1043
- });
1296
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
1044
1297
  }
1045
1298
  }
1046
1299
  // Function declarations and closed families retain authentication metadata
@@ -1065,18 +1318,12 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1065
1318
  for (const [sourceKey, source] of callableSourcesByAbi.get(abiKey(target.abi)) ?? []) {
1066
1319
  if (sourceKey === targetKey)
1067
1320
  continue;
1068
- const id = `${sourceKey}->${targetKey}`;
1069
- if (nodes.has(id))
1321
+ if (nodes.hasPair(sourceKey, targetKey))
1070
1322
  continue;
1071
1323
  const installed = registry.widening(source, target);
1072
1324
  if (!installed)
1073
1325
  continue;
1074
- nodes.set(id, {
1075
- id,
1076
- source,
1077
- target,
1078
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
1079
- });
1326
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
1080
1327
  }
1081
1328
  }
1082
1329
  // Boxing into `dynamic`: the one widening target `wideningSourcesOf` cannot
@@ -1102,18 +1349,12 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1102
1349
  for (const [sourceKey, source] of referencedKeyed) {
1103
1350
  if (sourceKey === targetKey)
1104
1351
  continue;
1105
- const id = `${sourceKey}->${targetKey}`;
1106
- if (nodes.has(id))
1352
+ if (nodes.hasPair(sourceKey, targetKey))
1107
1353
  continue;
1108
1354
  const installed = registry.widening(source, target);
1109
1355
  if (!installed)
1110
1356
  continue;
1111
- nodes.set(id, {
1112
- id,
1113
- source,
1114
- target,
1115
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
1116
- });
1357
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
1117
1358
  }
1118
1359
  }
1119
1360
  // Conversion into a function IDENTITY: its own loop for the same reason the
@@ -1129,18 +1370,12 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1129
1370
  for (const [sourceKey, source] of referencedKeyed) {
1130
1371
  if (sourceKey === targetKey)
1131
1372
  continue;
1132
- const id = `${sourceKey}->${targetKey}`;
1133
- if (nodes.has(id))
1373
+ if (nodes.hasPair(sourceKey, targetKey))
1134
1374
  continue;
1135
1375
  const installed = registry.widening(source, target);
1136
1376
  if (!installed)
1137
1377
  continue;
1138
- nodes.set(id, {
1139
- id,
1140
- source,
1141
- target,
1142
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
1143
- });
1378
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
1144
1379
  }
1145
1380
  }
1146
1381
  // Class upcasts: a derived class-ref stored where a base class-ref is
@@ -1159,8 +1394,7 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1159
1394
  for (const [sourceKey, source] of classRefs) {
1160
1395
  if (sourceKey === targetKey)
1161
1396
  continue;
1162
- const id = `${sourceKey}->${targetKey}`;
1163
- if (nodes.has(id))
1397
+ if (nodes.hasPair(sourceKey, targetKey))
1164
1398
  continue;
1165
1399
  // Both directions, from one enumeration. Upcast (a derived class stored
1166
1400
  // where a base is declared) is a widening; DOWNCAST -- a base-declared
@@ -1173,12 +1407,7 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1173
1407
  const installed = registry.widening(source, target) ?? registry.narrowing(source, target);
1174
1408
  if (!installed)
1175
1409
  continue;
1176
- nodes.set(id, {
1177
- id,
1178
- source,
1179
- target,
1180
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
1181
- });
1410
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
1182
1411
  }
1183
1412
  }
1184
1413
  // The constructor-side mirror: a derived class's constructor (or a family of
@@ -1194,18 +1423,12 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1194
1423
  continue;
1195
1424
  if (!source.members.every((member) => target.members.includes(member)))
1196
1425
  continue;
1197
- const id = `${sourceKey}->${targetKey}`;
1198
- if (nodes.has(id))
1426
+ if (nodes.hasPair(sourceKey, targetKey))
1199
1427
  continue;
1200
1428
  const installed = registry.widening(source, target);
1201
1429
  if (!installed)
1202
1430
  continue;
1203
- nodes.set(id, {
1204
- id,
1205
- source,
1206
- target,
1207
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
1208
- });
1431
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
1209
1432
  }
1210
1433
  }
1211
1434
  // The same class upcast when the declared destination keeps absence or
@@ -1216,18 +1439,12 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1216
1439
  const classSumTargets = keyedDistinct(referenced.values()).filter(([, one]) => one.kind === 'optional' || one.kind === 'tagged-union');
1217
1440
  for (const [targetKey, target] of classSumTargets) {
1218
1441
  for (const [sourceKey, source] of classRefs) {
1219
- const id = `${sourceKey}->${targetKey}`;
1220
- if (nodes.has(id))
1442
+ if (nodes.hasPair(sourceKey, targetKey))
1221
1443
  continue;
1222
1444
  const installed = registry.widening(source, target);
1223
1445
  if (!installed)
1224
1446
  continue;
1225
- nodes.set(id, {
1226
- id,
1227
- source,
1228
- target,
1229
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
1230
- });
1447
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
1231
1448
  }
1232
1449
  }
1233
1450
  // A choice among generic functions (`generic-function-set`, model.ts): a
@@ -1252,18 +1469,12 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1252
1469
  target.members.length === 1;
1253
1470
  if (!widens)
1254
1471
  continue;
1255
- const id = `${sourceKey}->${targetKey}`;
1256
- if (nodes.has(id))
1472
+ if (nodes.hasPair(sourceKey, targetKey))
1257
1473
  continue;
1258
1474
  const installed = registry.widening(source, target);
1259
1475
  if (!installed)
1260
1476
  continue;
1261
- nodes.set(id, {
1262
- id,
1263
- source,
1264
- target,
1265
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
1266
- });
1477
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
1267
1478
  }
1268
1479
  }
1269
1480
  // Union recasts: two tagged unions that carry the same member set at
@@ -1356,11 +1567,7 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1356
1567
  // dynamic-materialization nodes above are keyed by their target alone, and
1357
1568
  // the loop would have asked about those pairs before.
1358
1569
  const sourcesWithNodeInto = new Map();
1359
- for (const node of nodes.values()) {
1360
- const sourceKey = representationKey(node.source);
1361
- const targetKey = representationKey(node.target);
1362
- if (node.id !== `${sourceKey}->${targetKey}`)
1363
- continue;
1570
+ for (const [sourceKey, targetKey] of nodes.pairKeys()) {
1364
1571
  let sources = sourcesWithNodeInto.get(targetKey);
1365
1572
  if (!sources) {
1366
1573
  sources = new Set();
@@ -1376,13 +1583,7 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1376
1583
  const installed = registry.recasting(source, target);
1377
1584
  if (!installed)
1378
1585
  continue;
1379
- const id = `${sourceKey}->${targetKey}`;
1380
- nodes.set(id, {
1381
- id,
1382
- source,
1383
- target,
1384
- capability: { kind: 'atom', classifier: installed.classifier, materializer: installed.materializer }
1385
- });
1586
+ nodes.putAtom(sourceKey, targetKey, source, target, installed);
1386
1587
  }
1387
1588
  }
1388
1589
  // Dynamic reasons identify provenance, not distinct boxed ABIs. The generic
@@ -1397,20 +1598,14 @@ export const buildConversionGraph = (plan, registry = emptyConversionRegistry, c
1397
1598
  if (sourceKey === genericDynamicKey || source.kind !== 'dynamic')
1398
1599
  continue;
1399
1600
  for (const [targetKey, target] of referenced) {
1400
- const id = `${sourceKey}->${targetKey}`;
1401
- if (nodes.has(id))
1601
+ if (nodes.hasPair(sourceKey, targetKey))
1402
1602
  continue;
1403
- nodes.set(id, {
1404
- id,
1405
- source,
1406
- target,
1407
- capability: deriveConversionCapability(target, context)
1408
- });
1603
+ nodes.putPair(sourceKey, targetKey, source, target, deriveConversionCapability(target, context));
1409
1604
  }
1410
1605
  }
1411
1606
  // A graph whose recursive references never close is materializable in each
1412
1607
  // node taken alone and unrunnable taken together; the whole-graph check is
1413
1608
  // the only place that difference is visible.
1414
- validateConversionGraph([...nodes.values()]);
1609
+ validateConversionGraph(nodes.storedNodes(), (id) => nodes.storedNodeOf(id), { has: (id) => nodes.isShaped(id) });
1415
1610
  return { nodes };
1416
1611
  };