@geastack/compiler 1.0.26 → 1.0.29

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 (946) 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 +275 -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 +52 -0
  27. package/dist/conversion/dynamic-wrapper.js +82 -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 +480 -0
  77. package/dist/ir/absent-class-arm.d.ts +1 -1
  78. package/dist/ir/absent-class-arm.js +1 -1
  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 +63 -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 +1197 -36
  112. package/dist/ir/class-allocation-domain.d.ts +9 -0
  113. package/dist/ir/class-allocation-domain.js +111 -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/lazy-splits.d.ts +20 -0
  175. package/dist/ir/lazy-splits.js +58 -0
  176. package/dist/ir/literal-set-membership.d.ts +2 -2
  177. package/dist/ir/literal-set-membership.js +2 -2
  178. package/dist/ir/logical-receivers.d.ts +15 -0
  179. package/dist/ir/logical-receivers.js +98 -0
  180. package/dist/ir/lower-allocation.js +16 -13
  181. package/dist/ir/lower-destructuring.js +7 -6
  182. package/dist/ir/lower-graph.d.ts +4 -4
  183. package/dist/ir/lower-graph.js +2 -2
  184. package/dist/ir/lower-invocation.d.ts +2 -2
  185. package/dist/ir/lower-invocation.js +99 -57
  186. package/dist/ir/lower-narrow.js +35 -13
  187. package/dist/ir/lower-operands.d.ts +40 -11
  188. package/dist/ir/lower-operands.js +206 -87
  189. package/dist/ir/lower-property.js +31 -8
  190. package/dist/ir/lower.js +9 -9
  191. package/dist/ir/merge-conversions.d.ts +18 -0
  192. package/dist/ir/merge-conversions.js +106 -0
  193. package/dist/ir/model.d.ts +138 -28
  194. package/dist/ir/native-accessor-definition.d.ts +104 -0
  195. package/dist/ir/native-accessor-definition.js +735 -0
  196. package/dist/ir/native-array-descriptor-snapshot.d.ts +45 -0
  197. package/dist/ir/native-array-descriptor-snapshot.js +380 -0
  198. package/dist/ir/native-array-insertion.d.ts +16 -0
  199. package/dist/ir/native-array-insertion.js +42 -0
  200. package/dist/ir/native-callable-argument.d.ts +38 -0
  201. package/dist/ir/native-callable-argument.js +128 -0
  202. package/dist/ir/native-callable-data-flow.d.ts +9 -0
  203. package/dist/ir/native-callable-data-flow.js +59 -0
  204. package/dist/ir/native-callable-data-owner.d.ts +45 -0
  205. package/dist/ir/native-callable-data-owner.js +755 -0
  206. package/dist/ir/native-callable-data-reads.d.ts +45 -0
  207. package/dist/ir/native-callable-data-reads.js +282 -0
  208. package/dist/ir/native-callable-data-slots.d.ts +78 -0
  209. package/dist/ir/native-callable-data-slots.js +403 -0
  210. package/dist/ir/native-callable-data-write.d.ts +58 -0
  211. package/dist/ir/native-callable-data-write.js +254 -0
  212. package/dist/ir/native-callable-integrity.d.ts +23 -0
  213. package/dist/ir/native-callable-integrity.js +77 -0
  214. package/dist/ir/native-callable-own-property.d.ts +42 -0
  215. package/dist/ir/native-callable-own-property.js +505 -0
  216. package/dist/ir/native-callable-prototype.d.ts +38 -0
  217. package/dist/ir/native-callable-prototype.js +307 -0
  218. package/dist/ir/native-callable-readonly-set.d.ts +25 -0
  219. package/dist/ir/native-callable-readonly-set.js +238 -0
  220. package/dist/ir/native-class-accessor.d.ts +3 -3
  221. package/dist/ir/native-class-accessor.js +3 -3
  222. package/dist/ir/native-class-construction.js +2 -2
  223. package/dist/ir/native-constructor-reads.d.ts +15 -0
  224. package/dist/ir/native-constructor-reads.js +156 -0
  225. package/dist/ir/native-constructor-static.d.ts +18 -0
  226. package/dist/ir/native-constructor-static.js +61 -0
  227. package/dist/ir/native-data-definition.d.ts +43 -0
  228. package/dist/ir/native-data-definition.js +222 -0
  229. package/dist/ir/native-document-array-entries.d.ts +15 -0
  230. package/dist/ir/native-document-array-entries.js +37 -0
  231. package/dist/ir/native-document-entries.d.ts +21 -0
  232. package/dist/ir/native-document-entries.js +74 -0
  233. package/dist/ir/native-entry-field-views.d.ts +18 -0
  234. package/dist/ir/native-entry-field-views.js +62 -0
  235. package/dist/ir/native-field-view-domains.d.ts +43 -0
  236. package/dist/ir/native-field-view-domains.js +300 -0
  237. package/dist/ir/native-field-view-facts.d.ts +97 -0
  238. package/dist/ir/native-field-view-facts.js +341 -0
  239. package/dist/ir/native-fixed-layout.js +1 -1
  240. package/dist/ir/native-host-construction.d.ts +4 -6
  241. package/dist/ir/native-host-construction.js +4 -6
  242. package/dist/ir/native-host-method-reads.d.ts +13 -0
  243. package/dist/ir/native-host-method-reads.js +53 -0
  244. package/dist/ir/native-iterator-field-views.d.ts +15 -0
  245. package/dist/ir/native-iterator-field-views.js +39 -0
  246. package/dist/ir/native-iterator-receivers.d.ts +8 -0
  247. package/dist/ir/native-iterator-receivers.js +59 -0
  248. package/dist/ir/native-logical-receiver-body.d.ts +8 -0
  249. package/dist/ir/native-logical-receiver-body.js +23 -0
  250. package/dist/ir/native-method-frames.d.ts +18 -0
  251. package/dist/ir/native-method-frames.js +127 -0
  252. package/dist/ir/native-method-read-source.d.ts +16 -0
  253. package/dist/ir/native-method-read-source.js +61 -0
  254. package/dist/ir/native-object-data-slots.d.ts +60 -0
  255. package/dist/ir/native-object-data-slots.js +493 -0
  256. package/dist/ir/native-object-sample.d.ts +32 -0
  257. package/dist/ir/native-object-sample.js +113 -0
  258. package/dist/ir/native-own-assignment.d.ts +123 -0
  259. package/dist/ir/native-own-assignment.js +529 -0
  260. package/dist/ir/native-property-coercibility.d.ts +3 -0
  261. package/dist/ir/native-property-coercibility.js +10 -0
  262. package/dist/ir/native-property-key-texts.d.ts +11 -0
  263. package/dist/ir/native-property-key-texts.js +41 -0
  264. package/dist/ir/native-property-presence-effects.d.ts +11 -0
  265. package/dist/ir/native-property-presence-effects.js +19 -0
  266. package/dist/ir/native-property-presence.d.ts +27 -0
  267. package/dist/ir/native-property-presence.js +275 -0
  268. package/dist/ir/native-prototype-calls.d.ts +19 -0
  269. package/dist/ir/native-prototype-calls.js +53 -0
  270. package/dist/ir/native-prototype-conversions.d.ts +5 -0
  271. package/dist/ir/native-prototype-conversions.js +46 -0
  272. package/dist/ir/native-prototype-presence-demand.d.ts +9 -0
  273. package/dist/ir/native-prototype-presence-demand.js +58 -0
  274. package/dist/ir/native-record-index.d.ts +1 -1
  275. package/dist/ir/native-union-method-targets.d.ts +8 -0
  276. package/dist/ir/native-union-method-targets.js +69 -0
  277. package/dist/ir/no-normal-call-completion.d.ts +15 -0
  278. package/dist/ir/no-normal-call-completion.js +184 -0
  279. package/dist/ir/non-normal-receiver.d.ts +39 -0
  280. package/dist/ir/non-normal-receiver.js +253 -0
  281. package/dist/ir/operation-conversions.d.ts +29 -0
  282. package/dist/ir/operation-conversions.js +484 -0
  283. package/dist/ir/operation-index.d.ts +1 -1
  284. package/dist/ir/presence-proof.d.ts +1 -1
  285. package/dist/ir/presence-proof.js +1 -0
  286. package/dist/ir/program-conversions.d.ts +48 -0
  287. package/dist/ir/program-conversions.js +221 -0
  288. package/dist/ir/program-facts.d.ts +4 -1
  289. package/dist/ir/program-facts.js +9 -7
  290. package/dist/ir/promise-reaction-conversions.d.ts +6 -0
  291. package/dist/ir/promise-reaction-conversions.js +92 -0
  292. package/dist/ir/property-read-conversions.d.ts +10 -0
  293. package/dist/ir/property-read-conversions.js +124 -0
  294. package/dist/ir/proven-branches.d.ts +2 -1
  295. package/dist/ir/proven-branches.js +97 -10
  296. package/dist/ir/publish-conversion-recipes.d.ts +27 -0
  297. package/dist/ir/publish-conversion-recipes.js +246 -0
  298. package/dist/ir/publish-native-field-view-facts.d.ts +17 -0
  299. package/dist/ir/publish-native-field-view-facts.js +119 -0
  300. package/dist/ir/queries.js +42 -4
  301. package/dist/ir/read-only-dictionary.d.ts +38 -0
  302. package/dist/ir/read-only-dictionary.js +281 -0
  303. package/dist/ir/reflection-demand.d.ts +2 -0
  304. package/dist/ir/reflection-demand.js +600 -44
  305. package/dist/ir/shake.d.ts +3 -0
  306. package/dist/ir/shake.js +24 -14
  307. package/dist/ir/shared-empty-records.js +1 -1
  308. package/dist/ir/short-circuit-threading.d.ts +23 -0
  309. package/dist/ir/short-circuit-threading.js +133 -0
  310. package/dist/ir/spread-conversions.d.ts +27 -0
  311. package/dist/ir/spread-conversions.js +134 -0
  312. package/dist/ir/spread-copy-elision.d.ts +2 -2
  313. package/dist/ir/spread-copy-elision.js +7 -4
  314. package/dist/ir/string-layout-reuse.d.ts +9 -8
  315. package/dist/ir/string-layout-reuse.js +8 -16
  316. package/dist/ir/string-length-reuse.d.ts +20 -4
  317. package/dist/ir/string-length-reuse.js +57 -13
  318. package/dist/ir/transfer.d.ts +5 -5
  319. package/dist/ir/transfer.js +53 -31
  320. package/dist/ir/typed-property-access.d.ts +2 -0
  321. package/dist/ir/typed-property-access.js +21 -8
  322. package/dist/ir/virtual-call-frames.d.ts +7 -0
  323. package/dist/ir/virtual-call-frames.js +8 -0
  324. package/dist/native-signatures.d.ts +45 -0
  325. package/dist/native-signatures.js +368 -0
  326. package/dist/plugins/gea/host.d.ts +6 -1
  327. package/dist/plugins/gea/host.js +30 -1
  328. package/dist/plugins/gea/lower.js +9 -3
  329. package/dist/plugins/gea/members.js +1 -1
  330. package/dist/plugins/gea/plugin.js +2 -1
  331. package/dist/plugins/gea/prelude.d.ts +1 -1
  332. package/dist/plugins/gea/prelude.js +1 -1
  333. package/dist/plugins/gea/reactive-slots.js +6 -6
  334. package/dist/plugins/gea/render-bridge.js +5 -6
  335. package/dist/plugins/gea/user-agent-styles.js +1 -1
  336. package/dist/plugins/installed.d.ts +2 -2
  337. package/dist/plugins/installed.js +2 -2
  338. package/dist/plugins/load.js +1 -1
  339. package/dist/plugins/model.d.ts +21 -36
  340. package/dist/plugins/webgl/host.d.ts +23 -23
  341. package/dist/plugins/webgl/host.js +25 -26
  342. package/dist/plugins/webgl/plugin.d.ts +16 -19
  343. package/dist/plugins/webgl/plugin.js +16 -23
  344. package/dist/project-preparation.js +12 -14
  345. package/dist/projection/abi.js +13 -10
  346. package/dist/projection/bindings.d.ts +8 -0
  347. package/dist/projection/bindings.js +36 -5
  348. package/dist/projection/callee.d.ts +17 -15
  349. package/dist/projection/callee.js +108 -81
  350. package/dist/projection/class-property-presence.d.ts +1 -1
  351. package/dist/projection/class-property-presence.js +1 -1
  352. package/dist/projection/classes.d.ts +2 -0
  353. package/dist/projection/classes.js +4 -1
  354. package/dist/projection/dispatch.d.ts +19 -3
  355. package/dist/projection/dispatch.js +39 -16
  356. package/dist/projection/fields.d.ts +14 -2
  357. package/dist/projection/fields.js +100 -38
  358. package/dist/projection/function-source.d.ts +5 -0
  359. package/dist/projection/function-source.js +15 -0
  360. package/dist/projection/immediate-callees.d.ts +12 -0
  361. package/dist/projection/immediate-callees.js +36 -0
  362. package/dist/projection/index-protocols.d.ts +12 -0
  363. package/dist/projection/index-protocols.js +39 -0
  364. package/dist/projection/instance-test.d.ts +8 -0
  365. package/dist/projection/instance-test.js +3 -1
  366. package/dist/projection/method-values.d.ts +7 -0
  367. package/dist/projection/method-values.js +29 -0
  368. package/dist/projection/native-accessor-access.d.ts +26 -0
  369. package/dist/projection/native-accessor-access.js +18 -0
  370. package/dist/projection/native-callable-data.d.ts +24 -0
  371. package/dist/projection/native-callable-data.js +101 -0
  372. package/dist/projection/native-expando.d.ts +3 -0
  373. package/dist/projection/native-expando.js +13 -0
  374. package/dist/projection/native-object-data.d.ts +47 -0
  375. package/dist/projection/native-object-data.js +203 -0
  376. package/dist/projection/native-prototype-methods.d.ts +22 -0
  377. package/dist/projection/native-prototype-methods.js +161 -0
  378. package/dist/projection/regexp-fields.d.ts +35 -0
  379. package/dist/projection/regexp-fields.js +80 -0
  380. package/dist/projection/slots.d.ts +5 -1
  381. package/dist/projection/slots.js +89 -10
  382. package/dist/representation/derive.d.ts +5 -7
  383. package/dist/representation/derive.js +78 -78
  384. package/dist/representation/difference.js +1 -1
  385. package/dist/representation/host-abi.d.ts +2 -2
  386. package/dist/representation/host-abi.js +4 -5
  387. package/dist/representation/host-templates.d.ts +6 -2
  388. package/dist/representation/host-templates.js +8 -2
  389. package/dist/representation/intersection.d.ts +3 -3
  390. package/dist/representation/intersection.js +3 -3
  391. package/dist/representation/merge.js +1 -1
  392. package/dist/representation/model.d.ts +27 -22
  393. package/dist/representation/model.js +35 -22
  394. package/dist/representation/native-callable-data-storage.d.ts +85 -0
  395. package/dist/representation/native-callable-data-storage.js +398 -0
  396. package/dist/representation/native-data-properties.d.ts +14 -0
  397. package/dist/representation/native-data-properties.js +52 -0
  398. package/dist/representation/native-logical-receiver.d.ts +36 -0
  399. package/dist/representation/native-logical-receiver.js +92 -0
  400. package/dist/representation/object-shape.d.ts +1 -1
  401. package/dist/representation/object-shape.js +1 -1
  402. package/dist/representation/optional.js +2 -2
  403. package/dist/representation/physical-carrier.d.ts +25 -0
  404. package/dist/representation/physical-carrier.js +153 -0
  405. package/dist/representation/policies.d.ts +16 -10
  406. package/dist/representation/policies.js +5 -1
  407. package/dist/representation/primitives.js +3 -0
  408. package/dist/representation/promise-resolution.d.ts +19 -0
  409. package/dist/representation/promise-resolution.js +50 -0
  410. package/dist/representation/prototype-domains.d.ts +43 -0
  411. package/dist/representation/prototype-domains.js +226 -0
  412. package/dist/representation/proxy-carriers.d.ts +3 -3
  413. package/dist/representation/proxy-carriers.js +2 -3
  414. package/dist/representation/publish.d.ts +4 -0
  415. package/dist/representation/publish.js +73 -42
  416. package/dist/representation/record-fields.d.ts +2 -2
  417. package/dist/representation/record-fields.js +2 -2
  418. package/dist/representation/static-field-cells.d.ts +1 -1
  419. package/dist/representation/structural-method-abi.d.ts +6 -0
  420. package/dist/representation/structural-method-abi.js +13 -0
  421. package/dist/representation/unassigned-binding-cells.d.ts +3 -3
  422. package/dist/representation/union.js +19 -4
  423. package/dist/representation/unwritten-record-members.d.ts +6 -6
  424. package/dist/representation/unwritten-record-members.js +1 -1
  425. package/dist/representation/value-records.js +77 -5
  426. package/dist/representation/verify.js +1 -1
  427. package/dist/representation/well-known-symbols.d.ts +3 -0
  428. package/dist/representation/well-known-symbols.js +11 -0
  429. package/dist/semantics/alias-this-field-declaration-transform.js +3 -3
  430. package/dist/semantics/ambient-type-realization-transform.d.ts +19 -20
  431. package/dist/semantics/ambient-type-realization-transform.js +20 -12
  432. package/dist/semantics/ambient.d.ts +13 -13
  433. package/dist/semantics/ambient.js +12 -12
  434. package/dist/semantics/borrowed-builtin-call-bind-source-transform.d.ts +5 -0
  435. package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +110 -52
  436. package/dist/semantics/borrowed-method-receiver-copy-source-transform.d.ts +4 -4
  437. package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +4 -4
  438. package/dist/semantics/call-invalidated-narrowing.js +2 -2
  439. package/dist/semantics/callable-origins.d.ts +49 -1
  440. package/dist/semantics/callable-origins.js +148 -32
  441. package/dist/semantics/callable-own-data-slots.d.ts +122 -0
  442. package/dist/semantics/callable-own-data-slots.js +421 -0
  443. package/dist/semantics/class-alias.d.ts +4 -4
  444. package/dist/semantics/class-alias.js +4 -4
  445. package/dist/semantics/class-heritage.d.ts +8 -7
  446. package/dist/semantics/class-heritage.js +8 -7
  447. package/dist/semantics/commonjs-wrapper.js +5 -2
  448. package/dist/semantics/constructor-function-class-source-transform.js +2 -3
  449. package/dist/semantics/constructor-slot-subclasses.d.ts +1 -1
  450. package/dist/semantics/constructor-slot-subclasses.js +5 -5
  451. package/dist/semantics/declaration-overlay-transform.d.ts +9 -12
  452. package/dist/semantics/declaration-overlay-transform.js +138 -141
  453. package/dist/semantics/declared-integers.d.ts +24 -0
  454. package/dist/semantics/declared-integers.js +34 -0
  455. package/dist/semantics/define-property-source-transform.js +21 -8
  456. package/dist/semantics/dynamic-fallback.d.ts +1 -1
  457. package/dist/semantics/dynamic-fallback.js +1 -1
  458. package/dist/semantics/frontend.d.ts +12 -16
  459. package/dist/semantics/frontend.js +187 -75
  460. package/dist/semantics/host-methods.d.ts +3 -3
  461. package/dist/semantics/host-methods.js +1 -1
  462. package/dist/semantics/host-protocols.d.ts +3 -3
  463. package/dist/semantics/host-protocols.js +26 -26
  464. package/dist/semantics/interface-families.d.ts +2 -2
  465. package/dist/semantics/interface-families.js +46 -47
  466. package/dist/semantics/interface-implementors.d.ts +12 -15
  467. package/dist/semantics/interface-implementors.js +12 -15
  468. package/dist/semantics/jsdoc-namepath-transform.js +7 -7
  469. package/dist/semantics/model/operands.d.ts +18 -3
  470. package/dist/semantics/model/operands.js +41 -0
  471. package/dist/semantics/model/operations.d.ts +82 -1
  472. package/dist/semantics/model/selected-signature.d.ts +24 -3
  473. package/dist/semantics/model/structural-type-table.js +24 -6
  474. package/dist/semantics/model/structural-types.d.ts +10 -8
  475. package/dist/semantics/model/structural-types.js +7 -5
  476. package/dist/semantics/module-resolution.js +3 -2
  477. package/dist/semantics/native-callable-readonly-set.d.ts +17 -0
  478. package/dist/semantics/native-callable-readonly-set.js +1 -0
  479. package/dist/semantics/native-function-signatures.d.ts +14 -0
  480. package/dist/semantics/native-function-signatures.js +96 -0
  481. package/dist/semantics/native-object-data-slots.d.ts +72 -0
  482. package/dist/semantics/native-object-data-slots.js +679 -0
  483. package/dist/semantics/native-own-assignment.d.ts +62 -0
  484. package/dist/semantics/native-own-assignment.js +1 -0
  485. package/dist/semantics/normalize/absent-globals.d.ts +8 -8
  486. package/dist/semantics/normalize/absent-globals.js +5 -5
  487. package/dist/semantics/normalize/arguments-objects.d.ts +3 -1
  488. package/dist/semantics/normalize/arguments-objects.js +1 -1
  489. package/dist/semantics/normalize/asserted-argument-arms.d.ts +7 -7
  490. package/dist/semantics/normalize/asserted-arm-absence.d.ts +1 -2
  491. package/dist/semantics/normalize/asserted-arm-absence.js +1 -2
  492. package/dist/semantics/normalize/binding-fixpoint.js +3 -3
  493. package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +2 -2
  494. package/dist/semantics/normalize/bivariant-slot-parameter.js +6 -6
  495. package/dist/semantics/normalize/callable-data-write.d.ts +46 -0
  496. package/dist/semantics/normalize/callable-data-write.js +182 -0
  497. package/dist/semantics/normalize/census.js +5 -5
  498. package/dist/semantics/normalize/class-instance-record-statement.d.ts +1 -1
  499. package/dist/semantics/normalize/class-instance-record-statement.js +1 -1
  500. package/dist/semantics/normalize/collection-bindings.d.ts +11 -13
  501. package/dist/semantics/normalize/collection-bindings.js +60 -33
  502. package/dist/semantics/normalize/commonjs-module-record.d.ts +7 -4
  503. package/dist/semantics/normalize/commonjs-module-record.js +93 -4
  504. package/dist/semantics/normalize/contribution.js +4 -4
  505. package/dist/semantics/normalize/dead-method-copies.d.ts +5 -5
  506. package/dist/semantics/normalize/dead-typeof-guards.d.ts +2 -2
  507. package/dist/semantics/normalize/dead-typeof-guards.js +6 -6
  508. package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +22 -13
  509. package/dist/semantics/normalize/deferred-intrinsic-protocols.js +85 -13
  510. package/dist/semantics/normalize/derived-expression-type.d.ts +129 -91
  511. package/dist/semantics/normalize/derived-expression-type.js +419 -192
  512. package/dist/semantics/normalize/field-bindings.d.ts +4 -4
  513. package/dist/semantics/normalize/field-bindings.js +334 -67
  514. package/dist/semantics/normalize/flow/array-element-continuation.d.ts +2 -2
  515. package/dist/semantics/normalize/flow/array-element-continuation.js +35 -18
  516. package/dist/semantics/normalize/flow/callable-array-origins.d.ts +1 -1
  517. package/dist/semantics/normalize/flow/callable-array-origins.js +3 -3
  518. package/dist/semantics/normalize/flow/callable-completions.d.ts +2 -2
  519. package/dist/semantics/normalize/flow/callable-completions.js +2 -2
  520. package/dist/semantics/normalize/flow/callable-reach.d.ts +19 -6
  521. package/dist/semantics/normalize/flow/callable-reach.js +722 -289
  522. package/dist/semantics/normalize/flow/class-family-member-read.js +24 -29
  523. package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +2 -2
  524. package/dist/semantics/normalize/flow/collection-value-continuation.js +2 -2
  525. package/dist/semantics/normalize/flow/component-solver.d.ts +19 -16
  526. package/dist/semantics/normalize/flow/component-solver.js +138 -69
  527. package/dist/semantics/normalize/flow/computed-key-set.d.ts +6 -7
  528. package/dist/semantics/normalize/flow/computed-key-set.js +20 -1
  529. package/dist/semantics/normalize/flow/export-importers.js +4 -4
  530. package/dist/semantics/normalize/flow/host-text-sink.d.ts +3 -2
  531. package/dist/semantics/normalize/flow/host-text-sink.js +4 -3
  532. package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +3 -2
  533. package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +2 -2
  534. package/dist/semantics/normalize/flow/intrinsic-data-definition.js +3 -3
  535. package/dist/semantics/normalize/flow/invocation-facts.d.ts +3 -2
  536. package/dist/semantics/normalize/flow/invocation-facts.js +3 -3
  537. package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +12 -6
  538. package/dist/semantics/normalize/flow/member-call-forwarding.js +94 -21
  539. package/dist/semantics/normalize/flow/model.d.ts +5 -5
  540. package/dist/semantics/normalize/flow/model.js +11 -11
  541. package/dist/semantics/normalize/flow/node-path-token.js +3 -3
  542. package/dist/semantics/normalize/flow/origin-authority.d.ts +3 -3
  543. package/dist/semantics/normalize/flow/owned-class-receivers.js +8 -7
  544. package/dist/semantics/normalize/flow/parameter-values.js +6 -6
  545. package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +30 -4
  546. package/dist/semantics/normalize/flow/proof-hypotheses.js +56 -5
  547. package/dist/semantics/normalize/flow/proof-memo-settlement.d.ts +21 -0
  548. package/dist/semantics/normalize/flow/proof-memo-settlement.js +32 -0
  549. package/dist/semantics/normalize/flow/record-alias-closure.d.ts +1 -1
  550. package/dist/semantics/normalize/flow/record-alias-closure.js +1 -1
  551. package/dist/semantics/normalize/flow/seeded-origins.d.ts +4 -4
  552. package/dist/semantics/normalize/flow/seeded-origins.js +4 -4
  553. package/dist/semantics/normalize/flow/source-accessor-descriptor.d.ts +22 -0
  554. package/dist/semantics/normalize/flow/source-accessor-descriptor.js +210 -0
  555. package/dist/semantics/normalize/flow/source-callable-own-data.d.ts +33 -0
  556. package/dist/semantics/normalize/flow/source-callable-own-data.js +238 -0
  557. package/dist/semantics/normalize/flow/source-callable-readonly-set.d.ts +26 -0
  558. package/dist/semantics/normalize/flow/source-callable-readonly-set.js +337 -0
  559. package/dist/semantics/normalize/flow/source-class-data.d.ts +7 -7
  560. package/dist/semantics/normalize/flow/source-class-data.js +25 -26
  561. package/dist/semantics/normalize/flow/source-class-static-data.d.ts +2 -2
  562. package/dist/semantics/normalize/flow/source-class-static-data.js +2 -2
  563. package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +15 -0
  564. package/dist/semantics/normalize/flow/source-commonjs-exports.js +7 -0
  565. package/dist/semantics/normalize/flow/source-descriptor-protocol.d.ts +20 -0
  566. package/dist/semantics/normalize/flow/source-descriptor-protocol.js +75 -0
  567. package/dist/semantics/normalize/flow/source-executing-parameter-values.d.ts +8 -0
  568. package/dist/semantics/normalize/flow/source-executing-parameter-values.js +93 -0
  569. package/dist/semantics/normalize/flow/source-global-binding.d.ts +13 -0
  570. package/dist/semantics/normalize/flow/source-global-binding.js +42 -0
  571. package/dist/semantics/normalize/flow/source-intrinsic-member-data.d.ts +27 -0
  572. package/dist/semantics/normalize/flow/source-intrinsic-member-data.js +178 -0
  573. package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +1 -1
  574. package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +31 -11
  575. package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +7 -3
  576. package/dist/semantics/normalize/flow/source-invocation-receiver.js +30 -2
  577. package/dist/semantics/normalize/flow/source-native-class-alias.d.ts +7 -0
  578. package/dist/semantics/normalize/flow/source-native-class-alias.js +91 -0
  579. package/dist/semantics/normalize/flow/source-normal-predecessor.d.ts +10 -0
  580. package/dist/semantics/normalize/flow/source-normal-predecessor.js +90 -0
  581. package/dist/semantics/normalize/flow/source-property-key.d.ts +3 -0
  582. package/dist/semantics/normalize/flow/source-property-key.js +7 -0
  583. package/dist/semantics/normalize/flow/source-read-protocol.d.ts +20 -0
  584. package/dist/semantics/normalize/flow/source-read-protocol.js +108 -0
  585. package/dist/semantics/normalize/flow/source-record-data.js +31 -30
  586. package/dist/semantics/normalize/flow/source-value-session.d.ts +106 -3
  587. package/dist/semantics/normalize/flow/source-value-session.js +1172 -218
  588. package/dist/semantics/normalize/flow/standard-prototype-method-source.d.ts +16 -0
  589. package/dist/semantics/normalize/flow/standard-prototype-method-source.js +64 -0
  590. package/dist/semantics/normalize/flow/targets.d.ts +13 -14
  591. package/dist/semantics/normalize/flow/targets.js +20 -23
  592. package/dist/semantics/normalize/flow/value-flow.d.ts +2 -4
  593. package/dist/semantics/normalize/flow/value-flow.js +4 -13
  594. package/dist/semantics/normalize/flow/value-provenance.d.ts +23 -3
  595. package/dist/semantics/normalize/flow/value-provenance.js +44 -4
  596. package/dist/semantics/normalize/fresh-dictionary-storage.d.ts +32 -0
  597. package/dist/semantics/normalize/fresh-dictionary-storage.js +530 -0
  598. package/dist/semantics/normalize/fresh-indexed-storage.d.ts +43 -0
  599. package/dist/semantics/normalize/fresh-indexed-storage.js +88 -0
  600. package/dist/semantics/normalize/fresh-ordinary-object.d.ts +8 -0
  601. package/dist/semantics/normalize/fresh-ordinary-object.js +27 -0
  602. package/dist/semantics/normalize/gating.js +2 -2
  603. package/dist/semantics/normalize/global-host-mutations.js +770 -261
  604. package/dist/semantics/normalize/host-effect-contracts.d.ts +1 -1
  605. package/dist/semantics/normalize/host-effect-contracts.js +1 -1
  606. package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +2 -2
  607. package/dist/semantics/normalize/host-mutation-computed-keys.js +8 -0
  608. package/dist/semantics/normalize/host-mutation-key-reader.d.ts +6 -11
  609. package/dist/semantics/normalize/host-mutation-key-reader.js +11 -28
  610. package/dist/semantics/normalize/host-mutation-keys.d.ts +11 -7
  611. package/dist/semantics/normalize/host-mutation-keys.js +26 -15
  612. package/dist/semantics/normalize/identities.js +20 -17
  613. package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +8 -3
  614. package/dist/semantics/normalize/implicit-arguments-tuple.js +21 -4
  615. package/dist/semantics/normalize/installed-global-properties.d.ts +17 -0
  616. package/dist/semantics/normalize/installed-global-properties.js +214 -0
  617. package/dist/semantics/normalize/instantiation.js +6 -6
  618. package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +1 -1
  619. package/dist/semantics/normalize/intrinsic-property-call.d.ts +6 -1
  620. package/dist/semantics/normalize/intrinsic-property-call.js +19 -0
  621. package/dist/semantics/normalize/intrinsic-prototype.d.ts +7 -0
  622. package/dist/semantics/normalize/intrinsic-prototype.js +10 -0
  623. package/dist/semantics/normalize/intrinsic-return-identity.d.ts +5 -0
  624. package/dist/semantics/normalize/intrinsic-return-identity.js +29 -0
  625. package/dist/semantics/normalize/jsdoc-type-names.js +59 -63
  626. package/dist/semantics/normalize/keyof.js +3 -3
  627. package/dist/semantics/normalize/local-bindings.d.ts +4 -4
  628. package/dist/semantics/normalize/local-bindings.js +60 -61
  629. package/dist/semantics/normalize/logical-object-truthiness.d.ts +8 -0
  630. package/dist/semantics/normalize/logical-object-truthiness.js +20 -0
  631. package/dist/semantics/normalize/merged-declaration.d.ts +3 -3
  632. package/dist/semantics/normalize/merged-declaration.js +3 -3
  633. package/dist/semantics/normalize/never-override-result.d.ts +2 -3
  634. package/dist/semantics/normalize/never-override-result.js +2 -3
  635. package/dist/semantics/normalize/null-blind-parameter.d.ts +2 -2
  636. package/dist/semantics/normalize/null-blind-parameter.js +2 -2
  637. package/dist/semantics/normalize/object-bag-bindings.d.ts +19 -19
  638. package/dist/semantics/normalize/object-bag-bindings.js +334 -141
  639. package/dist/semantics/normalize/omitted-stated-parameter.d.ts +8 -8
  640. package/dist/semantics/normalize/omitted-stated-parameter.js +8 -9
  641. package/dist/semantics/normalize/override-field-arms.d.ts +3 -3
  642. package/dist/semantics/normalize/override-field-arms.js +15 -16
  643. package/dist/semantics/normalize/parameter-bindings.d.ts +13 -12
  644. package/dist/semantics/normalize/parameter-bindings.js +173 -139
  645. package/dist/semantics/normalize/parameter-slot.d.ts +9 -10
  646. package/dist/semantics/normalize/parameter-slot.js +16 -17
  647. package/dist/semantics/normalize/physical-overload-result.d.ts +8 -8
  648. package/dist/semantics/normalize/physical-overload-result.js +10 -10
  649. package/dist/semantics/normalize/producer-context.d.ts +27 -12
  650. package/dist/semantics/normalize/producers/allocations.js +5 -1
  651. package/dist/semantics/normalize/producers/bindings.js +8 -7
  652. package/dist/semantics/normalize/producers/class-lifecycle.js +52 -7
  653. package/dist/semantics/normalize/producers/computations.js +27 -3
  654. package/dist/semantics/normalize/producers/control.js +5 -5
  655. package/dist/semantics/normalize/producers/declaration-lifecycle.js +4 -4
  656. package/dist/semantics/normalize/producers/destructuring.js +10 -5
  657. package/dist/semantics/normalize/producers/erasure.d.ts +9 -0
  658. package/dist/semantics/normalize/producers/erasure.js +22 -0
  659. package/dist/semantics/normalize/producers/invocations.d.ts +1 -1
  660. package/dist/semantics/normalize/producers/invocations.js +200 -55
  661. package/dist/semantics/normalize/producers/logical-merge-type.d.ts +2 -2
  662. package/dist/semantics/normalize/producers/logical-merge-type.js +12 -12
  663. package/dist/semantics/normalize/producers/native-callable-readonly-set.d.ts +6 -0
  664. package/dist/semantics/normalize/producers/native-callable-readonly-set.js +24 -0
  665. package/dist/semantics/normalize/producers/native-own-assignment.d.ts +14 -0
  666. package/dist/semantics/normalize/producers/native-own-assignment.js +153 -0
  667. package/dist/semantics/normalize/producers/properties.js +153 -20
  668. package/dist/semantics/normalize/producers/protocol.js +4 -4
  669. package/dist/semantics/normalize/producers/references.js +21 -19
  670. package/dist/semantics/normalize/producers/shared.d.ts +1 -1
  671. package/dist/semantics/normalize/producers/shared.js +59 -58
  672. package/dist/semantics/normalize/producers/spread-arguments.js +7 -3
  673. package/dist/semantics/normalize/producers/tuple-spread.d.ts +2 -2
  674. package/dist/semantics/normalize/producers/tuple-spread.js +5 -5
  675. package/dist/semantics/normalize/property-key-domain.d.ts +6 -6
  676. package/dist/semantics/normalize/property-key-domain.js +7 -7
  677. package/dist/semantics/normalize/reachability.d.ts +6 -7
  678. package/dist/semantics/normalize/reachability.js +60 -62
  679. package/dist/semantics/normalize/record-home-arms.js +2 -3
  680. package/dist/semantics/normalize/record-link-families.d.ts +1 -1
  681. package/dist/semantics/normalize/record-link-families.js +1 -1
  682. package/dist/semantics/normalize/record-stand-in-arms.d.ts +4 -5
  683. package/dist/semantics/normalize/return-bindings.d.ts +19 -9
  684. package/dist/semantics/normalize/return-bindings.js +49 -41
  685. package/dist/semantics/normalize/script-global-redefinition.d.ts +1 -1
  686. package/dist/semantics/normalize/script-global-redefinition.js +1 -1
  687. package/dist/semantics/normalize/shared-array-storage.d.ts +4 -5
  688. package/dist/semantics/normalize/shared-array-storage.js +7 -8
  689. package/dist/semantics/normalize/sloppy-absence.d.ts +6 -3
  690. package/dist/semantics/normalize/sloppy-absence.js +7 -3
  691. package/dist/semantics/normalize/source-object-prototype-absence.d.ts +7 -0
  692. package/dist/semantics/normalize/source-object-prototype-absence.js +19 -0
  693. package/dist/semantics/normalize/specialization.d.ts +10 -10
  694. package/dist/semantics/normalize/specialization.js +107 -112
  695. package/dist/semantics/normalize/specialized-source-frames.d.ts +11 -0
  696. package/dist/semantics/normalize/specialized-source-frames.js +41 -0
  697. package/dist/semantics/normalize/structural-array-element.d.ts +5 -5
  698. package/dist/semantics/normalize/structural-array-element.js +40 -39
  699. package/dist/semantics/normalize/structural-array-read.js +3 -3
  700. package/dist/semantics/normalize/structural-callable.d.ts +15 -1
  701. package/dist/semantics/normalize/structural-callable.js +35 -3
  702. package/dist/semantics/normalize/structural-creation-order.d.ts +2 -2
  703. package/dist/semantics/normalize/structural-declarations.d.ts +22 -21
  704. package/dist/semantics/normalize/structural-declarations.js +42 -42
  705. package/dist/semantics/normalize/structural-declared-body.js +10 -11
  706. package/dist/semantics/normalize/structural-indexed-access.js +2 -2
  707. package/dist/semantics/normalize/structural-instantiated-member.d.ts +9 -10
  708. package/dist/semantics/normalize/structural-instantiated-member.js +43 -30
  709. package/dist/semantics/normalize/structural-joins.d.ts +4 -16
  710. package/dist/semantics/normalize/structural-joins.js +5 -65
  711. package/dist/semantics/normalize/structural-layout-relevance.d.ts +5 -5
  712. package/dist/semantics/normalize/structural-layout-relevance.js +22 -23
  713. package/dist/semantics/normalize/structural-layout-type.d.ts +1 -1
  714. package/dist/semantics/normalize/structural-layout-type.js +140 -107
  715. package/dist/semantics/normalize/structural-local-union.d.ts +1 -1
  716. package/dist/semantics/normalize/structural-local-union.js +38 -12
  717. package/dist/semantics/normalize/structural-mutable-field.d.ts +9 -0
  718. package/dist/semantics/normalize/structural-mutable-field.js +152 -0
  719. package/dist/semantics/normalize/structural-parts.d.ts +6 -0
  720. package/dist/semantics/normalize/structural-parts.js +35 -32
  721. package/dist/semantics/normalize/structural-receiver.d.ts +3 -3
  722. package/dist/semantics/normalize/structural-receiver.js +12 -13
  723. package/dist/semantics/normalize/structural-self-reference.d.ts +12 -11
  724. package/dist/semantics/normalize/structural-self-reference.js +24 -25
  725. package/dist/semantics/normalize/structural.d.ts +13 -3
  726. package/dist/semantics/normalize/structural.js +400 -201
  727. package/dist/semantics/normalize/suppressed-write-arms.d.ts +10 -11
  728. package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +6 -6
  729. package/dist/semantics/normalize/symbol-keyed-this-slots.js +4 -4
  730. package/dist/semantics/normalize/unresolvable-names.d.ts +2 -3
  731. package/dist/semantics/normalize/unresolvable-names.js +2 -2
  732. package/dist/semantics/normalize/unshared-array-result.d.ts +4 -4
  733. package/dist/semantics/normalize/unshared-array-result.js +4 -4
  734. package/dist/semantics/package-sources.js +2 -3
  735. package/dist/semantics/program.d.ts +10 -13
  736. package/dist/semantics/program.js +80 -26
  737. package/dist/semantics/property-key.d.ts +9 -0
  738. package/dist/semantics/property-key.js +25 -0
  739. package/dist/semantics/prototype-object-class-source-transform.js +2 -2
  740. package/dist/semantics/prototype-reparenting.d.ts +1 -1
  741. package/dist/semantics/prototype-reparenting.js +1 -1
  742. package/dist/semantics/shared-declaration-files.d.ts +6 -1
  743. package/dist/semantics/shared-declaration-files.js +2 -2
  744. package/dist/semantics/source-transform-protocol.d.ts +26 -0
  745. package/dist/semantics/source-transform-protocol.js +1 -0
  746. package/dist/semantics/stable-checker.js +9 -13
  747. package/dist/semantics/subclass-member-overlay-transform.d.ts +2 -2
  748. package/dist/semantics/subclass-member-overlay-transform.js +89 -88
  749. package/dist/semantics/this-constructor-source-transform.js +2 -2
  750. package/dist/semantics/unchecked-guard-argument-copies.d.ts +3 -3
  751. package/dist/semantics/unchecked-write-member-declarations.d.ts +9 -11
  752. package/dist/semantics/unchecked-write-member-declarations.js +11 -13
  753. package/dist/semantics/uninstantiable-classes.d.ts +1 -1
  754. package/dist/semantics/uninstantiable-classes.js +1 -1
  755. package/dist/targets/cpp/balanced-units.d.ts +1 -1
  756. package/dist/targets/cpp/balanced-units.js +1 -1
  757. package/dist/targets/cpp/borrowed-arm-projections.d.ts +2 -3
  758. package/dist/targets/cpp/borrowed-arm-projections.js +2 -3
  759. package/dist/targets/cpp/borrowed-call-entry.js +3 -3
  760. package/dist/targets/cpp/captures.d.ts +2 -2
  761. package/dist/targets/cpp/captures.js +4 -4
  762. package/dist/targets/cpp/char-code-buffers.d.ts +1 -1
  763. package/dist/targets/cpp/char-code-buffers.js +4 -1
  764. package/dist/targets/cpp/class-layout.d.ts +7 -17
  765. package/dist/targets/cpp/class-layout.js +6 -13
  766. package/dist/targets/cpp/class-properties/computed-method-value.d.ts +1 -1
  767. package/dist/targets/cpp/class-properties/computed-method-value.js +5 -27
  768. package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +49 -59
  769. package/dist/targets/cpp/class-properties/emit-class-properties.js +68 -232
  770. package/dist/targets/cpp/class-properties/native-method-read.d.ts +5 -0
  771. package/dist/targets/cpp/class-properties/native-method-read.js +60 -0
  772. package/dist/targets/cpp/class-properties/native-prototype.d.ts +3 -1
  773. package/dist/targets/cpp/class-properties/native-prototype.js +5 -6
  774. package/dist/targets/cpp/class-ref-transport.d.ts +1 -11
  775. package/dist/targets/cpp/class-ref-transport.js +1 -9
  776. package/dist/targets/cpp/conversions.js +613 -252
  777. package/dist/targets/cpp/coroutine-bodies.d.ts +1 -97
  778. package/dist/targets/cpp/coroutine-bodies.js +1 -187
  779. package/dist/targets/cpp/document.js +1 -1
  780. package/dist/targets/cpp/emit-allocation.d.ts +0 -38
  781. package/dist/targets/cpp/emit-allocation.js +63 -88
  782. package/dist/targets/cpp/emit-array-view.d.ts +7 -0
  783. package/dist/targets/cpp/emit-array-view.js +47 -0
  784. package/dist/targets/cpp/emit-arrays.d.ts +9 -52
  785. package/dist/targets/cpp/emit-arrays.js +177 -113
  786. package/dist/targets/cpp/emit-binding-reference.d.ts +10 -0
  787. package/dist/targets/cpp/emit-binding-reference.js +19 -1
  788. package/dist/targets/cpp/emit-bindings.js +19 -24
  789. package/dist/targets/cpp/emit-buffers.d.ts +8 -4
  790. package/dist/targets/cpp/emit-buffers.js +88 -47
  791. package/dist/targets/cpp/emit-callable-view.d.ts +6 -0
  792. package/dist/targets/cpp/emit-callable-view.js +133 -0
  793. package/dist/targets/cpp/emit-callable.d.ts +11 -1
  794. package/dist/targets/cpp/emit-callable.js +225 -266
  795. package/dist/targets/cpp/emit-carrier-members.d.ts +2 -2
  796. package/dist/targets/cpp/emit-carrier-members.js +42 -35
  797. package/dist/targets/cpp/emit-certified-conversion.d.ts +7 -0
  798. package/dist/targets/cpp/emit-certified-conversion.js +27 -0
  799. package/dist/targets/cpp/emit-context.d.ts +123 -64
  800. package/dist/targets/cpp/emit-context.js +147 -44
  801. package/dist/targets/cpp/emit-descriptor-snapshot.d.ts +10 -0
  802. package/dist/targets/cpp/emit-descriptor-snapshot.js +60 -0
  803. package/dist/targets/cpp/emit-dictionary-view.d.ts +6 -0
  804. package/dist/targets/cpp/emit-dictionary-view.js +102 -0
  805. package/dist/targets/cpp/emit-document-record-view.d.ts +3 -0
  806. package/dist/targets/cpp/emit-document-record-view.js +104 -0
  807. package/dist/targets/cpp/emit-dynamic-properties.d.ts +42 -17
  808. package/dist/targets/cpp/emit-dynamic-properties.js +118 -72
  809. package/dist/targets/cpp/emit-equality.d.ts +2 -1
  810. package/dist/targets/cpp/emit-equality.js +65 -45
  811. package/dist/targets/cpp/emit-exceptions.js +1 -1
  812. package/dist/targets/cpp/emit-in.js +22 -11
  813. package/dist/targets/cpp/emit-instanceof.js +15 -14
  814. package/dist/targets/cpp/emit-integers.d.ts +40 -3
  815. package/dist/targets/cpp/emit-integers.js +76 -5
  816. package/dist/targets/cpp/emit-iterable-object-view.d.ts +2 -0
  817. package/dist/targets/cpp/emit-iterable-object-view.js +15 -11
  818. package/dist/targets/cpp/emit-iterator-object-view.d.ts +2 -0
  819. package/dist/targets/cpp/emit-iterator-object-view.js +24 -16
  820. package/dist/targets/cpp/emit-iterator.d.ts +2 -0
  821. package/dist/targets/cpp/emit-iterator.js +115 -43
  822. package/dist/targets/cpp/emit-json.js +6 -6
  823. package/dist/targets/cpp/emit-jsx.js +2 -2
  824. package/dist/targets/cpp/emit-live-field-view.d.ts +26 -0
  825. package/dist/targets/cpp/emit-live-field-view.js +50 -0
  826. package/dist/targets/cpp/emit-narrowing.d.ts +60 -139
  827. package/dist/targets/cpp/emit-narrowing.js +694 -624
  828. package/dist/targets/cpp/emit-native-accessor-definition.d.ts +10 -0
  829. package/dist/targets/cpp/emit-native-accessor-definition.js +94 -0
  830. package/dist/targets/cpp/emit-native-callable-data.d.ts +23 -0
  831. package/dist/targets/cpp/emit-native-callable-data.js +117 -0
  832. package/dist/targets/cpp/emit-native-document-entry.d.ts +4 -0
  833. package/dist/targets/cpp/emit-native-document-entry.js +52 -0
  834. package/dist/targets/cpp/emit-native-field-view.d.ts +26 -0
  835. package/dist/targets/cpp/emit-native-field-view.js +217 -0
  836. package/dist/targets/cpp/emit-native-method.d.ts +16 -0
  837. package/dist/targets/cpp/emit-native-method.js +90 -0
  838. package/dist/targets/cpp/emit-native-object-data.d.ts +7 -0
  839. package/dist/targets/cpp/emit-native-object-data.js +66 -0
  840. package/dist/targets/cpp/emit-native-object-sample.d.ts +8 -0
  841. package/dist/targets/cpp/emit-native-object-sample.js +34 -0
  842. package/dist/targets/cpp/emit-native-own-assignment.d.ts +7 -0
  843. package/dist/targets/cpp/emit-native-own-assignment.js +119 -0
  844. package/dist/targets/cpp/emit-native-selection.d.ts +2 -2
  845. package/dist/targets/cpp/emit-native-selection.js +14 -5
  846. package/dist/targets/cpp/emit-number-storage.d.ts +2 -0
  847. package/dist/targets/cpp/emit-number-storage.js +1 -0
  848. package/dist/targets/cpp/emit-presence.d.ts +3 -4
  849. package/dist/targets/cpp/emit-presence.js +43 -21
  850. package/dist/targets/cpp/emit-properties.js +224 -111
  851. package/dist/targets/cpp/emit-protocol-iterator.d.ts +2 -0
  852. package/dist/targets/cpp/emit-protocol-iterator.js +45 -23
  853. package/dist/targets/cpp/emit-record-view.d.ts +5 -10
  854. package/dist/targets/cpp/emit-record-view.js +223 -269
  855. package/dist/targets/cpp/emit-return.js +33 -8
  856. package/dist/targets/cpp/emit-scopes.d.ts +2 -2
  857. package/dist/targets/cpp/emit-sum-widening.js +13 -5
  858. package/dist/targets/cpp/emit-tonumber.d.ts +1 -1
  859. package/dist/targets/cpp/emit-tonumber.js +3 -3
  860. package/dist/targets/cpp/emit-tostring.d.ts +20 -2
  861. package/dist/targets/cpp/emit-tostring.js +131 -28
  862. package/dist/targets/cpp/emit-typeof.d.ts +4 -0
  863. package/dist/targets/cpp/emit-typeof.js +29 -1
  864. package/dist/targets/cpp/emit-union-properties.d.ts +6 -23
  865. package/dist/targets/cpp/emit-union-properties.js +127 -235
  866. package/dist/targets/cpp/emit.d.ts +4 -1
  867. package/dist/targets/cpp/emit.js +336 -119
  868. package/dist/targets/cpp/error-types.d.ts +1 -3
  869. package/dist/targets/cpp/error-types.js +1 -2
  870. package/dist/targets/cpp/evaluated-once.d.ts +4 -4
  871. package/dist/targets/cpp/evaluated-once.js +5 -5
  872. package/dist/targets/cpp/function-source-reads.d.ts +2 -15
  873. package/dist/targets/cpp/function-source-reads.js +3 -38
  874. package/dist/targets/cpp/host/core-globals.d.ts +5 -0
  875. package/dist/targets/cpp/host/core-globals.js +10 -0
  876. package/dist/targets/cpp/host/emit-host-arity.js +1 -1
  877. package/dist/targets/cpp/host/emit-host-invoke.js +73 -23
  878. package/dist/targets/cpp/host/emit-host-object.d.ts +2 -1
  879. package/dist/targets/cpp/host/emit-host-object.js +328 -145
  880. package/dist/targets/cpp/host/emit-host-properties.js +4 -6
  881. package/dist/targets/cpp/host/emit-host-reflect.js +29 -5
  882. package/dist/targets/cpp/host/emit-host-value.d.ts +1 -1
  883. package/dist/targets/cpp/host/emit-host-value.js +2 -2
  884. package/dist/targets/cpp/host/host-members.d.ts +11 -0
  885. package/dist/targets/cpp/host/host-members.js +27 -5
  886. package/dist/targets/cpp/host/host-method-aliases.d.ts +1 -30
  887. package/dist/targets/cpp/host/host-method-aliases.js +1 -76
  888. package/dist/targets/cpp/host/native-protocols.js +1 -1
  889. package/dist/targets/cpp/host/object-protocol.d.ts +1 -1
  890. package/dist/targets/cpp/host/object-protocol.js +24 -24
  891. package/dist/targets/cpp/host-namespace-reads.d.ts +1 -83
  892. package/dist/targets/cpp/host-namespace-reads.js +1 -113
  893. package/dist/targets/cpp/manifest/capabilities.js +33 -33
  894. package/dist/targets/cpp/manifest.d.ts +5 -0
  895. package/dist/targets/cpp/manifest.js +38 -14
  896. package/dist/targets/cpp/native-collection-base.js +7 -6
  897. package/dist/targets/cpp/native-debug-source.d.ts +15 -0
  898. package/dist/targets/cpp/native-debug-source.js +21 -0
  899. package/dist/targets/cpp/native-error-base.d.ts +1 -1
  900. package/dist/targets/cpp/native-error-base.js +1 -1
  901. package/dist/targets/cpp/native-narrowing-transport.d.ts +2 -0
  902. package/dist/targets/cpp/native-narrowing-transport.js +25 -5
  903. package/dist/targets/cpp/native-view-targets.d.ts +3 -0
  904. package/dist/targets/cpp/native-view-targets.js +5 -0
  905. package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +3 -33
  906. package/dist/targets/cpp/prototype/emit-prototype-array.js +40 -22
  907. package/dist/targets/cpp/prototype/emit-prototype-date.d.ts +1 -58
  908. package/dist/targets/cpp/prototype/emit-prototype-date.js +14 -97
  909. package/dist/targets/cpp/prototype/emit-prototype-error.d.ts +20 -0
  910. package/dist/targets/cpp/prototype/emit-prototype-error.js +2 -2
  911. package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +3 -27
  912. package/dist/targets/cpp/prototype/emit-prototype-invoke.js +60 -52
  913. package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +1 -41
  914. package/dist/targets/cpp/prototype/emit-prototype-iterator.js +4 -43
  915. package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +2 -13
  916. package/dist/targets/cpp/prototype/emit-prototype-promise.js +10 -58
  917. package/dist/targets/cpp/prototype/emit-prototype-regexp.d.ts +4 -25
  918. package/dist/targets/cpp/prototype/emit-prototype-regexp.js +16 -81
  919. package/dist/targets/cpp/prototype/emit-prototype-string.d.ts +1 -1
  920. package/dist/targets/cpp/prototype/emit-prototype-string.js +17 -28
  921. package/dist/targets/cpp/prototype/prototype-method-reads.js +4 -80
  922. package/dist/targets/cpp/reactive-dependencies.d.ts +12 -6
  923. package/dist/targets/cpp/reactive-dependencies.js +62 -42
  924. package/dist/targets/cpp/reactive-origins.js +12 -0
  925. package/dist/targets/cpp/records.d.ts +133 -14
  926. package/dist/targets/cpp/records.js +345 -153
  927. package/dist/targets/cpp/regexp-types.d.ts +1 -26
  928. package/dist/targets/cpp/regexp-types.js +4 -29
  929. package/dist/targets/cpp/segment-scopes.d.ts +30 -0
  930. package/dist/targets/cpp/segment-scopes.js +294 -0
  931. package/dist/targets/cpp/translation-unit.d.ts +21 -2
  932. package/dist/targets/cpp/translation-unit.js +121 -276
  933. package/dist/targets/cpp/types.d.ts +8 -3
  934. package/dist/targets/cpp/types.js +30 -6
  935. package/dist/targets/cpp/virtual-callees.d.ts +18 -0
  936. package/dist/targets/cpp/virtual-callees.js +27 -0
  937. package/dist/targets/cpp/virtual-methods.d.ts +7 -7
  938. package/dist/targets/cpp/virtual-methods.js +213 -58
  939. package/package.json +8 -3
  940. package/src/targets/cpp/runtime/gea_dictionary_view.h +204 -0
  941. package/src/targets/cpp/runtime/gea_document_view.h +845 -0
  942. package/src/targets/cpp/runtime/gea_dynamic_proxy.h +66 -23
  943. package/src/targets/cpp/runtime/gea_eval.h +6 -6
  944. package/src/targets/cpp/runtime/gea_runtime.h +7550 -1166
  945. package/dist/targets/cpp/direct-call-receivers.d.ts +0 -37
  946. package/dist/targets/cpp/direct-call-receivers.js +0 -79
@@ -1,8 +1,9 @@
1
1
  import { runtimeParametersOf } from './targets.js';
2
2
  import { seededOriginSolvers } from './seeded-origins.js';
3
- import { enterHypothesisGuard, hypothesisSettledAsTruth, hypothesisStats, exitHypothesisGuard, registerGuardedAnswer, hypothesisGuardIsOpen, hypothesisNotes, noteHypothesis, popHypothesisTrail, pushHypothesisTrail } from './proof-hypotheses.js';
3
+ import { enterHypothesisGuard, answerDependsOn, hypothesisSettledAsTruth, hypothesisStats, exitHypothesisGuard, registerGuardedAnswer, hypothesisGuardIsOpen, hypothesisNotes, noteHypothesis, popHypothesisTrail, pushHypothesisTrail } from './proof-hypotheses.js';
4
4
  import { unwrapErasedExpression } from '../producers/erasure.js';
5
5
  import ts from 'typescript';
6
+ import { isGlobalObjectAssign } from '../derived-expression-type.js';
6
7
  import { heritageClassOrInterfaceOf, isClassSpelledSourceClass, isConstructorFunction } from './model.js';
7
8
  import { isObjectLiteralPrototypeSetter } from '../assignment-patterns.js';
8
9
  import { isModuleExportedDeclaration, isTypePositionReference, resolveFlowSymbolAlias, unwrapNaming } from './targets.js';
@@ -16,12 +17,13 @@ import { callableArrayTargetsOf, closedCallableTargetsOf } from './callable-arra
16
17
  import { arrayStoredValuesOf } from './array-element-continuation.js';
17
18
  import { nativeArrayProtocolPlanOf } from './native-collection-protocol.js';
18
19
  import { deferredIntrinsicProtocolLedgerOf } from '../deferred-intrinsic-protocols.js';
20
+ import { sourceGlobalCallableBindingIsClosed } from './source-global-binding.js';
19
21
  import { recordMethodCallTargetsOf, sourceRecordDataWritePlanOf } from './source-record-data.js';
20
22
  import { nodePathToken, nodeSetToken } from './node-path-token.js';
21
23
  import { objectLiteralEntryKeyOf, recordLiteralReceiverClosed } from './record-alias-closure.js';
22
24
  import { censusArgumentsObjects } from '../arguments-objects.js';
23
25
  import { sourceInvocationFrame, sourceInvocationFact, invocationValueContinuationsOf, invocationCompletionValuesOf } from './invocation-facts.js';
24
- import { declaredDataMemberAccess, reflectiveDefinitionMayInstallGetterOf, sourceClassConstructorSlotIsOriginal, sourceClassDataMemberPlanOf, sourceClassKeyReadPlanOf } from './source-class-data.js';
26
+ import { constructorInstalledMemberDeclarationsOf, declaredDataMemberAccess, reflectiveDefinitionMayInstallGetterOf, sourceClassConstructorSlotIsOriginal, sourceClassDataMemberPlanOf, sourceClassKeyReadPlanOf } from './source-class-data.js';
25
27
  import { intrinsicDataDefinitionTargetOf } from './intrinsic-data-definition.js';
26
28
  import { coercionHooksAreHost, hostTextSinkArgumentOf } from './host-text-sink.js';
27
29
  import { enclosingArgumentsFunction, isArgumentsObjectIdentifier } from '../implicit-arguments.js';
@@ -32,7 +34,41 @@ import { localBindingValuesOf, localBindingWritesAreComplete } from './value-pro
32
34
  import { computedKeySetOf } from './computed-key-set.js';
33
35
  import { callableCompletionValuesOf, constructionYieldsCompletionOf } from './callable-completions.js';
34
36
  import { sourceValueSessionOf } from './source-value-session.js';
35
- import { isGlobalObjectAssign } from './value-flow.js';
37
+ import { settleProofMemoClaims } from './proof-memo-settlement.js';
38
+ const jointSourceInvocationReceipts = new WeakMap();
39
+ /** The stamp describes provenance; only the exact fact minted by the joint
40
+ * target/frame authority carries permission. Clones and changed frames do not.
41
+ */
42
+ export const sourceInvocationFactHasJointTargets = (flow, fact) => {
43
+ const receipt = jointSourceInvocationReceipts.get(flow)?.get(fact);
44
+ return (fact.targetAuthority === 'source-values' &&
45
+ receipt !== undefined &&
46
+ receipt.call === fact.call &&
47
+ receipt.operands === fact.operands &&
48
+ receipt.callee === fact.operands.callee &&
49
+ receipt.receiver === fact.operands.receiver &&
50
+ receipt.kind === fact.operands.kind &&
51
+ receipt.explicitThis === fact.operands.explicitThis &&
52
+ receipt.dispatch === fact.operands.dispatch &&
53
+ receipt.args.length === fact.operands.args.length &&
54
+ receipt.args.every((argument, index) => argument === fact.operands.args[index]) &&
55
+ receipt.frameArray === fact.frames &&
56
+ receipt.frames.length === fact.frames.length &&
57
+ receipt.requirements === fact.requirements &&
58
+ receipt.frames.every((entry, index) => entry.frame === fact.frames[index] &&
59
+ entry.body === entry.frame.body &&
60
+ entry.layout === entry.frame.layout &&
61
+ entry.layout.call === fact.call &&
62
+ entry.layout.body === entry.body &&
63
+ entry.layout.operands === fact.operands &&
64
+ entry.receiver === entry.layout.receiver &&
65
+ entry.arguments === entry.layout.arguments &&
66
+ entry.forwarding === entry.frame.forwarding &&
67
+ entry.completions === entry.frame.completions &&
68
+ entry.parameters === entry.frame.parameters &&
69
+ entry.receiverUses === entry.frame.receiverUses &&
70
+ entry.completionSummary === entry.frame.completionSummary));
71
+ };
36
72
  const memberImplementationInventories = new WeakMap();
37
73
  /**
38
74
  * Instance-owned stores indexed by their lexical receiver and property key.
@@ -88,8 +124,8 @@ const ownedConstructionReceiverWrappers = new WeakSet();
88
124
  * syntax alone -- never the `given` authority the wrapper closes over -- so
89
125
  * the answer is the same for every proof that asks about this expression.
90
126
  * Recomputing it inside a per-proof wrapper repeated the same two checker
91
- * lookups and an ancestor walk on every ask; a live three.js profile put that
92
- * at 6.5% of self time, the largest single cost after the proof memo itself.
127
+ * lookups and an ancestor walk on every ask; a live profile of a large library
128
+ * compile put that at 6.5% of self time, the largest single cost after the proof memo itself.
93
129
  */
94
130
  const ownedConstructionDeclaredTypes = new WeakMap();
95
131
  const ownedConstructionDeclaredTypeOf = (checker, flow, expression) => {
@@ -208,8 +244,8 @@ const callsOf = (flow) => {
208
244
  * this function hands the returned name to, already proves the escape
209
245
  * question for an ARBITRARY receiver via its own receiver/family walk, so
210
246
  * gating recognition to `this` here proves nothing extra; it only hides the
211
- * slot from that proof. Three's `mesh.onBeforeRender = function ( renderer,
212
- * object ) { ... }` -- `mesh` an ordinary variable, not `this` -- is exactly
247
+ * slot from that proof. `node.onRender = function ( renderer,
248
+ * object ) { ... }` -- `node` an ordinary variable, not `this` -- is exactly
213
249
  * an instance override of a class's own declared (empty) stub, and this
214
250
  * function returning null for it silently pushed every caller past the
215
251
  * closure proof and straight to a hard refusal, which is a stronger claim
@@ -257,7 +293,7 @@ export const emptyCallableReachIndex = {
257
293
  * both; an authority minted per anchor -- `closedClassAllocationOriginsOf`
258
294
  * asks for one per EXPRESSION, `derived-expression-type` one per query --
259
295
  * with fresh closures gave every one of its proofs a key nothing else could
260
- * match, so the three.js app ran 17,000 distinct top-level walks that were the same
296
+ * match, so a large library compile ran tens of thousands of distinct top-level walks that were the same
261
297
  * few hundred questions.
262
298
  */
263
299
  const checkerTypeAtByChecker = new WeakMap();
@@ -326,10 +362,17 @@ export const closedCallableAuthorityOf = (checker, flow, receiverTypeAt, argumen
326
362
  closedCalleeBodiesOf: () => null
327
363
  });
328
364
  };
365
+ /**
366
+ * Every value the array `array` names can ever hold, under the shared
367
+ * closed-frame authority, or `null` when that set is not closed. For a census
368
+ * outside this module's own proofs; intrinsic obligations go to the caller's
369
+ * active ledger capture.
370
+ */
371
+ export const closedArrayStoredValuesOf = (checker, flow, array) => arrayStoredValuesOf(checker, flow, array, closedCallableAuthorityOf(checker, flow, checkerTypeAtOf(checker), argumentsUsesAtOf(checker, flow)));
329
372
  /**
330
373
  * The array-callee extension of `closedCallableAuthorityOf`, for a consumer
331
374
  * that has to pass a real `CallableArrayOriginAuthority` to
332
- * `callableArrayTargetsOf` -- three's `EventDispatcher.dispatchEvent` calls
375
+ * `callableArrayTargetsOf` -- an event-emitter base class's dispatch method calls
333
376
  * every listener through `array[ i ].call( this, event )`, a computed
334
377
  * element read no symbol names, and closing it needs the same three
335
378
  * collection/protocol queries `closedMemberCallableUses` already builds for
@@ -348,7 +391,7 @@ export const closedArrayCalleeAuthorityOf = (checker, flow, receiverTypeAt, argu
348
391
  /**
349
392
  * `callableArrayTargetsOf`'s own array-identity walk has no case for a
350
393
  * plain object used as a string-keyed RECORD of arrays (`this._listeners[
351
- * type ]`, three's `EventDispatcher`) -- see the identical fallback and
394
+ * type ]`, an event-emitter base class's listener table) -- see the identical fallback and
352
395
  * its full rationale on `elementCalleeAuthority` in
353
396
  * `closedMemberCallableUses` above, which this mirrors for the external
354
397
  * caller (`parameter-bindings.ts`'s alias-declarations census) that has no
@@ -541,7 +584,7 @@ const sameCountedCalls = (a, b) => {
541
584
  };
542
585
  const activeFieldReadsByFlow = new WeakMap();
543
586
  const fieldAnswers = new WeakMap();
544
- const fieldStats = { asks: 0, hits: 0, stores: 0 };
587
+ const fieldStats = { asks: 0, hits: 0, stores: 0, scanned: 0, longest: 0, keysChecked: 0 };
545
588
  const sharedAnswers = new WeakMap();
546
589
  /**
547
590
  * `GEA_REFUSAL_MEMO=0` recomputes every refusal instead of replaying the
@@ -668,7 +711,7 @@ export const memberProofStats = () => `[PROOF-STATS] entries=${proofStats.entrie
668
711
  `leans: recordProof=${proofStats.assumedRecordProof} valueTerminal=${proofStats.assumedValueTerminal} fieldRead=${proofStats.assumedFieldRead} memberFamily=${proofStats.assumedMemberFamily} ` +
669
712
  `shared: asks=${sharedStats.asks} hits=${sharedStats.hits} stores=${sharedStats.stores} refusalStores=${sharedStats.refusals} ungroundedRefusals=${sharedStats.ungrounded} ` +
670
713
  `keys: members=${proofStats.members} receiverFns=${proofStats.receiverFns} argumentFns=${proofStats.argumentFns} valueModes=${proofStats.valueModes} valueModeStores=${proofStats.valueModeStores} ` +
671
- `fields: asks=${fieldStats.asks} hits=${fieldStats.hits} stores=${fieldStats.stores}` +
714
+ `fields: asks=${fieldStats.asks} hits=${fieldStats.hits} stores=${fieldStats.stores} scanned=${fieldStats.scanned} longest=${fieldStats.longest} keysChecked=${fieldStats.keysChecked}` +
672
715
  `\n [ASK-SITES]${topAskSites()}` +
673
716
  `\n [QUESTIONS] ${topQuestions()}`;
674
717
  const EMPTY_KEYS = new Set();
@@ -694,8 +737,8 @@ const memberOwnerClassIn = (flow, declaration) => {
694
737
  const frame = flow.receiverOwnerOf(unwrapNaming(assignment.left.expression));
695
738
  // A constructor function OWNS the `this.<key> = ...` writes in its own
696
739
  // body the way a class owns its elements -- there is no enclosing class to
697
- // step out to, and asking for one is why every member of three's pre-ES6
698
- // renderer factories had no owner class and so no family at all.
740
+ // step out to, and asking for one is why every member of a pre-ES6
741
+ // constructor-function factory had no owner class and so no family at all.
699
742
  if (frame && isConstructorFunction(frame))
700
743
  return frame;
701
744
  const owner = frame && ts.isClassElement(frame) ? frame.parent : undefined;
@@ -744,13 +787,17 @@ export const hasClosedMemberCallableUses = (...parameters) => {
744
787
  let byValueMode = byArgumentsUsesAt.get(argumentsUsesAt);
745
788
  if (!byValueMode) {
746
789
  proofStats.argumentFns++;
747
- byArgumentsUsesAt.set(argumentsUsesAt, (byValueMode = new Map()));
790
+ byArgumentsUsesAt.set(argumentsUsesAt, (byValueMode = { named: new Map(), fresh: new WeakMap() }));
748
791
  }
749
- const modeKey = valueMode?.identity ?? valueMode;
750
- let answers = byValueMode.get(modeKey);
792
+ const modeKey = valueMode?.identity;
793
+ let answers = valueMode !== undefined && modeKey === undefined ? byValueMode.fresh.get(valueMode) : byValueMode.named.get(modeKey);
751
794
  if (!answers) {
752
795
  proofStats.valueModes++;
753
- byValueMode.set(modeKey, (answers = []));
796
+ answers = [];
797
+ if (valueMode !== undefined && modeKey === undefined)
798
+ byValueMode.fresh.set(valueMode, answers);
799
+ else
800
+ byValueMode.named.set(modeKey, answers);
754
801
  }
755
802
  if (!nested)
756
803
  proofStats.topLevelEntries++;
@@ -774,7 +821,7 @@ export const hasClosedMemberCallableUses = (...parameters) => {
774
821
  // synchronous call returns. An answer gated on one is still correct to
775
822
  // keep -- `inherited` below still requires the guard to be open again
776
823
  // before reuse -- but it is also, for all practical purposes, gated on a
777
- // fact that will never recur: the three.js app's `answers` arrays grew without
824
+ // fact that will never recur: on a large library compile the `answers` arrays grew without
778
825
  // bound on exactly these entries, and this proof's linear scan over them
779
826
  // (`inherited(key)` per assumed key, per stored answer, per call) was over
780
827
  // 90% of a stuck compile's sampled time (`measurements/live-*.cpuprofile`).
@@ -784,8 +831,7 @@ export const hasClosedMemberCallableUses = (...parameters) => {
784
831
  const inheritedPark = (key) => inheritedMembers.has(key) ||
785
832
  inheritedFamilies.has(key) ||
786
833
  (activeRecordProofs.get(flow)?.has(key) ?? false) ||
787
- (activeValueTerminals.get(flow)?.has(key) ?? false) ||
788
- (activeFieldReadsByFlow.get(flow)?.has(key) ?? false);
834
+ (activeValueTerminals.get(flow)?.has(key) ?? false);
789
835
  const inherited = (key) => inheritedPark(key) || hypothesisGuardIsOpen(key);
790
836
  // The three per-`flow` park sets are read once for the whole scan instead of
791
837
  // three WeakMap lookups per assumed key per stored answer. Nothing between
@@ -796,7 +842,7 @@ export const hasClosedMemberCallableUses = (...parameters) => {
796
842
  // runs AFTER the proof body and must see the sets as they are then.
797
843
  //
798
844
  // This is the scan's dominant term, not a micro-optimisation: a live profile
799
- // of a three.js compile put `inheritedPark` at 14.3% of all samples on its
845
+ // of a large library compile put `inheritedPark` at 14.3% of all samples on its
800
846
  // own (`measurements/live-baseline.cpuprofile`), reached
801
847
  // `answers.length` x `assumed.size` times per question.
802
848
  const scanRecordProofs = activeRecordProofs.get(flow);
@@ -821,6 +867,7 @@ export const hasClosedMemberCallableUses = (...parameters) => {
821
867
  if (!applies)
822
868
  continue;
823
869
  proofStats.hits++;
870
+ answer.uses++;
824
871
  for (const key of answer.assumed)
825
872
  noteAssumption(key);
826
873
  for (const key of answer.escaped)
@@ -834,7 +881,7 @@ export const hasClosedMemberCallableUses = (...parameters) => {
834
881
  // Deduplicated: a nested memo hit replays its open uses into THIS proof's
835
882
  // record, so the same (reference, kind) arrives once per nested question
836
883
  // that reported it, and every enclosing proof would have stored a copy.
837
- // The three.js app retained 20 GB of these lists in 50 s before the map.
884
+ // One large library compile retained 20 GB of these lists in 50 s before the map.
838
885
  const opens = new Map();
839
886
  const record = (reference, kind) => {
840
887
  let kinds = opens.get(reference);
@@ -863,37 +910,14 @@ export const hasClosedMemberCallableUses = (...parameters) => {
863
910
  return ownFamilies;
864
911
  };
865
912
  const provisionalStart = provisionalAnswers.length;
866
- const dischargeProvisionalAnswers = (closed, assumed, escaped) => {
867
- if (!closed || escaped.size !== 0) {
868
- // The condition is not (known to be) a fact: the claims stay as stored,
869
- // conditional, and are no longer tracked for confirmation.
870
- provisionalAnswers.length = provisionalStart;
871
- return;
872
- }
873
- const own = member ? [member] : [];
874
- for (const family of ownCoinduction())
875
- own.push(family);
876
- let kept = provisionalStart;
877
- for (let at = provisionalStart; at < provisionalAnswers.length; at++) {
878
- const claim = provisionalAnswers[at];
879
- let leaned = false;
880
- for (const key of own)
881
- if (claim.assumed.delete(key))
882
- leaned = true;
883
- if (leaned)
884
- for (const key of assumed)
885
- claim.assumed.add(key);
886
- let pending = false;
887
- for (const key of claim.assumed)
888
- if (inheritedMembers.has(key) || inheritedFamilies.has(key)) {
889
- pending = true;
890
- break;
891
- }
892
- if (pending)
893
- provisionalAnswers[kept++] = claim;
894
- }
895
- provisionalAnswers.length = kept;
896
- };
913
+ const dischargeProvisionalAnswers = (closed, assumed, escaped, requirements) => settleProofMemoClaims(provisionalAnswers, provisionalStart, {
914
+ closed,
915
+ own: new Set([...(member ? [member] : []), ...ownCoinduction()]),
916
+ inherited: new Set([...inheritedMembers, ...inheritedFamilies]),
917
+ assumed,
918
+ escaped,
919
+ requirements
920
+ });
897
921
  const trail = pushHypothesisTrail();
898
922
  const work = () => {
899
923
  try {
@@ -923,12 +947,17 @@ export const hasClosedMemberCallableUses = (...parameters) => {
923
947
  // alone, and a record-root proof parks `ownPark` for this call alone;
924
948
  // both are released the instant this returns. Recording them as
925
949
  // assumptions made every value-mode answer permanently inapplicable --
926
- // of 157,871 answers one three.js run stored, 18 were unconditional --
950
+ // of 157,871 answers one large compile stored, 18 were unconditional --
927
951
  // so the memo held nothing and the same question was re-proven millions
928
952
  // of times. A park an ENCLOSING proof established is untouched by this:
929
953
  // it is not this mode's own, so it still lands in `assumed`.
930
954
  if (valueMode !== undefined && (key === valueMode.terminalUse || key === valueMode.ownPark))
931
955
  continue;
956
+ // See `hypothesisIsPessimistic`: a closed answer owes a pessimistic
957
+ // hypothesis nothing, so it is neither a condition of the answer nor
958
+ // something an enclosing proof has to hear about.
959
+ if (!answerDependsOn(key, closed))
960
+ continue;
932
961
  if (inherited(key)) {
933
962
  assumed.add(key);
934
963
  noteAssumption(key);
@@ -984,8 +1013,8 @@ export const hasClosedMemberCallableUses = (...parameters) => {
984
1013
  // `exitHypothesisGuard` settles it -- discharging the key, or striking the
985
1014
  // answer if the real answer contradicted it.
986
1015
  //
987
- // Dropping them instead was the whole cost: in 200,000 three.js proof
988
- // entries this memo computed 156,070 answers and KEPT 119. Every later ask
1016
+ // Dropping them instead was the whole cost: in 200,000 proof
1017
+ // entries of a large library compile this memo computed 156,070 answers and KEPT 119. Every later ask
989
1018
  // of the same question proved it again, which is how 64 distinct questions
990
1019
  // become millions of proof entries.
991
1020
  //
@@ -994,14 +1023,35 @@ export const hasClosedMemberCallableUses = (...parameters) => {
994
1023
  // short enough that scanning it stays cheaper than the recompute it saves.
995
1024
  // Dropping a storable answer is never a correctness question -- a miss
996
1025
  // recomputes and gets the same result.
997
- dischargeProvisionalAnswers(closed, assumed, escaped);
998
- if (assumed.size !== 0 && answers.length >= CONDITIONAL_ANSWER_LIMIT)
999
- proofStats.droppedByLimit++;
1000
- if (assumed.size === 0 || answers.length < CONDITIONAL_ANSWER_LIMIT) {
1026
+ dischargeProvisionalAnswers(closed, assumed, escaped, requirements);
1027
+ // A full bucket gives up its least-replayed CONDITIONAL answer rather than
1028
+ // refusing the new one. Keeping whichever eight arrived first froze the
1029
+ // bucket on the answers of the first paths into a cycle -- the ones least
1030
+ // likely to recur -- while the same question was then recomputed, and
1031
+ // dropped again, once per later path (the identical condition set was
1032
+ // stored and dropped 2,918 times in one run).
1033
+ let victim = -1;
1034
+ if (assumed.size !== 0 && answers.length >= CONDITIONAL_ANSWER_LIMIT) {
1035
+ let fewest = Number.POSITIVE_INFINITY;
1036
+ for (let at = 0; at < answers.length; at++) {
1037
+ const held = answers[at];
1038
+ if (held.assumed.size !== 0 && held.uses < fewest) {
1039
+ fewest = held.uses;
1040
+ victim = at;
1041
+ }
1042
+ }
1043
+ if (victim === -1) {
1044
+ proofStats.droppedByLimit++;
1045
+ }
1046
+ }
1047
+ if (assumed.size === 0 || answers.length < CONDITIONAL_ANSWER_LIMIT || victim !== -1) {
1001
1048
  proofStats.kept++;
1002
- const stored = { counted, assumed, escaped, closed, requirements, opens: recorded };
1003
- answers.push(stored);
1004
- if (dischargeEnabled && closed && assumed.size !== 0)
1049
+ const stored = { counted, assumed, escaped, closed, requirements: [...requirements], opens: recorded, uses: 0 };
1050
+ if (victim !== -1)
1051
+ answers[victim] = stored;
1052
+ else
1053
+ answers.push(stored);
1054
+ if (dischargeEnabled && closed && escaped.size === 0 && assumed.size !== 0)
1005
1055
  provisionalAnswers.push(stored);
1006
1056
  if (leansOnReentryGuard)
1007
1057
  registerGuardedAnswer(stored, () => {
@@ -1031,7 +1081,7 @@ export const hasClosedMemberCallableUses = (...parameters) => {
1031
1081
  * this proof a question; `GEA_BINDING_DEBUG` prints the chain of open uses,
1032
1082
  * which simply ENDS -- with no reason attached -- whenever the refusal is one
1033
1083
  * of the inventory closures at the bottom of this function that report no open
1034
- * use at all. `Object3D.copy` refused there, and both instruments showed a
1084
+ * use at all. A scene-node class's `copy` refused there, and both instruments showed a
1035
1085
  * chain that terminated for no stated cause.
1036
1086
  */
1037
1087
  const memberClosureDebug = process.env['GEA_MEMBER_CLOSURE_DEBUG'];
@@ -1096,7 +1146,7 @@ const recordLeafSummary = (arm, ownerMember, site) => {
1096
1146
  };
1097
1147
  const describeNode = (node) => {
1098
1148
  const file = node.getSourceFile();
1099
- // The TEXT, not only the position: every three.js file the walk reports on is
1149
+ // The TEXT, not only the position: a library file the walk reports on may be
1100
1150
  // rewritten by a source transform before the compiler sees it, so a reported
1101
1151
  // line does not address anything on disk without it.
1102
1152
  const text = node.getText().slice(0, 90).replace(/\s+/g, ' ');
@@ -1109,8 +1159,8 @@ const describeNode = (node) => {
1109
1159
  * `virtualAccessorsOf` and `slotDeclarationsOf` each ask this once per
1110
1160
  * (candidate descendant, base) pair for EVERY reachable class declaration --
1111
1161
  * and a proof-scoped cache only catches repeats WITHIN one member's proof.
1112
- * The real repetition is ACROSS proofs: the three.js app asks "does this class descend
1113
- * from `Object3D`/`Vector3`/..." from thousands of different member proofs
1162
+ * The real repetition is ACROSS proofs: a large library compile asks "does this class descend
1163
+ * from `Node`/`Vector`/..." from thousands of different member proofs
1114
1164
  * over the course of one compile, and a proof-local cache starts over every
1115
1165
  * time. Measured at 5.8% of the whole compile with a proof-local cache that
1116
1166
  * still missed almost every call.
@@ -1151,8 +1201,8 @@ const descendsFromNominal = (checker, type, baseSymbol) => {
1151
1201
  * proof-local map in `virtualAccessorsOf` is not a substitute for it: that one
1152
1202
  * is keyed by the receiver EXPRESSION, so it catches only repeats of the same
1153
1203
  * syntactic access within one proof, while the walk itself sweeps the whole
1154
- * round's `flow.classDeclarations` -- hundreds of classes for three.js, each
1155
- * costing a `getDeclaredTypeOfSymbol` and a heritage descent. The three.js app ran that
1204
+ * round's `flow.classDeclarations` -- hundreds of classes for a large library, each
1205
+ * costing a `getDeclaredTypeOfSymbol` and a heritage descent. One such compile ran that
1156
1206
  * sweep once per (proof, access) and it was the largest SELF-time entry in the
1157
1207
  * compiler's own modules (5.5%).
1158
1208
  *
@@ -1211,6 +1261,19 @@ const pathInterningOf = (flow) => {
1211
1261
  return held;
1212
1262
  };
1213
1263
  const slotDeclarationsCaches = new WeakMap();
1264
+ // Caller discovery can re-enter through a fresh member proof while resolving
1265
+ // a parameter's allocation origins. Its guard therefore belongs to the flow,
1266
+ // rather than to one closedMemberCallableUses invocation.
1267
+ const allocationCallerInventoryGuards = new WeakMap();
1268
+ const allocationCallerInventoryGuardOf = (flow, declaration, family) => {
1269
+ let declarations = allocationCallerInventoryGuards.get(flow);
1270
+ if (!declarations)
1271
+ allocationCallerInventoryGuards.set(flow, (declarations = new WeakMap()));
1272
+ let guards = declarations.get(declaration);
1273
+ if (!guards)
1274
+ declarations.set(declaration, (guards = { exact: {}, family: {} }));
1275
+ return family ? guards.family : guards.exact;
1276
+ };
1214
1277
  const closedMemberCallableUses = (checker, flow, member, countedCalls, givenReceiverTypeAt, argumentsUsesAt, givenOpenUse, activeMembers = new Set(), activeFamilies = new Set(), valueMode) => {
1215
1278
  if (member && activeMembers.has(member)) {
1216
1279
  noteAssumption(member);
@@ -1223,7 +1286,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1223
1286
  // The checker types `new this.constructor()` as `any`. The construction is
1224
1287
  // one of the enclosing class's owned family (`thisConstructorFamilyOf`), so
1225
1288
  // it is at least that class: its declared type names every member the
1226
- // fresh object can be read through -- `.copy` in three's `clone()` -- and
1289
+ // fresh object can be read through -- `.copy` in a `clone()` that is
1290
+ // `new this.constructor().copy( this )` -- and
1227
1291
  // the family's overrides are found from there the way any base-typed
1228
1292
  // receiver's are. Without this every member read on the clone had no
1229
1293
  // declaration and the container walk stopped at `no-declaration`.
@@ -1244,10 +1308,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1244
1308
  * `ownerOriginsClosed` asks a question about a CLASS -- is every construction
1245
1309
  * and every initializer receiver of this family accounted for -- but the only
1246
1310
  * re-entrancy guard it had was `activeMembers`, keyed by whichever METHOD
1247
- * happened to ask. Three's scratch-singleton idiom turns that into a cycle
1248
- * with no leaf: `const _v1 = new Vector3()` is read by nearly every method of
1249
- * `Vector3`, so proving `fromArray` closed walks `_v1`, whose `_v1.set(...)`
1250
- * mention launches a fresh proof of `set`, which asks the identical `Vector3`
1311
+ * happened to ask. A math library's module-level scratch-singleton idiom turns that into a cycle
1312
+ * with no leaf: `const _v1 = new Vector()` is read by nearly every method of
1313
+ * `Vector`, so proving `fromArray` closed walks `_v1`, whose `_v1.set(...)`
1314
+ * mention launches a fresh proof of `set`, which asks the identical `Vector`
1251
1315
  * family question again through a different member symbol -- and the guard
1252
1316
  * never fires because the symbols differ. Nothing in the loop is grounded by
1253
1317
  * an independent fact, so it unfolded to the depth limit and answered open.
@@ -1351,6 +1415,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1351
1415
  // the computation nothing, so the key is discharged -- neither an
1352
1416
  // assumption nor an escape. `parked` is asked FIRST so a key held open
1353
1417
  // for any other reason keeps scoping the answer.
1418
+ if (!answerDependsOn(key, computed.value !== null))
1419
+ continue;
1354
1420
  if (parked(key))
1355
1421
  assumed.add(key);
1356
1422
  else if (!hypothesisSettledAsTruth(key))
@@ -1367,7 +1433,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1367
1433
  // the trail now (`proof-hypotheses.ts`), so `assumed` scopes a refusal to
1368
1434
  // exactly the parks and open questions that produced it, and `grounded` is
1369
1435
  // the fail-closed half: a refusal leaning on a key this frame cannot name
1370
- // is still not stored. The three.js app asked `record-plan:` 1.5M times and kept
1436
+ // is still not stored. One large library compile asked `record-plan:` 1.5M times and kept
1371
1437
  // 16k answers because 98% of the asks refused.
1372
1438
  if (computed.value === null && !grounded)
1373
1439
  sharedStats.ungrounded++;
@@ -1379,7 +1445,11 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1379
1445
  sharedStats.stores++;
1380
1446
  if (computed.value === null)
1381
1447
  sharedStats.refusals++;
1382
- answers.push({ assumed, escaped, value: computed.value, requirements: computed.requirements, opens: recorded });
1448
+ const stored = { assumed, escaped, value: computed.value, requirements: [...computed.requirements], opens: recorded };
1449
+ answers.push(stored);
1450
+ if (dischargeEnabled && computed.value !== null && grounded && assumed.size !== 0)
1451
+ provisionalAnswers.push(stored);
1452
+ return { value: computed.value, requirements: stored.requirements };
1383
1453
  }
1384
1454
  return computed;
1385
1455
  };
@@ -1399,7 +1469,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1399
1469
  (memberClosureDebug === '*' || memberClosureDebug.split(',').includes(member.getName()));
1400
1470
  const openMember = (reason, at) => {
1401
1471
  // The member NAME alone is ambiguous and was misleading: `copy` is
1402
- // declared by two dozen unrelated three.js classes, and the rollup read
1472
+ // declared by two dozen unrelated classes in one library, and the rollup read
1403
1473
  // as one huge refusal when it is twenty small ones. The owner and the
1404
1474
  // nesting depth are what tell a TOP-LEVEL refusal -- the only kind a
1405
1475
  // caller in `parameter-bindings.ts` ever sees -- from one discovered
@@ -1453,7 +1523,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1453
1523
  if (ts.isPropertyAssignment(parent) && parent.name === reference)
1454
1524
  return true;
1455
1525
  // Every other spelling of "this is where the member is written down".
1456
- // `Mesh` declares `geometry;` as a bare typed field, and reading its own
1526
+ // A class may declare `geometry;` as a bare typed field, and reading its own
1457
1527
  // declaration name as a use of the member left that field's receiver
1458
1528
  // unexplained -- the terminal of 35 escapes.
1459
1529
  if ((ts.isPropertyDeclaration(parent) ||
@@ -1603,8 +1673,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1603
1673
  return isClassSpelledSourceClass(owner) && owner.heritageClauses?.length ? { kind: 'opaque' } : { kind: 'none' };
1604
1674
  // `getBaseTypes` ASSERTS its argument is a class-or-interface type; it is not
1605
1675
  // a query that answers "no bases" for anything else. A pre-ES6 JS constructor
1606
- // function whose body declares nested helper functions -- three's
1607
- // `WebGLRenderer` exactly -- resolves `ownerSymbol` to the FUNCTION symbol,
1676
+ // function whose body declares nested helper functions -- a large
1677
+ // `function Renderer() { ... }` module, for one -- resolves `ownerSymbol` to the FUNCTION symbol,
1608
1678
  // whose declared type is not that class type, and the cast threw out of the
1609
1679
  // whole proof. `heritageClassOrInterfaceOf` is the same guard the nominal
1610
1680
  // descent above already uses; when it declines, this class chain is simply
@@ -1629,15 +1699,28 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1629
1699
  const closedCallerSitesOf = (declaration) => {
1630
1700
  const ledger = deferredIntrinsicProtocolLedgerOf(flow);
1631
1701
  let answer = callerSites.get(declaration);
1702
+ if (answer && [...answer.assumed].some((key) => !parked(key) && !hypothesisSettledAsTruth(key))) {
1703
+ callerSites.delete(declaration);
1704
+ answer = undefined;
1705
+ }
1632
1706
  if (!answer) {
1633
- answer = ledger
1634
- ? ledger.capture(() => closedCallerSitesUncached(declaration))
1635
- : { value: closedCallerSitesUncached(declaration), requirements: [] };
1707
+ const trail = pushHypothesisTrail();
1708
+ try {
1709
+ const captured = ledger
1710
+ ? ledger.capture(() => closedCallerSitesUncached(declaration))
1711
+ : { value: closedCallerSitesUncached(declaration), requirements: [] };
1712
+ answer = { ...captured, assumed: trail };
1713
+ }
1714
+ finally {
1715
+ popHypothesisTrail();
1716
+ }
1636
1717
  // An inherited answer is taken while the base's own frame is open;
1637
1718
  // only a settled answer and its supporting obligations may be retained.
1638
1719
  if (inheritingCallerSites.size === 0)
1639
1720
  callerSites.set(declaration, answer);
1640
1721
  }
1722
+ for (const key of answer.assumed)
1723
+ noteAssumption(key);
1641
1724
  if (answer.value === null)
1642
1725
  return null;
1643
1726
  // A successful cached answer still owes its prototype dependencies to
@@ -1674,21 +1757,27 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1674
1757
  }
1675
1758
  return sites;
1676
1759
  }
1677
- const own = callsOf(flow).declarations.get(declaration) ?? [];
1760
+ const own = [...(callsOf(flow).declarations.get(declaration) ?? [])];
1761
+ const allocated = allocationMemberCallerSitesOf(declaration, false, new Set(own.map((site) => site.call)));
1762
+ if (allocated === null)
1763
+ return null;
1764
+ for (const site of allocated)
1765
+ if (!own.includes(site))
1766
+ own.push(site);
1678
1767
  // A call through a base-typed receiver runs the override the runtime
1679
- // object selects: `camera.copy( source )` resolves to the base's `copy`,
1680
- // and a `PerspectiveCamera`'s override runs. Its callers ARE the base's
1768
+ // object selects: `shape.copy( source )` resolves to the base's `copy`,
1769
+ // and a `Circle`'s override runs. Its callers ARE the base's
1681
1770
  // callers -- that is what dispatch means -- whether or not the override
1682
1771
  // also has calls written against it, and leaving them out when it did let
1683
1772
  // `a.m( v )` with `a: A` holding a `B` bind `B.m`'s parameter from `B`'s
1684
1773
  // own calls alone. Answering "no callers, therefore nothing is proven"
1685
- // refused every three.js `copy`/`clone` override and, through the `super`
1774
+ // refused every `copy`/`clone` override in a class-hierarchy library and, through the `super`
1686
1775
  // receiver, the whole family behind it. A base whose slot has no nameable
1687
1776
  // callers -- abstract, data, accessor -- refuses.
1688
1777
  //
1689
1778
  // Zero call sites is an answer, not a gap: the closure proof below decides
1690
1779
  // whether it is a complete one. Refusing instead meant that a method this
1691
- // program never calls -- three's `BufferGeometry` carries a dozen,
1780
+ // program never calls -- a library geometry class can carry a dozen,
1692
1781
  // `rotateX` among them -- could say nothing about its own `this`.
1693
1782
  const base = baseMemberOf(declaration);
1694
1783
  if (base.kind === 'opaque')
@@ -1717,8 +1806,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1717
1806
  const calls = [...own, ...inherited.filter((site) => !own.includes(site))];
1718
1807
  const counted = new Set(own.map((site) => site.call));
1719
1808
  // `this.setSize = function ( width, height ) { ... }` is a method slot
1720
- // written the other way round. Three's `WebGLOutput` publishes its whole
1721
- // API that way, and `closedCallerSitesOf` was the one place still
1809
+ // written the other way round. A pre-ES6 constructor-function module can
1810
+ // publish its whole API that way, and `closedCallerSitesOf` was the one place still
1722
1811
  // spelling "method" syntactically -- `fieldDeclaration` below already
1723
1812
  // states that a special assignment is a declaration form. The member slot
1724
1813
  // is the only handle on the function object, which is why the right-hand
@@ -1729,9 +1818,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1729
1818
  if (slot !== null && 'body' in declaration && declaration.body !== undefined) {
1730
1819
  const symbol = checker.getSymbolAtLocation(slot);
1731
1820
  // A call the checker resolves against the symbol's STATED declaration --
1732
- // `Object3D`'s own `onBeforeRender(){}` stub, for a call through a
1733
- // receiver the checker types `Object3D` -- never indexes under an
1734
- // INSTANCE override written elsewhere (`mesh.onBeforeRender = function
1821
+ // a base class's own `onRender(){}` stub, for a call through a
1822
+ // receiver the checker types `Node` -- never indexes under an
1823
+ // INSTANCE override written elsewhere (`node.onRender = function
1735
1824
  // ( renderer, object ) { ... }`), because the checker has no
1736
1825
  // flow-sensitive model of "this receiver was later given its own
1737
1826
  // property". `memberImplementationsOf` is the existing, already-proven
@@ -1763,8 +1852,39 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1763
1852
  hasClosedMemberCallableUses(checker, flow, symbol, siblingCounted, receiverTypeAt, argumentsUsesAt, onOpenUse, nestedMembers, nestedFamilies());
1764
1853
  return closedMember ? sites : null;
1765
1854
  }
1855
+ if (ts.isArrowFunction(declaration) || (ts.isFunctionExpression(declaration) && declaration.name === undefined)) {
1856
+ // A function expression has no declaration binding of its own. Its
1857
+ // exact initializer cell can nevertheless name every caller, provided
1858
+ // that cell never changes and every executable use is an entered call.
1859
+ const value = outermostErasureOf(declaration);
1860
+ const binding = value.parent;
1861
+ if (!ts.isVariableDeclaration(binding) ||
1862
+ binding.initializer !== value ||
1863
+ !ts.isIdentifier(binding.name) ||
1864
+ !flow.callableBodyIsIndexed(declaration) ||
1865
+ (argumentsUsesAt(declaration)?.length ?? 0) > 0 ||
1866
+ !localBindingWritesAreComplete(flow, binding) ||
1867
+ isModuleExportedDeclaration(checker, binding, checker.getSymbolAtLocation(binding.name) ?? null))
1868
+ return null;
1869
+ const writes = flow.writesToDeclaration(binding).filter((write) => write.slot === 'whole');
1870
+ if (writes.length === 0 ||
1871
+ writes.some((write) => write.edge !== 'declaration-initializer' || write.value === null || unwrapValue(write.value) !== declaration))
1872
+ return null;
1873
+ for (const reference of flow.referencesToDeclaration(binding)) {
1874
+ if (reference === binding.name || isTypePositionReference(reference))
1875
+ continue;
1876
+ const use = outermostErasureOf(reference);
1877
+ const parent = use.parent;
1878
+ if (ts.isCallExpression(parent) && parent.expression === use && counted.has(parent))
1879
+ continue;
1880
+ return null;
1881
+ }
1882
+ return calls;
1883
+ }
1766
1884
  if (!ts.isFunctionDeclaration(declaration) || !declaration.name || !declaration.body)
1767
1885
  return null;
1886
+ if (!sourceGlobalCallableBindingIsClosed(checker, flow, declaration))
1887
+ return null;
1768
1888
  if ((argumentsUsesAt(declaration)?.length ?? 0) > 0 || callableBindingIsWritten(flow, declaration))
1769
1889
  return null;
1770
1890
  // An export is a mention no expression spells: code outside the program
@@ -1772,8 +1892,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1772
1892
  // could expose the binding outside the stated module set, and otherwise
1773
1893
  // names every importer's mention -- which are classified below exactly
1774
1894
  // like the declaring module's own. Refusing every IMPORTED export here
1775
- // was where three's `WebGLBackground.setClearColor`/`setClearAlpha` and
1776
- // `WebGLOutput.setSize`/`setEffects`/`begin` all stopped.
1895
+ // was where every `this.method = function` slot of an imported pre-ES6
1896
+ // constructor-function module stopped.
1777
1897
  const exported = isModuleExportedDeclaration(checker, declaration, checker.getSymbolAtLocation(declaration.name) ?? null);
1778
1898
  const imported = exported ? inProgramImportReferencesOf(checker, flow, declaration) : [];
1779
1899
  if (imported === null)
@@ -1783,7 +1903,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1783
1903
  if (reference === declaration.name || isTypePositionReference(reference))
1784
1904
  continue;
1785
1905
  const parent = reference.parent;
1786
- // `@type {ReturnType<typeof WebGLRenderList>}`: a type query evaluates nothing.
1906
+ // `@type {ReturnType<typeof RenderList>}`: a type query evaluates nothing.
1787
1907
  if (ts.isTypeQueryNode(parent) && parent.exprName === reference)
1788
1908
  continue;
1789
1909
  if ((ts.isCallExpression(parent) || ts.isNewExpression(parent)) && parent.expression === reference) {
@@ -1804,7 +1924,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1804
1924
  // `recordReference`), a namespace's whole-object uses included.
1805
1925
  if (ts.isImportSpecifier(parent) || ts.isImportClause(parent) || ts.isNamespaceImport(parent) || ts.isExportSpecifier(parent))
1806
1926
  continue;
1807
- // `{ sort: sort }` / `{ sort }` in three's `WebGLRenderList`: the
1927
+ // `{ sort: sort }` / `{ sort }` in a factory function's returned record: the
1808
1928
  // function goes into a record slot, and every call through the slot is
1809
1929
  // one of its callers -- provided the slot itself is closed.
1810
1930
  const slotCalls = recordSlotCallersOf(declaration, reference);
@@ -1833,25 +1953,110 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1833
1953
  if (!index) {
1834
1954
  const built = new Map();
1835
1955
  for (const site of flow.calls) {
1836
- const callee = ts.isCallExpression(site.call) ? unwrapNaming(site.call.expression) : null;
1837
- if (!callee || !ts.isPropertyAccessExpression(callee))
1956
+ const callee = ts.isCallExpression(site.call) ? site.operands.callee : null;
1957
+ if (!callee || (!ts.isPropertyAccessExpression(callee) && !ts.isElementAccessExpression(callee)))
1958
+ continue;
1959
+ const key = accessKeyOf(callee);
1960
+ if (key === null)
1838
1961
  continue;
1839
- const entries = built.get(callee.name.text);
1962
+ const entries = built.get(key);
1840
1963
  if (entries)
1841
1964
  entries.push(site);
1842
1965
  else
1843
- built.set(callee.name.text, [site]);
1966
+ built.set(key, [site]);
1844
1967
  }
1845
1968
  callsByMemberName.set(flow, (index = built));
1846
1969
  }
1847
1970
  return index.get(key) ?? [];
1848
1971
  };
1972
+ /** The checker cannot index a call through `new this.constructor()` or an
1973
+ * untyped constructor alias under its stored body. Its exact allocation
1974
+ * lookup still belongs to that body's caller inventory. This collects
1975
+ * candidates only; the existing slot/use proof must close every one.
1976
+ */
1977
+ const allocationMemberCallerSitesOf = (declaration, family, counted) => {
1978
+ const owner = memberOwnerClassOf(declaration);
1979
+ const key = memberKeyOf(declaration);
1980
+ if (owner === null || key === null)
1981
+ return [];
1982
+ // These exact call pointers already belong to the consuming inventory and
1983
+ // still pass its complete slot/use proof. Re-discovering their candidate
1984
+ // attribution through allocation origins adds a circular closure question,
1985
+ // rather than a caller. Unindexed aliases and constructor calls remain.
1986
+ const candidates = memberNamedCallsOf(key).filter((site) => !counted.has(site.call));
1987
+ if (candidates.length === 0)
1988
+ return [];
1989
+ const guard = allocationCallerInventoryGuardOf(flow, declaration, family);
1990
+ if (hypothesisGuardIsOpen(guard)) {
1991
+ noteAssumption(guard);
1992
+ // An unfinished inventory is unknown, not an empty caller set. In
1993
+ // particular it cannot narrow a parameter to only the already indexed
1994
+ // callers while another proof is still discovering an allocation call.
1995
+ return null;
1996
+ }
1997
+ enterHypothesisGuard(guard, true);
1998
+ try {
1999
+ const body = ts.isMethodDeclaration(declaration) ||
2000
+ ts.isFunctionDeclaration(declaration) ||
2001
+ ts.isFunctionExpression(declaration) ||
2002
+ ts.isArrowFunction(declaration)
2003
+ ? declaration
2004
+ : null;
2005
+ const wanted = new Set(family ? (memberImplementationsOf(declaration) ?? []) : body ? [body] : (ownMemberBodiesOf(declaration) ?? []));
2006
+ const symbol = slotSymbolOf(declaration);
2007
+ const found = [];
2008
+ for (const site of candidates) {
2009
+ if (!ts.isCallExpression(site.call) || site.explicitThis || site.operands.dispatch.kind !== 'member')
2010
+ continue;
2011
+ const callee = site.operands.callee;
2012
+ if ((!ts.isPropertyAccessExpression(callee) && !ts.isElementAccessExpression(callee)) || accessKeyOf(callee) !== key)
2013
+ continue;
2014
+ // Caller discovery and target admission must ask the same original
2015
+ // construction question. A computed own constructor has no standalone
2016
+ // allocation answer, but its closed slot and complete source family
2017
+ // can still select this body; dropping that call makes the later use
2018
+ // proof reject the very caller the target proof admitted.
2019
+ const origins = memberReceiverOriginsOf(callee.expression);
2020
+ if (origins === null || origins.classes.size === 0)
2021
+ continue;
2022
+ let matches = false;
2023
+ let complete = true;
2024
+ for (const source of origins.classes) {
2025
+ const sourceSymbol = source.name ? checker.getSymbolAtLocation(source.name) : checker.getTypeAtLocation(source).getSymbol();
2026
+ const held = sourceSymbol && checker.getPropertyOfType(checker.getDeclaredTypeOfSymbol(sourceSymbol), key);
2027
+ const declarations = held?.declarations?.length
2028
+ ? held.declarations
2029
+ : constructorInstalledMemberDeclarationsOf(flow, source).get(key);
2030
+ if (!declarations?.length) {
2031
+ complete = false;
2032
+ break;
2033
+ }
2034
+ for (const selected of declarations) {
2035
+ const bodies = memberImplementationsOf(selected);
2036
+ if (bodies === null || bodies.length === 0) {
2037
+ complete = false;
2038
+ break;
2039
+ }
2040
+ matches ||= (family && symbol !== undefined && slotSymbolOf(selected) === symbol) || bodies.some((body) => wanted.has(body));
2041
+ }
2042
+ if (!complete)
2043
+ break;
2044
+ }
2045
+ if (complete && matches)
2046
+ found.push(site);
2047
+ }
2048
+ return found;
2049
+ }
2050
+ finally {
2051
+ exitHypothesisGuard(guard, true);
2052
+ }
2053
+ };
1849
2054
  /**
1850
2055
  * The calls through the record slot a function-name mention fills, or null
1851
2056
  * when the mention is not a record slot or the slot is not closed.
1852
2057
  *
1853
2058
  * A record method call names no declaration the checker can hand back when
1854
- * the record is untyped -- three reads `currentRenderList` out of an `any`
2059
+ * the record is untyped -- e.g. a list read out of an `any`
1855
2060
  * -- so the calls are found by key and admitted only where
1856
2061
  * `recordMethodCallTargetsOf` includes this body in the complete target set. The
1857
2062
  * slot's own closure proof then counts exactly those calls: a call through
@@ -1912,9 +2117,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1912
2117
  /**
1913
2118
  * `enumeratedParameterValuesOf` (`global-host-mutations.ts`) now calls this
1914
2119
  * for every call-argument reference whose static declaration is an
1915
- * identifier parameter, program-wide -- not once per parameter. Three's
1916
- * heavily forwarded parameters (`material`, `object`, `camera`, `scene`)
1917
- * each have thousands of such reference sites across `WebGLRenderer.js` and
2120
+ * identifier parameter, program-wide -- not once per parameter. A large
2121
+ * library's heavily forwarded parameters (`object`, `context`, `options`)
2122
+ * can each have thousands of such reference sites across one module and
1918
2123
  * its satellites, and every one of them used to redo the full
1919
2124
  * `closedCallerSitesOf` + call-site + write-set walk below from scratch.
1920
2125
  *
@@ -2052,9 +2257,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2052
2257
  return null;
2053
2258
  }
2054
2259
  // An omitted argument with no default IS the value `undefined` -- a
2055
- // known value, not a missing one. Three constructs `new
2056
- // MeshDistanceMaterial()` and `new MeshDepthMaterial()` bare, and
2057
- // refusing those frames made `Material.setValues`' key set refuse.
2260
+ // known value, not a missing one. A subclass constructed bare --
2261
+ // `new DerivedStyle()` -- forwards `undefined` to a base
2262
+ // `setValues( options )`, and refusing those frames made that
2263
+ // method's key set refuse.
2058
2264
  values.add(args?.[position] ?? parameter.initializer ?? omittedArgumentOf(call, position));
2059
2265
  }
2060
2266
  }
@@ -2089,8 +2295,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2089
2295
  };
2090
2296
  /**
2091
2297
  * Every value `arguments[ i ]` can read inside `owner`, for an `i` this
2092
- * file already knows is numeric but not which one -- three's
2093
- * `Object3D.add` walks `arguments` exactly this way to admit several
2298
+ * file already knows is numeric but not which one -- a tree node's
2299
+ * `add( ...children )`-style method that walks `arguments` exactly this way to admit several
2094
2300
  * children in one call. Unlike `parameterValuesOf` (one declared position),
2095
2301
  * an unindexed read can land on ANY actual argument at ANY position, so
2096
2302
  * every position of every closed caller site is in the set, not only the
@@ -2115,8 +2321,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2115
2321
  * Every value a parameter receives when its function is used as an
2116
2322
  * intrinsic Array callback, or null when some use is anything else.
2117
2323
  *
2118
- * Three's `painterSortStable( a, b )` is never called by name: it is handed
2119
- * to `opaque.sort( customOpaqueSort || painterSortStable )`, and the sort
2324
+ * A comparator `sortStable( a, b )` that is never called by name: it is handed
2325
+ * to `opaque.sort( customSort || sortStable )`, and the sort
2120
2326
  * calls it with pairs of the array's own elements. That is a closed frame
2121
2327
  * -- every element the array ever stored, by `arrayStoredValuesOf` -- as
2122
2328
  * long as each mention of the function is a direct call or the callback of
@@ -2199,9 +2405,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2199
2405
  return [...values];
2200
2406
  };
2201
2407
  /**
2202
- * The whole origin authority for a record plan. Three's pooled render item
2203
- * is read back out of `renderItems[ renderItemsIndex ]`, and the list out of
2204
- * `listArray[ renderCallDepth ]`: such reads are origins only with the
2408
+ * The whole origin authority for a record plan. A renderer's pooled render item
2409
+ * read back out of `renderItems[ renderItemsIndex ]`, and the list out of
2410
+ * `listArray[ renderCallDepth ]`, is an example: such reads are origins only with the
2205
2411
  * intrinsic protocols closed, and an index the checker types `any` (an
2206
2412
  * unannotated parameter) counts as numeric where this proof's census view
2207
2413
  * types it so.
@@ -2227,8 +2433,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2227
2433
  explicitInvocationIsIntact: (call) => explicitInvocationIsIntact(call),
2228
2434
  protocolClosed: (plan) => nativeProtocolClosed(plan),
2229
2435
  numericKey: (key) => numericArrayIndex(key),
2230
- // `_this.renderLists = renderLists` publishes three's render-list record
2231
- // onto the renderer; whether any use of those literals can replace the
2436
+ // `_this.renderLists = renderLists` publishes a factory-built record
2437
+ // onto the constructed object; whether any use of those literals can replace the
2232
2438
  // called slot is this proof's record-closure walk over the roots the
2233
2439
  // record-method route hands back. (Asking `constructionDataMemberOf` of
2234
2440
  // the receiver instead would re-derive the very plan being built.)
@@ -2397,7 +2603,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2397
2603
  * folded into a summary.
2398
2604
  *
2399
2605
  * Folding at the FIRST repeat is sound but loses the shape a nested
2400
- * container really has: three keeps a list of render lists, each holding
2606
+ * container really has: a renderer can keep a list of render lists, each holding
2401
2607
  * arrays of render items -- `[] . opaque . [] . object` repeats the element
2402
2608
  * hop without any object graph closing on itself -- and a summary of `{ [],
2403
2609
  * opaque }` would make every mention along the way possibly an array AND
@@ -2591,7 +2797,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2591
2797
  /**
2592
2798
  * A member lookup asks which DECLARATION a key names, and a receiver still
2593
2799
  * carrying its nullish arms names the same one: `output.setEffects` where
2594
- * `output` is `WebGLOutput | null` reaches exactly one `setEffects`, and a
2800
+ * `output` is `Output | null` reaches exactly one `setEffects`, and a
2595
2801
  * receiver that really is null throws AT the access rather than reaching some
2596
2802
  * other declaration -- so the null arm contributes no member and no escape
2597
2803
  * path. `field-bindings.ts`'s `memberSymbolOf` already states this for the
@@ -2623,9 +2829,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2623
2829
  * own, else every source class that can construct the receiver, else the
2624
2830
  * entry of each object literal the receiver can have been allocated as.
2625
2831
  *
2626
- * The last is how three's pooled render items are read: `renderItem` comes
2832
+ * The last is how a renderer's pooled render items are read: `renderItem` comes
2627
2833
  * back out of an untyped array, so the checker names no `id` on it, but
2628
- * every render item is the one literal `getNextRenderItem` writes. Empty
2834
+ * every render item is the one literal a `getNextItem()` helper writes. Empty
2629
2835
  * when any allocation lacks the key -- a prototype lookup is not a slot.
2630
2836
  */
2631
2837
  const fieldDeclarationsOf = (expression, key) => {
@@ -2763,8 +2969,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2763
2969
  if (declared !== null)
2764
2970
  return declared;
2765
2971
  // An untyped receiver whose every allocation carries the key in one
2766
- // literal entry: three reads `currentRenderList` out of an `any`, and
2767
- // every list is the literal `WebGLRenderList` returns.
2972
+ // literal entry: a list read out of an `any`, where every list is the
2973
+ // literal one factory function returns.
2768
2974
  const records = fieldDeclarationsOf(access.expression, key);
2769
2975
  return records.length === 1 ? records[0] : null;
2770
2976
  };
@@ -2819,8 +3025,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2819
3025
  (!selected.needsDefaultPrototype || ledger?.requirePrototypeKeys('Object', { names: [selectedKey] }, reference) === true));
2820
3026
  });
2821
3027
  const terminalUse = (reference) => {
2822
- // `const { object, geometry, group } = renderItem` in three's
2823
- // `renderObjects` reads each key exactly as `renderItem.object` would.
3028
+ // `const { object, geometry, group } = renderItem` in a render
3029
+ // loop reads each key exactly as `renderItem.object` would.
2824
3030
  // A rest element copies every own slot out, so it stays with the
2825
3031
  // shared engine.
2826
3032
  const holder = reference.parent;
@@ -2911,8 +3117,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2911
3117
  * or, for `this` in a function the literal was written holding, the literal
2912
3118
  * itself, which the same proof makes the only possible receiver.
2913
3119
  *
2914
- * Three's `ColorManagement.convert` reads `this.enabled`, and `Color` reads
2915
- * the imported `ColorManagement.workingColorSpace`. The checker names the
3120
+ * A singleton object literal's method `Settings.convert` reads `this.enabled`,
3121
+ * and a class in another module reads the imported `Settings.workingSpace`. The checker names the
2916
3122
  * literal's entry for both -- a name a second literal with a getter under
2917
3123
  * that key would satisfy just as well, which is why it is not evidence.
2918
3124
  */
@@ -2958,10 +3164,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2958
3164
  * An accessor read is a CALL that runs user code with this receiver bound,
2959
3165
  * which is why the member-read arm below refuses one outright. That refusal
2960
3166
  * is stronger than it needs to be: the body is right there to be proven, the
2961
- * same way a method body is. Three's `Camera` states `reversedDepth` as a
2962
- * getter over `this._reversedDepth`, and `this.reversedDepth` inside
2963
- * `updateProjectionMatrix` was the terminal of 35 escapes -- `WebGLState`'s
2964
- * whole buffer family among them -- for a getter that does nothing but read
3167
+ * same way a method body is. A class stating `reversed` as a
3168
+ * getter over `this._reversed`, read as `this.reversed` inside one of its
3169
+ * own methods, was the terminal of 35 escapes -- a whole unrelated buffer
3170
+ * family among them -- for a getter that does nothing but read
2965
3171
  * one of its own fields.
2966
3172
  *
2967
3173
  * Every nominal DESCENDANT that declares the key as an accessor of the
@@ -3053,7 +3259,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3053
3259
  return [...found];
3054
3260
  };
3055
3261
  resolvingImplementations.add(declaration);
3056
- enterHypothesisGuard(declaration);
3262
+ enterHypothesisGuard(declaration, true);
3057
3263
  // What the re-entry above hands out is a REFUSAL (`return null`). So the
3058
3264
  // hypothesis is confirmed exactly when this walk also refuses; then every
3059
3265
  // answer that leaned on it rested on something true and becomes
@@ -3207,6 +3413,20 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3207
3413
  }
3208
3414
  return { bodies, values: [...values] };
3209
3415
  };
3416
+ const ownMemberBodiesOf = (declaration) => {
3417
+ const inventory = ownImplementationsOf(declaration);
3418
+ if (inventory === null)
3419
+ return null;
3420
+ const bodies = new Set(inventory.bodies);
3421
+ for (const value of inventory.values) {
3422
+ const targets = closedCallableTargetsOf(checker, flow, value, elementCalleeAuthority);
3423
+ if (targets === null)
3424
+ return null;
3425
+ for (const target of targets)
3426
+ bodies.add(target);
3427
+ }
3428
+ return [...bodies];
3429
+ };
3210
3430
  /**
3211
3431
  * The member declarations whose slots a call through `declared` can read:
3212
3432
  * its own symbol's declarations, and every descendant redeclaration
@@ -3215,8 +3435,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3215
3435
  // MODULE-level, keyed by `flow`: `declared` plus the round's fixed class
3216
3436
  // list and checker facts fully determine the answer (`memberOwnerClassOf`/
3217
3437
  // `memberKeyOf` are pure syntax, not proof state), so every one of a round's
3218
- // many proofs asking about the same slot -- three's many `.add(...)` sites
3219
- // all reaching one `Object3D.prototype.add` -- can share one answer instead
3438
+ // many proofs asking about the same slot -- a library's many `.add(...)` sites
3439
+ // all reaching one `Node.prototype.add` -- can share one answer instead
3220
3440
  // of each re-walking `flow.classDeclarations` from zero.
3221
3441
  let slotDeclarationsCache = slotDeclarationsCaches.get(flow);
3222
3442
  if (!slotDeclarationsCache)
@@ -3265,6 +3485,13 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3265
3485
  const symbol = slotSymbolOf(declaration);
3266
3486
  if (!symbol)
3267
3487
  return false;
3488
+ // The nested closure already consumes this exact recursive lease. Its
3489
+ // caller inventory must not recurse first and manufacture an open answer;
3490
+ // retaining the assumption prevents reuse before the outer proof settles.
3491
+ if (nestedMembers.has(symbol)) {
3492
+ noteAssumption(symbol);
3493
+ return true;
3494
+ }
3268
3495
  const held = slotClosures.get(symbol);
3269
3496
  const ledger = deferredIntrinsicProtocolLedgerOf(flow);
3270
3497
  if (held !== undefined) {
@@ -3291,6 +3518,11 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3291
3518
  if (ts.isCallExpression(call) && call.expression === access)
3292
3519
  calls.add(call);
3293
3520
  }
3521
+ const allocated = allocationMemberCallerSitesOf(entry, true, calls);
3522
+ if (allocated === null)
3523
+ return false;
3524
+ for (const site of allocated)
3525
+ calls.add(site.call);
3294
3526
  }
3295
3527
  // An untyped record receiver names no declaration the index files the
3296
3528
  // call under: its calls are found by key and admitted where the slot is
@@ -3335,9 +3567,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3335
3567
  * unresolvable receiver is not a write, and it cannot change what the slot
3336
3568
  * holds for anyone. Asked as one conjunction over the whole program, one
3337
3569
  * `geometry.getAttribute( ... )` off an untyped parameter opened
3338
- * `BufferGeometry.getAttribute` for the 1,179 typed call sites of the same
3339
- * key in the three.js app, and every math class's `copy`/`set`/`add` the same way --
3340
- * so every reach proof in three's renderer refused as one cycle, and no
3570
+ * `Geometry.getAttribute` for the 1,179 typed call sites of the same
3571
+ * key in one large library compile, and every math class's `copy`/`set`/`add` the same way --
3572
+ * so every reach proof in that library's renderer refused as one cycle, and no
3341
3573
  * fixture-sized fix ever moved the refused-site count (2,227 -> 2,227
3342
3574
  * across six root fixes on 2026-09-14).
3343
3575
  *
@@ -3579,10 +3811,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3579
3811
  // callee IS that class's own binding (TypeScript rejects assigning to a
3580
3812
  // class declaration's binding, TS2629). A callee that only reaches the
3581
3813
  // constructor through a wider value -- a `typeof Base` cell, an inherited
3582
- // constructor -- still refuses. Measured on mongodb: every `Document`-
3583
- // typed argument (`{ [key: string]: any }` admits every class instance)
3814
+ // constructor -- still refuses. Measured on a large library compile: every
3815
+ // index-signature-typed argument (`{ [key: string]: any }` admits every class instance)
3584
3816
  // handed to any source constructor made EVERY class family escape, which
3585
- // left `Connection.command`'s member slot open.
3817
+ // left an ordinary method slot open.
3586
3818
  if (compiledBody && declaration !== undefined && ts.isConstructorDeclaration(declaration) && ts.isNewExpression(node)) {
3587
3819
  if (newNamesOwnConstructor(node, declaration))
3588
3820
  continue;
@@ -3666,13 +3898,13 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3666
3898
  * <compiled function>` assignment -- or null the moment one is not.
3667
3899
  * `memberSlotWritesClosed` answers "does nothing write this slot", which is
3668
3900
  * stronger than TARGET IDENTITY needs: a write only opens the slot to an
3669
- * unknown callable when what it installs cannot itself be named. Three's
3670
- * `Object3D.prototype.onBeforeRender` is a per-instance render hook --
3671
- * `WebGLBackground.js` does `boxMesh.onBeforeRender = function( renderer,
3672
- * scene, camera ) { ... }` on a local `Mesh` instance, from OUTSIDE any
3901
+ * unknown callable when what it installs cannot itself be named. A base
3902
+ * class's `Node.prototype.onRender` stub is a per-instance hook --
3903
+ * one module does `boxNode.onRender = function( renderer,
3904
+ * scene, camera ) { ... }` on a local instance, from OUTSIDE any
3673
3905
  * class body, so `instanceMemberWritesOf` (which only sees `this.x =` /
3674
- * `super.x =`) never learns of it -- so `WebGLRenderer.js`'s
3675
- * `scene.onBeforeRender( ... )` calls through a slot with one such
3906
+ * `super.x =`) never learns of it -- so another module's
3907
+ * `scene.onRender( ... )` calls through a slot with one such
3676
3908
  * override, itself a compiled function this walk can name. A slot written
3677
3909
  * three times with three compiled functions is exactly as closed as a slot
3678
3910
  * written once.
@@ -3789,7 +4021,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3789
4021
  // proof, and that proof's walk asks `constructionDataMemberOf`, whose record
3790
4022
  // plan expands a parameter through `parameterValuesOf` back into a
3791
4023
  // `fieldValuesOf` -- of the nested proof, which held its own empty guard. On
3792
- // `object.matrix.parent = object` (three's `Object3D.parent` back-reference)
4024
+ // `object.matrix.parent = object` (a scene-graph node's parent back-reference)
3793
4025
  // each level spawned a fresh proof asking the same read and the stack
3794
4026
  // overflowed. A re-ask of a read still being answered is the same cycle
3795
4027
  // whichever proof instance asks it, and it already refused within one.
@@ -3797,8 +4029,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3797
4029
  if (!activeFieldReads)
3798
4030
  activeFieldReadsByFlow.set(flow, (activeFieldReads = new Set()));
3799
4031
  const callCompletionValuesAt = (call) => {
3800
- // `options = Object.assign( { ...defaults }, options )` in three's
3801
- // `RenderTarget`: the intact intrinsic returns its target. The graph
4032
+ // `options = Object.assign( { ...defaults }, options )` in a class
4033
+ // constructor that rebinds its options parameter: the intact intrinsic returns its target. The graph
3802
4034
  // models the same call (`bulkAssignOf`); this is the legacy resolver's
3803
4035
  // reading of it, and it goes when `parameterValuesOf` does.
3804
4036
  if (isGlobalObjectAssign(checker, call) &&
@@ -3813,9 +4045,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3813
4045
  // leans on `collectionStoredValuesOf` for this identical question; the
3814
4046
  // exact-origin graph asked its every OTHER leaf (`fieldValuesOf`,
3815
4047
  // `parameterValuesOf`, `thisFamilyOf`) but never a call, so a value
3816
- // round-tripped through a WeakMap -- three's `WebGLEnvironments`
3817
- // `cubeMaps.get( texture )`, holding the very `WebGLCubeRenderTarget`
3818
- // `getCube` just allocated -- had no exact origin, and every method later
4048
+ // round-tripped through a WeakMap -- a cache's
4049
+ // `cache.get( key )`, holding the very object
4050
+ // its `getOrCreate` just allocated -- had no exact origin, and every method later
3819
4051
  // called on it (`cubemap.dispose()` in the map's own dispose listener)
3820
4052
  // refused as `targets:origin-slot-open`.
3821
4053
  const stored = collectionStoredValuesOf(checker, flow, call, nativeProtocolClosed);
@@ -3857,6 +4089,13 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3857
4089
  return traceField('recursive-read');
3858
4090
  }
3859
4091
  activeFieldReads.add(access);
4092
+ // A read still being answered is a re-entry guard in everything but name:
4093
+ // it hands its re-entries a refusal. Opened as one, the refusals that
4094
+ // leaned on it are settled when the read finishes, instead of staying
4095
+ // conditional on this exact read being in flight for the rest of the
4096
+ // compile -- one stored refusal per combination of reads open at the time.
4097
+ enterHypothesisGuard(access, true);
4098
+ let outcome;
3860
4099
  try {
3861
4100
  const ledger = deferredIntrinsicProtocolLedgerOf(flow);
3862
4101
  fieldStats.asks++;
@@ -3888,16 +4127,22 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3888
4127
  let answers = byAccess.get(access);
3889
4128
  if (!answers)
3890
4129
  byAccess.set(access, (answers = []));
4130
+ if (answers.length > fieldStats.longest)
4131
+ fieldStats.longest = answers.length;
3891
4132
  for (const answer of answers) {
4133
+ fieldStats.scanned++;
3892
4134
  let applies = true;
3893
- for (const assumedKey of answer.assumed)
4135
+ for (const assumedKey of answer.assumed) {
4136
+ fieldStats.keysChecked++;
3894
4137
  if (!parked(assumedKey)) {
3895
4138
  applies = false;
3896
4139
  break;
3897
4140
  }
4141
+ }
3898
4142
  if (!applies)
3899
4143
  continue;
3900
4144
  fieldStats.hits++;
4145
+ answer.uses++;
3901
4146
  for (const assumedKey of answer.assumed)
3902
4147
  noteAssumption(assumedKey);
3903
4148
  for (const escapedKey of answer.escaped)
@@ -3906,7 +4151,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3906
4151
  onOpenUse(reference, kind);
3907
4152
  if (answer.values !== null && ledger)
3908
4153
  ledger.include(answer.requirements);
3909
- return answer.values ?? traceField('shared-refusal');
4154
+ return (outcome = answer.values ?? traceField('shared-refusal'));
3910
4155
  }
3911
4156
  const trail = pushHypothesisTrail();
3912
4157
  const opens = new Map();
@@ -3935,6 +4180,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3935
4180
  // frame's, so no enclosing positive answer's scope changes.
3936
4181
  const escaped = new Set();
3937
4182
  for (const key of trail) {
4183
+ // See `hypothesisIsPessimistic`: a read that came out with values owes
4184
+ // a pessimistic hypothesis nothing.
4185
+ if (!answerDependsOn(key, computed.value !== null))
4186
+ continue;
3938
4187
  if (parked(key))
3939
4188
  assumed.add(key);
3940
4189
  else
@@ -3946,13 +4195,39 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3946
4195
  for (const kind of kinds)
3947
4196
  recorded.push([reference, kind]);
3948
4197
  fieldStats.stores++;
3949
- answers.push({ assumed, escaped, values: computed.value, requirements: computed.requirements, opens: recorded });
4198
+ const stored = {
4199
+ assumed,
4200
+ escaped,
4201
+ values: computed.value,
4202
+ requirements: [...computed.requirements],
4203
+ opens: recorded,
4204
+ uses: 0
4205
+ };
4206
+ answers.push(stored);
4207
+ if (dischargeEnabled && computed.value !== null && escaped.size === 0 && assumed.size !== 0)
4208
+ provisionalAnswers.push(stored);
4209
+ // Settled like the proof memo's answers: when a re-entry guard this
4210
+ // answer leaned on closes, the answer either sheds that key (the guard's
4211
+ // refusal was the truth) or leaves the bucket. Unregistered, a refusal
4212
+ // stayed conditional on every read that happened to be in flight when it
4213
+ // was computed -- ~35 of them -- and one large app compile grew one bucket per field to
4214
+ // thousands of refusals, each with its own signature, every one scanned
4215
+ // on every later ask of that field.
4216
+ if (assumed.size !== 0)
4217
+ registerGuardedAnswer(stored, () => {
4218
+ const at = answers.indexOf(stored);
4219
+ if (at !== -1)
4220
+ answers.splice(at, 1);
4221
+ });
3950
4222
  if (computed.value !== null && ledger)
3951
- ledger.include(computed.requirements);
3952
- return computed.value;
4223
+ ledger.include(stored.requirements);
4224
+ return (outcome = computed.value);
3953
4225
  }
3954
4226
  finally {
3955
4227
  activeFieldReads.delete(access);
4228
+ // The refusal handed to re-entries was the truth only if the read itself
4229
+ // came out refused; otherwise answers that leaned on it are struck.
4230
+ exitHypothesisGuard(access, outcome === null, outcome === null);
3956
4231
  }
3957
4232
  };
3958
4233
  /** Everything the memo above covers: the array-index shortcut, the value
@@ -4087,8 +4362,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4087
4362
  // whole question as one word (`member-call-argument:receiver-outside
4088
4363
  // -family`), and that word is true of a receiver whose allocations cannot
4089
4364
  // be enumerated, one whose `this` frame is static, and one whose own slot
4090
- // is open alike -- three different fixes. The three.js app's `scene.add( sun )`
4091
- // refused here and there was no way to say which.
4365
+ // is open alike -- three different fixes. A `scene.add( light )` in one
4366
+ // large library compile refused here and there was no way to say which.
4092
4367
  const familyTraced = (reason, detail) => {
4093
4368
  if (watchedReceiverFamily !== undefined) {
4094
4369
  const file = receiver.getSourceFile();
@@ -4128,7 +4403,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4128
4403
  // so the frame question below answers it exactly. Sending it to
4129
4404
  // `exactClassAllocationOriginsOf` instead asked "which classes can this
4130
4405
  // expression denote" of a keyword that denotes no cell, and every
4131
- // `super.copy` in three's Texture/RenderTarget/DepthTexture chain refused
4406
+ // `super.copy` in a multi-level class chain's `copy` overrides refused
4132
4407
  // as `allocations-not-enumerable`.
4133
4408
  if (value.kind !== ts.SyntaxKind.ThisKeyword && value.kind !== ts.SyntaxKind.SuperKeyword) {
4134
4409
  // A receiver that arrived as a parameter is answered by THIS proof's
@@ -4136,13 +4411,13 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4136
4411
  // method's callers means proving its slot closed, and that is the
4137
4412
  // question this proof is already inside, with this proof's counted
4138
4413
  // calls. Without it `Renderer.render( object )` handing `object` to
4139
- // `object.onBeforeRender( this )` left the renderer unplaceable, which
4140
- // is the `object-to-dynamic-conversion` behind three's whole
4141
- // `onBeforeRender` family.
4414
+ // `object.onRender( this )` left the renderer unplaceable, which
4415
+ // is the `object-to-dynamic-conversion` behind a whole family of
4416
+ // per-instance hook calls.
4142
4417
  const origins = allocationOriginsOf(value);
4143
4418
  if (origins === null) {
4144
- // `new this.constructor( ... )` -- three's universal `clone()`, and the
4145
- // receiver of 150 refusals off `Texture.clone` alone -- names a
4419
+ // `new this.constructor( ... )` -- the universal `clone()` idiom, and the
4420
+ // receiver of 150 refusals off one class's `clone` alone -- names a
4146
4421
  // COMPUTED callee, and `exactClassAllocationOriginsOf` resolves only
4147
4422
  // identifiers and namespace members. It is not missing a branch: it is
4148
4423
  // asked standalone, with no candidate family to check `this` against,
@@ -4153,9 +4428,17 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4153
4428
  // explicit receiver, and whose `constructor` slot nothing writes, the
4154
4429
  // allocation is `C`'s own family.
4155
4430
  const own = ts.isNewExpression(value) ? ownConstructorClassOf(value) : null;
4156
- if (own !== null)
4431
+ if (own !== null) {
4432
+ // A complete original construction may select a base or an
4433
+ // overriding subclass. This body receives only the arms whose
4434
+ // actual slot selects it; the other arms still need their own
4435
+ // complete source targets, rather than being treated as receivers
4436
+ // of every override in the family's conservative target union.
4437
+ if (ts.isNewExpression(value) && ownConstructorMemberReceiverOf(value, declared, inFamily))
4438
+ return true;
4157
4439
  return (inFamily(own) ||
4158
4440
  familyTraced('own-constructor-outside-family', () => `owner=${owner.name?.text ?? '(anonymous)'} own=${own.name?.text ?? '(anonymous)'}`));
4441
+ }
4159
4442
  // ⛔ UNSOUND MEASUREMENT ARM (`GEA_RECEIVER_FAMILY_FORCE=1`): prices what
4160
4443
  // this one refusal alone is holding open. Never set it for a kept build.
4161
4444
  if (process.env['GEA_RECEIVER_FAMILY_FORCE'] === undefined)
@@ -4228,9 +4511,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4228
4511
  // itself gets out. A data definition stores INTO it -- the same effect as
4229
4512
  // `this.<key> = value` -- and hands it to nothing, so what it installs is
4230
4513
  // the only question: a primitive can neither be a method the proof would
4231
- // have to follow nor hold the receiver back. Three's `Material` defines
4232
- // `id` this way in its constructor, and refusing it here left every
4233
- // receiver-family proof over a material open.
4514
+ // have to follow nor hold the receiver back. A base class that defines
4515
+ // `id` this way in its constructor left every receiver-family proof over
4516
+ // its instances open when this refused.
4234
4517
  const refuse = (why) => {
4235
4518
  traceReceiver(reference, 'data-definition', false, () => `keys=${plan.keys.join(',')} ${why}`);
4236
4519
  return false;
@@ -4246,10 +4529,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4246
4529
  // that names one of those keys, an element hop, or a hop named only by
4247
4530
  // its declaration (any key at runtime) could be what the definition
4248
4531
  // overwrites. Every other named hop is a slot the definition never
4249
- // touches. A SUMMARY path lists several heads -- `.renderTarget,
4250
- // .textures,[],.renderTarget` reaching a render target's textures from a
4251
- // texture in three -- and reading it as "kind is not property" refused
4252
- // `Object.defineProperty(this, 'id', ...)` in `Texture`'s constructor
4532
+ // touches. A SUMMARY path lists several heads -- `.container,
4533
+ // .items,[],.container` reaching a container's items from one of
4534
+ // those items -- and reading it as "kind is not property" refused
4535
+ // `Object.defineProperty(this, 'id', ...)` in the item class's constructor
4253
4536
  // for a definition of `id` that no head of the path names.
4254
4537
  // (`siblingKeyed` is that comparison: an element hop only collides with a
4255
4538
  // canonical index, a declaration-only hop with any key.)
@@ -4274,7 +4557,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4274
4557
  * origins.ts`) only traces an array literal through cells, conditionals,
4275
4558
  * `.slice()` copies and `collectionValuesOf`-backed native-map reads -- it
4276
4559
  * has no case at all for a plain object used as a string-keyed RECORD of
4277
- * arrays (`this._listeners[ type ]`, three's `EventDispatcher`), because
4560
+ * arrays (`this._listeners[ type ]`, an event-emitter base class), because
4278
4561
  * that identity question is answered by a different, already-general
4279
4562
  * mechanism: `arrayStoredValuesOf` (`array-element-continuation.ts`),
4280
4563
  * which `computedKeyAuthority`/`arrayContentsOf` above already ask for
@@ -4289,7 +4572,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4289
4572
  *
4290
4573
  * MEASURED DEAD END (2026-09-16): the obvious next shape -- a callable at a
4291
4574
  * FIXED tuple slot, `for (const entry of list) entry[0]( out )`, which is
4292
- * how hono's `RegExpRouter` dispatches every route -- cannot be closed from
4575
+ * how a regex-compiled router can dispatch every route -- cannot be closed from
4293
4576
  * here. A fixed index needs one slot plus the proof that nothing else ever
4294
4577
  * wrote it, and the only enumeration of writes available at this layer is
4295
4578
  * `arrayStoredValuesOf`, which is CIRCULAR for exactly this shape: it
@@ -4301,7 +4584,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4301
4584
  * `callableArrayTargetsOf` in `callable-array-origins.ts`, that admits an
4302
4585
  * element-slot callee the way that walk's own `use`/`callableUse` already
4303
4586
  * admits `array[ i ]( ... )`. A version built without one landed zero
4304
- * closed callees on `hono-hello` and was reverted.
4587
+ * closed callees on a small web-server app and was reverted.
4305
4588
  */
4306
4589
  const arrayElementTargetsViaRecordOf = (element) => {
4307
4590
  if (!numericArrayIndex(element.argumentExpression))
@@ -4355,7 +4638,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4355
4638
  const argument = site.operands.args.indexOf(reference);
4356
4639
  if (argument < 0)
4357
4640
  return false;
4358
- // `new WebGLTextures( state )` on a plain source function: `new` binds the
4641
+ // `new Textures( state )` on a plain source function: `new` binds the
4359
4642
  // arguments to the function's own formals exactly as a call does. What
4360
4643
  // becomes of the fresh `this` is not this argument's question: a factory
4361
4644
  // discards it behind an object completion (`constructionYieldsCompletionOf`),
@@ -4364,12 +4647,12 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4364
4647
  // allocation whose own receiver references are walked as that function's
4365
4648
  // `this`. Either way the argument reaches only the formal. The
4366
4649
  // class-constructor authority below refuses a constructor function by
4367
- // design -- its body is no `ConstructorDeclaration` -- so three's factory
4368
- // shims were an open escape at every `new` that handed them a record, and
4369
- // so were its `this`-writing renderer modules: `new WebGLTextures( _gl,
4650
+ // design -- its body is no `ConstructorDeclaration` -- so a pre-ES6
4651
+ // library's factory shims were an open escape at every `new` that handed
4652
+ // them a record, and so were its `this`-writing modules: `new Textures( _gl,
4370
4653
  // extensions, state, properties, capabilities, utils, info )` and `new
4371
- // WebGLShadowMap( _this, objects, capabilities )` were 746 of the three.js app's
4372
- // leaf refusals, every one an `objects`/`extensions`/`state` argument.
4654
+ // ShadowMap( _this, objects, capabilities )` were 746 of one large library
4655
+ // compile's leaf refusals, every one an `objects`/`extensions`/`state` argument.
4373
4656
  const factory = constructorFunctionCalleeOf(call);
4374
4657
  if (factory !== null) {
4375
4658
  const parameter = factory.parameters[argument];
@@ -4425,9 +4708,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4425
4708
  value.text === 'undefined' &&
4426
4709
  (checker.getSymbolAtLocation(value)?.declarations ?? []).every((entry) => entry.getSourceFile().hasNoDefaultLib));
4427
4710
  /**
4428
- * Whether every value `expression` can ever hold is nullish. Three's
4429
- * renderer keeps `let _nodesHandler = null` and assigns it only in
4430
- * `setNodesHandler( nodesHandler )`; where nothing calls that setter,
4711
+ * Whether every value `expression` can ever hold is nullish. A
4712
+ * renderer that keeps `let _nodesHandler = null` and assigns it only in
4713
+ * `setNodesHandler( nodesHandler )` is an example: where nothing calls that setter,
4431
4714
  * `_nodesHandler.renderStart( scene, camera )` is on a receiver that throws
4432
4715
  * before either argument is evaluated. Only a binding whose every write is
4433
4716
  * a spelled value answers: one plain `let`/`var`/`const` statement
@@ -4440,6 +4723,18 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4440
4723
  return true;
4441
4724
  if (ts.isConditionalExpression(value))
4442
4725
  return nullishOnly(value.whenTrue, active) && nullishOnly(value.whenFalse, active);
4726
+ // An element read yields a stored value or `undefined` (a hole or a miss).
4727
+ // A module that keeps `let _effects = []`, fills it only through
4728
+ // `setEffects( effects )`, and runs `_effects[ i ].render( renderer, ... )`;
4729
+ // where nothing calls that setter the array never holds anything, so the
4730
+ // callee lookup throws before `renderer` is evaluated -- and treating the
4731
+ // renderer as handed to unknown code reflected all of its fields.
4732
+ if (ts.isElementAccessExpression(value)) {
4733
+ if (!numericArrayIndex(value.argumentExpression))
4734
+ return false;
4735
+ const stored = arrayContentsOf(value.expression);
4736
+ return stored !== null && stored.every((held) => nullishOnly(held, active));
4737
+ }
4443
4738
  if (!ts.isIdentifier(value))
4444
4739
  return false;
4445
4740
  const target = flow.targetOf(value);
@@ -4541,9 +4836,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4541
4836
  // NAME both halves. This is the ONE authority both walks ask about a
4542
4837
  // store into `<expr>.<key>` -- `receiverUseBody` and `containerUseBody`
4543
4838
  // each consult `publishedValue` before their own assignment arms -- and
4544
- // it is where three's whole scene graph stops: `this.camera = camera`
4545
- // (LightShadow), `object.parent = this` (Object3D.add), `this.textures[
4546
- // i ].renderTarget = this` (RenderTarget). Both of its refusals were a
4839
+ // it is where a whole scene graph stops: `this.camera = camera`
4840
+ // (a field store), `object.parent = this` (a tree node's `add`), `this.items[
4841
+ // i ].container = this` (a container's back-reference). Both of its refusals were a
4547
4842
  // bare `false`, so every instrument showed a chain that ended for no
4548
4843
  // stated cause, and two separate investigations misattributed the
4549
4844
  // terminal to the `isIdentifier` guard in the caller's own arm below --
@@ -4562,7 +4857,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4562
4857
  if (numeric(receiverTypeAt(expression) ?? checker.getTypeAtLocation(expression)))
4563
4858
  return true;
4564
4859
  // An unannotated parameter is numeric where every value its closed frame
4565
- // receives is: three's `listArray[ renderCallDepth ]`, whose one caller
4860
+ // receives is: `listArray[ renderCallDepth ]`, whose one caller
4566
4861
  // passes `renderListStack.length`. A re-entered question refuses.
4567
4862
  const value = unwrapValue(expression);
4568
4863
  const declaration = ts.isIdentifier(value) ? flow.targetOf(value)?.declaration : undefined;
@@ -4581,7 +4876,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4581
4876
  * Whether every object `expression` can denote is an Array.
4582
4877
  *
4583
4878
  * The checker says so for most arrays, but not for one read back out of an
4584
- * untyped container: three's `listArray = lists.get( scene )` is `any`, and
4879
+ * untyped container: `listArray = lists.get( scene )` read off an untyped map is `any`, and
4585
4880
  * every value that map ever holds is the literal `[ list ]`. So the origins
4586
4881
  * are asked instead -- literals, the map's stored values, a binding's every
4587
4882
  * write. A re-entered question is assumed: the only value a cycle of
@@ -4591,8 +4886,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4591
4886
  /**
4592
4887
  * Whether the checker types `expression` as an object that is certainly not
4593
4888
  * an array: every union member a non-array, non-tuple object with no number
4594
- * index. `any`, `unknown` and type parameters are not certain -- three reads
4595
- * its render lists out of an `any` -- and answer false.
4889
+ * index. `any`, `unknown` and type parameters are not certain -- a library
4890
+ * can read its lists out of an `any` -- and answer false.
4596
4891
  */
4597
4892
  const definiteNonArray = (expression) => {
4598
4893
  const held = checker.getTypeAtLocation(unwrapValue(expression));
@@ -4673,7 +4968,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4673
4968
  * `array.push( value )`, `unshift`, `fill`'s value and `splice`'s inserted
4674
4969
  * items through the intrinsic Array protocol: the value is now one element
4675
4970
  * deep in every object the receiver denotes. Null when the call is not that
4676
- * shape -- a record's own `push`, as three's render list has -- so the arms
4971
+ * shape -- a record's own `push`, as a factory-built list record has -- so the arms
4677
4972
  * after it answer.
4678
4973
  */
4679
4974
  const arrayStoreArgumentUse = (call, reference, tail) => {
@@ -4695,9 +4990,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4695
4990
  };
4696
4991
  /**
4697
4992
  * Every function a callback argument can be, and whether it can also be
4698
- * nullish. `customOpaqueSort || painterSortStable` in three's render list is
4699
- * `painterSortStable` exactly when `customOpaqueSort` holds nothing -- which
4700
- * is the only value `setOpaqueSort`'s never-called setter leaves in it.
4993
+ * nullish. `customSort || sortStable` is
4994
+ * `sortStable` exactly when `customSort` holds nothing -- which
4995
+ * is the only value a never-called `setSort` setter leaves in it.
4701
4996
  */
4702
4997
  const callableValuesOf = (expression, active = new Set()) => {
4703
4998
  const value = unwrapValue(expression);
@@ -4915,9 +5210,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4915
5210
  if (ts.isMethodDeclaration(frame)) {
4916
5211
  // Enumerating every caller of `frame` (`closedCallerSitesOf`, with no
4917
5212
  // explicit `this` among them) is the very slot-closure question this
4918
- // proof sits inside when `frame` IS the clone idiom: three's
4919
- // Object3D/Material/Texture/Camera/BufferGeometry/RenderTarget/Sphere
4920
- // each declare `clone() { return new this.constructor().copy(this) }`,
5213
+ // proof sits inside when `frame` IS the clone idiom: a class-hierarchy
5214
+ // library where half a dozen unrelated classes each declare `clone() { return new this.constructor().copy(this) }`,
4921
5215
  // so a full caller enumeration for one clone chases the others'.
4922
5216
  //
4923
5217
  // `memberSlotClosed` is the weaker, still SOUND fact that settles it
@@ -4957,13 +5251,86 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4957
5251
  originsOf: allocationOriginsOf
4958
5252
  });
4959
5253
  };
5254
+ /** A computed own constructor retains its complete original source family.
5255
+ * Member selection must walk every construction alternative, rather than
5256
+ * borrow the override currently being checked by this recursive proof. */
5257
+ const memberReceiverOriginsOf = (receiver) => {
5258
+ const origins = allocationOriginsOf(receiver);
5259
+ if (origins !== null)
5260
+ return origins;
5261
+ const value = unwrapValue(receiver);
5262
+ if (!ts.isNewExpression(value))
5263
+ return null;
5264
+ const owner = ownConstructorClassOf(value);
5265
+ if (owner === null)
5266
+ return null;
5267
+ const inventory = ownedClassReceiverInventoryOf(checker, flow, new Set([owner]));
5268
+ const construction = inventory?.constructionFacts.find((fact) => fact.call === value);
5269
+ if (inventory === null ||
5270
+ !construction ||
5271
+ construction.alternatives.length === 0 ||
5272
+ construction.familyProjection.length !== construction.alternatives.length ||
5273
+ construction.alternatives.some((alternative) => !inventory.classes.has(alternative)))
5274
+ return null;
5275
+ return {
5276
+ classes: new Set(construction.alternatives),
5277
+ constructions: new Map([[value, construction.alternatives]])
5278
+ };
5279
+ };
5280
+ const ownConstructorMemberReceiverOf = (receiver, declared, inFamily) => {
5281
+ const selected = outermostErasureOf(receiver).parent;
5282
+ if (!ts.isPropertyAccessExpression(selected) && !ts.isElementAccessExpression(selected))
5283
+ return false;
5284
+ const call = selected.parent;
5285
+ const key = accessKeyOf(selected);
5286
+ if (!ts.isCallExpression(call) || call.expression !== selected || key === null || key !== memberKeyOf(declared))
5287
+ return false;
5288
+ const site = callsOf(flow).sites.get(call);
5289
+ if (!site ||
5290
+ site.explicitThis !== null ||
5291
+ site.operands.dispatch.kind !== 'member' ||
5292
+ site.operands.callee !== selected ||
5293
+ unwrapValue(selected.expression) !== receiver)
5294
+ return false;
5295
+ const origins = memberReceiverOriginsOf(receiver);
5296
+ if (origins === null || origins.classes.size === 0) {
5297
+ traceClosedCallee(call, 'ownConstructorMemberReceiverOf', 'original construction origins unavailable');
5298
+ return false;
5299
+ }
5300
+ let receives = false;
5301
+ for (const owner of origins.classes) {
5302
+ const symbol = owner.name ? checker.getSymbolAtLocation(owner.name) : checker.getTypeAtLocation(owner).getSymbol();
5303
+ const slots = symbol && checker.getPropertyOfType(checker.getDeclaredTypeOfSymbol(symbol), key)?.declarations;
5304
+ if (!slots?.length)
5305
+ return false;
5306
+ for (const slot of slots) {
5307
+ if (!slotDeclarationsOf(slot).every(slotClosedForTargets)) {
5308
+ traceClosedCallee(call, 'ownConstructorMemberReceiverOf', `target slot remains open for ${owner.name?.text ?? '(anonymous)'}`);
5309
+ return false;
5310
+ }
5311
+ const bodies = ownMemberBodiesOf(slot);
5312
+ if (bodies === null || bodies.length === 0 || bodies.some((body) => !flow.callableBodyIsIndexed(body)))
5313
+ return false;
5314
+ if (!bodies.includes(declared))
5315
+ continue;
5316
+ if (!inFamily(owner)) {
5317
+ traceClosedCallee(call, 'ownConstructorMemberReceiverOf', `selected body receives a different family: ${owner.name?.text ?? '(anonymous)'}`);
5318
+ return false;
5319
+ }
5320
+ receives = true;
5321
+ }
5322
+ }
5323
+ if (!receives)
5324
+ traceClosedCallee(call, 'ownConstructorMemberReceiverOf', 'no original construction selects this body');
5325
+ return receives;
5326
+ };
4960
5327
  /**
4961
5328
  * `object.constructor` read as a value and not called on `object`.
4962
5329
  *
4963
5330
  * While no write replaces the slot, what it yields is the function that
4964
5331
  * allocated `object` -- never `object`, and nothing `object` holds. Only a
4965
5332
  * CALL through the slot could hand `object` on, as that call's `this`.
4966
- * Three's `Texture.clone` is `new this.constructor().copy( this )`.
5333
+ * The universal `clone()` idiom is `new this.constructor().copy( this )`.
4967
5334
  */
4968
5335
  const constructorValueRead = (access) => {
4969
5336
  if (!ts.isPropertyAccessExpression(access) || access.name.text !== 'constructor')
@@ -5007,7 +5374,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5007
5374
  classAnswers.set(path, (table = new Map()));
5008
5375
  return coinduct(table, owner, () => {
5009
5376
  const use = (value) => onward(value, path);
5010
- // TEMPORARY diagnostic for root A's real-WebGLRenderer probe -- names
5377
+ // TEMPORARY diagnostic for root A's real-library probe -- names
5011
5378
  // which of `familyReceiversClosed`'s two obligations (an initializer's
5012
5379
  // own `this`, or a construction site) refused, and at which site.
5013
5380
  // Remove once the real-file refusal is found.
@@ -5243,9 +5610,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5243
5610
  // this constructor already owns -- the same body selection `new Base()`
5244
5611
  // makes (source-construction-frames.ts), reached from the heritage
5245
5612
  // clause instead of a spelled callee. Refusing it outright left every
5246
- // derived constructor's arguments unforwarded: three's
5247
- // DirectionalLight/AmbientLight/HemisphereLight `super( color,
5248
- // intensity )` were unauthenticated callees in the host-mutation
5613
+ // derived constructor's arguments unforwarded: several sibling
5614
+ // subclasses' `super( color,
5615
+ // intensity )` calls were unauthenticated callees in the host-mutation
5249
5616
  // census, and one opaque `intensity` there was the `*` wildcard for
5250
5617
  // the whole program. The receiver is lexical (`this` of the home
5251
5618
  // class), which the census attributes from the base body's own
@@ -5267,7 +5634,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5267
5634
  if (ts.isPropertyAccessExpression(callee) || ts.isElementAccessExpression(callee)) {
5268
5635
  const receiver = callee.expression;
5269
5636
  const key = accessKeyOf(callee);
5270
- const origins = key === null ? null : allocationOriginsOf(receiver);
5637
+ const origins = key === null ? null : memberReceiverOriginsOf(receiver);
5271
5638
  traceClosedCallee(call, 'invocationTargetsOf/origins', `key=${key ?? 'null'} origins=${origins === null ? 'null' : origins.classes.size}`);
5272
5639
  if (origins !== null) {
5273
5640
  const privateDeclarations = ts.isPropertyAccessExpression(callee) && ts.isPrivateIdentifier(callee.name) ? privateMemberDeclarationsOf(callee.name) : null;
@@ -5321,7 +5688,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5321
5688
  * `GEA_CLOSED_CALLEE_WATCH=<substring>|'*'` traces `closedCalleeBodiesOf`'s
5322
5689
  * own cascade for ONE call, scoped by its text. `GEA_INVOCATION_REFUSALS`
5323
5690
  * already narrates every refusal in the whole program -- millions of rows
5324
- * on the three.js app, and its rows rank RE-ASKS of the same question, not roots
5691
+ * on a large library compile, and its rows rank RE-ASKS of the same question, not roots
5325
5692
  * (see the memory note on reading it) -- so isolating one call's own
5326
5693
  * decision path out of that firehose is impractical. This prints only for
5327
5694
  * the matching call, once per stage, so which of `invocationTargetsOf`'s
@@ -5368,7 +5735,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5368
5735
  return null;
5369
5736
  const receiver = callee.expression;
5370
5737
  const key = accessKeyOf(callee);
5371
- const origins = key === null ? null : allocationOriginsOf(receiver);
5738
+ const origins = key === null ? null : memberReceiverOriginsOf(receiver);
5372
5739
  const closedWithOverrides = (declared, into) => {
5373
5740
  for (const slot of slotDeclarationsOf(declared)) {
5374
5741
  if (slotClosedForTargets(slot))
@@ -5463,7 +5830,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5463
5830
  * `GEA_CLOSED_CALLEE_WATCH` so a single run names which stage (if any)
5464
5831
  * answered a given call -- `invocationTargetsOf` first (its own
5465
5832
  * member-access branches are traced above, including the
5466
- * `recordMethodCallTargetsOf` route three's factory-record idiom needs),
5833
+ * `recordMethodCallTargetsOf` route the factory-record idiom -- a plain
5834
+ * function returning `{ push: push, ... }` -- needs),
5467
5835
  * then this session's two relaxations.
5468
5836
  */
5469
5837
  const closedCalleeBodiesCascade = (call) => {
@@ -5472,6 +5840,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5472
5840
  traceClosedCallee(call, 'closedCalleeBodiesOf', `invocationTargetsOf -> ${fromTargets.length} bodies`);
5473
5841
  return fromTargets;
5474
5842
  }
5843
+ if (sourceValueSessionOf(checker, flow).ownsInvocation(call)) {
5844
+ traceClosedCallee(call, 'closedCalleeBodiesOf', 'source value session invocation proof refused');
5845
+ return null;
5846
+ }
5475
5847
  const fromMember = memberAccessCalleeBodiesOf(call);
5476
5848
  if (fromMember !== null) {
5477
5849
  traceClosedCallee(call, 'closedCalleeBodiesOf', `memberAccessCalleeBodiesOf -> ${fromMember.length} bodies`);
@@ -5502,8 +5874,16 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5502
5874
  const invocationFactOf = (call) => {
5503
5875
  const ledger = deferredIntrinsicProtocolLedgerOf(flow);
5504
5876
  const known = invocationFacts.get(call);
5505
- if (known)
5506
- return known.requirements.length === 0 || ledger?.include(known.requirements) === true ? known : null;
5877
+ if (known) {
5878
+ const sourceValues = sourceValueSessionOf(checker, flow);
5879
+ const candidate = sourceValues.candidateOrdinaryOwnCallableOperandsOf(call);
5880
+ const current = candidate === null ? callsOf(flow).sites.get(call)?.operands : sourceValues.ordinaryOwnCallableOperandsOf(call);
5881
+ // A conditional own-slot proof may become available in a later ledger
5882
+ // capture. A wrapper frame memo cannot stand in for that exact entry.
5883
+ if (known.operands === current)
5884
+ return known.requirements.length === 0 || ledger?.include(known.requirements) === true ? known : null;
5885
+ invocationFacts.delete(call);
5886
+ }
5507
5887
  if (activeInvocationFacts.has(call)) {
5508
5888
  // A refusal on the strength of a fact still being computed is a
5509
5889
  // hypothesis, not a result: anything that leaned on it is reusable only
@@ -5514,46 +5894,85 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5514
5894
  const site = callsOf(flow).sites.get(call);
5515
5895
  if (!site?.operands)
5516
5896
  return invocationRefusal(call, 'no-operands');
5517
- const operands = site.operands;
5518
5897
  const compute = () => {
5519
5898
  const targets = invocationTargetsOf(call);
5520
5899
  if (targets === null)
5521
5900
  return invocationRefusal(call, 'no-targets');
5522
5901
  if (targets.length === 0)
5523
5902
  return invocationRefusal(call, 'empty-targets');
5524
- const candidates = targets.map((body) => sourceInvocationFrame(flow, call, body, argumentsUsesAt));
5903
+ const sourceValues = sourceValueSessionOf(checker, flow);
5904
+ const candidateOwnOperands = sourceValues.candidateOrdinaryOwnCallableOperandsOf(call);
5905
+ const ordinaryOwnOperands = sourceValues.ordinaryOwnCallableOperandsOf(call);
5906
+ if (candidateOwnOperands !== ordinaryOwnOperands)
5907
+ return invocationRefusal(call, 'unclosed-own-member-entry');
5908
+ const operands = ordinaryOwnOperands ?? site.operands;
5909
+ const candidates = targets.map((body) => sourceInvocationFrame(flow, call, body, argumentsUsesAt, ordinaryOwnOperands ?? undefined));
5525
5910
  // An unindexed body contributes missing effects, not an empty frame.
5526
5911
  if (candidates.every((frame) => frame !== null))
5527
- return candidates;
5912
+ return { operands, frames: candidates, jointSource: sourceValues.ownsInvocation(call) };
5528
5913
  for (const [index, frame] of candidates.entries())
5529
5914
  if (frame === null)
5530
5915
  invocationRefusal(targets[index], `unmodelled-frame for ${describeCall(call)}`);
5531
5916
  return null;
5532
5917
  };
5533
5918
  activeInvocationFacts.add(call);
5534
- enterHypothesisGuard(call);
5919
+ enterHypothesisGuard(call, true);
5920
+ let refused = false;
5535
5921
  try {
5536
5922
  // Only the REFUSAL is shared across proofs. A successful fact stays in
5537
5923
  // this proof's own `invocationFacts` (`shareable` declines to publish
5538
5924
  // it) because a fact carries frames built against this proof's census
5539
5925
  // view; the refusal carries none, and `targets:origin-slot-open` alone
5540
- // was re-derived 41,190 times for one site in the three.js app.
5926
+ // was re-derived 41,190 times for one site in a large library compile.
5541
5927
  const answer = sharedAnswerOf(`invocation-targets:${nodePathToken(call)}`, compute, (value) => value === null);
5542
- if (answer.value === null)
5928
+ if (answer.value === null) {
5929
+ refused = true;
5543
5930
  return null;
5544
- const fact = sourceInvocationFact(call, operands, answer.value, answer.requirements);
5545
- if (fact.requirements.length > 0 && ledger?.include(fact.requirements) !== true)
5931
+ }
5932
+ const fact = sourceInvocationFact(call, answer.value.operands, answer.value.frames, answer.requirements, answer.value.jointSource ? 'source-values' : 'legacy');
5933
+ if (fact.requirements.length > 0 && ledger?.include(fact.requirements) !== true) {
5934
+ refused = true;
5546
5935
  return invocationRefusal(call, 'uncapturable-intrinsic-requirements');
5936
+ }
5937
+ if (answer.value.jointSource) {
5938
+ let receipts = jointSourceInvocationReceipts.get(flow);
5939
+ if (!receipts)
5940
+ jointSourceInvocationReceipts.set(flow, (receipts = new WeakMap()));
5941
+ receipts.set(fact, {
5942
+ call,
5943
+ operands: fact.operands,
5944
+ callee: fact.operands.callee,
5945
+ receiver: fact.operands.receiver,
5946
+ args: [...fact.operands.args],
5947
+ kind: fact.operands.kind,
5948
+ explicitThis: fact.operands.explicitThis,
5949
+ dispatch: fact.operands.dispatch,
5950
+ frameArray: fact.frames,
5951
+ frames: fact.frames.map((frame) => ({
5952
+ frame,
5953
+ body: frame.body,
5954
+ layout: frame.layout,
5955
+ forwarding: frame.forwarding,
5956
+ completions: frame.completions,
5957
+ parameters: frame.parameters,
5958
+ receiverUses: frame.receiverUses,
5959
+ completionSummary: frame.completionSummary,
5960
+ receiver: frame.layout.receiver,
5961
+ arguments: frame.layout.arguments
5962
+ })),
5963
+ requirements: fact.requirements
5964
+ });
5965
+ }
5547
5966
  // A successful continuation can still depend on an enclosing recursive
5548
5967
  // hypothesis. Publish its memo only when that hypothesis is discharged.
5549
5968
  computedKeyAuthority.whenSettled(() => invocationFacts.set(call, fact));
5550
5969
  return fact;
5551
5970
  }
5552
5971
  finally {
5553
- // The re-entry above hands out one thing, a refusal. A refusal here is
5554
- // therefore the same answer, so the hypothesis it issued has become a
5555
- // fact and every answer that leaned on it is freed of it.
5556
- exitHypothesisGuard(call, true);
5972
+ // Re-entry is conservative in either case, but only an actual refusal
5973
+ // settles it as the exact answer. Without settlement, enclosing array
5974
+ // provenance walks keep re-deriving the same intrinsic-call refusals.
5975
+ exitHypothesisGuard(call, true, refused);
5557
5976
  activeInvocationFacts.delete(call);
5558
5977
  }
5559
5978
  };
@@ -5655,7 +6074,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5655
6074
  // A plain call leaves `this` undefined in a module, so only `new` makes an
5656
6075
  // object -- the call's own result -- and every `this` in the body is it.
5657
6076
  // A call through a record slot (`list.push( item )` entering the function
5658
- // `WebGLRenderList` stored as `push`) binds `this` to the record.
6077
+ // a factory function stored as `push`) binds `this` to the record.
5659
6078
  const module = ts.isExternalModule(owner.getSourceFile());
5660
6079
  const use = (value) => onward(value, path);
5661
6080
  return (calls.every(({ call, explicitThis }) => {
@@ -5686,7 +6105,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5686
6105
  const references = cellMentionsOf(declaration, target.symbol ?? null);
5687
6106
  if (references === null)
5688
6107
  return false;
5689
- // TEMPORARY diagnostic for root A's real-WebGLRenderer probe -- names
6108
+ // TEMPORARY diagnostic for root A's real-library probe -- names
5690
6109
  // which mention of a forwarded cell (e.g. every `_this.` reference) the
5691
6110
  // caller's `use` refuses on. Remove once the real-file refusal is found.
5692
6111
  const watchedForwardCell = process.env['GEA_FORWARD_CELL_DEBUG'];
@@ -5721,8 +6140,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5721
6140
  // array literal, a store through the intrinsic protocol, a numeric index
5722
6141
  // on an array-valued receiver, a rest frame -- and the walk follows that
5723
6142
  // same object. A path whose every head is an element needs no second
5724
- // proof here, and asking the checker again refused three's `any`-typed
5725
- // `currentRenderList.opaque` and `listArray`. A summary that may be at a
6143
+ // proof here, and asking the checker again refused `any`-typed
6144
+ // reads like `currentList.opaque` and `listArray`. A summary that may be at a
5726
6145
  // record as well asks the origins.
5727
6146
  const established = headsOf(path).every((id) => id === '[]');
5728
6147
  if (!arrayValued(reference)) {
@@ -5820,21 +6239,21 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5820
6239
  // same container the sound reading rather than merely the cheap one.
5821
6240
  //
5822
6241
  // Leaving `map` out of this switch fell through to the blanket `return
5823
- // false` below, and that one missing case is the terminal of the three.js app's
5824
- // largest carrier group: three's logging shim renders its rest frame
6242
+ // false` below, and that one missing case was the terminal of one large
6243
+ // library compile's largest carrier group: a logging shim that renders its rest frame
5825
6244
  // with `params.map( ( param ) => String( param ) )`, so EVERY object
5826
6245
  // handed to `error( ... )` escaped there -- including `object` at
5827
- // `Object3D.add`'s self-parenting guard. That refused `add`'s implicit
6246
+ // a tree node's `add` self-parenting guard. That refused `add`'s implicit
5828
6247
  // `arguments` frame `function-escapes:uncounted-member-reference`,
5829
- // which left `Object3D.children`'s element unbound, which is 1496 of
5830
- // the three.js app's 3718 nested dynamic carriers.
6248
+ // which left the node's `children` element unbound, which was 1496 of
6249
+ // that compile's 3718 nested dynamic carriers.
5831
6250
  case 'map':
5832
6251
  return written.length === 1 && callbackClosed(written[0], [element, null, use]) && use(context);
5833
6252
  }
5834
6253
  // NAME the member. A built-in this switch does not model is the one shape
5835
6254
  // whose fix is a single `case`, and the bare `return false` here gave the
5836
6255
  // walk's report nothing to name: `map` sat unmodelled behind it holding
5837
- // 1496 of the three.js app's nested carriers open, indistinguishable from a real
6256
+ // 1496 of that compile's nested carriers open, indistinguishable from a real
5838
6257
  // escape.
5839
6258
  return traceReceiver(reference, 'element', false, () => `unmodelled-member=${parent.name.text}`);
5840
6259
  }
@@ -5886,7 +6305,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5886
6305
  // A member published by `this.<key> = ...` inside a constructor function
5887
6306
  // is owned by that function exactly as a `ts.ClassElement` is owned by its
5888
6307
  // class. Asking only for a class-spelled ancestor is what left every
5889
- // member of three's pre-ES6 renderer factories with no container family at
6308
+ // member of a pre-ES6 constructor-function factory with no container family at
5890
6309
  // all, and a null family refuses every proof that consults it.
5891
6310
  const owner = ts.findAncestor(member, (node) => ts.isClassDeclaration(node) || ts.isClassExpression(node) || isConstructorFunction(node));
5892
6311
  const family = owner && (ts.isClassDeclaration(owner) || ts.isClassExpression(owner) || isConstructorFunction(owner))
@@ -5902,8 +6321,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5902
6321
  * A read that resolves to no declaration is usually refused because an
5903
6322
  * accessor could hand the receiver's other members out. A key the family does
5904
6323
  * not declare has no accessor to be: the read evaluates to `undefined` and
5905
- * runs nothing. Three's logging shim probes `stackTrace.isStackTrace` on
5906
- * whatever it was handed, and every object reaching it there is an `Object3D`
6324
+ * runs nothing. A logging shim that probes `stackTrace.isStackTrace` on
6325
+ * whatever it was handed, where every object reaching it is a `Node`
5907
6326
  * that declares no such member -- which made the probe the terminal of 35
5908
6327
  * escapes.
5909
6328
  */
@@ -5923,7 +6342,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5923
6342
  * source code -- so the conversion cannot reach what this walk carries
5924
6343
  * inside it.
5925
6344
  *
5926
- * The static type at a conversion site is often `any` (three's logging shim
6345
+ * The static type at a conversion site is often `any` (a logging shim that
5927
6346
  * takes `...params`), which says nothing. The PATH does: it names the member
5928
6347
  * the value sits in, and therefore the closed family of objects that carry
5929
6348
  * it. Every class in that family answering only the host's own `toString`,
@@ -5950,7 +6369,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5950
6369
  /**
5951
6370
  * Whether a call through a mutable binding can execute anything at all.
5952
6371
  *
5953
- * `_setConsoleFunction( 'warn', message, ...params )` in three's logging shim
6372
+ * `_setConsoleFunction( 'warn', message, ...params )` in a logging shim
5954
6373
  * hands its arguments to whatever that module-level `let` holds -- and it
5955
6374
  * holds `null`, because `setConsoleFunction` is the only thing that writes it
5956
6375
  * and this program never calls it, so reachability prunes that write with the
@@ -5961,11 +6380,11 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5961
6380
  */
5962
6381
  const callThroughUncallableBinding = (call) => {
5963
6382
  const callee = unwrapNaming(call.expression);
5964
- // The same fact for a MEMBER slot: three's `Texture` declares `this.onUpdate
5965
- // = null` and nothing in the three.js app ever stores a function there, so `if (
5966
- // texture.onUpdate ) texture.onUpdate( texture )` in WebGLTextures runs no
6383
+ // The same fact for a MEMBER slot: a class declares `this.onUpdate
6384
+ // = null` and nothing in the program ever stores a function there, so `if (
6385
+ // item.onUpdate ) item.onUpdate( item )` in another module runs no
5967
6386
  // body -- yet `targets:no-member-implementations` refused it, and with an
5968
- // opaque `texture` the host-mutation census read the call as an
6387
+ // opaque `item` the host-mutation census read the call as an
5969
6388
  // unauthenticated callee handed an opaque argument: a `*` wildcard. A
5970
6389
  // slot whose declaration and every write hold only `null`/`undefined`
5971
6390
  // has nothing to enter; a computed store the index attributes to the
@@ -6037,11 +6456,11 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6037
6456
  const declaration = key === accessKeyOf(parent) ? fieldDeclaration(parent) : fieldDeclarationOf(reference, key);
6038
6457
  const read = { element: false, declaration, key };
6039
6458
  // An accessor slot runs user code with the carried object bound as its
6040
- // receiver: `this.needsUpdate = true` in three's `Texture.copy` is a
6459
+ // receiver: `this.needsUpdate = true` in a class's `copy` is a
6041
6460
  // CALL of the setter, and the read of a getter is a call of the getter.
6042
6461
  // Their bodies are right there to walk the way a method body is walked
6043
6462
  // (`methodReceiverUses`); refusing them as "not a data member" stopped
6044
- // every family walk that reached `Texture.copy` through the clone.
6463
+ // every family walk that reached that `copy` through the clone.
6045
6464
  // The stored value goes to the setter's parameter, not into the
6046
6465
  // container, so only the bodies' receiver mentions matter. The flow
6047
6466
  // index resolves the access to the special-assignment form it indexed
@@ -6063,15 +6482,15 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6063
6482
  // that slot; it hands the object to nobody. A store into a slot whose
6064
6483
  // stores are owed may be putting in the very object that holds the
6065
6484
  // followed value, so that value is published there too.
6066
- // NAME both halves. `object.parent = this` in `Object3D.add` is the
6067
- // deepest open use in the three.js app's whole member-closure chain, and both
6485
+ // NAME both halves. `object.parent = this` in a tree node's `add` was the
6486
+ // deepest open use in one large library compile's whole member-closure chain, and both
6068
6487
  // refusals here were bare `false`: the walk's report could not say
6069
6488
  // whether the slot failed to be a data member or whether publishing
6070
6489
  // the stored value failed.
6071
6490
  //
6072
- // `mesh.onBeforeRender = function ( renderer, object ) { ... }`
6491
+ // `node.onRender = function ( renderer, object ) { ... }`
6073
6492
  // installs a CALLABLE, not a data value: it changes which function
6074
- // answers `mesh.onBeforeRender()`, never what `mesh` itself carries
6493
+ // answers `node.onRender()`, never what `node` itself carries
6075
6494
  // or where it can be reached from. That question is a member-slot
6076
6495
  // publication, already the obligation `escapeReason`'s own
6077
6496
  // `inlineMemberPublication` arm and `memberImplementationsOf` place on
@@ -6108,9 +6527,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6108
6527
  }
6109
6528
  const declarations = siblingDeclarationsOf(reference, key);
6110
6529
  if (declarations === null) {
6111
- // `this[ key ]` in three's `Texture.setValues` with `wrapR` among the
6112
- // keys: a plain texture has no such member and the read is
6113
- // `undefined`, while a `Data3DTexture` holds data there. The
6530
+ // `this[ key ]` in a base class's `setValues` with `depth` among the
6531
+ // keys: the base class has no such member and the read is
6532
+ // `undefined`, while a subclass holds data there. The
6114
6533
  // data-member plan refuses a key absent on any owner; the key-read
6115
6534
  // plan classifies each class, and a code-free family -- data or
6116
6535
  // absent everywhere, `Object.prototype` proven clean for the key --
@@ -6128,8 +6547,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6128
6547
  const use = (expression) => containerUse(expression, path);
6129
6548
  // A mention the checker has narrowed to a primitive is not a mention of the
6130
6549
  // object being followed: a primitive holds no members, so nothing this walk
6131
- // carries can be read out of it or stored back into it. Three's logging
6132
- // shim inspects its first argument under `typeof message === 'string'`, and
6550
+ // carries can be read out of it or stored back into it. A logging
6551
+ // shim that inspects its first argument under `typeof message === 'string'`, and
6133
6552
  // treating that guarded read as a use of whatever else the slot might hold
6134
6553
  // made `message.startsWith` the terminal of 35 escapes.
6135
6554
  if (primitive(checker.getTypeAtLocation(reference)))
@@ -6140,7 +6559,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6140
6559
  if (ts.isBinaryExpression(parent) && parent.left === reference && parent.operatorToken.kind === ts.SyntaxKind.EqualsToken) {
6141
6560
  // A plain assignment's left side names the SLOT being written. It is not
6142
6561
  // evaluated as a value, so it hands nothing to anyone -- `this.geometry
6143
- // = geometry` in three's `Mesh` was read as a use of whatever
6562
+ // = geometry` in a class constructor was read as a use of whatever
6144
6563
  // `this.geometry` held and was the terminal of 35 escapes. (A compound
6145
6564
  // assignment does read the slot first, which is why only `=` is here.)
6146
6565
  if (ts.isPropertyAccessExpression(reference) || ts.isElementAccessExpression(reference))
@@ -6155,7 +6574,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6155
6574
  if (ts.isBindingElement(parent) && parent.name === reference)
6156
6575
  return true;
6157
6576
  // A member's own declaration name is where the member is written down,
6158
- // not a mention of the object that carries it. `Mesh` declares `geometry;`
6577
+ // not a mention of the object that carries it. A class may declare `geometry;`
6159
6578
  // as a bare typed field, and reading that name as a receiver use left it
6160
6579
  // unexplained -- the terminal of 35 escapes.
6161
6580
  if ((ts.isPropertyDeclaration(parent) ||
@@ -6204,7 +6623,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6204
6623
  const key = accessKeyOf(parent);
6205
6624
  if (key !== null)
6206
6625
  return containerMemberUse(reference, parent, key, path, use);
6207
- // `this[ key ]` in three's `Texture.setValues`: a computed key whose
6626
+ // `this[ key ]` in a base class's `setValues( values )`: a computed key whose
6208
6627
  // set this program proves finite is every one of those named reads
6209
6628
  // or stores, exactly as the receiver walk's `computed-data-store` arm
6210
6629
  // reads it. A key set that stays open is the refusal below.
@@ -6228,8 +6647,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6228
6647
  // `super( ... )` is dispatch on the object this frame already owns, exactly
6229
6648
  // as the receiver walk reads it (its arm below): it hands the container
6230
6649
  // to nobody. Read as a call ARGUMENT it went to `forwardedInvocationUse`,
6231
- // matched no parameter and refused -- three's `RenderTarget` constructor
6232
- // opens with `super()`, and every owed `.textures` head stopped there.
6650
+ // matched no parameter and refused -- a derived constructor that
6651
+ // opens with `super()` stopped every owed `.items` head there.
6233
6652
  if (reference.kind === ts.SyntaxKind.SuperKeyword && ts.isCallExpression(parent) && parent.expression === reference)
6234
6653
  return true;
6235
6654
  if (ts.isCallExpression(parent) || ts.isNewExpression(parent)) {
@@ -6248,7 +6667,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6248
6667
  : null;
6249
6668
  if (storedReads !== null)
6250
6669
  return storedReads.every(use);
6251
- // `updateMap.set( object, frame )` in three's `WebGLObjects.update`: a
6670
+ // `updateMap.set( object, frame )` in an update-tracking module: a
6252
6671
  // closed native map compares its key by identity and never yields it back.
6253
6672
  if (ts.isCallExpression(parent) && collectionKeyArgumentIsInert(checker, flow, parent, reference, nativeProtocolClosed))
6254
6673
  return true;
@@ -6260,7 +6679,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6260
6679
  // `a && b`, `a || b`, `a ?? b` and `c ? a : b` select one operand and
6261
6680
  // return it. ToBoolean and the nullish test execute no user code, so the
6262
6681
  // only thing that leaves is whatever the expression evaluates to -- follow
6263
- // that, and nothing else. Three's logging shim guards its optional stack
6682
+ // that, and nothing else. A logging shim that guards its optional stack
6264
6683
  // trace with `stackTrace && stackTrace.isStackTrace`, and refusing the
6265
6684
  // whole shape made that test the terminal of 35 escapes.
6266
6685
  if ((ts.isBinaryExpression(parent) &&
@@ -6279,7 +6698,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6279
6698
  * the store that made the backlink.
6280
6699
  *
6281
6700
  * A member written in a class: every construction and field initializer.
6282
- * A record slot -- three's `WebGLRenderList` returns `{ push: push, ... }`
6701
+ * A record slot -- a factory function that returns `{ push: push, ... }`
6283
6702
  * -- the literal itself. A slot written through a receiver (`leaf.onDraw =
6284
6703
  * fn`): that receiver's allocations. Coinductive, so an answer that leaned
6285
6704
  * on this one is kept only once this one holds; the tri-state it replaces
@@ -6299,7 +6718,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6299
6718
  const ownerOriginsClosed = (carrier) => {
6300
6719
  // A proof with no member slot and no field owners is a receiver-family
6301
6720
  // proof (`classInstancesUse`): what it follows is the family's instances
6302
- // themselves. A data read inside it -- `this.blendColor` in `Material.copy`,
6721
+ // themselves. A data read inside it -- `this.color` in a base class's `copy`,
6303
6722
  // reached from `new this.constructor().copy( this )` -- has no slot to
6304
6723
  // name an owner by, so the CARRIER of the data it selects (the `this.<key>
6305
6724
  // = ...` write or class element) stands in: its own receiver is the family
@@ -6310,9 +6729,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6310
6729
  // directly inside `member`'s own body -- but the walk can cross into a
6311
6730
  // DIFFERENT declaration's body first: an accessor inherited from a base
6312
6731
  // class, its `this` still the same receiver, reached while proving
6313
- // `member` closed. `RenderTarget`'s `get texture()` -- read through
6314
- // `WebGLCubeRenderTarget.fromEquirectangularTexture`'s `this.texture` --
6315
- // asked whether `this.textures` (a `RenderTarget` field the subclass never
6732
+ // `member` closed. A base class's `get item()` -- read through
6733
+ // a subclass method's `this.item` --
6734
+ // asked whether `this.items` (a base-class field the subclass never
6316
6735
  // itself writes) escapes through `member`'s own class alone, which has no
6317
6736
  // writer to walk and so answered "open" for every accessor read reached
6318
6737
  // this way. The carrier -- the accessor `get`/`set` itself -- names the
@@ -6352,7 +6771,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6352
6771
  // Every carrier was a literal or a receiver walked above: no class
6353
6772
  // allocates one, and there is no inventory left to ask. (Asking it of no
6354
6773
  // class answers "unknown", which refused every member only literals
6355
- // carry -- three's `ColorManagement` methods reading `this.spaces`.)
6774
+ // carry -- a singleton object literal's methods reading `this.spaces`.)
6356
6775
  if (roots.size === 0)
6357
6776
  return carried !== undefined || (member?.declarations?.length ?? 0) > 0;
6358
6777
  // An OUTER proof is already answering for this family: park it. Only the
@@ -6366,7 +6785,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6366
6785
  // All owner publications in constructors/field initializers must close,
6367
6786
  // including allocations with no visible call to the method being typed.
6368
6787
  // `openMember` NAMES which of the three failed: `family-origins-open` is
6369
- // the three.js app's largest member-closure refusal and it used to report only
6788
+ // one large library compile's largest member-closure refusal and it used to report only
6370
6789
  // that the whole conjunction did, when an unbuildable inventory, an
6371
6790
  // initializer's `this` and a construction site are three different
6372
6791
  // defects with three different fixes.
@@ -6384,8 +6803,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6384
6803
  // class and for `super` at the base's, and `emit-class-properties.ts`
6385
6804
  // tells them apart by exactly that.
6386
6805
  //
6387
- // Without this, `super.copy( source )` -- every three.js `copy`/`clone`
6388
- // override -- was an unresolvable receiver, and the whole containing
6806
+ // Without this, `super.copy( source )` -- every `copy`/`clone`
6807
+ // override in a class-hierarchy library -- was an unresolvable receiver, and the whole containing
6389
6808
  // family's parameters went unbound behind it.
6390
6809
  if (expression.kind === ts.SyntaxKind.ThisKeyword || expression.kind === ts.SyntaxKind.SuperKeyword) {
6391
6810
  const owner = flow.receiverOwnerOf(expression);
@@ -6406,8 +6825,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6406
6825
  // A FRESH allocation has no cell to walk: nothing else holds the object,
6407
6826
  // so the expression IS the value and its own uses are the whole inventory.
6408
6827
  // Asking `flow.targetOf` for a declaration and refusing when there is none
6409
- // treated `new this.constructor().copy( this )` -- every three.js `clone`
6410
- // -- as an unresolvable receiver, when it is the most closed receiver
6828
+ // treated `new this.constructor().copy( this )` -- the universal `clone`
6829
+ // idiom -- as an unresolvable receiver, when it is the most closed receiver
6411
6830
  // there is. An object literal was already read this way at the receiver
6412
6831
  // inventory below; this states the same fact for the constructed case,
6413
6832
  // where the allocation's own uses answer it.
@@ -6431,9 +6850,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6431
6850
  * obligation `closedCallerSitesOf` discharges for an exported function. An
6432
6851
  * import binding is the exported cell seen from the importer, and is answered
6433
6852
  * as that cell. The bindings themselves (`import { x }`, `export { x }`,
6434
- * `export default x`) evaluate nothing and are not uses. Three's
6435
- * `ColorManagement` is `export const ColorManagement =
6436
- * createColorManagement()`, and refusing every export here was where each
6853
+ * `export default x`) evaluate nothing and are not uses. A module whose
6854
+ * singleton is `export const Settings =
6855
+ * createSettings()` is an example, and refusing every export here was where each
6437
6856
  * of its methods' parameters stopped.
6438
6857
  */
6439
6858
  const cellMentionsOf = (declaration, symbol) => {
@@ -6568,8 +6987,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6568
6987
  return terminal;
6569
6988
  // A mention the checker has narrowed to a primitive is not a mention of the
6570
6989
  // object being followed: a primitive holds no members, so nothing this walk
6571
- // carries can be read out of it or stored back into it. Three's logging
6572
- // shim inspects its first argument under `typeof message === 'string'`, and
6990
+ // carries can be read out of it or stored back into it. A logging
6991
+ // shim that inspects its first argument under `typeof message === 'string'`, and
6573
6992
  // treating that guarded read as a use of whatever else the slot might hold
6574
6993
  // made `message.startsWith` the terminal of 35 escapes.
6575
6994
  if (primitive(checker.getTypeAtLocation(reference)))
@@ -6580,7 +6999,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6580
6999
  if (ts.isBinaryExpression(parent) && parent.left === reference && parent.operatorToken.kind === ts.SyntaxKind.EqualsToken) {
6581
7000
  // A plain assignment's left side names the SLOT being written. It is not
6582
7001
  // evaluated as a value, so it hands nothing to anyone -- `this.geometry
6583
- // = geometry` in three's `Mesh` was read as a use of whatever
7002
+ // = geometry` in a class constructor was read as a use of whatever
6584
7003
  // `this.geometry` held and was the terminal of 35 escapes. (A compound
6585
7004
  // assignment does read the slot first, which is why only `=` is here.)
6586
7005
  if (ts.isPropertyAccessExpression(reference) || ts.isElementAccessExpression(reference))
@@ -6597,7 +7016,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6597
7016
  if (ts.isPropertyAssignment(parent) && parent.name === reference)
6598
7017
  return true;
6599
7018
  // A member's own declaration name is where the member is written down,
6600
- // not a mention of the object that carries it. `Mesh` declares `geometry;`
7019
+ // not a mention of the object that carries it. A class may declare `geometry;`
6601
7020
  // as a bare typed field, and reading that name as a receiver use left it
6602
7021
  // unexplained -- the terminal of 35 escapes.
6603
7022
  if ((ts.isPropertyDeclaration(parent) ||
@@ -6625,9 +7044,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6625
7044
  return receiverCell(parent.name);
6626
7045
  }
6627
7046
  // The declaration-initializer case above misses a cell DECLARED bare and
6628
- // filled later by a plain assignment -- three's `WebGLRenderer` declares
7047
+ // filled later by a plain assignment -- a `function Renderer()` that declares
6629
7048
  // `let properties, textures;` at its own top level, then a nested
6630
- // `initGLContext` assigns `properties = new WebGLProperties();` before
7049
+ // `initContext` assigns `properties = new Properties();` before
6631
7050
  // publishing it onward (`_this.properties = properties`). The allocation
6632
7051
  // is the SAME cell an initializer would name; only the edge shape differs.
6633
7052
  if (ts.isBinaryExpression(parent) &&
@@ -6695,9 +7114,23 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6695
7114
  return traceReceiver(reference, 'invocation-receiver', invocations.every((site) => {
6696
7115
  if (!ts.isCallExpression(site.call))
6697
7116
  return false;
7117
+ // This receiver walk carries the tracked member through records,
7118
+ // formal parameters and containers. A structurally erased alias
7119
+ // can lose that member's checker symbol, but reading the same key
7120
+ // still invokes the carried slot and must belong to its caller
7121
+ // inventory. Checking only the target body's this-uses omitted
7122
+ // calls such as retained[0].method('text').
6698
7123
  const targets = invocationTargetsOf(site.call);
6699
- if (targets === null)
7124
+ if (targets === null || (targets.length === 0 && !callThroughUncallableBinding(site.call)))
6700
7125
  return false;
7126
+ if (member !== null && (sameMember(parent) || accessKeyOf(parent) === member.getName()) && !countedCalls.has(site.call)) {
7127
+ const held = (member.declarations ?? []).map(ownMemberBodiesOf);
7128
+ // A same-spelled override or lexical super call can select a
7129
+ // different body. Only the complete selected source targets can
7130
+ // distinguish it from an omitted caller of this exact slot.
7131
+ if (held.some((bodies) => bodies === null || targets.some((body) => bodies.includes(body))))
7132
+ return false;
7133
+ }
6701
7134
  // `.call(other)` reads the member here, but binds `other` as this.
6702
7135
  // Its actual receiver occurrence is followed through that frame.
6703
7136
  return (site.operands.receiver !== reference || targets.every((body) => flow.receiverReferencesToDeclaration(body).every(receiverUse)));
@@ -6804,8 +7237,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6804
7237
  plan.writeBodies !== null &&
6805
7238
  plan.writeBodies.every((body) => flow.receiverReferencesToDeclaration(body).every(receiverUse)));
6806
7239
  }
6807
- // `mesh.onBeforeRender = function ( renderer, scene, camera ) { ... }`
6808
- // in three's `WebGLBackground`: a store over a prototype METHOD. The
7240
+ // `node.onRender = function ( renderer, scene, camera ) { ... }`
7241
+ // from outside the class: a store over a prototype METHOD. The
6809
7242
  // [[Set]] finds the method's data property first and creates an own one
6810
7243
  // on the receiver, running no code -- only a setter could hand the
6811
7244
  // receiver on. The descriptor authority names any setters independently
@@ -6834,8 +7267,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6834
7267
  // a getter under the same key -- satisfies just as well.
6835
7268
  const selectedData = dataMember && (declaredDataMemberAccess(target) || constructionDataMember(parent) || ownLiteralDataMember(parent));
6836
7269
  // A getter under this key on SOME class the receiver's declared type
6837
- // could be -- three's `InterleavedBufferAttribute.count`, read off a
6838
- // `BufferAttribute | InterleavedBufferAttribute` parameter -- is not by
7270
+ // could be -- `InterleavedAttribute.count`, read off an
7271
+ // `Attribute | InterleavedAttribute` parameter -- is not by
6839
7272
  // itself proof that the read escapes: only a getter BODY that leaks the
6840
7273
  // receiver is. `sourceClassKeyReadPlanOf` classifies every class the
6841
7274
  // receiver could be (construction origins first, the declared type
@@ -6845,7 +7278,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6845
7278
  // SETTER's write bodies. Walking them with the identical
6846
7279
  // `receiverReferencesToDeclaration(...).every(receiverUse)` rule
6847
7280
  // answers the read the same way: closed unless the getter's own `this`
6848
- // mentions themselves escape (three's `InterleavedBufferAttribute.count`
7281
+ // mentions themselves escape (`InterleavedAttribute.count`
6849
7282
  // is `return this.data.count`, which recurses into this same arm for
6850
7283
  // `this.data`). `sourceClassKeyReadPlanOf` only sees the checker's
6851
7284
  // STATIC declared members, so a reflective definition that could
@@ -6857,8 +7290,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6857
7290
  // allocation-origins proof for the receiver, and every getter body it
6858
7291
  // hands back is walked through this proof's own `receiverUse`. Asked
6859
7292
  // eagerly at every member read it re-ran that work for the tens of
6860
- // thousands of reads the selected-data arm already accepted -- the three.js app
6861
- // went from ~3 min to over 8 min at 23 GB before this ordering.
7293
+ // thousands of reads the selected-data arm already accepted -- one large
7294
+ // library compile went from ~3 min to over 8 min at 23 GB before this ordering.
6862
7295
  const key = accessKeyOf(parent);
6863
7296
  let readerClosedHeld = null;
6864
7297
  const readerClosed = () => {
@@ -6946,7 +7379,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6946
7379
  // `a && b`, `a || b`, `a ?? b` and `c ? a : b` select one operand and
6947
7380
  // return it. ToBoolean and the nullish test execute no user code, so the
6948
7381
  // only thing that leaves is whatever the expression evaluates to -- follow
6949
- // that, and nothing else. Three's logging shim guards its optional stack
7382
+ // that, and nothing else. A logging shim that guards its optional stack
6950
7383
  // trace with `stackTrace && stackTrace.isStackTrace`, and refusing the
6951
7384
  // whole shape made that test the terminal of 35 escapes.
6952
7385
  if ((ts.isBinaryExpression(parent) &&