@geastack/compiler 1.0.27 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (956) hide show
  1. package/dist/cli-coverage.js +2 -2
  2. package/dist/cli-emit.js +36 -12
  3. package/dist/compiler.d.ts +11 -9
  4. package/dist/compiler.js +264 -43
  5. package/dist/conversion/algebra.d.ts +84 -4
  6. package/dist/conversion/algebra.js +39 -0
  7. package/dist/conversion/array-view.d.ts +63 -0
  8. package/dist/conversion/array-view.js +186 -0
  9. package/dist/conversion/build.d.ts +8 -8
  10. package/dist/conversion/build.js +56 -50
  11. package/dist/conversion/certified-iterator-object-view.d.ts +13 -0
  12. package/dist/conversion/certified-iterator-object-view.js +31 -0
  13. package/dist/conversion/certified-iterator-protocols.d.ts +23 -0
  14. package/dist/conversion/certified-iterator-protocols.js +50 -0
  15. package/dist/conversion/checked-native-field-read.d.ts +7 -0
  16. package/dist/conversion/checked-native-field-read.js +36 -0
  17. package/dist/conversion/constructor-identity-family.d.ts +6 -6
  18. package/dist/conversion/constructor-identity-family.js +3 -3
  19. package/dist/conversion/derive.js +11 -8
  20. package/dist/conversion/dictionary-view.d.ts +114 -0
  21. package/dist/conversion/dictionary-view.js +293 -0
  22. package/dist/conversion/document-record-view.d.ts +89 -0
  23. package/dist/conversion/document-record-view.js +269 -0
  24. package/dist/conversion/dynamic-result-carriers.d.ts +6 -0
  25. package/dist/conversion/dynamic-result-carriers.js +43 -0
  26. package/dist/conversion/dynamic-wrapper.d.ts +57 -0
  27. package/dist/conversion/dynamic-wrapper.js +85 -0
  28. package/dist/conversion/impossible-field-read.d.ts +9 -0
  29. package/dist/conversion/impossible-field-read.js +28 -0
  30. package/dist/conversion/iterable-object-view.d.ts +1 -1
  31. package/dist/conversion/iterator-object-view.d.ts +2 -2
  32. package/dist/conversion/native-absence.d.ts +4 -0
  33. package/dist/conversion/native-absence.js +4 -0
  34. package/dist/conversion/native-buffer-method.d.ts +16 -0
  35. package/dist/conversion/native-buffer-method.js +37 -0
  36. package/dist/conversion/native-callable-adapter.d.ts +13 -0
  37. package/dist/conversion/native-callable-adapter.js +73 -0
  38. package/dist/conversion/native-descriptor-snapshot.d.ts +30 -0
  39. package/dist/conversion/native-descriptor-snapshot.js +75 -0
  40. package/dist/conversion/native-entry-writer.d.ts +21 -0
  41. package/dist/conversion/native-entry-writer.js +32 -0
  42. package/dist/conversion/native-field-view.d.ts +42 -0
  43. package/dist/conversion/native-field-view.js +145 -0
  44. package/dist/conversion/native-logical-receiver.d.ts +11 -0
  45. package/dist/conversion/native-logical-receiver.js +19 -0
  46. package/dist/conversion/native-method.d.ts +43 -0
  47. package/dist/conversion/native-method.js +56 -0
  48. package/dist/conversion/native-object-sample.d.ts +30 -0
  49. package/dist/conversion/native-object-sample.js +37 -0
  50. package/dist/conversion/native-payload-transport.d.ts +1 -1
  51. package/dist/conversion/native-payload-transport.js +1 -1
  52. package/dist/conversion/native-record-products.d.ts +15 -0
  53. package/dist/conversion/native-record-products.js +73 -0
  54. package/dist/conversion/native-selection.d.ts +18 -1
  55. package/dist/conversion/native-selection.js +117 -4
  56. package/dist/conversion/native-sum.d.ts +27 -0
  57. package/dist/conversion/native-sum.js +74 -9
  58. package/dist/conversion/native-view-origins.d.ts +12 -0
  59. package/dist/conversion/native-view-origins.js +97 -0
  60. package/dist/conversion/nodes.d.ts +75 -7
  61. package/dist/conversion/nodes.js +694 -19
  62. package/dist/conversion/number-storage.d.ts +8 -0
  63. package/dist/conversion/number-storage.js +8 -0
  64. package/dist/conversion/operand-view.js +10 -1
  65. package/dist/conversion/promise-adoption.d.ts +15 -0
  66. package/dist/conversion/promise-adoption.js +29 -0
  67. package/dist/conversion/protocol-iterator.d.ts +3 -3
  68. package/dist/conversion/recipe-closure.d.ts +14 -0
  69. package/dist/conversion/recipe-closure.js +135 -0
  70. package/dist/conversion/record-view.d.ts +51 -26
  71. package/dist/conversion/record-view.js +160 -97
  72. package/dist/conversion/registry.d.ts +18 -2
  73. package/dist/conversion/sibling-class.d.ts +4 -0
  74. package/dist/conversion/sibling-class.js +7 -0
  75. package/dist/conversion/structural-plan.d.ts +87 -0
  76. package/dist/conversion/structural-plan.js +487 -0
  77. package/dist/ir/absent-class-arm.d.ts +5 -1
  78. package/dist/ir/absent-class-arm.js +51 -3
  79. package/dist/ir/async-result-conventions.d.ts +15 -0
  80. package/dist/ir/async-result-conventions.js +140 -0
  81. package/dist/ir/borrowed-call-arguments.d.ts +3 -3
  82. package/dist/ir/borrowed-call-arguments.js +9 -9
  83. package/dist/ir/build.d.ts +20 -29
  84. package/dist/ir/build.js +116 -19
  85. package/dist/ir/call-dispatch.js +153 -40
  86. package/dist/ir/call-entry.d.ts +14 -3
  87. package/dist/ir/call-entry.js +72 -5
  88. package/dist/ir/callable-class-flow.d.ts +48 -3
  89. package/dist/ir/callable-class-flow.js +1509 -81
  90. package/dist/ir/callable-flow-candidates.d.ts +25 -0
  91. package/dist/ir/callable-flow-candidates.js +135 -0
  92. package/dist/ir/callable-identity-demand.d.ts +2 -2
  93. package/dist/ir/callable-identity-demand.js +33 -1
  94. package/dist/ir/callable-member-candidates.d.ts +1 -1
  95. package/dist/ir/callable-member-candidates.js +2 -2
  96. package/dist/ir/callable-records.js +1 -0
  97. package/dist/ir/callable-site-escape.js +3 -4
  98. package/dist/ir/captures.js +1 -1
  99. package/dist/ir/certificate.d.ts +1 -0
  100. package/dist/ir/certificate.js +2 -1
  101. package/dist/ir/certify/carrier-keys.d.ts +2 -2
  102. package/dist/ir/certify/carrier-keys.js +4 -4
  103. package/dist/ir/certify/has-property-key.d.ts +3 -3
  104. package/dist/ir/certify/has-property-key.js +3 -3
  105. package/dist/ir/certify/parallel-region.d.ts +26 -0
  106. package/dist/ir/certify/parallel-region.js +1331 -0
  107. package/dist/ir/certify/property-access-keys.d.ts +11 -11
  108. package/dist/ir/certify/property-access-keys.js +11 -11
  109. package/dist/ir/certify/property-access.js +7 -9
  110. package/dist/ir/certify.d.ts +66 -3
  111. package/dist/ir/certify.js +1209 -37
  112. package/dist/ir/class-allocation-domain.d.ts +9 -0
  113. package/dist/ir/class-allocation-domain.js +158 -0
  114. package/dist/ir/class-evaluation.d.ts +2 -3
  115. package/dist/ir/class-evaluation.js +2 -3
  116. package/dist/ir/class-static-fields.d.ts +12 -1
  117. package/dist/ir/class-static-fields.js +25 -0
  118. package/dist/ir/closed-normal-results.d.ts +18 -0
  119. package/dist/ir/closed-normal-results.js +208 -0
  120. package/dist/ir/construct-entry.js +1 -0
  121. package/dist/ir/construction-only-fields.d.ts +20 -1
  122. package/dist/ir/construction-only-fields.js +95 -9
  123. package/dist/ir/convert-carriers.d.ts +7 -0
  124. package/dist/ir/convert-carriers.js +12 -0
  125. package/dist/ir/coroutine-bodies.d.ts +74 -0
  126. package/dist/ir/coroutine-bodies.js +93 -0
  127. package/dist/ir/dead-logical-merge.d.ts +7 -0
  128. package/dist/ir/dead-logical-merge.js +84 -0
  129. package/dist/ir/dead-values.d.ts +7 -5
  130. package/dist/ir/dead-values.js +34 -5
  131. package/dist/ir/deferral.d.ts +3 -1
  132. package/dist/ir/deferral.js +19 -6
  133. package/dist/ir/dense-loops.d.ts +96 -7
  134. package/dist/ir/dense-loops.js +333 -17
  135. package/dist/ir/descriptor-own-protocol.d.ts +12 -0
  136. package/dist/ir/descriptor-own-protocol.js +35 -0
  137. package/dist/ir/dynamic-constructor-conversions.d.ts +17 -0
  138. package/dist/ir/dynamic-constructor-conversions.js +52 -0
  139. package/dist/ir/emission-representations.js +44 -2
  140. package/dist/ir/facts.d.ts +14 -2
  141. package/dist/ir/facts.js +23 -9
  142. package/dist/ir/fixed-data-definition-attributes.d.ts +10 -0
  143. package/dist/ir/fixed-data-definition-attributes.js +200 -0
  144. package/dist/ir/fixed-data-definition.d.ts +23 -5
  145. package/dist/ir/fixed-data-definition.js +80 -2
  146. package/dist/ir/function-reflection-demand.d.ts +11 -0
  147. package/dist/ir/function-reflection-demand.js +71 -0
  148. package/dist/ir/generic-call-entry.d.ts +18 -0
  149. package/dist/ir/generic-call-entry.js +94 -0
  150. package/dist/ir/hoist.d.ts +16 -3
  151. package/dist/ir/hoist.js +121 -8
  152. package/dist/ir/host-method-aliases.d.ts +15 -0
  153. package/dist/ir/host-method-aliases.js +61 -0
  154. package/dist/ir/host-namespace-reads.d.ts +24 -0
  155. package/dist/ir/host-namespace-reads.js +151 -0
  156. package/dist/ir/host-promise-conversions.d.ts +5 -0
  157. package/dist/ir/host-promise-conversions.js +61 -0
  158. package/dist/ir/host-template-conversions.d.ts +34 -0
  159. package/dist/ir/host-template-conversions.js +357 -0
  160. package/dist/ir/instance-reparenting.d.ts +3 -4
  161. package/dist/ir/instantiation.d.ts +1 -1
  162. package/dist/ir/instantiation.js +1 -1
  163. package/dist/ir/integer-storage.d.ts +19 -9
  164. package/dist/ir/integer-storage.js +158 -44
  165. package/dist/ir/integers.d.ts +34 -7
  166. package/dist/ir/integers.js +240 -7
  167. package/dist/ir/integrity-restrictions.d.ts +4 -4
  168. package/dist/ir/integrity-restrictions.js +7 -4
  169. package/dist/ir/internal-operation-conversions.d.ts +7 -0
  170. package/dist/ir/internal-operation-conversions.js +195 -0
  171. package/dist/ir/intrinsic-call-facts.d.ts +40 -0
  172. package/dist/ir/intrinsic-call-facts.js +176 -0
  173. package/dist/ir/key-order-observation.d.ts +1 -1
  174. package/dist/ir/key-order-observation.js +3 -0
  175. package/dist/ir/lazy-splits.d.ts +20 -0
  176. package/dist/ir/lazy-splits.js +58 -0
  177. package/dist/ir/literal-set-membership.d.ts +2 -2
  178. package/dist/ir/literal-set-membership.js +2 -2
  179. package/dist/ir/logical-receivers.d.ts +15 -0
  180. package/dist/ir/logical-receivers.js +98 -0
  181. package/dist/ir/lower-allocation.js +16 -13
  182. package/dist/ir/lower-destructuring.js +7 -6
  183. package/dist/ir/lower-graph.d.ts +4 -4
  184. package/dist/ir/lower-graph.js +2 -2
  185. package/dist/ir/lower-invocation.d.ts +2 -2
  186. package/dist/ir/lower-invocation.js +99 -57
  187. package/dist/ir/lower-narrow.js +35 -13
  188. package/dist/ir/lower-operands.d.ts +40 -11
  189. package/dist/ir/lower-operands.js +206 -87
  190. package/dist/ir/lower-property.js +31 -8
  191. package/dist/ir/lower.js +9 -9
  192. package/dist/ir/merge-conversions.d.ts +18 -0
  193. package/dist/ir/merge-conversions.js +106 -0
  194. package/dist/ir/model.d.ts +138 -28
  195. package/dist/ir/native-accessor-definition.d.ts +104 -0
  196. package/dist/ir/native-accessor-definition.js +735 -0
  197. package/dist/ir/native-array-descriptor-snapshot.d.ts +45 -0
  198. package/dist/ir/native-array-descriptor-snapshot.js +380 -0
  199. package/dist/ir/native-array-insertion.d.ts +16 -0
  200. package/dist/ir/native-array-insertion.js +42 -0
  201. package/dist/ir/native-array-transport.js +37 -3
  202. package/dist/ir/native-callable-argument.d.ts +38 -0
  203. package/dist/ir/native-callable-argument.js +128 -0
  204. package/dist/ir/native-callable-data-flow.d.ts +9 -0
  205. package/dist/ir/native-callable-data-flow.js +59 -0
  206. package/dist/ir/native-callable-data-owner.d.ts +45 -0
  207. package/dist/ir/native-callable-data-owner.js +755 -0
  208. package/dist/ir/native-callable-data-reads.d.ts +45 -0
  209. package/dist/ir/native-callable-data-reads.js +282 -0
  210. package/dist/ir/native-callable-data-slots.d.ts +78 -0
  211. package/dist/ir/native-callable-data-slots.js +403 -0
  212. package/dist/ir/native-callable-data-write.d.ts +58 -0
  213. package/dist/ir/native-callable-data-write.js +254 -0
  214. package/dist/ir/native-callable-integrity.d.ts +23 -0
  215. package/dist/ir/native-callable-integrity.js +77 -0
  216. package/dist/ir/native-callable-own-property.d.ts +42 -0
  217. package/dist/ir/native-callable-own-property.js +505 -0
  218. package/dist/ir/native-callable-prototype.d.ts +38 -0
  219. package/dist/ir/native-callable-prototype.js +307 -0
  220. package/dist/ir/native-callable-readonly-set.d.ts +25 -0
  221. package/dist/ir/native-callable-readonly-set.js +238 -0
  222. package/dist/ir/native-class-accessor.d.ts +3 -3
  223. package/dist/ir/native-class-accessor.js +3 -3
  224. package/dist/ir/native-class-construction.js +2 -2
  225. package/dist/ir/native-constructor-reads.d.ts +15 -0
  226. package/dist/ir/native-constructor-reads.js +156 -0
  227. package/dist/ir/native-constructor-static.d.ts +18 -0
  228. package/dist/ir/native-constructor-static.js +61 -0
  229. package/dist/ir/native-data-definition.d.ts +43 -0
  230. package/dist/ir/native-data-definition.js +222 -0
  231. package/dist/ir/native-document-array-entries.d.ts +15 -0
  232. package/dist/ir/native-document-array-entries.js +37 -0
  233. package/dist/ir/native-document-entries.d.ts +21 -0
  234. package/dist/ir/native-document-entries.js +74 -0
  235. package/dist/ir/native-entry-field-views.d.ts +18 -0
  236. package/dist/ir/native-entry-field-views.js +62 -0
  237. package/dist/ir/native-field-view-domains.d.ts +50 -0
  238. package/dist/ir/native-field-view-domains.js +325 -0
  239. package/dist/ir/native-field-view-facts.d.ts +97 -0
  240. package/dist/ir/native-field-view-facts.js +354 -0
  241. package/dist/ir/native-fixed-layout.js +1 -1
  242. package/dist/ir/native-host-construction.d.ts +4 -6
  243. package/dist/ir/native-host-construction.js +4 -6
  244. package/dist/ir/native-host-method-reads.d.ts +13 -0
  245. package/dist/ir/native-host-method-reads.js +53 -0
  246. package/dist/ir/native-iterator-field-views.d.ts +15 -0
  247. package/dist/ir/native-iterator-field-views.js +39 -0
  248. package/dist/ir/native-iterator-receivers.d.ts +8 -0
  249. package/dist/ir/native-iterator-receivers.js +59 -0
  250. package/dist/ir/native-key-query.js +5 -2
  251. package/dist/ir/native-logical-receiver-body.d.ts +8 -0
  252. package/dist/ir/native-logical-receiver-body.js +23 -0
  253. package/dist/ir/native-method-frames.d.ts +18 -0
  254. package/dist/ir/native-method-frames.js +127 -0
  255. package/dist/ir/native-method-read-source.d.ts +16 -0
  256. package/dist/ir/native-method-read-source.js +61 -0
  257. package/dist/ir/native-object-data-slots.d.ts +60 -0
  258. package/dist/ir/native-object-data-slots.js +493 -0
  259. package/dist/ir/native-object-sample.d.ts +32 -0
  260. package/dist/ir/native-object-sample.js +113 -0
  261. package/dist/ir/native-own-assignment.d.ts +123 -0
  262. package/dist/ir/native-own-assignment.js +529 -0
  263. package/dist/ir/native-property-coercibility.d.ts +3 -0
  264. package/dist/ir/native-property-coercibility.js +10 -0
  265. package/dist/ir/native-property-key-texts.d.ts +11 -0
  266. package/dist/ir/native-property-key-texts.js +41 -0
  267. package/dist/ir/native-property-presence-effects.d.ts +11 -0
  268. package/dist/ir/native-property-presence-effects.js +19 -0
  269. package/dist/ir/native-property-presence.d.ts +27 -0
  270. package/dist/ir/native-property-presence.js +275 -0
  271. package/dist/ir/native-prototype-calls.d.ts +19 -0
  272. package/dist/ir/native-prototype-calls.js +53 -0
  273. package/dist/ir/native-prototype-conversions.d.ts +5 -0
  274. package/dist/ir/native-prototype-conversions.js +46 -0
  275. package/dist/ir/native-prototype-presence-demand.d.ts +9 -0
  276. package/dist/ir/native-prototype-presence-demand.js +58 -0
  277. package/dist/ir/native-record-index.d.ts +1 -1
  278. package/dist/ir/native-union-method-targets.d.ts +8 -0
  279. package/dist/ir/native-union-method-targets.js +69 -0
  280. package/dist/ir/no-normal-call-completion.d.ts +15 -0
  281. package/dist/ir/no-normal-call-completion.js +184 -0
  282. package/dist/ir/non-normal-receiver.d.ts +39 -0
  283. package/dist/ir/non-normal-receiver.js +253 -0
  284. package/dist/ir/operation-conversions.d.ts +29 -0
  285. package/dist/ir/operation-conversions.js +490 -0
  286. package/dist/ir/operation-index.d.ts +1 -1
  287. package/dist/ir/presence-proof.d.ts +1 -1
  288. package/dist/ir/presence-proof.js +1 -0
  289. package/dist/ir/program-conversions.d.ts +48 -0
  290. package/dist/ir/program-conversions.js +229 -0
  291. package/dist/ir/program-facts.d.ts +4 -1
  292. package/dist/ir/program-facts.js +9 -7
  293. package/dist/ir/promise-reaction-conversions.d.ts +6 -0
  294. package/dist/ir/promise-reaction-conversions.js +92 -0
  295. package/dist/ir/property-read-conversions.d.ts +10 -0
  296. package/dist/ir/property-read-conversions.js +124 -0
  297. package/dist/ir/proven-branches.d.ts +2 -1
  298. package/dist/ir/proven-branches.js +97 -10
  299. package/dist/ir/publish-conversion-recipes.d.ts +27 -0
  300. package/dist/ir/publish-conversion-recipes.js +246 -0
  301. package/dist/ir/publish-native-field-view-facts.d.ts +17 -0
  302. package/dist/ir/publish-native-field-view-facts.js +119 -0
  303. package/dist/ir/queries.js +42 -4
  304. package/dist/ir/read-only-dictionary.d.ts +38 -0
  305. package/dist/ir/read-only-dictionary.js +281 -0
  306. package/dist/ir/reflection-demand.d.ts +2 -0
  307. package/dist/ir/reflection-demand.js +840 -71
  308. package/dist/ir/shake.d.ts +3 -0
  309. package/dist/ir/shake.js +39 -15
  310. package/dist/ir/shared-empty-records.js +1 -1
  311. package/dist/ir/short-circuit-threading.d.ts +23 -0
  312. package/dist/ir/short-circuit-threading.js +133 -0
  313. package/dist/ir/spread-conversions.d.ts +27 -0
  314. package/dist/ir/spread-conversions.js +134 -0
  315. package/dist/ir/spread-copy-elision.d.ts +2 -2
  316. package/dist/ir/spread-copy-elision.js +7 -4
  317. package/dist/ir/string-layout-reuse.d.ts +9 -8
  318. package/dist/ir/string-layout-reuse.js +8 -16
  319. package/dist/ir/string-length-reuse.d.ts +20 -4
  320. package/dist/ir/string-length-reuse.js +57 -13
  321. package/dist/ir/transfer.d.ts +5 -5
  322. package/dist/ir/transfer.js +53 -31
  323. package/dist/ir/typed-property-access.d.ts +2 -0
  324. package/dist/ir/typed-property-access.js +21 -8
  325. package/dist/ir/virtual-call-frames.d.ts +7 -0
  326. package/dist/ir/virtual-call-frames.js +8 -0
  327. package/dist/native-signatures.d.ts +45 -0
  328. package/dist/native-signatures.js +368 -0
  329. package/dist/plugins/gea/host.d.ts +6 -1
  330. package/dist/plugins/gea/host.js +30 -1
  331. package/dist/plugins/gea/lower.js +9 -3
  332. package/dist/plugins/gea/members.js +1 -1
  333. package/dist/plugins/gea/plugin.js +2 -1
  334. package/dist/plugins/gea/prelude.d.ts +1 -1
  335. package/dist/plugins/gea/prelude.js +1 -1
  336. package/dist/plugins/gea/reactive-slots.js +6 -6
  337. package/dist/plugins/gea/render-bridge.js +5 -6
  338. package/dist/plugins/gea/user-agent-styles.js +1 -1
  339. package/dist/plugins/installed.d.ts +2 -2
  340. package/dist/plugins/installed.js +2 -2
  341. package/dist/plugins/load.js +1 -1
  342. package/dist/plugins/model.d.ts +21 -36
  343. package/dist/plugins/webgl/host.d.ts +23 -23
  344. package/dist/plugins/webgl/host.js +25 -26
  345. package/dist/plugins/webgl/plugin.d.ts +16 -19
  346. package/dist/plugins/webgl/plugin.js +16 -23
  347. package/dist/project-preparation.js +12 -14
  348. package/dist/projection/abi.js +13 -10
  349. package/dist/projection/bindings.d.ts +8 -0
  350. package/dist/projection/bindings.js +36 -5
  351. package/dist/projection/callee.d.ts +17 -15
  352. package/dist/projection/callee.js +108 -81
  353. package/dist/projection/class-property-presence.d.ts +1 -1
  354. package/dist/projection/class-property-presence.js +1 -1
  355. package/dist/projection/classes.d.ts +2 -0
  356. package/dist/projection/classes.js +4 -1
  357. package/dist/projection/dispatch.d.ts +19 -3
  358. package/dist/projection/dispatch.js +39 -16
  359. package/dist/projection/fields.d.ts +14 -2
  360. package/dist/projection/fields.js +100 -38
  361. package/dist/projection/function-source.d.ts +5 -0
  362. package/dist/projection/function-source.js +15 -0
  363. package/dist/projection/immediate-callees.d.ts +12 -0
  364. package/dist/projection/immediate-callees.js +36 -0
  365. package/dist/projection/index-protocols.d.ts +12 -0
  366. package/dist/projection/index-protocols.js +39 -0
  367. package/dist/projection/instance-test.d.ts +8 -0
  368. package/dist/projection/instance-test.js +3 -1
  369. package/dist/projection/method-values.d.ts +7 -0
  370. package/dist/projection/method-values.js +29 -0
  371. package/dist/projection/native-accessor-access.d.ts +26 -0
  372. package/dist/projection/native-accessor-access.js +18 -0
  373. package/dist/projection/native-callable-data.d.ts +24 -0
  374. package/dist/projection/native-callable-data.js +101 -0
  375. package/dist/projection/native-expando.d.ts +3 -0
  376. package/dist/projection/native-expando.js +13 -0
  377. package/dist/projection/native-object-data.d.ts +47 -0
  378. package/dist/projection/native-object-data.js +203 -0
  379. package/dist/projection/native-prototype-methods.d.ts +22 -0
  380. package/dist/projection/native-prototype-methods.js +161 -0
  381. package/dist/projection/regexp-fields.d.ts +35 -0
  382. package/dist/projection/regexp-fields.js +80 -0
  383. package/dist/projection/slots.d.ts +5 -1
  384. package/dist/projection/slots.js +89 -10
  385. package/dist/representation/derive.d.ts +5 -7
  386. package/dist/representation/derive.js +78 -78
  387. package/dist/representation/difference.js +1 -1
  388. package/dist/representation/host-abi.d.ts +2 -2
  389. package/dist/representation/host-abi.js +4 -5
  390. package/dist/representation/host-templates.d.ts +7 -3
  391. package/dist/representation/host-templates.js +13 -5
  392. package/dist/representation/intersection.d.ts +3 -3
  393. package/dist/representation/intersection.js +3 -3
  394. package/dist/representation/merge.js +1 -1
  395. package/dist/representation/model.d.ts +27 -22
  396. package/dist/representation/model.js +35 -22
  397. package/dist/representation/native-callable-data-storage.d.ts +85 -0
  398. package/dist/representation/native-callable-data-storage.js +398 -0
  399. package/dist/representation/native-data-properties.d.ts +14 -0
  400. package/dist/representation/native-data-properties.js +52 -0
  401. package/dist/representation/native-logical-receiver.d.ts +36 -0
  402. package/dist/representation/native-logical-receiver.js +92 -0
  403. package/dist/representation/object-shape.d.ts +1 -1
  404. package/dist/representation/object-shape.js +1 -1
  405. package/dist/representation/optional.js +2 -2
  406. package/dist/representation/physical-carrier.d.ts +25 -0
  407. package/dist/representation/physical-carrier.js +153 -0
  408. package/dist/representation/policies.d.ts +16 -10
  409. package/dist/representation/policies.js +5 -1
  410. package/dist/representation/primitives.js +3 -0
  411. package/dist/representation/promise-resolution.d.ts +19 -0
  412. package/dist/representation/promise-resolution.js +50 -0
  413. package/dist/representation/prototype-domains.d.ts +43 -0
  414. package/dist/representation/prototype-domains.js +226 -0
  415. package/dist/representation/proxy-carriers.d.ts +3 -3
  416. package/dist/representation/proxy-carriers.js +2 -3
  417. package/dist/representation/publish.d.ts +4 -0
  418. package/dist/representation/publish.js +73 -42
  419. package/dist/representation/record-fields.d.ts +2 -2
  420. package/dist/representation/record-fields.js +2 -2
  421. package/dist/representation/static-field-cells.d.ts +1 -1
  422. package/dist/representation/structural-method-abi.d.ts +6 -0
  423. package/dist/representation/structural-method-abi.js +13 -0
  424. package/dist/representation/unassigned-binding-cells.d.ts +3 -3
  425. package/dist/representation/union.js +19 -4
  426. package/dist/representation/unwritten-record-members.d.ts +6 -6
  427. package/dist/representation/unwritten-record-members.js +1 -1
  428. package/dist/representation/value-records.js +77 -5
  429. package/dist/representation/verify.js +1 -1
  430. package/dist/representation/well-known-symbols.d.ts +3 -0
  431. package/dist/representation/well-known-symbols.js +11 -0
  432. package/dist/semantics/alias-this-field-declaration-transform.js +3 -3
  433. package/dist/semantics/ambient-type-realization-transform.d.ts +19 -20
  434. package/dist/semantics/ambient-type-realization-transform.js +20 -12
  435. package/dist/semantics/ambient.d.ts +13 -13
  436. package/dist/semantics/ambient.js +12 -12
  437. package/dist/semantics/borrowed-builtin-call-bind-source-transform.d.ts +5 -0
  438. package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +110 -52
  439. package/dist/semantics/borrowed-method-receiver-copy-source-transform.d.ts +4 -4
  440. package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +4 -4
  441. package/dist/semantics/call-invalidated-narrowing.js +2 -2
  442. package/dist/semantics/callable-origins.d.ts +49 -1
  443. package/dist/semantics/callable-origins.js +148 -32
  444. package/dist/semantics/callable-own-data-slots.d.ts +122 -0
  445. package/dist/semantics/callable-own-data-slots.js +421 -0
  446. package/dist/semantics/class-alias.d.ts +4 -4
  447. package/dist/semantics/class-alias.js +4 -4
  448. package/dist/semantics/class-heritage.d.ts +8 -7
  449. package/dist/semantics/class-heritage.js +8 -7
  450. package/dist/semantics/commonjs-wrapper.js +5 -2
  451. package/dist/semantics/constructor-function-class-source-transform.js +2 -3
  452. package/dist/semantics/constructor-slot-subclasses.d.ts +1 -1
  453. package/dist/semantics/constructor-slot-subclasses.js +5 -5
  454. package/dist/semantics/declaration-overlay-transform.d.ts +9 -12
  455. package/dist/semantics/declaration-overlay-transform.js +135 -142
  456. package/dist/semantics/declared-integers.d.ts +24 -0
  457. package/dist/semantics/declared-integers.js +34 -0
  458. package/dist/semantics/define-property-source-transform.js +21 -8
  459. package/dist/semantics/dynamic-fallback.d.ts +1 -1
  460. package/dist/semantics/dynamic-fallback.js +1 -1
  461. package/dist/semantics/frontend.d.ts +12 -16
  462. package/dist/semantics/frontend.js +187 -75
  463. package/dist/semantics/host-methods.d.ts +3 -3
  464. package/dist/semantics/host-methods.js +1 -1
  465. package/dist/semantics/host-protocols.d.ts +3 -3
  466. package/dist/semantics/host-protocols.js +26 -26
  467. package/dist/semantics/interface-families.d.ts +2 -2
  468. package/dist/semantics/interface-families.js +46 -47
  469. package/dist/semantics/interface-implementors.d.ts +12 -15
  470. package/dist/semantics/interface-implementors.js +12 -15
  471. package/dist/semantics/jsdoc-namepath-transform.js +7 -7
  472. package/dist/semantics/model/operands.d.ts +18 -3
  473. package/dist/semantics/model/operands.js +41 -0
  474. package/dist/semantics/model/operations.d.ts +82 -1
  475. package/dist/semantics/model/selected-signature.d.ts +24 -3
  476. package/dist/semantics/model/structural-type-table.js +24 -6
  477. package/dist/semantics/model/structural-types.d.ts +10 -8
  478. package/dist/semantics/model/structural-types.js +7 -5
  479. package/dist/semantics/module-resolution.js +3 -2
  480. package/dist/semantics/native-callable-readonly-set.d.ts +17 -0
  481. package/dist/semantics/native-callable-readonly-set.js +1 -0
  482. package/dist/semantics/native-function-signatures.d.ts +14 -0
  483. package/dist/semantics/native-function-signatures.js +96 -0
  484. package/dist/semantics/native-object-data-slots.d.ts +72 -0
  485. package/dist/semantics/native-object-data-slots.js +679 -0
  486. package/dist/semantics/native-own-assignment.d.ts +62 -0
  487. package/dist/semantics/native-own-assignment.js +1 -0
  488. package/dist/semantics/normalize/absent-globals.d.ts +8 -8
  489. package/dist/semantics/normalize/absent-globals.js +5 -5
  490. package/dist/semantics/normalize/any-cast-member-call.d.ts +36 -0
  491. package/dist/semantics/normalize/any-cast-member-call.js +55 -0
  492. package/dist/semantics/normalize/arguments-objects.d.ts +3 -1
  493. package/dist/semantics/normalize/arguments-objects.js +1 -1
  494. package/dist/semantics/normalize/asserted-argument-arms.d.ts +7 -7
  495. package/dist/semantics/normalize/asserted-arm-absence.d.ts +1 -2
  496. package/dist/semantics/normalize/asserted-arm-absence.js +1 -2
  497. package/dist/semantics/normalize/binding-fixpoint.js +3 -3
  498. package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +2 -2
  499. package/dist/semantics/normalize/bivariant-slot-parameter.js +6 -6
  500. package/dist/semantics/normalize/callable-data-write.d.ts +46 -0
  501. package/dist/semantics/normalize/callable-data-write.js +182 -0
  502. package/dist/semantics/normalize/census.js +5 -5
  503. package/dist/semantics/normalize/class-instance-record-statement.d.ts +1 -1
  504. package/dist/semantics/normalize/class-instance-record-statement.js +1 -1
  505. package/dist/semantics/normalize/collection-bindings.d.ts +11 -13
  506. package/dist/semantics/normalize/collection-bindings.js +60 -33
  507. package/dist/semantics/normalize/commonjs-module-record.d.ts +7 -4
  508. package/dist/semantics/normalize/commonjs-module-record.js +93 -4
  509. package/dist/semantics/normalize/contribution.js +4 -4
  510. package/dist/semantics/normalize/dead-method-copies.d.ts +5 -5
  511. package/dist/semantics/normalize/dead-typeof-guards.d.ts +2 -2
  512. package/dist/semantics/normalize/dead-typeof-guards.js +6 -6
  513. package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +22 -13
  514. package/dist/semantics/normalize/deferred-intrinsic-protocols.js +85 -13
  515. package/dist/semantics/normalize/derived-expression-type.d.ts +129 -91
  516. package/dist/semantics/normalize/derived-expression-type.js +459 -192
  517. package/dist/semantics/normalize/field-bindings.d.ts +4 -4
  518. package/dist/semantics/normalize/field-bindings.js +334 -67
  519. package/dist/semantics/normalize/flow/array-element-continuation.d.ts +2 -2
  520. package/dist/semantics/normalize/flow/array-element-continuation.js +35 -18
  521. package/dist/semantics/normalize/flow/callable-array-origins.d.ts +1 -1
  522. package/dist/semantics/normalize/flow/callable-array-origins.js +3 -3
  523. package/dist/semantics/normalize/flow/callable-completions.d.ts +2 -2
  524. package/dist/semantics/normalize/flow/callable-completions.js +2 -2
  525. package/dist/semantics/normalize/flow/callable-reach.d.ts +19 -6
  526. package/dist/semantics/normalize/flow/callable-reach.js +755 -289
  527. package/dist/semantics/normalize/flow/class-family-member-read.js +24 -29
  528. package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +2 -2
  529. package/dist/semantics/normalize/flow/collection-value-continuation.js +2 -2
  530. package/dist/semantics/normalize/flow/component-solver.d.ts +19 -16
  531. package/dist/semantics/normalize/flow/component-solver.js +138 -69
  532. package/dist/semantics/normalize/flow/computed-key-set.d.ts +6 -7
  533. package/dist/semantics/normalize/flow/computed-key-set.js +20 -1
  534. package/dist/semantics/normalize/flow/export-importers.js +4 -4
  535. package/dist/semantics/normalize/flow/host-text-sink.d.ts +3 -2
  536. package/dist/semantics/normalize/flow/host-text-sink.js +4 -3
  537. package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +3 -2
  538. package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +2 -2
  539. package/dist/semantics/normalize/flow/intrinsic-data-definition.js +3 -3
  540. package/dist/semantics/normalize/flow/invocation-facts.d.ts +3 -2
  541. package/dist/semantics/normalize/flow/invocation-facts.js +3 -3
  542. package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +12 -6
  543. package/dist/semantics/normalize/flow/member-call-forwarding.js +94 -21
  544. package/dist/semantics/normalize/flow/model.d.ts +5 -5
  545. package/dist/semantics/normalize/flow/model.js +11 -11
  546. package/dist/semantics/normalize/flow/node-path-token.js +3 -3
  547. package/dist/semantics/normalize/flow/origin-authority.d.ts +3 -3
  548. package/dist/semantics/normalize/flow/owned-class-receivers.js +8 -7
  549. package/dist/semantics/normalize/flow/parameter-values.js +6 -6
  550. package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +30 -4
  551. package/dist/semantics/normalize/flow/proof-hypotheses.js +56 -5
  552. package/dist/semantics/normalize/flow/proof-memo-settlement.d.ts +21 -0
  553. package/dist/semantics/normalize/flow/proof-memo-settlement.js +32 -0
  554. package/dist/semantics/normalize/flow/record-alias-closure.d.ts +1 -1
  555. package/dist/semantics/normalize/flow/record-alias-closure.js +1 -1
  556. package/dist/semantics/normalize/flow/seeded-origins.d.ts +4 -4
  557. package/dist/semantics/normalize/flow/seeded-origins.js +4 -4
  558. package/dist/semantics/normalize/flow/source-accessor-descriptor.d.ts +22 -0
  559. package/dist/semantics/normalize/flow/source-accessor-descriptor.js +210 -0
  560. package/dist/semantics/normalize/flow/source-callable-own-data.d.ts +33 -0
  561. package/dist/semantics/normalize/flow/source-callable-own-data.js +238 -0
  562. package/dist/semantics/normalize/flow/source-callable-readonly-set.d.ts +26 -0
  563. package/dist/semantics/normalize/flow/source-callable-readonly-set.js +337 -0
  564. package/dist/semantics/normalize/flow/source-class-data.d.ts +7 -7
  565. package/dist/semantics/normalize/flow/source-class-data.js +25 -26
  566. package/dist/semantics/normalize/flow/source-class-static-data.d.ts +2 -2
  567. package/dist/semantics/normalize/flow/source-class-static-data.js +2 -2
  568. package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +15 -0
  569. package/dist/semantics/normalize/flow/source-commonjs-exports.js +7 -0
  570. package/dist/semantics/normalize/flow/source-descriptor-protocol.d.ts +20 -0
  571. package/dist/semantics/normalize/flow/source-descriptor-protocol.js +75 -0
  572. package/dist/semantics/normalize/flow/source-executing-parameter-values.d.ts +8 -0
  573. package/dist/semantics/normalize/flow/source-executing-parameter-values.js +93 -0
  574. package/dist/semantics/normalize/flow/source-global-binding.d.ts +13 -0
  575. package/dist/semantics/normalize/flow/source-global-binding.js +42 -0
  576. package/dist/semantics/normalize/flow/source-intrinsic-member-data.d.ts +27 -0
  577. package/dist/semantics/normalize/flow/source-intrinsic-member-data.js +178 -0
  578. package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +1 -1
  579. package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +31 -11
  580. package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +7 -3
  581. package/dist/semantics/normalize/flow/source-invocation-receiver.js +30 -2
  582. package/dist/semantics/normalize/flow/source-native-class-alias.d.ts +7 -0
  583. package/dist/semantics/normalize/flow/source-native-class-alias.js +91 -0
  584. package/dist/semantics/normalize/flow/source-normal-predecessor.d.ts +10 -0
  585. package/dist/semantics/normalize/flow/source-normal-predecessor.js +90 -0
  586. package/dist/semantics/normalize/flow/source-property-key.d.ts +3 -0
  587. package/dist/semantics/normalize/flow/source-property-key.js +7 -0
  588. package/dist/semantics/normalize/flow/source-read-protocol.d.ts +20 -0
  589. package/dist/semantics/normalize/flow/source-read-protocol.js +108 -0
  590. package/dist/semantics/normalize/flow/source-record-data.js +31 -30
  591. package/dist/semantics/normalize/flow/source-value-session.d.ts +106 -3
  592. package/dist/semantics/normalize/flow/source-value-session.js +1172 -218
  593. package/dist/semantics/normalize/flow/standard-prototype-method-source.d.ts +16 -0
  594. package/dist/semantics/normalize/flow/standard-prototype-method-source.js +64 -0
  595. package/dist/semantics/normalize/flow/targets.d.ts +13 -14
  596. package/dist/semantics/normalize/flow/targets.js +20 -23
  597. package/dist/semantics/normalize/flow/value-flow.d.ts +2 -4
  598. package/dist/semantics/normalize/flow/value-flow.js +4 -13
  599. package/dist/semantics/normalize/flow/value-provenance.d.ts +23 -3
  600. package/dist/semantics/normalize/flow/value-provenance.js +44 -4
  601. package/dist/semantics/normalize/fresh-dictionary-storage.d.ts +34 -0
  602. package/dist/semantics/normalize/fresh-dictionary-storage.js +637 -0
  603. package/dist/semantics/normalize/fresh-indexed-storage.d.ts +43 -0
  604. package/dist/semantics/normalize/fresh-indexed-storage.js +88 -0
  605. package/dist/semantics/normalize/fresh-ordinary-object.d.ts +8 -0
  606. package/dist/semantics/normalize/fresh-ordinary-object.js +27 -0
  607. package/dist/semantics/normalize/gating.js +2 -2
  608. package/dist/semantics/normalize/global-host-mutations.js +770 -261
  609. package/dist/semantics/normalize/host-effect-contracts.d.ts +1 -1
  610. package/dist/semantics/normalize/host-effect-contracts.js +1 -1
  611. package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +2 -2
  612. package/dist/semantics/normalize/host-mutation-computed-keys.js +8 -0
  613. package/dist/semantics/normalize/host-mutation-key-reader.d.ts +6 -11
  614. package/dist/semantics/normalize/host-mutation-key-reader.js +11 -28
  615. package/dist/semantics/normalize/host-mutation-keys.d.ts +11 -7
  616. package/dist/semantics/normalize/host-mutation-keys.js +26 -15
  617. package/dist/semantics/normalize/identities.js +20 -17
  618. package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +8 -3
  619. package/dist/semantics/normalize/implicit-arguments-tuple.js +21 -4
  620. package/dist/semantics/normalize/installed-global-properties.d.ts +17 -0
  621. package/dist/semantics/normalize/installed-global-properties.js +214 -0
  622. package/dist/semantics/normalize/instantiation.js +6 -6
  623. package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +1 -1
  624. package/dist/semantics/normalize/intrinsic-property-call.d.ts +6 -1
  625. package/dist/semantics/normalize/intrinsic-property-call.js +19 -0
  626. package/dist/semantics/normalize/intrinsic-prototype.d.ts +7 -0
  627. package/dist/semantics/normalize/intrinsic-prototype.js +10 -0
  628. package/dist/semantics/normalize/intrinsic-return-identity.d.ts +5 -0
  629. package/dist/semantics/normalize/intrinsic-return-identity.js +29 -0
  630. package/dist/semantics/normalize/jsdoc-type-names.js +59 -63
  631. package/dist/semantics/normalize/keyof.js +3 -3
  632. package/dist/semantics/normalize/local-bindings.d.ts +4 -4
  633. package/dist/semantics/normalize/local-bindings.js +68 -62
  634. package/dist/semantics/normalize/logical-object-truthiness.d.ts +8 -0
  635. package/dist/semantics/normalize/logical-object-truthiness.js +20 -0
  636. package/dist/semantics/normalize/merged-declaration.d.ts +3 -3
  637. package/dist/semantics/normalize/merged-declaration.js +3 -3
  638. package/dist/semantics/normalize/never-override-result.d.ts +2 -3
  639. package/dist/semantics/normalize/never-override-result.js +2 -3
  640. package/dist/semantics/normalize/null-blind-parameter.d.ts +2 -2
  641. package/dist/semantics/normalize/null-blind-parameter.js +2 -2
  642. package/dist/semantics/normalize/object-bag-bindings.d.ts +19 -19
  643. package/dist/semantics/normalize/object-bag-bindings.js +334 -141
  644. package/dist/semantics/normalize/omitted-stated-parameter.d.ts +8 -8
  645. package/dist/semantics/normalize/omitted-stated-parameter.js +8 -9
  646. package/dist/semantics/normalize/override-field-arms.d.ts +3 -3
  647. package/dist/semantics/normalize/override-field-arms.js +15 -16
  648. package/dist/semantics/normalize/parameter-bindings.d.ts +13 -12
  649. package/dist/semantics/normalize/parameter-bindings.js +173 -139
  650. package/dist/semantics/normalize/parameter-slot.d.ts +9 -10
  651. package/dist/semantics/normalize/parameter-slot.js +16 -17
  652. package/dist/semantics/normalize/physical-overload-result.d.ts +8 -8
  653. package/dist/semantics/normalize/physical-overload-result.js +10 -10
  654. package/dist/semantics/normalize/producer-context.d.ts +27 -12
  655. package/dist/semantics/normalize/producers/allocations.js +5 -1
  656. package/dist/semantics/normalize/producers/bindings.js +8 -7
  657. package/dist/semantics/normalize/producers/boundary.js +3 -22
  658. package/dist/semantics/normalize/producers/cited-value-type.d.ts +19 -0
  659. package/dist/semantics/normalize/producers/cited-value-type.js +38 -0
  660. package/dist/semantics/normalize/producers/class-lifecycle.js +52 -7
  661. package/dist/semantics/normalize/producers/computations.js +59 -14
  662. package/dist/semantics/normalize/producers/control.js +5 -5
  663. package/dist/semantics/normalize/producers/declaration-lifecycle.js +4 -4
  664. package/dist/semantics/normalize/producers/destructuring.js +10 -5
  665. package/dist/semantics/normalize/producers/erasure.d.ts +9 -0
  666. package/dist/semantics/normalize/producers/erasure.js +22 -0
  667. package/dist/semantics/normalize/producers/invocations.d.ts +1 -1
  668. package/dist/semantics/normalize/producers/invocations.js +210 -55
  669. package/dist/semantics/normalize/producers/logical-merge-type.d.ts +2 -2
  670. package/dist/semantics/normalize/producers/logical-merge-type.js +12 -12
  671. package/dist/semantics/normalize/producers/native-callable-readonly-set.d.ts +6 -0
  672. package/dist/semantics/normalize/producers/native-callable-readonly-set.js +24 -0
  673. package/dist/semantics/normalize/producers/native-own-assignment.d.ts +14 -0
  674. package/dist/semantics/normalize/producers/native-own-assignment.js +153 -0
  675. package/dist/semantics/normalize/producers/properties.js +153 -20
  676. package/dist/semantics/normalize/producers/protocol.js +4 -4
  677. package/dist/semantics/normalize/producers/references.js +21 -19
  678. package/dist/semantics/normalize/producers/shared.d.ts +1 -1
  679. package/dist/semantics/normalize/producers/shared.js +59 -58
  680. package/dist/semantics/normalize/producers/spread-arguments.js +7 -3
  681. package/dist/semantics/normalize/producers/tuple-spread.d.ts +2 -2
  682. package/dist/semantics/normalize/producers/tuple-spread.js +5 -5
  683. package/dist/semantics/normalize/property-key-domain.d.ts +6 -6
  684. package/dist/semantics/normalize/property-key-domain.js +7 -7
  685. package/dist/semantics/normalize/reachability.d.ts +6 -7
  686. package/dist/semantics/normalize/reachability.js +60 -62
  687. package/dist/semantics/normalize/record-home-arms.js +2 -3
  688. package/dist/semantics/normalize/record-link-families.d.ts +1 -1
  689. package/dist/semantics/normalize/record-link-families.js +1 -1
  690. package/dist/semantics/normalize/record-stand-in-arms.d.ts +4 -5
  691. package/dist/semantics/normalize/return-bindings.d.ts +19 -9
  692. package/dist/semantics/normalize/return-bindings.js +96 -42
  693. package/dist/semantics/normalize/script-global-redefinition.d.ts +1 -1
  694. package/dist/semantics/normalize/script-global-redefinition.js +1 -1
  695. package/dist/semantics/normalize/shared-array-storage.d.ts +4 -5
  696. package/dist/semantics/normalize/shared-array-storage.js +7 -8
  697. package/dist/semantics/normalize/sloppy-absence.d.ts +6 -3
  698. package/dist/semantics/normalize/sloppy-absence.js +7 -3
  699. package/dist/semantics/normalize/source-object-prototype-absence.d.ts +7 -0
  700. package/dist/semantics/normalize/source-object-prototype-absence.js +19 -0
  701. package/dist/semantics/normalize/specialization.d.ts +10 -10
  702. package/dist/semantics/normalize/specialization.js +107 -112
  703. package/dist/semantics/normalize/specialized-source-frames.d.ts +11 -0
  704. package/dist/semantics/normalize/specialized-source-frames.js +41 -0
  705. package/dist/semantics/normalize/structural-any-binding-consumer.d.ts +34 -0
  706. package/dist/semantics/normalize/structural-any-binding-consumer.js +208 -0
  707. package/dist/semantics/normalize/structural-array-element.d.ts +5 -5
  708. package/dist/semantics/normalize/structural-array-element.js +40 -39
  709. package/dist/semantics/normalize/structural-array-read.js +3 -3
  710. package/dist/semantics/normalize/structural-callable.d.ts +15 -1
  711. package/dist/semantics/normalize/structural-callable.js +35 -3
  712. package/dist/semantics/normalize/structural-creation-order.d.ts +2 -2
  713. package/dist/semantics/normalize/structural-declarations.d.ts +22 -21
  714. package/dist/semantics/normalize/structural-declarations.js +52 -43
  715. package/dist/semantics/normalize/structural-declared-body.js +10 -11
  716. package/dist/semantics/normalize/structural-indexed-access.js +2 -2
  717. package/dist/semantics/normalize/structural-instantiated-member.d.ts +9 -10
  718. package/dist/semantics/normalize/structural-instantiated-member.js +43 -30
  719. package/dist/semantics/normalize/structural-joins.d.ts +4 -16
  720. package/dist/semantics/normalize/structural-joins.js +5 -65
  721. package/dist/semantics/normalize/structural-layout-relevance.d.ts +5 -5
  722. package/dist/semantics/normalize/structural-layout-relevance.js +22 -23
  723. package/dist/semantics/normalize/structural-layout-type.d.ts +1 -1
  724. package/dist/semantics/normalize/structural-layout-type.js +140 -107
  725. package/dist/semantics/normalize/structural-local-union.d.ts +1 -1
  726. package/dist/semantics/normalize/structural-local-union.js +38 -12
  727. package/dist/semantics/normalize/structural-mutable-field.d.ts +9 -0
  728. package/dist/semantics/normalize/structural-mutable-field.js +152 -0
  729. package/dist/semantics/normalize/structural-parts.d.ts +6 -0
  730. package/dist/semantics/normalize/structural-parts.js +35 -32
  731. package/dist/semantics/normalize/structural-receiver.d.ts +3 -3
  732. package/dist/semantics/normalize/structural-receiver.js +12 -13
  733. package/dist/semantics/normalize/structural-self-reference.d.ts +12 -11
  734. package/dist/semantics/normalize/structural-self-reference.js +24 -25
  735. package/dist/semantics/normalize/structural.d.ts +15 -3
  736. package/dist/semantics/normalize/structural.js +440 -201
  737. package/dist/semantics/normalize/suppressed-write-arms.d.ts +10 -11
  738. package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +6 -6
  739. package/dist/semantics/normalize/symbol-keyed-this-slots.js +4 -4
  740. package/dist/semantics/normalize/unresolvable-names.d.ts +2 -3
  741. package/dist/semantics/normalize/unresolvable-names.js +2 -2
  742. package/dist/semantics/normalize/unshared-array-result.d.ts +4 -4
  743. package/dist/semantics/normalize/unshared-array-result.js +4 -4
  744. package/dist/semantics/package-sources.js +2 -3
  745. package/dist/semantics/program.d.ts +10 -13
  746. package/dist/semantics/program.js +80 -26
  747. package/dist/semantics/property-key.d.ts +9 -0
  748. package/dist/semantics/property-key.js +25 -0
  749. package/dist/semantics/prototype-object-class-source-transform.js +2 -2
  750. package/dist/semantics/prototype-reparenting.d.ts +1 -1
  751. package/dist/semantics/prototype-reparenting.js +1 -1
  752. package/dist/semantics/shared-declaration-files.d.ts +6 -1
  753. package/dist/semantics/shared-declaration-files.js +2 -2
  754. package/dist/semantics/source-transform-protocol.d.ts +26 -0
  755. package/dist/semantics/source-transform-protocol.js +1 -0
  756. package/dist/semantics/stable-checker.js +9 -13
  757. package/dist/semantics/subclass-member-overlay-transform.d.ts +2 -2
  758. package/dist/semantics/subclass-member-overlay-transform.js +89 -88
  759. package/dist/semantics/this-constructor-source-transform.js +2 -2
  760. package/dist/semantics/unchecked-guard-argument-copies.d.ts +3 -3
  761. package/dist/semantics/unchecked-write-member-declarations.d.ts +9 -11
  762. package/dist/semantics/unchecked-write-member-declarations.js +11 -13
  763. package/dist/semantics/uninstantiable-classes.d.ts +1 -1
  764. package/dist/semantics/uninstantiable-classes.js +1 -1
  765. package/dist/targets/cpp/balanced-units.d.ts +1 -1
  766. package/dist/targets/cpp/balanced-units.js +1 -1
  767. package/dist/targets/cpp/borrowed-arm-projections.d.ts +2 -3
  768. package/dist/targets/cpp/borrowed-arm-projections.js +2 -3
  769. package/dist/targets/cpp/borrowed-call-entry.js +3 -3
  770. package/dist/targets/cpp/captures.d.ts +2 -2
  771. package/dist/targets/cpp/captures.js +4 -4
  772. package/dist/targets/cpp/char-code-buffers.d.ts +1 -1
  773. package/dist/targets/cpp/char-code-buffers.js +4 -1
  774. package/dist/targets/cpp/class-layout.d.ts +7 -17
  775. package/dist/targets/cpp/class-layout.js +6 -13
  776. package/dist/targets/cpp/class-properties/computed-method-value.d.ts +1 -1
  777. package/dist/targets/cpp/class-properties/computed-method-value.js +5 -27
  778. package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +49 -59
  779. package/dist/targets/cpp/class-properties/emit-class-properties.js +68 -232
  780. package/dist/targets/cpp/class-properties/native-method-read.d.ts +5 -0
  781. package/dist/targets/cpp/class-properties/native-method-read.js +60 -0
  782. package/dist/targets/cpp/class-properties/native-prototype.d.ts +3 -1
  783. package/dist/targets/cpp/class-properties/native-prototype.js +5 -6
  784. package/dist/targets/cpp/class-ref-transport.d.ts +1 -11
  785. package/dist/targets/cpp/class-ref-transport.js +1 -9
  786. package/dist/targets/cpp/conversions.js +633 -252
  787. package/dist/targets/cpp/coroutine-bodies.d.ts +1 -97
  788. package/dist/targets/cpp/coroutine-bodies.js +1 -187
  789. package/dist/targets/cpp/document.js +1 -1
  790. package/dist/targets/cpp/emit-allocation.d.ts +0 -38
  791. package/dist/targets/cpp/emit-allocation.js +63 -88
  792. package/dist/targets/cpp/emit-array-view.d.ts +7 -0
  793. package/dist/targets/cpp/emit-array-view.js +47 -0
  794. package/dist/targets/cpp/emit-arrays.d.ts +9 -52
  795. package/dist/targets/cpp/emit-arrays.js +177 -113
  796. package/dist/targets/cpp/emit-binding-reference.d.ts +10 -0
  797. package/dist/targets/cpp/emit-binding-reference.js +19 -1
  798. package/dist/targets/cpp/emit-bindings.js +19 -24
  799. package/dist/targets/cpp/emit-buffers.d.ts +8 -4
  800. package/dist/targets/cpp/emit-buffers.js +88 -47
  801. package/dist/targets/cpp/emit-callable-view.d.ts +6 -0
  802. package/dist/targets/cpp/emit-callable-view.js +133 -0
  803. package/dist/targets/cpp/emit-callable.d.ts +11 -1
  804. package/dist/targets/cpp/emit-callable.js +225 -266
  805. package/dist/targets/cpp/emit-carrier-members.d.ts +2 -2
  806. package/dist/targets/cpp/emit-carrier-members.js +42 -35
  807. package/dist/targets/cpp/emit-certified-conversion.d.ts +7 -0
  808. package/dist/targets/cpp/emit-certified-conversion.js +27 -0
  809. package/dist/targets/cpp/emit-context.d.ts +123 -64
  810. package/dist/targets/cpp/emit-context.js +147 -44
  811. package/dist/targets/cpp/emit-descriptor-snapshot.d.ts +10 -0
  812. package/dist/targets/cpp/emit-descriptor-snapshot.js +60 -0
  813. package/dist/targets/cpp/emit-dictionary-view.d.ts +6 -0
  814. package/dist/targets/cpp/emit-dictionary-view.js +102 -0
  815. package/dist/targets/cpp/emit-document-record-view.d.ts +3 -0
  816. package/dist/targets/cpp/emit-document-record-view.js +104 -0
  817. package/dist/targets/cpp/emit-dynamic-properties.d.ts +42 -17
  818. package/dist/targets/cpp/emit-dynamic-properties.js +118 -72
  819. package/dist/targets/cpp/emit-equality.d.ts +2 -1
  820. package/dist/targets/cpp/emit-equality.js +65 -45
  821. package/dist/targets/cpp/emit-exceptions.js +1 -1
  822. package/dist/targets/cpp/emit-in.js +22 -11
  823. package/dist/targets/cpp/emit-instanceof.js +15 -14
  824. package/dist/targets/cpp/emit-integers.d.ts +40 -3
  825. package/dist/targets/cpp/emit-integers.js +76 -5
  826. package/dist/targets/cpp/emit-iterable-object-view.d.ts +2 -0
  827. package/dist/targets/cpp/emit-iterable-object-view.js +15 -11
  828. package/dist/targets/cpp/emit-iterator-object-view.d.ts +2 -0
  829. package/dist/targets/cpp/emit-iterator-object-view.js +24 -16
  830. package/dist/targets/cpp/emit-iterator.d.ts +2 -0
  831. package/dist/targets/cpp/emit-iterator.js +115 -43
  832. package/dist/targets/cpp/emit-json.js +6 -6
  833. package/dist/targets/cpp/emit-jsx.js +2 -2
  834. package/dist/targets/cpp/emit-live-field-view.d.ts +26 -0
  835. package/dist/targets/cpp/emit-live-field-view.js +50 -0
  836. package/dist/targets/cpp/emit-narrowing.d.ts +60 -139
  837. package/dist/targets/cpp/emit-narrowing.js +715 -624
  838. package/dist/targets/cpp/emit-native-accessor-definition.d.ts +10 -0
  839. package/dist/targets/cpp/emit-native-accessor-definition.js +94 -0
  840. package/dist/targets/cpp/emit-native-callable-data.d.ts +23 -0
  841. package/dist/targets/cpp/emit-native-callable-data.js +117 -0
  842. package/dist/targets/cpp/emit-native-document-entry.d.ts +4 -0
  843. package/dist/targets/cpp/emit-native-document-entry.js +52 -0
  844. package/dist/targets/cpp/emit-native-field-view.d.ts +26 -0
  845. package/dist/targets/cpp/emit-native-field-view.js +235 -0
  846. package/dist/targets/cpp/emit-native-method.d.ts +16 -0
  847. package/dist/targets/cpp/emit-native-method.js +90 -0
  848. package/dist/targets/cpp/emit-native-object-data.d.ts +7 -0
  849. package/dist/targets/cpp/emit-native-object-data.js +66 -0
  850. package/dist/targets/cpp/emit-native-object-sample.d.ts +8 -0
  851. package/dist/targets/cpp/emit-native-object-sample.js +34 -0
  852. package/dist/targets/cpp/emit-native-own-assignment.d.ts +7 -0
  853. package/dist/targets/cpp/emit-native-own-assignment.js +119 -0
  854. package/dist/targets/cpp/emit-native-selection.d.ts +2 -2
  855. package/dist/targets/cpp/emit-native-selection.js +14 -5
  856. package/dist/targets/cpp/emit-number-storage.d.ts +2 -0
  857. package/dist/targets/cpp/emit-number-storage.js +1 -0
  858. package/dist/targets/cpp/emit-presence.d.ts +3 -4
  859. package/dist/targets/cpp/emit-presence.js +43 -21
  860. package/dist/targets/cpp/emit-properties.js +224 -111
  861. package/dist/targets/cpp/emit-protocol-iterator.d.ts +2 -0
  862. package/dist/targets/cpp/emit-protocol-iterator.js +45 -23
  863. package/dist/targets/cpp/emit-record-view.d.ts +5 -10
  864. package/dist/targets/cpp/emit-record-view.js +223 -269
  865. package/dist/targets/cpp/emit-return.js +33 -8
  866. package/dist/targets/cpp/emit-scopes.d.ts +2 -2
  867. package/dist/targets/cpp/emit-sum-widening.js +13 -5
  868. package/dist/targets/cpp/emit-tonumber.d.ts +1 -1
  869. package/dist/targets/cpp/emit-tonumber.js +3 -3
  870. package/dist/targets/cpp/emit-tostring.d.ts +20 -2
  871. package/dist/targets/cpp/emit-tostring.js +131 -28
  872. package/dist/targets/cpp/emit-typeof.d.ts +4 -0
  873. package/dist/targets/cpp/emit-typeof.js +29 -1
  874. package/dist/targets/cpp/emit-union-properties.d.ts +6 -23
  875. package/dist/targets/cpp/emit-union-properties.js +136 -237
  876. package/dist/targets/cpp/emit.d.ts +4 -1
  877. package/dist/targets/cpp/emit.js +336 -119
  878. package/dist/targets/cpp/error-types.d.ts +1 -3
  879. package/dist/targets/cpp/error-types.js +1 -2
  880. package/dist/targets/cpp/evaluated-once.d.ts +4 -4
  881. package/dist/targets/cpp/evaluated-once.js +5 -5
  882. package/dist/targets/cpp/function-source-reads.d.ts +2 -15
  883. package/dist/targets/cpp/function-source-reads.js +3 -38
  884. package/dist/targets/cpp/host/core-globals.d.ts +5 -0
  885. package/dist/targets/cpp/host/core-globals.js +10 -0
  886. package/dist/targets/cpp/host/emit-host-arity.js +1 -1
  887. package/dist/targets/cpp/host/emit-host-invoke.js +73 -23
  888. package/dist/targets/cpp/host/emit-host-object.d.ts +2 -1
  889. package/dist/targets/cpp/host/emit-host-object.js +329 -146
  890. package/dist/targets/cpp/host/emit-host-properties.js +4 -6
  891. package/dist/targets/cpp/host/emit-host-reflect.js +29 -5
  892. package/dist/targets/cpp/host/emit-host-value.d.ts +1 -1
  893. package/dist/targets/cpp/host/emit-host-value.js +2 -2
  894. package/dist/targets/cpp/host/host-members.d.ts +11 -0
  895. package/dist/targets/cpp/host/host-members.js +27 -5
  896. package/dist/targets/cpp/host/host-method-aliases.d.ts +1 -30
  897. package/dist/targets/cpp/host/host-method-aliases.js +1 -76
  898. package/dist/targets/cpp/host/native-protocols.js +1 -1
  899. package/dist/targets/cpp/host/object-protocol.d.ts +1 -1
  900. package/dist/targets/cpp/host/object-protocol.js +24 -24
  901. package/dist/targets/cpp/host-namespace-reads.d.ts +1 -83
  902. package/dist/targets/cpp/host-namespace-reads.js +1 -113
  903. package/dist/targets/cpp/manifest/capabilities.js +33 -33
  904. package/dist/targets/cpp/manifest.d.ts +5 -0
  905. package/dist/targets/cpp/manifest.js +38 -14
  906. package/dist/targets/cpp/native-collection-base.js +7 -6
  907. package/dist/targets/cpp/native-debug-source.d.ts +15 -0
  908. package/dist/targets/cpp/native-debug-source.js +21 -0
  909. package/dist/targets/cpp/native-error-base.d.ts +1 -1
  910. package/dist/targets/cpp/native-error-base.js +1 -1
  911. package/dist/targets/cpp/native-narrowing-transport.d.ts +2 -0
  912. package/dist/targets/cpp/native-narrowing-transport.js +25 -5
  913. package/dist/targets/cpp/native-view-targets.d.ts +3 -0
  914. package/dist/targets/cpp/native-view-targets.js +5 -0
  915. package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +3 -33
  916. package/dist/targets/cpp/prototype/emit-prototype-array.js +40 -22
  917. package/dist/targets/cpp/prototype/emit-prototype-date.d.ts +1 -58
  918. package/dist/targets/cpp/prototype/emit-prototype-date.js +14 -97
  919. package/dist/targets/cpp/prototype/emit-prototype-error.d.ts +20 -0
  920. package/dist/targets/cpp/prototype/emit-prototype-error.js +2 -2
  921. package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +3 -27
  922. package/dist/targets/cpp/prototype/emit-prototype-invoke.js +60 -52
  923. package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +1 -41
  924. package/dist/targets/cpp/prototype/emit-prototype-iterator.js +4 -43
  925. package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +2 -13
  926. package/dist/targets/cpp/prototype/emit-prototype-promise.js +10 -58
  927. package/dist/targets/cpp/prototype/emit-prototype-regexp.d.ts +4 -25
  928. package/dist/targets/cpp/prototype/emit-prototype-regexp.js +16 -81
  929. package/dist/targets/cpp/prototype/emit-prototype-string.d.ts +1 -1
  930. package/dist/targets/cpp/prototype/emit-prototype-string.js +17 -28
  931. package/dist/targets/cpp/prototype/prototype-method-reads.js +4 -80
  932. package/dist/targets/cpp/reactive-dependencies.d.ts +12 -6
  933. package/dist/targets/cpp/reactive-dependencies.js +62 -42
  934. package/dist/targets/cpp/reactive-origins.js +12 -0
  935. package/dist/targets/cpp/records.d.ts +133 -14
  936. package/dist/targets/cpp/records.js +345 -153
  937. package/dist/targets/cpp/regexp-types.d.ts +1 -26
  938. package/dist/targets/cpp/regexp-types.js +4 -29
  939. package/dist/targets/cpp/segment-scopes.d.ts +30 -0
  940. package/dist/targets/cpp/segment-scopes.js +294 -0
  941. package/dist/targets/cpp/translation-unit.d.ts +21 -2
  942. package/dist/targets/cpp/translation-unit.js +121 -276
  943. package/dist/targets/cpp/types.d.ts +8 -3
  944. package/dist/targets/cpp/types.js +30 -6
  945. package/dist/targets/cpp/virtual-callees.d.ts +18 -0
  946. package/dist/targets/cpp/virtual-callees.js +27 -0
  947. package/dist/targets/cpp/virtual-methods.d.ts +7 -7
  948. package/dist/targets/cpp/virtual-methods.js +213 -58
  949. package/package.json +8 -3
  950. package/src/targets/cpp/runtime/gea_dictionary_view.h +204 -0
  951. package/src/targets/cpp/runtime/gea_document_view.h +845 -0
  952. package/src/targets/cpp/runtime/gea_dynamic_proxy.h +66 -23
  953. package/src/targets/cpp/runtime/gea_eval.h +6 -6
  954. package/src/targets/cpp/runtime/gea_runtime.h +7587 -1166
  955. package/dist/targets/cpp/direct-call-receivers.d.ts +0 -37
  956. package/dist/targets/cpp/direct-call-receivers.js +0 -79
@@ -1,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
@@ -1660,6 +1743,59 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1660
1743
  ? valueMode.explicitInvocationIsIntact(call)
1661
1744
  : deferredIntrinsicProtocolLedgerOf(flow)?.requirePrototypeKeys('Function', { names: [wrapper.name.text] }, call) === true;
1662
1745
  };
1746
+ /**
1747
+ * Every caller of the function value `value` holds, when the cell it
1748
+ * initializes is the function's only handle: a `const` written once, whose
1749
+ * every executable use -- in its own module or an importer's -- is an
1750
+ * entered call, or initializes another such cell. Hono exports its query
1751
+ * parser twice, `getQueryParam = _getQueryParam as (...) => ...` and a
1752
+ * wrapper calling it directly; the cast alias is one more name for the same
1753
+ * function, and its calls are this function's calls.
1754
+ */
1755
+ const closedBindingCallsOf = (value, counted, sites, depth) => {
1756
+ if (depth > 4)
1757
+ return false;
1758
+ const initializer = outermostErasureOf(value);
1759
+ const binding = initializer.parent;
1760
+ if (!ts.isVariableDeclaration(binding) ||
1761
+ binding.initializer !== initializer ||
1762
+ !ts.isIdentifier(binding.name) ||
1763
+ !localBindingWritesAreComplete(flow, binding))
1764
+ return false;
1765
+ const writes = flow.writesToDeclaration(binding).filter((write) => write.slot === 'whole');
1766
+ if (writes.length === 0 ||
1767
+ writes.some((write) => write.edge !== 'declaration-initializer' ||
1768
+ write.value === null ||
1769
+ unwrapValue(write.value) !== unwrapValue(value)))
1770
+ return false;
1771
+ const exported = isModuleExportedDeclaration(checker, binding, checker.getSymbolAtLocation(binding.name) ?? null);
1772
+ const imported = exported ? inProgramImportReferencesOf(checker, flow, binding) : [];
1773
+ if (imported === null)
1774
+ return false;
1775
+ for (const reference of new Set([...flow.referencesToDeclaration(binding), ...imported])) {
1776
+ if (reference === binding.name || isTypePositionReference(reference))
1777
+ continue;
1778
+ const parent = reference.parent;
1779
+ if (ts.isImportSpecifier(parent) || ts.isImportClause(parent) || ts.isExportSpecifier(parent))
1780
+ continue;
1781
+ const use = outermostErasureOf(reference);
1782
+ const call = use.parent;
1783
+ if (ts.isCallExpression(call) && call.expression === use) {
1784
+ if (counted.has(call))
1785
+ continue;
1786
+ const site = callsOf(flow).sites.get(call);
1787
+ if (site === undefined)
1788
+ return false;
1789
+ if (!sites.includes(site))
1790
+ sites.push(site);
1791
+ continue;
1792
+ }
1793
+ if (ts.isVariableDeclaration(call) && call.initializer === use && closedBindingCallsOf(reference, counted, sites, depth + 1))
1794
+ continue;
1795
+ return false;
1796
+ }
1797
+ return true;
1798
+ };
1663
1799
  const closedCallerSitesUncached = (declaration) => {
1664
1800
  if (ts.isConstructorDeclaration(declaration)) {
1665
1801
  const calls = constructorCallsOf(checker, flow, declaration);
@@ -1674,21 +1810,27 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1674
1810
  }
1675
1811
  return sites;
1676
1812
  }
1677
- const own = callsOf(flow).declarations.get(declaration) ?? [];
1813
+ const own = [...(callsOf(flow).declarations.get(declaration) ?? [])];
1814
+ const allocated = allocationMemberCallerSitesOf(declaration, false, new Set(own.map((site) => site.call)));
1815
+ if (allocated === null)
1816
+ return null;
1817
+ for (const site of allocated)
1818
+ if (!own.includes(site))
1819
+ own.push(site);
1678
1820
  // 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
1821
+ // object selects: `shape.copy( source )` resolves to the base's `copy`,
1822
+ // and a `Circle`'s override runs. Its callers ARE the base's
1681
1823
  // callers -- that is what dispatch means -- whether or not the override
1682
1824
  // also has calls written against it, and leaving them out when it did let
1683
1825
  // `a.m( v )` with `a: A` holding a `B` bind `B.m`'s parameter from `B`'s
1684
1826
  // own calls alone. Answering "no callers, therefore nothing is proven"
1685
- // refused every three.js `copy`/`clone` override and, through the `super`
1827
+ // refused every `copy`/`clone` override in a class-hierarchy library and, through the `super`
1686
1828
  // receiver, the whole family behind it. A base whose slot has no nameable
1687
1829
  // callers -- abstract, data, accessor -- refuses.
1688
1830
  //
1689
1831
  // Zero call sites is an answer, not a gap: the closure proof below decides
1690
1832
  // whether it is a complete one. Refusing instead meant that a method this
1691
- // program never calls -- three's `BufferGeometry` carries a dozen,
1833
+ // program never calls -- a library geometry class can carry a dozen,
1692
1834
  // `rotateX` among them -- could say nothing about its own `this`.
1693
1835
  const base = baseMemberOf(declaration);
1694
1836
  if (base.kind === 'opaque')
@@ -1717,8 +1859,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1717
1859
  const calls = [...own, ...inherited.filter((site) => !own.includes(site))];
1718
1860
  const counted = new Set(own.map((site) => site.call));
1719
1861
  // `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
1862
+ // written the other way round. A pre-ES6 constructor-function module can
1863
+ // publish its whole API that way, and `closedCallerSitesOf` was the one place still
1722
1864
  // spelling "method" syntactically -- `fieldDeclaration` below already
1723
1865
  // states that a special assignment is a declaration form. The member slot
1724
1866
  // is the only handle on the function object, which is why the right-hand
@@ -1729,9 +1871,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1729
1871
  if (slot !== null && 'body' in declaration && declaration.body !== undefined) {
1730
1872
  const symbol = checker.getSymbolAtLocation(slot);
1731
1873
  // 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
1874
+ // a base class's own `onRender(){}` stub, for a call through a
1875
+ // receiver the checker types `Node` -- never indexes under an
1876
+ // INSTANCE override written elsewhere (`node.onRender = function
1735
1877
  // ( renderer, object ) { ... }`), because the checker has no
1736
1878
  // flow-sensitive model of "this receiver was later given its own
1737
1879
  // property". `memberImplementationsOf` is the existing, already-proven
@@ -1763,8 +1905,19 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1763
1905
  hasClosedMemberCallableUses(checker, flow, symbol, siblingCounted, receiverTypeAt, argumentsUsesAt, onOpenUse, nestedMembers, nestedFamilies());
1764
1906
  return closedMember ? sites : null;
1765
1907
  }
1908
+ if (ts.isArrowFunction(declaration) || (ts.isFunctionExpression(declaration) && declaration.name === undefined)) {
1909
+ // A function expression has no declaration binding of its own. Its
1910
+ // exact initializer cell can nevertheless name every caller, provided
1911
+ // that cell never changes and every executable use is an entered call.
1912
+ if (!flow.callableBodyIsIndexed(declaration) || (argumentsUsesAt(declaration)?.length ?? 0) > 0)
1913
+ return null;
1914
+ const sites = [...calls];
1915
+ return closedBindingCallsOf(declaration, counted, sites, 0) ? sites : null;
1916
+ }
1766
1917
  if (!ts.isFunctionDeclaration(declaration) || !declaration.name || !declaration.body)
1767
1918
  return null;
1919
+ if (!sourceGlobalCallableBindingIsClosed(checker, flow, declaration))
1920
+ return null;
1768
1921
  if ((argumentsUsesAt(declaration)?.length ?? 0) > 0 || callableBindingIsWritten(flow, declaration))
1769
1922
  return null;
1770
1923
  // An export is a mention no expression spells: code outside the program
@@ -1772,8 +1925,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1772
1925
  // could expose the binding outside the stated module set, and otherwise
1773
1926
  // names every importer's mention -- which are classified below exactly
1774
1927
  // 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.
1928
+ // was where every `this.method = function` slot of an imported pre-ES6
1929
+ // constructor-function module stopped.
1777
1930
  const exported = isModuleExportedDeclaration(checker, declaration, checker.getSymbolAtLocation(declaration.name) ?? null);
1778
1931
  const imported = exported ? inProgramImportReferencesOf(checker, flow, declaration) : [];
1779
1932
  if (imported === null)
@@ -1783,7 +1936,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1783
1936
  if (reference === declaration.name || isTypePositionReference(reference))
1784
1937
  continue;
1785
1938
  const parent = reference.parent;
1786
- // `@type {ReturnType<typeof WebGLRenderList>}`: a type query evaluates nothing.
1939
+ // `@type {ReturnType<typeof RenderList>}`: a type query evaluates nothing.
1787
1940
  if (ts.isTypeQueryNode(parent) && parent.exprName === reference)
1788
1941
  continue;
1789
1942
  if ((ts.isCallExpression(parent) || ts.isNewExpression(parent)) && parent.expression === reference) {
@@ -1804,7 +1957,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1804
1957
  // `recordReference`), a namespace's whole-object uses included.
1805
1958
  if (ts.isImportSpecifier(parent) || ts.isImportClause(parent) || ts.isNamespaceImport(parent) || ts.isExportSpecifier(parent))
1806
1959
  continue;
1807
- // `{ sort: sort }` / `{ sort }` in three's `WebGLRenderList`: the
1960
+ // `{ sort: sort }` / `{ sort }` in a factory function's returned record: the
1808
1961
  // function goes into a record slot, and every call through the slot is
1809
1962
  // one of its callers -- provided the slot itself is closed.
1810
1963
  const slotCalls = recordSlotCallersOf(declaration, reference);
@@ -1833,25 +1986,110 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1833
1986
  if (!index) {
1834
1987
  const built = new Map();
1835
1988
  for (const site of flow.calls) {
1836
- const callee = ts.isCallExpression(site.call) ? unwrapNaming(site.call.expression) : null;
1837
- if (!callee || !ts.isPropertyAccessExpression(callee))
1989
+ const callee = ts.isCallExpression(site.call) ? site.operands.callee : null;
1990
+ if (!callee || (!ts.isPropertyAccessExpression(callee) && !ts.isElementAccessExpression(callee)))
1991
+ continue;
1992
+ const key = accessKeyOf(callee);
1993
+ if (key === null)
1838
1994
  continue;
1839
- const entries = built.get(callee.name.text);
1995
+ const entries = built.get(key);
1840
1996
  if (entries)
1841
1997
  entries.push(site);
1842
1998
  else
1843
- built.set(callee.name.text, [site]);
1999
+ built.set(key, [site]);
1844
2000
  }
1845
2001
  callsByMemberName.set(flow, (index = built));
1846
2002
  }
1847
2003
  return index.get(key) ?? [];
1848
2004
  };
2005
+ /** The checker cannot index a call through `new this.constructor()` or an
2006
+ * untyped constructor alias under its stored body. Its exact allocation
2007
+ * lookup still belongs to that body's caller inventory. This collects
2008
+ * candidates only; the existing slot/use proof must close every one.
2009
+ */
2010
+ const allocationMemberCallerSitesOf = (declaration, family, counted) => {
2011
+ const owner = memberOwnerClassOf(declaration);
2012
+ const key = memberKeyOf(declaration);
2013
+ if (owner === null || key === null)
2014
+ return [];
2015
+ // These exact call pointers already belong to the consuming inventory and
2016
+ // still pass its complete slot/use proof. Re-discovering their candidate
2017
+ // attribution through allocation origins adds a circular closure question,
2018
+ // rather than a caller. Unindexed aliases and constructor calls remain.
2019
+ const candidates = memberNamedCallsOf(key).filter((site) => !counted.has(site.call));
2020
+ if (candidates.length === 0)
2021
+ return [];
2022
+ const guard = allocationCallerInventoryGuardOf(flow, declaration, family);
2023
+ if (hypothesisGuardIsOpen(guard)) {
2024
+ noteAssumption(guard);
2025
+ // An unfinished inventory is unknown, not an empty caller set. In
2026
+ // particular it cannot narrow a parameter to only the already indexed
2027
+ // callers while another proof is still discovering an allocation call.
2028
+ return null;
2029
+ }
2030
+ enterHypothesisGuard(guard, true);
2031
+ try {
2032
+ const body = ts.isMethodDeclaration(declaration) ||
2033
+ ts.isFunctionDeclaration(declaration) ||
2034
+ ts.isFunctionExpression(declaration) ||
2035
+ ts.isArrowFunction(declaration)
2036
+ ? declaration
2037
+ : null;
2038
+ const wanted = new Set(family ? (memberImplementationsOf(declaration) ?? []) : body ? [body] : (ownMemberBodiesOf(declaration) ?? []));
2039
+ const symbol = slotSymbolOf(declaration);
2040
+ const found = [];
2041
+ for (const site of candidates) {
2042
+ if (!ts.isCallExpression(site.call) || site.explicitThis || site.operands.dispatch.kind !== 'member')
2043
+ continue;
2044
+ const callee = site.operands.callee;
2045
+ if ((!ts.isPropertyAccessExpression(callee) && !ts.isElementAccessExpression(callee)) || accessKeyOf(callee) !== key)
2046
+ continue;
2047
+ // Caller discovery and target admission must ask the same original
2048
+ // construction question. A computed own constructor has no standalone
2049
+ // allocation answer, but its closed slot and complete source family
2050
+ // can still select this body; dropping that call makes the later use
2051
+ // proof reject the very caller the target proof admitted.
2052
+ const origins = memberReceiverOriginsOf(callee.expression);
2053
+ if (origins === null || origins.classes.size === 0)
2054
+ continue;
2055
+ let matches = false;
2056
+ let complete = true;
2057
+ for (const source of origins.classes) {
2058
+ const sourceSymbol = source.name ? checker.getSymbolAtLocation(source.name) : checker.getTypeAtLocation(source).getSymbol();
2059
+ const held = sourceSymbol && checker.getPropertyOfType(checker.getDeclaredTypeOfSymbol(sourceSymbol), key);
2060
+ const declarations = held?.declarations?.length
2061
+ ? held.declarations
2062
+ : constructorInstalledMemberDeclarationsOf(flow, source).get(key);
2063
+ if (!declarations?.length) {
2064
+ complete = false;
2065
+ break;
2066
+ }
2067
+ for (const selected of declarations) {
2068
+ const bodies = memberImplementationsOf(selected);
2069
+ if (bodies === null || bodies.length === 0) {
2070
+ complete = false;
2071
+ break;
2072
+ }
2073
+ matches ||= (family && symbol !== undefined && slotSymbolOf(selected) === symbol) || bodies.some((body) => wanted.has(body));
2074
+ }
2075
+ if (!complete)
2076
+ break;
2077
+ }
2078
+ if (complete && matches)
2079
+ found.push(site);
2080
+ }
2081
+ return found;
2082
+ }
2083
+ finally {
2084
+ exitHypothesisGuard(guard, true);
2085
+ }
2086
+ };
1849
2087
  /**
1850
2088
  * The calls through the record slot a function-name mention fills, or null
1851
2089
  * when the mention is not a record slot or the slot is not closed.
1852
2090
  *
1853
2091
  * 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`
2092
+ * the record is untyped -- e.g. a list read out of an `any`
1855
2093
  * -- so the calls are found by key and admitted only where
1856
2094
  * `recordMethodCallTargetsOf` includes this body in the complete target set. The
1857
2095
  * slot's own closure proof then counts exactly those calls: a call through
@@ -1912,9 +2150,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
1912
2150
  /**
1913
2151
  * `enumeratedParameterValuesOf` (`global-host-mutations.ts`) now calls this
1914
2152
  * 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
2153
+ * identifier parameter, program-wide -- not once per parameter. A large
2154
+ * library's heavily forwarded parameters (`object`, `context`, `options`)
2155
+ * can each have thousands of such reference sites across one module and
1918
2156
  * its satellites, and every one of them used to redo the full
1919
2157
  * `closedCallerSitesOf` + call-site + write-set walk below from scratch.
1920
2158
  *
@@ -2052,9 +2290,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2052
2290
  return null;
2053
2291
  }
2054
2292
  // 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.
2293
+ // known value, not a missing one. A subclass constructed bare --
2294
+ // `new DerivedStyle()` -- forwards `undefined` to a base
2295
+ // `setValues( options )`, and refusing those frames made that
2296
+ // method's key set refuse.
2058
2297
  values.add(args?.[position] ?? parameter.initializer ?? omittedArgumentOf(call, position));
2059
2298
  }
2060
2299
  }
@@ -2089,8 +2328,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2089
2328
  };
2090
2329
  /**
2091
2330
  * 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
2331
+ * file already knows is numeric but not which one -- a tree node's
2332
+ * `add( ...children )`-style method that walks `arguments` exactly this way to admit several
2094
2333
  * children in one call. Unlike `parameterValuesOf` (one declared position),
2095
2334
  * an unindexed read can land on ANY actual argument at ANY position, so
2096
2335
  * every position of every closed caller site is in the set, not only the
@@ -2115,8 +2354,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2115
2354
  * Every value a parameter receives when its function is used as an
2116
2355
  * intrinsic Array callback, or null when some use is anything else.
2117
2356
  *
2118
- * Three's `painterSortStable( a, b )` is never called by name: it is handed
2119
- * to `opaque.sort( customOpaqueSort || painterSortStable )`, and the sort
2357
+ * A comparator `sortStable( a, b )` that is never called by name: it is handed
2358
+ * to `opaque.sort( customSort || sortStable )`, and the sort
2120
2359
  * calls it with pairs of the array's own elements. That is a closed frame
2121
2360
  * -- every element the array ever stored, by `arrayStoredValuesOf` -- as
2122
2361
  * long as each mention of the function is a direct call or the callback of
@@ -2199,9 +2438,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2199
2438
  return [...values];
2200
2439
  };
2201
2440
  /**
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
2441
+ * The whole origin authority for a record plan. A renderer's pooled render item
2442
+ * read back out of `renderItems[ renderItemsIndex ]`, and the list out of
2443
+ * `listArray[ renderCallDepth ]`, is an example: such reads are origins only with the
2205
2444
  * intrinsic protocols closed, and an index the checker types `any` (an
2206
2445
  * unannotated parameter) counts as numeric where this proof's census view
2207
2446
  * types it so.
@@ -2227,8 +2466,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2227
2466
  explicitInvocationIsIntact: (call) => explicitInvocationIsIntact(call),
2228
2467
  protocolClosed: (plan) => nativeProtocolClosed(plan),
2229
2468
  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
2469
+ // `_this.renderLists = renderLists` publishes a factory-built record
2470
+ // onto the constructed object; whether any use of those literals can replace the
2232
2471
  // called slot is this proof's record-closure walk over the roots the
2233
2472
  // record-method route hands back. (Asking `constructionDataMemberOf` of
2234
2473
  // the receiver instead would re-derive the very plan being built.)
@@ -2397,7 +2636,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2397
2636
  * folded into a summary.
2398
2637
  *
2399
2638
  * 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
2639
+ * container really has: a renderer can keep a list of render lists, each holding
2401
2640
  * arrays of render items -- `[] . opaque . [] . object` repeats the element
2402
2641
  * hop without any object graph closing on itself -- and a summary of `{ [],
2403
2642
  * opaque }` would make every mention along the way possibly an array AND
@@ -2591,7 +2830,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2591
2830
  /**
2592
2831
  * A member lookup asks which DECLARATION a key names, and a receiver still
2593
2832
  * carrying its nullish arms names the same one: `output.setEffects` where
2594
- * `output` is `WebGLOutput | null` reaches exactly one `setEffects`, and a
2833
+ * `output` is `Output | null` reaches exactly one `setEffects`, and a
2595
2834
  * receiver that really is null throws AT the access rather than reaching some
2596
2835
  * other declaration -- so the null arm contributes no member and no escape
2597
2836
  * path. `field-bindings.ts`'s `memberSymbolOf` already states this for the
@@ -2623,9 +2862,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2623
2862
  * own, else every source class that can construct the receiver, else the
2624
2863
  * entry of each object literal the receiver can have been allocated as.
2625
2864
  *
2626
- * The last is how three's pooled render items are read: `renderItem` comes
2865
+ * The last is how a renderer's pooled render items are read: `renderItem` comes
2627
2866
  * 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
2867
+ * every render item is the one literal a `getNextItem()` helper writes. Empty
2629
2868
  * when any allocation lacks the key -- a prototype lookup is not a slot.
2630
2869
  */
2631
2870
  const fieldDeclarationsOf = (expression, key) => {
@@ -2763,8 +3002,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2763
3002
  if (declared !== null)
2764
3003
  return declared;
2765
3004
  // 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.
3005
+ // literal entry: a list read out of an `any`, where every list is the
3006
+ // literal one factory function returns.
2768
3007
  const records = fieldDeclarationsOf(access.expression, key);
2769
3008
  return records.length === 1 ? records[0] : null;
2770
3009
  };
@@ -2819,8 +3058,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2819
3058
  (!selected.needsDefaultPrototype || ledger?.requirePrototypeKeys('Object', { names: [selectedKey] }, reference) === true));
2820
3059
  });
2821
3060
  const terminalUse = (reference) => {
2822
- // `const { object, geometry, group } = renderItem` in three's
2823
- // `renderObjects` reads each key exactly as `renderItem.object` would.
3061
+ // `const { object, geometry, group } = renderItem` in a render
3062
+ // loop reads each key exactly as `renderItem.object` would.
2824
3063
  // A rest element copies every own slot out, so it stays with the
2825
3064
  // shared engine.
2826
3065
  const holder = reference.parent;
@@ -2911,8 +3150,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2911
3150
  * or, for `this` in a function the literal was written holding, the literal
2912
3151
  * itself, which the same proof makes the only possible receiver.
2913
3152
  *
2914
- * Three's `ColorManagement.convert` reads `this.enabled`, and `Color` reads
2915
- * the imported `ColorManagement.workingColorSpace`. The checker names the
3153
+ * A singleton object literal's method `Settings.convert` reads `this.enabled`,
3154
+ * and a class in another module reads the imported `Settings.workingSpace`. The checker names the
2916
3155
  * literal's entry for both -- a name a second literal with a getter under
2917
3156
  * that key would satisfy just as well, which is why it is not evidence.
2918
3157
  */
@@ -2958,10 +3197,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
2958
3197
  * An accessor read is a CALL that runs user code with this receiver bound,
2959
3198
  * which is why the member-read arm below refuses one outright. That refusal
2960
3199
  * 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
3200
+ * same way a method body is. A class stating `reversed` as a
3201
+ * getter over `this._reversed`, read as `this.reversed` inside one of its
3202
+ * own methods, was the terminal of 35 escapes -- a whole unrelated buffer
3203
+ * family among them -- for a getter that does nothing but read
2965
3204
  * one of its own fields.
2966
3205
  *
2967
3206
  * Every nominal DESCENDANT that declares the key as an accessor of the
@@ -3053,7 +3292,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3053
3292
  return [...found];
3054
3293
  };
3055
3294
  resolvingImplementations.add(declaration);
3056
- enterHypothesisGuard(declaration);
3295
+ enterHypothesisGuard(declaration, true);
3057
3296
  // What the re-entry above hands out is a REFUSAL (`return null`). So the
3058
3297
  // hypothesis is confirmed exactly when this walk also refuses; then every
3059
3298
  // answer that leaned on it rested on something true and becomes
@@ -3207,6 +3446,20 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3207
3446
  }
3208
3447
  return { bodies, values: [...values] };
3209
3448
  };
3449
+ const ownMemberBodiesOf = (declaration) => {
3450
+ const inventory = ownImplementationsOf(declaration);
3451
+ if (inventory === null)
3452
+ return null;
3453
+ const bodies = new Set(inventory.bodies);
3454
+ for (const value of inventory.values) {
3455
+ const targets = closedCallableTargetsOf(checker, flow, value, elementCalleeAuthority);
3456
+ if (targets === null)
3457
+ return null;
3458
+ for (const target of targets)
3459
+ bodies.add(target);
3460
+ }
3461
+ return [...bodies];
3462
+ };
3210
3463
  /**
3211
3464
  * The member declarations whose slots a call through `declared` can read:
3212
3465
  * its own symbol's declarations, and every descendant redeclaration
@@ -3215,8 +3468,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3215
3468
  // MODULE-level, keyed by `flow`: `declared` plus the round's fixed class
3216
3469
  // list and checker facts fully determine the answer (`memberOwnerClassOf`/
3217
3470
  // `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
3471
+ // many proofs asking about the same slot -- a library's many `.add(...)` sites
3472
+ // all reaching one `Node.prototype.add` -- can share one answer instead
3220
3473
  // of each re-walking `flow.classDeclarations` from zero.
3221
3474
  let slotDeclarationsCache = slotDeclarationsCaches.get(flow);
3222
3475
  if (!slotDeclarationsCache)
@@ -3265,6 +3518,13 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3265
3518
  const symbol = slotSymbolOf(declaration);
3266
3519
  if (!symbol)
3267
3520
  return false;
3521
+ // The nested closure already consumes this exact recursive lease. Its
3522
+ // caller inventory must not recurse first and manufacture an open answer;
3523
+ // retaining the assumption prevents reuse before the outer proof settles.
3524
+ if (nestedMembers.has(symbol)) {
3525
+ noteAssumption(symbol);
3526
+ return true;
3527
+ }
3268
3528
  const held = slotClosures.get(symbol);
3269
3529
  const ledger = deferredIntrinsicProtocolLedgerOf(flow);
3270
3530
  if (held !== undefined) {
@@ -3291,6 +3551,11 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3291
3551
  if (ts.isCallExpression(call) && call.expression === access)
3292
3552
  calls.add(call);
3293
3553
  }
3554
+ const allocated = allocationMemberCallerSitesOf(entry, true, calls);
3555
+ if (allocated === null)
3556
+ return false;
3557
+ for (const site of allocated)
3558
+ calls.add(site.call);
3294
3559
  }
3295
3560
  // An untyped record receiver names no declaration the index files the
3296
3561
  // call under: its calls are found by key and admitted where the slot is
@@ -3335,9 +3600,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3335
3600
  * unresolvable receiver is not a write, and it cannot change what the slot
3336
3601
  * holds for anyone. Asked as one conjunction over the whole program, one
3337
3602
  * `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
3603
+ * `Geometry.getAttribute` for the 1,179 typed call sites of the same
3604
+ * key in one large library compile, and every math class's `copy`/`set`/`add` the same way --
3605
+ * so every reach proof in that library's renderer refused as one cycle, and no
3341
3606
  * fixture-sized fix ever moved the refused-site count (2,227 -> 2,227
3342
3607
  * across six root fixes on 2026-09-14).
3343
3608
  *
@@ -3579,10 +3844,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3579
3844
  // callee IS that class's own binding (TypeScript rejects assigning to a
3580
3845
  // class declaration's binding, TS2629). A callee that only reaches the
3581
3846
  // 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)
3847
+ // constructor -- still refuses. Measured on a large library compile: every
3848
+ // index-signature-typed argument (`{ [key: string]: any }` admits every class instance)
3584
3849
  // handed to any source constructor made EVERY class family escape, which
3585
- // left `Connection.command`'s member slot open.
3850
+ // left an ordinary method slot open.
3586
3851
  if (compiledBody && declaration !== undefined && ts.isConstructorDeclaration(declaration) && ts.isNewExpression(node)) {
3587
3852
  if (newNamesOwnConstructor(node, declaration))
3588
3853
  continue;
@@ -3666,13 +3931,13 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3666
3931
  * <compiled function>` assignment -- or null the moment one is not.
3667
3932
  * `memberSlotWritesClosed` answers "does nothing write this slot", which is
3668
3933
  * 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
3934
+ * unknown callable when what it installs cannot itself be named. A base
3935
+ * class's `Node.prototype.onRender` stub is a per-instance hook --
3936
+ * one module does `boxNode.onRender = function( renderer,
3937
+ * scene, camera ) { ... }` on a local instance, from OUTSIDE any
3673
3938
  * 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
3939
+ * `super.x =`) never learns of it -- so another module's
3940
+ * `scene.onRender( ... )` calls through a slot with one such
3676
3941
  * override, itself a compiled function this walk can name. A slot written
3677
3942
  * three times with three compiled functions is exactly as closed as a slot
3678
3943
  * written once.
@@ -3789,7 +4054,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3789
4054
  // proof, and that proof's walk asks `constructionDataMemberOf`, whose record
3790
4055
  // plan expands a parameter through `parameterValuesOf` back into a
3791
4056
  // `fieldValuesOf` -- of the nested proof, which held its own empty guard. On
3792
- // `object.matrix.parent = object` (three's `Object3D.parent` back-reference)
4057
+ // `object.matrix.parent = object` (a scene-graph node's parent back-reference)
3793
4058
  // each level spawned a fresh proof asking the same read and the stack
3794
4059
  // overflowed. A re-ask of a read still being answered is the same cycle
3795
4060
  // whichever proof instance asks it, and it already refused within one.
@@ -3797,8 +4062,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3797
4062
  if (!activeFieldReads)
3798
4063
  activeFieldReadsByFlow.set(flow, (activeFieldReads = new Set()));
3799
4064
  const callCompletionValuesAt = (call) => {
3800
- // `options = Object.assign( { ...defaults }, options )` in three's
3801
- // `RenderTarget`: the intact intrinsic returns its target. The graph
4065
+ // `options = Object.assign( { ...defaults }, options )` in a class
4066
+ // constructor that rebinds its options parameter: the intact intrinsic returns its target. The graph
3802
4067
  // models the same call (`bulkAssignOf`); this is the legacy resolver's
3803
4068
  // reading of it, and it goes when `parameterValuesOf` does.
3804
4069
  if (isGlobalObjectAssign(checker, call) &&
@@ -3813,9 +4078,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3813
4078
  // leans on `collectionStoredValuesOf` for this identical question; the
3814
4079
  // exact-origin graph asked its every OTHER leaf (`fieldValuesOf`,
3815
4080
  // `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
4081
+ // round-tripped through a WeakMap -- a cache's
4082
+ // `cache.get( key )`, holding the very object
4083
+ // its `getOrCreate` just allocated -- had no exact origin, and every method later
3819
4084
  // called on it (`cubemap.dispose()` in the map's own dispose listener)
3820
4085
  // refused as `targets:origin-slot-open`.
3821
4086
  const stored = collectionStoredValuesOf(checker, flow, call, nativeProtocolClosed);
@@ -3857,6 +4122,13 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3857
4122
  return traceField('recursive-read');
3858
4123
  }
3859
4124
  activeFieldReads.add(access);
4125
+ // A read still being answered is a re-entry guard in everything but name:
4126
+ // it hands its re-entries a refusal. Opened as one, the refusals that
4127
+ // leaned on it are settled when the read finishes, instead of staying
4128
+ // conditional on this exact read being in flight for the rest of the
4129
+ // compile -- one stored refusal per combination of reads open at the time.
4130
+ enterHypothesisGuard(access, true);
4131
+ let outcome;
3860
4132
  try {
3861
4133
  const ledger = deferredIntrinsicProtocolLedgerOf(flow);
3862
4134
  fieldStats.asks++;
@@ -3888,16 +4160,22 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3888
4160
  let answers = byAccess.get(access);
3889
4161
  if (!answers)
3890
4162
  byAccess.set(access, (answers = []));
4163
+ if (answers.length > fieldStats.longest)
4164
+ fieldStats.longest = answers.length;
3891
4165
  for (const answer of answers) {
4166
+ fieldStats.scanned++;
3892
4167
  let applies = true;
3893
- for (const assumedKey of answer.assumed)
4168
+ for (const assumedKey of answer.assumed) {
4169
+ fieldStats.keysChecked++;
3894
4170
  if (!parked(assumedKey)) {
3895
4171
  applies = false;
3896
4172
  break;
3897
4173
  }
4174
+ }
3898
4175
  if (!applies)
3899
4176
  continue;
3900
4177
  fieldStats.hits++;
4178
+ answer.uses++;
3901
4179
  for (const assumedKey of answer.assumed)
3902
4180
  noteAssumption(assumedKey);
3903
4181
  for (const escapedKey of answer.escaped)
@@ -3906,7 +4184,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3906
4184
  onOpenUse(reference, kind);
3907
4185
  if (answer.values !== null && ledger)
3908
4186
  ledger.include(answer.requirements);
3909
- return answer.values ?? traceField('shared-refusal');
4187
+ return (outcome = answer.values ?? traceField('shared-refusal'));
3910
4188
  }
3911
4189
  const trail = pushHypothesisTrail();
3912
4190
  const opens = new Map();
@@ -3935,6 +4213,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3935
4213
  // frame's, so no enclosing positive answer's scope changes.
3936
4214
  const escaped = new Set();
3937
4215
  for (const key of trail) {
4216
+ // See `hypothesisIsPessimistic`: a read that came out with values owes
4217
+ // a pessimistic hypothesis nothing.
4218
+ if (!answerDependsOn(key, computed.value !== null))
4219
+ continue;
3938
4220
  if (parked(key))
3939
4221
  assumed.add(key);
3940
4222
  else
@@ -3946,13 +4228,39 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
3946
4228
  for (const kind of kinds)
3947
4229
  recorded.push([reference, kind]);
3948
4230
  fieldStats.stores++;
3949
- answers.push({ assumed, escaped, values: computed.value, requirements: computed.requirements, opens: recorded });
4231
+ const stored = {
4232
+ assumed,
4233
+ escaped,
4234
+ values: computed.value,
4235
+ requirements: [...computed.requirements],
4236
+ opens: recorded,
4237
+ uses: 0
4238
+ };
4239
+ answers.push(stored);
4240
+ if (dischargeEnabled && computed.value !== null && escaped.size === 0 && assumed.size !== 0)
4241
+ provisionalAnswers.push(stored);
4242
+ // Settled like the proof memo's answers: when a re-entry guard this
4243
+ // answer leaned on closes, the answer either sheds that key (the guard's
4244
+ // refusal was the truth) or leaves the bucket. Unregistered, a refusal
4245
+ // stayed conditional on every read that happened to be in flight when it
4246
+ // was computed -- ~35 of them -- and one large app compile grew one bucket per field to
4247
+ // thousands of refusals, each with its own signature, every one scanned
4248
+ // on every later ask of that field.
4249
+ if (assumed.size !== 0)
4250
+ registerGuardedAnswer(stored, () => {
4251
+ const at = answers.indexOf(stored);
4252
+ if (at !== -1)
4253
+ answers.splice(at, 1);
4254
+ });
3950
4255
  if (computed.value !== null && ledger)
3951
- ledger.include(computed.requirements);
3952
- return computed.value;
4256
+ ledger.include(stored.requirements);
4257
+ return (outcome = computed.value);
3953
4258
  }
3954
4259
  finally {
3955
4260
  activeFieldReads.delete(access);
4261
+ // The refusal handed to re-entries was the truth only if the read itself
4262
+ // came out refused; otherwise answers that leaned on it are struck.
4263
+ exitHypothesisGuard(access, outcome === null, outcome === null);
3956
4264
  }
3957
4265
  };
3958
4266
  /** Everything the memo above covers: the array-index shortcut, the value
@@ -4087,8 +4395,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4087
4395
  // whole question as one word (`member-call-argument:receiver-outside
4088
4396
  // -family`), and that word is true of a receiver whose allocations cannot
4089
4397
  // 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.
4398
+ // is open alike -- three different fixes. A `scene.add( light )` in one
4399
+ // large library compile refused here and there was no way to say which.
4092
4400
  const familyTraced = (reason, detail) => {
4093
4401
  if (watchedReceiverFamily !== undefined) {
4094
4402
  const file = receiver.getSourceFile();
@@ -4128,7 +4436,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4128
4436
  // so the frame question below answers it exactly. Sending it to
4129
4437
  // `exactClassAllocationOriginsOf` instead asked "which classes can this
4130
4438
  // expression denote" of a keyword that denotes no cell, and every
4131
- // `super.copy` in three's Texture/RenderTarget/DepthTexture chain refused
4439
+ // `super.copy` in a multi-level class chain's `copy` overrides refused
4132
4440
  // as `allocations-not-enumerable`.
4133
4441
  if (value.kind !== ts.SyntaxKind.ThisKeyword && value.kind !== ts.SyntaxKind.SuperKeyword) {
4134
4442
  // A receiver that arrived as a parameter is answered by THIS proof's
@@ -4136,13 +4444,13 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4136
4444
  // method's callers means proving its slot closed, and that is the
4137
4445
  // question this proof is already inside, with this proof's counted
4138
4446
  // 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.
4447
+ // `object.onRender( this )` left the renderer unplaceable, which
4448
+ // is the `object-to-dynamic-conversion` behind a whole family of
4449
+ // per-instance hook calls.
4142
4450
  const origins = allocationOriginsOf(value);
4143
4451
  if (origins === null) {
4144
- // `new this.constructor( ... )` -- three's universal `clone()`, and the
4145
- // receiver of 150 refusals off `Texture.clone` alone -- names a
4452
+ // `new this.constructor( ... )` -- the universal `clone()` idiom, and the
4453
+ // receiver of 150 refusals off one class's `clone` alone -- names a
4146
4454
  // COMPUTED callee, and `exactClassAllocationOriginsOf` resolves only
4147
4455
  // identifiers and namespace members. It is not missing a branch: it is
4148
4456
  // asked standalone, with no candidate family to check `this` against,
@@ -4153,9 +4461,17 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4153
4461
  // explicit receiver, and whose `constructor` slot nothing writes, the
4154
4462
  // allocation is `C`'s own family.
4155
4463
  const own = ts.isNewExpression(value) ? ownConstructorClassOf(value) : null;
4156
- if (own !== null)
4464
+ if (own !== null) {
4465
+ // A complete original construction may select a base or an
4466
+ // overriding subclass. This body receives only the arms whose
4467
+ // actual slot selects it; the other arms still need their own
4468
+ // complete source targets, rather than being treated as receivers
4469
+ // of every override in the family's conservative target union.
4470
+ if (ts.isNewExpression(value) && ownConstructorMemberReceiverOf(value, declared, inFamily))
4471
+ return true;
4157
4472
  return (inFamily(own) ||
4158
4473
  familyTraced('own-constructor-outside-family', () => `owner=${owner.name?.text ?? '(anonymous)'} own=${own.name?.text ?? '(anonymous)'}`));
4474
+ }
4159
4475
  // ⛔ UNSOUND MEASUREMENT ARM (`GEA_RECEIVER_FAMILY_FORCE=1`): prices what
4160
4476
  // this one refusal alone is holding open. Never set it for a kept build.
4161
4477
  if (process.env['GEA_RECEIVER_FAMILY_FORCE'] === undefined)
@@ -4228,9 +4544,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4228
4544
  // itself gets out. A data definition stores INTO it -- the same effect as
4229
4545
  // `this.<key> = value` -- and hands it to nothing, so what it installs is
4230
4546
  // 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.
4547
+ // have to follow nor hold the receiver back. A base class that defines
4548
+ // `id` this way in its constructor left every receiver-family proof over
4549
+ // its instances open when this refused.
4234
4550
  const refuse = (why) => {
4235
4551
  traceReceiver(reference, 'data-definition', false, () => `keys=${plan.keys.join(',')} ${why}`);
4236
4552
  return false;
@@ -4246,10 +4562,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4246
4562
  // that names one of those keys, an element hop, or a hop named only by
4247
4563
  // its declaration (any key at runtime) could be what the definition
4248
4564
  // 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
4565
+ // touches. A SUMMARY path lists several heads -- `.container,
4566
+ // .items,[],.container` reaching a container's items from one of
4567
+ // those items -- and reading it as "kind is not property" refused
4568
+ // `Object.defineProperty(this, 'id', ...)` in the item class's constructor
4253
4569
  // for a definition of `id` that no head of the path names.
4254
4570
  // (`siblingKeyed` is that comparison: an element hop only collides with a
4255
4571
  // canonical index, a declaration-only hop with any key.)
@@ -4274,7 +4590,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4274
4590
  * origins.ts`) only traces an array literal through cells, conditionals,
4275
4591
  * `.slice()` copies and `collectionValuesOf`-backed native-map reads -- it
4276
4592
  * 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
4593
+ * arrays (`this._listeners[ type ]`, an event-emitter base class), because
4278
4594
  * that identity question is answered by a different, already-general
4279
4595
  * mechanism: `arrayStoredValuesOf` (`array-element-continuation.ts`),
4280
4596
  * which `computedKeyAuthority`/`arrayContentsOf` above already ask for
@@ -4289,7 +4605,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4289
4605
  *
4290
4606
  * MEASURED DEAD END (2026-09-16): the obvious next shape -- a callable at a
4291
4607
  * 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
4608
+ * how a regex-compiled router can dispatch every route -- cannot be closed from
4293
4609
  * here. A fixed index needs one slot plus the proof that nothing else ever
4294
4610
  * wrote it, and the only enumeration of writes available at this layer is
4295
4611
  * `arrayStoredValuesOf`, which is CIRCULAR for exactly this shape: it
@@ -4301,7 +4617,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4301
4617
  * `callableArrayTargetsOf` in `callable-array-origins.ts`, that admits an
4302
4618
  * element-slot callee the way that walk's own `use`/`callableUse` already
4303
4619
  * admits `array[ i ]( ... )`. A version built without one landed zero
4304
- * closed callees on `hono-hello` and was reverted.
4620
+ * closed callees on a small web-server app and was reverted.
4305
4621
  */
4306
4622
  const arrayElementTargetsViaRecordOf = (element) => {
4307
4623
  if (!numericArrayIndex(element.argumentExpression))
@@ -4355,7 +4671,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4355
4671
  const argument = site.operands.args.indexOf(reference);
4356
4672
  if (argument < 0)
4357
4673
  return false;
4358
- // `new WebGLTextures( state )` on a plain source function: `new` binds the
4674
+ // `new Textures( state )` on a plain source function: `new` binds the
4359
4675
  // arguments to the function's own formals exactly as a call does. What
4360
4676
  // becomes of the fresh `this` is not this argument's question: a factory
4361
4677
  // discards it behind an object completion (`constructionYieldsCompletionOf`),
@@ -4364,12 +4680,12 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4364
4680
  // allocation whose own receiver references are walked as that function's
4365
4681
  // `this`. Either way the argument reaches only the formal. The
4366
4682
  // 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,
4683
+ // design -- its body is no `ConstructorDeclaration` -- so a pre-ES6
4684
+ // library's factory shims were an open escape at every `new` that handed
4685
+ // them a record, and so were its `this`-writing modules: `new Textures( _gl,
4370
4686
  // 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.
4687
+ // ShadowMap( _this, objects, capabilities )` were 746 of one large library
4688
+ // compile's leaf refusals, every one an `objects`/`extensions`/`state` argument.
4373
4689
  const factory = constructorFunctionCalleeOf(call);
4374
4690
  if (factory !== null) {
4375
4691
  const parameter = factory.parameters[argument];
@@ -4425,9 +4741,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4425
4741
  value.text === 'undefined' &&
4426
4742
  (checker.getSymbolAtLocation(value)?.declarations ?? []).every((entry) => entry.getSourceFile().hasNoDefaultLib));
4427
4743
  /**
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,
4744
+ * Whether every value `expression` can ever hold is nullish. A
4745
+ * renderer that keeps `let _nodesHandler = null` and assigns it only in
4746
+ * `setNodesHandler( nodesHandler )` is an example: where nothing calls that setter,
4431
4747
  * `_nodesHandler.renderStart( scene, camera )` is on a receiver that throws
4432
4748
  * before either argument is evaluated. Only a binding whose every write is
4433
4749
  * a spelled value answers: one plain `let`/`var`/`const` statement
@@ -4440,6 +4756,18 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4440
4756
  return true;
4441
4757
  if (ts.isConditionalExpression(value))
4442
4758
  return nullishOnly(value.whenTrue, active) && nullishOnly(value.whenFalse, active);
4759
+ // An element read yields a stored value or `undefined` (a hole or a miss).
4760
+ // A module that keeps `let _effects = []`, fills it only through
4761
+ // `setEffects( effects )`, and runs `_effects[ i ].render( renderer, ... )`;
4762
+ // where nothing calls that setter the array never holds anything, so the
4763
+ // callee lookup throws before `renderer` is evaluated -- and treating the
4764
+ // renderer as handed to unknown code reflected all of its fields.
4765
+ if (ts.isElementAccessExpression(value)) {
4766
+ if (!numericArrayIndex(value.argumentExpression))
4767
+ return false;
4768
+ const stored = arrayContentsOf(value.expression);
4769
+ return stored !== null && stored.every((held) => nullishOnly(held, active));
4770
+ }
4443
4771
  if (!ts.isIdentifier(value))
4444
4772
  return false;
4445
4773
  const target = flow.targetOf(value);
@@ -4541,9 +4869,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4541
4869
  // NAME both halves. This is the ONE authority both walks ask about a
4542
4870
  // store into `<expr>.<key>` -- `receiverUseBody` and `containerUseBody`
4543
4871
  // 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
4872
+ // it is where a whole scene graph stops: `this.camera = camera`
4873
+ // (a field store), `object.parent = this` (a tree node's `add`), `this.items[
4874
+ // i ].container = this` (a container's back-reference). Both of its refusals were a
4547
4875
  // bare `false`, so every instrument showed a chain that ended for no
4548
4876
  // stated cause, and two separate investigations misattributed the
4549
4877
  // terminal to the `isIdentifier` guard in the caller's own arm below --
@@ -4562,7 +4890,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4562
4890
  if (numeric(receiverTypeAt(expression) ?? checker.getTypeAtLocation(expression)))
4563
4891
  return true;
4564
4892
  // An unannotated parameter is numeric where every value its closed frame
4565
- // receives is: three's `listArray[ renderCallDepth ]`, whose one caller
4893
+ // receives is: `listArray[ renderCallDepth ]`, whose one caller
4566
4894
  // passes `renderListStack.length`. A re-entered question refuses.
4567
4895
  const value = unwrapValue(expression);
4568
4896
  const declaration = ts.isIdentifier(value) ? flow.targetOf(value)?.declaration : undefined;
@@ -4581,7 +4909,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4581
4909
  * Whether every object `expression` can denote is an Array.
4582
4910
  *
4583
4911
  * 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
4912
+ * untyped container: `listArray = lists.get( scene )` read off an untyped map is `any`, and
4585
4913
  * every value that map ever holds is the literal `[ list ]`. So the origins
4586
4914
  * are asked instead -- literals, the map's stored values, a binding's every
4587
4915
  * write. A re-entered question is assumed: the only value a cycle of
@@ -4591,8 +4919,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4591
4919
  /**
4592
4920
  * Whether the checker types `expression` as an object that is certainly not
4593
4921
  * 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.
4922
+ * index. `any`, `unknown` and type parameters are not certain -- a library
4923
+ * can read its lists out of an `any` -- and answer false.
4596
4924
  */
4597
4925
  const definiteNonArray = (expression) => {
4598
4926
  const held = checker.getTypeAtLocation(unwrapValue(expression));
@@ -4673,7 +5001,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4673
5001
  * `array.push( value )`, `unshift`, `fill`'s value and `splice`'s inserted
4674
5002
  * items through the intrinsic Array protocol: the value is now one element
4675
5003
  * 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
5004
+ * shape -- a record's own `push`, as a factory-built list record has -- so the arms
4677
5005
  * after it answer.
4678
5006
  */
4679
5007
  const arrayStoreArgumentUse = (call, reference, tail) => {
@@ -4695,9 +5023,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4695
5023
  };
4696
5024
  /**
4697
5025
  * 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.
5026
+ * nullish. `customSort || sortStable` is
5027
+ * `sortStable` exactly when `customSort` holds nothing -- which
5028
+ * is the only value a never-called `setSort` setter leaves in it.
4701
5029
  */
4702
5030
  const callableValuesOf = (expression, active = new Set()) => {
4703
5031
  const value = unwrapValue(expression);
@@ -4915,9 +5243,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4915
5243
  if (ts.isMethodDeclaration(frame)) {
4916
5244
  // Enumerating every caller of `frame` (`closedCallerSitesOf`, with no
4917
5245
  // 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) }`,
5246
+ // proof sits inside when `frame` IS the clone idiom: a class-hierarchy
5247
+ // library where half a dozen unrelated classes each declare `clone() { return new this.constructor().copy(this) }`,
4921
5248
  // so a full caller enumeration for one clone chases the others'.
4922
5249
  //
4923
5250
  // `memberSlotClosed` is the weaker, still SOUND fact that settles it
@@ -4957,13 +5284,86 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
4957
5284
  originsOf: allocationOriginsOf
4958
5285
  });
4959
5286
  };
5287
+ /** A computed own constructor retains its complete original source family.
5288
+ * Member selection must walk every construction alternative, rather than
5289
+ * borrow the override currently being checked by this recursive proof. */
5290
+ const memberReceiverOriginsOf = (receiver) => {
5291
+ const origins = allocationOriginsOf(receiver);
5292
+ if (origins !== null)
5293
+ return origins;
5294
+ const value = unwrapValue(receiver);
5295
+ if (!ts.isNewExpression(value))
5296
+ return null;
5297
+ const owner = ownConstructorClassOf(value);
5298
+ if (owner === null)
5299
+ return null;
5300
+ const inventory = ownedClassReceiverInventoryOf(checker, flow, new Set([owner]));
5301
+ const construction = inventory?.constructionFacts.find((fact) => fact.call === value);
5302
+ if (inventory === null ||
5303
+ !construction ||
5304
+ construction.alternatives.length === 0 ||
5305
+ construction.familyProjection.length !== construction.alternatives.length ||
5306
+ construction.alternatives.some((alternative) => !inventory.classes.has(alternative)))
5307
+ return null;
5308
+ return {
5309
+ classes: new Set(construction.alternatives),
5310
+ constructions: new Map([[value, construction.alternatives]])
5311
+ };
5312
+ };
5313
+ const ownConstructorMemberReceiverOf = (receiver, declared, inFamily) => {
5314
+ const selected = outermostErasureOf(receiver).parent;
5315
+ if (!ts.isPropertyAccessExpression(selected) && !ts.isElementAccessExpression(selected))
5316
+ return false;
5317
+ const call = selected.parent;
5318
+ const key = accessKeyOf(selected);
5319
+ if (!ts.isCallExpression(call) || call.expression !== selected || key === null || key !== memberKeyOf(declared))
5320
+ return false;
5321
+ const site = callsOf(flow).sites.get(call);
5322
+ if (!site ||
5323
+ site.explicitThis !== null ||
5324
+ site.operands.dispatch.kind !== 'member' ||
5325
+ site.operands.callee !== selected ||
5326
+ unwrapValue(selected.expression) !== receiver)
5327
+ return false;
5328
+ const origins = memberReceiverOriginsOf(receiver);
5329
+ if (origins === null || origins.classes.size === 0) {
5330
+ traceClosedCallee(call, 'ownConstructorMemberReceiverOf', 'original construction origins unavailable');
5331
+ return false;
5332
+ }
5333
+ let receives = false;
5334
+ for (const owner of origins.classes) {
5335
+ const symbol = owner.name ? checker.getSymbolAtLocation(owner.name) : checker.getTypeAtLocation(owner).getSymbol();
5336
+ const slots = symbol && checker.getPropertyOfType(checker.getDeclaredTypeOfSymbol(symbol), key)?.declarations;
5337
+ if (!slots?.length)
5338
+ return false;
5339
+ for (const slot of slots) {
5340
+ if (!slotDeclarationsOf(slot).every(slotClosedForTargets)) {
5341
+ traceClosedCallee(call, 'ownConstructorMemberReceiverOf', `target slot remains open for ${owner.name?.text ?? '(anonymous)'}`);
5342
+ return false;
5343
+ }
5344
+ const bodies = ownMemberBodiesOf(slot);
5345
+ if (bodies === null || bodies.length === 0 || bodies.some((body) => !flow.callableBodyIsIndexed(body)))
5346
+ return false;
5347
+ if (!bodies.includes(declared))
5348
+ continue;
5349
+ if (!inFamily(owner)) {
5350
+ traceClosedCallee(call, 'ownConstructorMemberReceiverOf', `selected body receives a different family: ${owner.name?.text ?? '(anonymous)'}`);
5351
+ return false;
5352
+ }
5353
+ receives = true;
5354
+ }
5355
+ }
5356
+ if (!receives)
5357
+ traceClosedCallee(call, 'ownConstructorMemberReceiverOf', 'no original construction selects this body');
5358
+ return receives;
5359
+ };
4960
5360
  /**
4961
5361
  * `object.constructor` read as a value and not called on `object`.
4962
5362
  *
4963
5363
  * While no write replaces the slot, what it yields is the function that
4964
5364
  * allocated `object` -- never `object`, and nothing `object` holds. Only a
4965
5365
  * CALL through the slot could hand `object` on, as that call's `this`.
4966
- * Three's `Texture.clone` is `new this.constructor().copy( this )`.
5366
+ * The universal `clone()` idiom is `new this.constructor().copy( this )`.
4967
5367
  */
4968
5368
  const constructorValueRead = (access) => {
4969
5369
  if (!ts.isPropertyAccessExpression(access) || access.name.text !== 'constructor')
@@ -5007,7 +5407,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5007
5407
  classAnswers.set(path, (table = new Map()));
5008
5408
  return coinduct(table, owner, () => {
5009
5409
  const use = (value) => onward(value, path);
5010
- // TEMPORARY diagnostic for root A's real-WebGLRenderer probe -- names
5410
+ // TEMPORARY diagnostic for root A's real-library probe -- names
5011
5411
  // which of `familyReceiversClosed`'s two obligations (an initializer's
5012
5412
  // own `this`, or a construction site) refused, and at which site.
5013
5413
  // Remove once the real-file refusal is found.
@@ -5243,9 +5643,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5243
5643
  // this constructor already owns -- the same body selection `new Base()`
5244
5644
  // makes (source-construction-frames.ts), reached from the heritage
5245
5645
  // 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
5646
+ // derived constructor's arguments unforwarded: several sibling
5647
+ // subclasses' `super( color,
5648
+ // intensity )` calls were unauthenticated callees in the host-mutation
5249
5649
  // census, and one opaque `intensity` there was the `*` wildcard for
5250
5650
  // the whole program. The receiver is lexical (`this` of the home
5251
5651
  // class), which the census attributes from the base body's own
@@ -5267,7 +5667,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5267
5667
  if (ts.isPropertyAccessExpression(callee) || ts.isElementAccessExpression(callee)) {
5268
5668
  const receiver = callee.expression;
5269
5669
  const key = accessKeyOf(callee);
5270
- const origins = key === null ? null : allocationOriginsOf(receiver);
5670
+ const origins = key === null ? null : memberReceiverOriginsOf(receiver);
5271
5671
  traceClosedCallee(call, 'invocationTargetsOf/origins', `key=${key ?? 'null'} origins=${origins === null ? 'null' : origins.classes.size}`);
5272
5672
  if (origins !== null) {
5273
5673
  const privateDeclarations = ts.isPropertyAccessExpression(callee) && ts.isPrivateIdentifier(callee.name) ? privateMemberDeclarationsOf(callee.name) : null;
@@ -5321,7 +5721,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5321
5721
  * `GEA_CLOSED_CALLEE_WATCH=<substring>|'*'` traces `closedCalleeBodiesOf`'s
5322
5722
  * own cascade for ONE call, scoped by its text. `GEA_INVOCATION_REFUSALS`
5323
5723
  * 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
5724
+ * on a large library compile, and its rows rank RE-ASKS of the same question, not roots
5325
5725
  * (see the memory note on reading it) -- so isolating one call's own
5326
5726
  * decision path out of that firehose is impractical. This prints only for
5327
5727
  * the matching call, once per stage, so which of `invocationTargetsOf`'s
@@ -5368,7 +5768,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5368
5768
  return null;
5369
5769
  const receiver = callee.expression;
5370
5770
  const key = accessKeyOf(callee);
5371
- const origins = key === null ? null : allocationOriginsOf(receiver);
5771
+ const origins = key === null ? null : memberReceiverOriginsOf(receiver);
5372
5772
  const closedWithOverrides = (declared, into) => {
5373
5773
  for (const slot of slotDeclarationsOf(declared)) {
5374
5774
  if (slotClosedForTargets(slot))
@@ -5463,7 +5863,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5463
5863
  * `GEA_CLOSED_CALLEE_WATCH` so a single run names which stage (if any)
5464
5864
  * answered a given call -- `invocationTargetsOf` first (its own
5465
5865
  * member-access branches are traced above, including the
5466
- * `recordMethodCallTargetsOf` route three's factory-record idiom needs),
5866
+ * `recordMethodCallTargetsOf` route the factory-record idiom -- a plain
5867
+ * function returning `{ push: push, ... }` -- needs),
5467
5868
  * then this session's two relaxations.
5468
5869
  */
5469
5870
  const closedCalleeBodiesCascade = (call) => {
@@ -5472,6 +5873,10 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5472
5873
  traceClosedCallee(call, 'closedCalleeBodiesOf', `invocationTargetsOf -> ${fromTargets.length} bodies`);
5473
5874
  return fromTargets;
5474
5875
  }
5876
+ if (sourceValueSessionOf(checker, flow).ownsInvocation(call)) {
5877
+ traceClosedCallee(call, 'closedCalleeBodiesOf', 'source value session invocation proof refused');
5878
+ return null;
5879
+ }
5475
5880
  const fromMember = memberAccessCalleeBodiesOf(call);
5476
5881
  if (fromMember !== null) {
5477
5882
  traceClosedCallee(call, 'closedCalleeBodiesOf', `memberAccessCalleeBodiesOf -> ${fromMember.length} bodies`);
@@ -5502,8 +5907,16 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5502
5907
  const invocationFactOf = (call) => {
5503
5908
  const ledger = deferredIntrinsicProtocolLedgerOf(flow);
5504
5909
  const known = invocationFacts.get(call);
5505
- if (known)
5506
- return known.requirements.length === 0 || ledger?.include(known.requirements) === true ? known : null;
5910
+ if (known) {
5911
+ const sourceValues = sourceValueSessionOf(checker, flow);
5912
+ const candidate = sourceValues.candidateOrdinaryOwnCallableOperandsOf(call);
5913
+ const current = candidate === null ? callsOf(flow).sites.get(call)?.operands : sourceValues.ordinaryOwnCallableOperandsOf(call);
5914
+ // A conditional own-slot proof may become available in a later ledger
5915
+ // capture. A wrapper frame memo cannot stand in for that exact entry.
5916
+ if (known.operands === current)
5917
+ return known.requirements.length === 0 || ledger?.include(known.requirements) === true ? known : null;
5918
+ invocationFacts.delete(call);
5919
+ }
5507
5920
  if (activeInvocationFacts.has(call)) {
5508
5921
  // A refusal on the strength of a fact still being computed is a
5509
5922
  // hypothesis, not a result: anything that leaned on it is reusable only
@@ -5514,46 +5927,85 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5514
5927
  const site = callsOf(flow).sites.get(call);
5515
5928
  if (!site?.operands)
5516
5929
  return invocationRefusal(call, 'no-operands');
5517
- const operands = site.operands;
5518
5930
  const compute = () => {
5519
5931
  const targets = invocationTargetsOf(call);
5520
5932
  if (targets === null)
5521
5933
  return invocationRefusal(call, 'no-targets');
5522
5934
  if (targets.length === 0)
5523
5935
  return invocationRefusal(call, 'empty-targets');
5524
- const candidates = targets.map((body) => sourceInvocationFrame(flow, call, body, argumentsUsesAt));
5936
+ const sourceValues = sourceValueSessionOf(checker, flow);
5937
+ const candidateOwnOperands = sourceValues.candidateOrdinaryOwnCallableOperandsOf(call);
5938
+ const ordinaryOwnOperands = sourceValues.ordinaryOwnCallableOperandsOf(call);
5939
+ if (candidateOwnOperands !== ordinaryOwnOperands)
5940
+ return invocationRefusal(call, 'unclosed-own-member-entry');
5941
+ const operands = ordinaryOwnOperands ?? site.operands;
5942
+ const candidates = targets.map((body) => sourceInvocationFrame(flow, call, body, argumentsUsesAt, ordinaryOwnOperands ?? undefined));
5525
5943
  // An unindexed body contributes missing effects, not an empty frame.
5526
5944
  if (candidates.every((frame) => frame !== null))
5527
- return candidates;
5945
+ return { operands, frames: candidates, jointSource: sourceValues.ownsInvocation(call) };
5528
5946
  for (const [index, frame] of candidates.entries())
5529
5947
  if (frame === null)
5530
5948
  invocationRefusal(targets[index], `unmodelled-frame for ${describeCall(call)}`);
5531
5949
  return null;
5532
5950
  };
5533
5951
  activeInvocationFacts.add(call);
5534
- enterHypothesisGuard(call);
5952
+ enterHypothesisGuard(call, true);
5953
+ let refused = false;
5535
5954
  try {
5536
5955
  // Only the REFUSAL is shared across proofs. A successful fact stays in
5537
5956
  // this proof's own `invocationFacts` (`shareable` declines to publish
5538
5957
  // it) because a fact carries frames built against this proof's census
5539
5958
  // 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.
5959
+ // was re-derived 41,190 times for one site in a large library compile.
5541
5960
  const answer = sharedAnswerOf(`invocation-targets:${nodePathToken(call)}`, compute, (value) => value === null);
5542
- if (answer.value === null)
5961
+ if (answer.value === null) {
5962
+ refused = true;
5543
5963
  return null;
5544
- const fact = sourceInvocationFact(call, operands, answer.value, answer.requirements);
5545
- if (fact.requirements.length > 0 && ledger?.include(fact.requirements) !== true)
5964
+ }
5965
+ const fact = sourceInvocationFact(call, answer.value.operands, answer.value.frames, answer.requirements, answer.value.jointSource ? 'source-values' : 'legacy');
5966
+ if (fact.requirements.length > 0 && ledger?.include(fact.requirements) !== true) {
5967
+ refused = true;
5546
5968
  return invocationRefusal(call, 'uncapturable-intrinsic-requirements');
5969
+ }
5970
+ if (answer.value.jointSource) {
5971
+ let receipts = jointSourceInvocationReceipts.get(flow);
5972
+ if (!receipts)
5973
+ jointSourceInvocationReceipts.set(flow, (receipts = new WeakMap()));
5974
+ receipts.set(fact, {
5975
+ call,
5976
+ operands: fact.operands,
5977
+ callee: fact.operands.callee,
5978
+ receiver: fact.operands.receiver,
5979
+ args: [...fact.operands.args],
5980
+ kind: fact.operands.kind,
5981
+ explicitThis: fact.operands.explicitThis,
5982
+ dispatch: fact.operands.dispatch,
5983
+ frameArray: fact.frames,
5984
+ frames: fact.frames.map((frame) => ({
5985
+ frame,
5986
+ body: frame.body,
5987
+ layout: frame.layout,
5988
+ forwarding: frame.forwarding,
5989
+ completions: frame.completions,
5990
+ parameters: frame.parameters,
5991
+ receiverUses: frame.receiverUses,
5992
+ completionSummary: frame.completionSummary,
5993
+ receiver: frame.layout.receiver,
5994
+ arguments: frame.layout.arguments
5995
+ })),
5996
+ requirements: fact.requirements
5997
+ });
5998
+ }
5547
5999
  // A successful continuation can still depend on an enclosing recursive
5548
6000
  // hypothesis. Publish its memo only when that hypothesis is discharged.
5549
6001
  computedKeyAuthority.whenSettled(() => invocationFacts.set(call, fact));
5550
6002
  return fact;
5551
6003
  }
5552
6004
  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);
6005
+ // Re-entry is conservative in either case, but only an actual refusal
6006
+ // settles it as the exact answer. Without settlement, enclosing array
6007
+ // provenance walks keep re-deriving the same intrinsic-call refusals.
6008
+ exitHypothesisGuard(call, true, refused);
5557
6009
  activeInvocationFacts.delete(call);
5558
6010
  }
5559
6011
  };
@@ -5655,7 +6107,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5655
6107
  // A plain call leaves `this` undefined in a module, so only `new` makes an
5656
6108
  // object -- the call's own result -- and every `this` in the body is it.
5657
6109
  // A call through a record slot (`list.push( item )` entering the function
5658
- // `WebGLRenderList` stored as `push`) binds `this` to the record.
6110
+ // a factory function stored as `push`) binds `this` to the record.
5659
6111
  const module = ts.isExternalModule(owner.getSourceFile());
5660
6112
  const use = (value) => onward(value, path);
5661
6113
  return (calls.every(({ call, explicitThis }) => {
@@ -5686,7 +6138,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5686
6138
  const references = cellMentionsOf(declaration, target.symbol ?? null);
5687
6139
  if (references === null)
5688
6140
  return false;
5689
- // TEMPORARY diagnostic for root A's real-WebGLRenderer probe -- names
6141
+ // TEMPORARY diagnostic for root A's real-library probe -- names
5690
6142
  // which mention of a forwarded cell (e.g. every `_this.` reference) the
5691
6143
  // caller's `use` refuses on. Remove once the real-file refusal is found.
5692
6144
  const watchedForwardCell = process.env['GEA_FORWARD_CELL_DEBUG'];
@@ -5721,8 +6173,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5721
6173
  // array literal, a store through the intrinsic protocol, a numeric index
5722
6174
  // on an array-valued receiver, a rest frame -- and the walk follows that
5723
6175
  // 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
6176
+ // proof here, and asking the checker again refused `any`-typed
6177
+ // reads like `currentList.opaque` and `listArray`. A summary that may be at a
5726
6178
  // record as well asks the origins.
5727
6179
  const established = headsOf(path).every((id) => id === '[]');
5728
6180
  if (!arrayValued(reference)) {
@@ -5820,21 +6272,21 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5820
6272
  // same container the sound reading rather than merely the cheap one.
5821
6273
  //
5822
6274
  // 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
6275
+ // false` below, and that one missing case was the terminal of one large
6276
+ // library compile's largest carrier group: a logging shim that renders its rest frame
5825
6277
  // with `params.map( ( param ) => String( param ) )`, so EVERY object
5826
6278
  // handed to `error( ... )` escaped there -- including `object` at
5827
- // `Object3D.add`'s self-parenting guard. That refused `add`'s implicit
6279
+ // a tree node's `add` self-parenting guard. That refused `add`'s implicit
5828
6280
  // `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.
6281
+ // which left the node's `children` element unbound, which was 1496 of
6282
+ // that compile's 3718 nested dynamic carriers.
5831
6283
  case 'map':
5832
6284
  return written.length === 1 && callbackClosed(written[0], [element, null, use]) && use(context);
5833
6285
  }
5834
6286
  // NAME the member. A built-in this switch does not model is the one shape
5835
6287
  // whose fix is a single `case`, and the bare `return false` here gave the
5836
6288
  // 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
6289
+ // 1496 of that compile's nested carriers open, indistinguishable from a real
5838
6290
  // escape.
5839
6291
  return traceReceiver(reference, 'element', false, () => `unmodelled-member=${parent.name.text}`);
5840
6292
  }
@@ -5886,7 +6338,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5886
6338
  // A member published by `this.<key> = ...` inside a constructor function
5887
6339
  // is owned by that function exactly as a `ts.ClassElement` is owned by its
5888
6340
  // 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
6341
+ // member of a pre-ES6 constructor-function factory with no container family at
5890
6342
  // all, and a null family refuses every proof that consults it.
5891
6343
  const owner = ts.findAncestor(member, (node) => ts.isClassDeclaration(node) || ts.isClassExpression(node) || isConstructorFunction(node));
5892
6344
  const family = owner && (ts.isClassDeclaration(owner) || ts.isClassExpression(owner) || isConstructorFunction(owner))
@@ -5902,8 +6354,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5902
6354
  * A read that resolves to no declaration is usually refused because an
5903
6355
  * accessor could hand the receiver's other members out. A key the family does
5904
6356
  * 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`
6357
+ * runs nothing. A logging shim that probes `stackTrace.isStackTrace` on
6358
+ * whatever it was handed, where every object reaching it is a `Node`
5907
6359
  * that declares no such member -- which made the probe the terminal of 35
5908
6360
  * escapes.
5909
6361
  */
@@ -5923,7 +6375,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5923
6375
  * source code -- so the conversion cannot reach what this walk carries
5924
6376
  * inside it.
5925
6377
  *
5926
- * The static type at a conversion site is often `any` (three's logging shim
6378
+ * The static type at a conversion site is often `any` (a logging shim that
5927
6379
  * takes `...params`), which says nothing. The PATH does: it names the member
5928
6380
  * the value sits in, and therefore the closed family of objects that carry
5929
6381
  * it. Every class in that family answering only the host's own `toString`,
@@ -5950,7 +6402,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5950
6402
  /**
5951
6403
  * Whether a call through a mutable binding can execute anything at all.
5952
6404
  *
5953
- * `_setConsoleFunction( 'warn', message, ...params )` in three's logging shim
6405
+ * `_setConsoleFunction( 'warn', message, ...params )` in a logging shim
5954
6406
  * hands its arguments to whatever that module-level `let` holds -- and it
5955
6407
  * holds `null`, because `setConsoleFunction` is the only thing that writes it
5956
6408
  * and this program never calls it, so reachability prunes that write with the
@@ -5961,11 +6413,11 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
5961
6413
  */
5962
6414
  const callThroughUncallableBinding = (call) => {
5963
6415
  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
6416
+ // The same fact for a MEMBER slot: a class declares `this.onUpdate
6417
+ // = null` and nothing in the program ever stores a function there, so `if (
6418
+ // item.onUpdate ) item.onUpdate( item )` in another module runs no
5967
6419
  // body -- yet `targets:no-member-implementations` refused it, and with an
5968
- // opaque `texture` the host-mutation census read the call as an
6420
+ // opaque `item` the host-mutation census read the call as an
5969
6421
  // unauthenticated callee handed an opaque argument: a `*` wildcard. A
5970
6422
  // slot whose declaration and every write hold only `null`/`undefined`
5971
6423
  // has nothing to enter; a computed store the index attributes to the
@@ -6037,11 +6489,11 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6037
6489
  const declaration = key === accessKeyOf(parent) ? fieldDeclaration(parent) : fieldDeclarationOf(reference, key);
6038
6490
  const read = { element: false, declaration, key };
6039
6491
  // 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
6492
+ // receiver: `this.needsUpdate = true` in a class's `copy` is a
6041
6493
  // CALL of the setter, and the read of a getter is a call of the getter.
6042
6494
  // Their bodies are right there to walk the way a method body is walked
6043
6495
  // (`methodReceiverUses`); refusing them as "not a data member" stopped
6044
- // every family walk that reached `Texture.copy` through the clone.
6496
+ // every family walk that reached that `copy` through the clone.
6045
6497
  // The stored value goes to the setter's parameter, not into the
6046
6498
  // container, so only the bodies' receiver mentions matter. The flow
6047
6499
  // index resolves the access to the special-assignment form it indexed
@@ -6063,15 +6515,15 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6063
6515
  // that slot; it hands the object to nobody. A store into a slot whose
6064
6516
  // stores are owed may be putting in the very object that holds the
6065
6517
  // 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
6518
+ // NAME both halves. `object.parent = this` in a tree node's `add` was the
6519
+ // deepest open use in one large library compile's whole member-closure chain, and both
6068
6520
  // refusals here were bare `false`: the walk's report could not say
6069
6521
  // whether the slot failed to be a data member or whether publishing
6070
6522
  // the stored value failed.
6071
6523
  //
6072
- // `mesh.onBeforeRender = function ( renderer, object ) { ... }`
6524
+ // `node.onRender = function ( renderer, object ) { ... }`
6073
6525
  // installs a CALLABLE, not a data value: it changes which function
6074
- // answers `mesh.onBeforeRender()`, never what `mesh` itself carries
6526
+ // answers `node.onRender()`, never what `node` itself carries
6075
6527
  // or where it can be reached from. That question is a member-slot
6076
6528
  // publication, already the obligation `escapeReason`'s own
6077
6529
  // `inlineMemberPublication` arm and `memberImplementationsOf` place on
@@ -6108,9 +6560,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6108
6560
  }
6109
6561
  const declarations = siblingDeclarationsOf(reference, key);
6110
6562
  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
6563
+ // `this[ key ]` in a base class's `setValues` with `depth` among the
6564
+ // keys: the base class has no such member and the read is
6565
+ // `undefined`, while a subclass holds data there. The
6114
6566
  // data-member plan refuses a key absent on any owner; the key-read
6115
6567
  // plan classifies each class, and a code-free family -- data or
6116
6568
  // absent everywhere, `Object.prototype` proven clean for the key --
@@ -6128,8 +6580,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6128
6580
  const use = (expression) => containerUse(expression, path);
6129
6581
  // A mention the checker has narrowed to a primitive is not a mention of the
6130
6582
  // 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
6583
+ // carries can be read out of it or stored back into it. A logging
6584
+ // shim that inspects its first argument under `typeof message === 'string'`, and
6133
6585
  // treating that guarded read as a use of whatever else the slot might hold
6134
6586
  // made `message.startsWith` the terminal of 35 escapes.
6135
6587
  if (primitive(checker.getTypeAtLocation(reference)))
@@ -6140,7 +6592,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6140
6592
  if (ts.isBinaryExpression(parent) && parent.left === reference && parent.operatorToken.kind === ts.SyntaxKind.EqualsToken) {
6141
6593
  // A plain assignment's left side names the SLOT being written. It is not
6142
6594
  // 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
6595
+ // = geometry` in a class constructor was read as a use of whatever
6144
6596
  // `this.geometry` held and was the terminal of 35 escapes. (A compound
6145
6597
  // assignment does read the slot first, which is why only `=` is here.)
6146
6598
  if (ts.isPropertyAccessExpression(reference) || ts.isElementAccessExpression(reference))
@@ -6155,7 +6607,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6155
6607
  if (ts.isBindingElement(parent) && parent.name === reference)
6156
6608
  return true;
6157
6609
  // 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;`
6610
+ // not a mention of the object that carries it. A class may declare `geometry;`
6159
6611
  // as a bare typed field, and reading that name as a receiver use left it
6160
6612
  // unexplained -- the terminal of 35 escapes.
6161
6613
  if ((ts.isPropertyDeclaration(parent) ||
@@ -6204,7 +6656,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6204
6656
  const key = accessKeyOf(parent);
6205
6657
  if (key !== null)
6206
6658
  return containerMemberUse(reference, parent, key, path, use);
6207
- // `this[ key ]` in three's `Texture.setValues`: a computed key whose
6659
+ // `this[ key ]` in a base class's `setValues( values )`: a computed key whose
6208
6660
  // set this program proves finite is every one of those named reads
6209
6661
  // or stores, exactly as the receiver walk's `computed-data-store` arm
6210
6662
  // reads it. A key set that stays open is the refusal below.
@@ -6228,8 +6680,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6228
6680
  // `super( ... )` is dispatch on the object this frame already owns, exactly
6229
6681
  // as the receiver walk reads it (its arm below): it hands the container
6230
6682
  // 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.
6683
+ // matched no parameter and refused -- a derived constructor that
6684
+ // opens with `super()` stopped every owed `.items` head there.
6233
6685
  if (reference.kind === ts.SyntaxKind.SuperKeyword && ts.isCallExpression(parent) && parent.expression === reference)
6234
6686
  return true;
6235
6687
  if (ts.isCallExpression(parent) || ts.isNewExpression(parent)) {
@@ -6248,7 +6700,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6248
6700
  : null;
6249
6701
  if (storedReads !== null)
6250
6702
  return storedReads.every(use);
6251
- // `updateMap.set( object, frame )` in three's `WebGLObjects.update`: a
6703
+ // `updateMap.set( object, frame )` in an update-tracking module: a
6252
6704
  // closed native map compares its key by identity and never yields it back.
6253
6705
  if (ts.isCallExpression(parent) && collectionKeyArgumentIsInert(checker, flow, parent, reference, nativeProtocolClosed))
6254
6706
  return true;
@@ -6260,7 +6712,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6260
6712
  // `a && b`, `a || b`, `a ?? b` and `c ? a : b` select one operand and
6261
6713
  // return it. ToBoolean and the nullish test execute no user code, so the
6262
6714
  // only thing that leaves is whatever the expression evaluates to -- follow
6263
- // that, and nothing else. Three's logging shim guards its optional stack
6715
+ // that, and nothing else. A logging shim that guards its optional stack
6264
6716
  // trace with `stackTrace && stackTrace.isStackTrace`, and refusing the
6265
6717
  // whole shape made that test the terminal of 35 escapes.
6266
6718
  if ((ts.isBinaryExpression(parent) &&
@@ -6279,7 +6731,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6279
6731
  * the store that made the backlink.
6280
6732
  *
6281
6733
  * A member written in a class: every construction and field initializer.
6282
- * A record slot -- three's `WebGLRenderList` returns `{ push: push, ... }`
6734
+ * A record slot -- a factory function that returns `{ push: push, ... }`
6283
6735
  * -- the literal itself. A slot written through a receiver (`leaf.onDraw =
6284
6736
  * fn`): that receiver's allocations. Coinductive, so an answer that leaned
6285
6737
  * on this one is kept only once this one holds; the tri-state it replaces
@@ -6299,7 +6751,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6299
6751
  const ownerOriginsClosed = (carrier) => {
6300
6752
  // A proof with no member slot and no field owners is a receiver-family
6301
6753
  // proof (`classInstancesUse`): what it follows is the family's instances
6302
- // themselves. A data read inside it -- `this.blendColor` in `Material.copy`,
6754
+ // themselves. A data read inside it -- `this.color` in a base class's `copy`,
6303
6755
  // reached from `new this.constructor().copy( this )` -- has no slot to
6304
6756
  // name an owner by, so the CARRIER of the data it selects (the `this.<key>
6305
6757
  // = ...` write or class element) stands in: its own receiver is the family
@@ -6310,9 +6762,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6310
6762
  // directly inside `member`'s own body -- but the walk can cross into a
6311
6763
  // DIFFERENT declaration's body first: an accessor inherited from a base
6312
6764
  // 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
6765
+ // `member` closed. A base class's `get item()` -- read through
6766
+ // a subclass method's `this.item` --
6767
+ // asked whether `this.items` (a base-class field the subclass never
6316
6768
  // itself writes) escapes through `member`'s own class alone, which has no
6317
6769
  // writer to walk and so answered "open" for every accessor read reached
6318
6770
  // this way. The carrier -- the accessor `get`/`set` itself -- names the
@@ -6352,7 +6804,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6352
6804
  // Every carrier was a literal or a receiver walked above: no class
6353
6805
  // allocates one, and there is no inventory left to ask. (Asking it of no
6354
6806
  // class answers "unknown", which refused every member only literals
6355
- // carry -- three's `ColorManagement` methods reading `this.spaces`.)
6807
+ // carry -- a singleton object literal's methods reading `this.spaces`.)
6356
6808
  if (roots.size === 0)
6357
6809
  return carried !== undefined || (member?.declarations?.length ?? 0) > 0;
6358
6810
  // An OUTER proof is already answering for this family: park it. Only the
@@ -6366,7 +6818,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6366
6818
  // All owner publications in constructors/field initializers must close,
6367
6819
  // including allocations with no visible call to the method being typed.
6368
6820
  // `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
6821
+ // one large library compile's largest member-closure refusal and it used to report only
6370
6822
  // that the whole conjunction did, when an unbuildable inventory, an
6371
6823
  // initializer's `this` and a construction site are three different
6372
6824
  // defects with three different fixes.
@@ -6384,8 +6836,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6384
6836
  // class and for `super` at the base's, and `emit-class-properties.ts`
6385
6837
  // tells them apart by exactly that.
6386
6838
  //
6387
- // Without this, `super.copy( source )` -- every three.js `copy`/`clone`
6388
- // override -- was an unresolvable receiver, and the whole containing
6839
+ // Without this, `super.copy( source )` -- every `copy`/`clone`
6840
+ // override in a class-hierarchy library -- was an unresolvable receiver, and the whole containing
6389
6841
  // family's parameters went unbound behind it.
6390
6842
  if (expression.kind === ts.SyntaxKind.ThisKeyword || expression.kind === ts.SyntaxKind.SuperKeyword) {
6391
6843
  const owner = flow.receiverOwnerOf(expression);
@@ -6406,8 +6858,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6406
6858
  // A FRESH allocation has no cell to walk: nothing else holds the object,
6407
6859
  // so the expression IS the value and its own uses are the whole inventory.
6408
6860
  // 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
6861
+ // treated `new this.constructor().copy( this )` -- the universal `clone`
6862
+ // idiom -- as an unresolvable receiver, when it is the most closed receiver
6411
6863
  // there is. An object literal was already read this way at the receiver
6412
6864
  // inventory below; this states the same fact for the constructed case,
6413
6865
  // where the allocation's own uses answer it.
@@ -6431,9 +6883,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6431
6883
  * obligation `closedCallerSitesOf` discharges for an exported function. An
6432
6884
  * import binding is the exported cell seen from the importer, and is answered
6433
6885
  * 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
6886
+ * `export default x`) evaluate nothing and are not uses. A module whose
6887
+ * singleton is `export const Settings =
6888
+ * createSettings()` is an example, and refusing every export here was where each
6437
6889
  * of its methods' parameters stopped.
6438
6890
  */
6439
6891
  const cellMentionsOf = (declaration, symbol) => {
@@ -6568,8 +7020,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6568
7020
  return terminal;
6569
7021
  // A mention the checker has narrowed to a primitive is not a mention of the
6570
7022
  // 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
7023
+ // carries can be read out of it or stored back into it. A logging
7024
+ // shim that inspects its first argument under `typeof message === 'string'`, and
6573
7025
  // treating that guarded read as a use of whatever else the slot might hold
6574
7026
  // made `message.startsWith` the terminal of 35 escapes.
6575
7027
  if (primitive(checker.getTypeAtLocation(reference)))
@@ -6580,7 +7032,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6580
7032
  if (ts.isBinaryExpression(parent) && parent.left === reference && parent.operatorToken.kind === ts.SyntaxKind.EqualsToken) {
6581
7033
  // A plain assignment's left side names the SLOT being written. It is not
6582
7034
  // 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
7035
+ // = geometry` in a class constructor was read as a use of whatever
6584
7036
  // `this.geometry` held and was the terminal of 35 escapes. (A compound
6585
7037
  // assignment does read the slot first, which is why only `=` is here.)
6586
7038
  if (ts.isPropertyAccessExpression(reference) || ts.isElementAccessExpression(reference))
@@ -6597,7 +7049,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6597
7049
  if (ts.isPropertyAssignment(parent) && parent.name === reference)
6598
7050
  return true;
6599
7051
  // 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;`
7052
+ // not a mention of the object that carries it. A class may declare `geometry;`
6601
7053
  // as a bare typed field, and reading that name as a receiver use left it
6602
7054
  // unexplained -- the terminal of 35 escapes.
6603
7055
  if ((ts.isPropertyDeclaration(parent) ||
@@ -6625,9 +7077,9 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6625
7077
  return receiverCell(parent.name);
6626
7078
  }
6627
7079
  // The declaration-initializer case above misses a cell DECLARED bare and
6628
- // filled later by a plain assignment -- three's `WebGLRenderer` declares
7080
+ // filled later by a plain assignment -- a `function Renderer()` that declares
6629
7081
  // `let properties, textures;` at its own top level, then a nested
6630
- // `initGLContext` assigns `properties = new WebGLProperties();` before
7082
+ // `initContext` assigns `properties = new Properties();` before
6631
7083
  // publishing it onward (`_this.properties = properties`). The allocation
6632
7084
  // is the SAME cell an initializer would name; only the edge shape differs.
6633
7085
  if (ts.isBinaryExpression(parent) &&
@@ -6695,9 +7147,23 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6695
7147
  return traceReceiver(reference, 'invocation-receiver', invocations.every((site) => {
6696
7148
  if (!ts.isCallExpression(site.call))
6697
7149
  return false;
7150
+ // This receiver walk carries the tracked member through records,
7151
+ // formal parameters and containers. A structurally erased alias
7152
+ // can lose that member's checker symbol, but reading the same key
7153
+ // still invokes the carried slot and must belong to its caller
7154
+ // inventory. Checking only the target body's this-uses omitted
7155
+ // calls such as retained[0].method('text').
6698
7156
  const targets = invocationTargetsOf(site.call);
6699
- if (targets === null)
7157
+ if (targets === null || (targets.length === 0 && !callThroughUncallableBinding(site.call)))
6700
7158
  return false;
7159
+ if (member !== null && (sameMember(parent) || accessKeyOf(parent) === member.getName()) && !countedCalls.has(site.call)) {
7160
+ const held = (member.declarations ?? []).map(ownMemberBodiesOf);
7161
+ // A same-spelled override or lexical super call can select a
7162
+ // different body. Only the complete selected source targets can
7163
+ // distinguish it from an omitted caller of this exact slot.
7164
+ if (held.some((bodies) => bodies === null || targets.some((body) => bodies.includes(body))))
7165
+ return false;
7166
+ }
6701
7167
  // `.call(other)` reads the member here, but binds `other` as this.
6702
7168
  // Its actual receiver occurrence is followed through that frame.
6703
7169
  return (site.operands.receiver !== reference || targets.every((body) => flow.receiverReferencesToDeclaration(body).every(receiverUse)));
@@ -6804,8 +7270,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6804
7270
  plan.writeBodies !== null &&
6805
7271
  plan.writeBodies.every((body) => flow.receiverReferencesToDeclaration(body).every(receiverUse)));
6806
7272
  }
6807
- // `mesh.onBeforeRender = function ( renderer, scene, camera ) { ... }`
6808
- // in three's `WebGLBackground`: a store over a prototype METHOD. The
7273
+ // `node.onRender = function ( renderer, scene, camera ) { ... }`
7274
+ // from outside the class: a store over a prototype METHOD. The
6809
7275
  // [[Set]] finds the method's data property first and creates an own one
6810
7276
  // on the receiver, running no code -- only a setter could hand the
6811
7277
  // receiver on. The descriptor authority names any setters independently
@@ -6834,8 +7300,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6834
7300
  // a getter under the same key -- satisfies just as well.
6835
7301
  const selectedData = dataMember && (declaredDataMemberAccess(target) || constructionDataMember(parent) || ownLiteralDataMember(parent));
6836
7302
  // 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
7303
+ // could be -- `InterleavedAttribute.count`, read off an
7304
+ // `Attribute | InterleavedAttribute` parameter -- is not by
6839
7305
  // itself proof that the read escapes: only a getter BODY that leaks the
6840
7306
  // receiver is. `sourceClassKeyReadPlanOf` classifies every class the
6841
7307
  // receiver could be (construction origins first, the declared type
@@ -6845,7 +7311,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6845
7311
  // SETTER's write bodies. Walking them with the identical
6846
7312
  // `receiverReferencesToDeclaration(...).every(receiverUse)` rule
6847
7313
  // answers the read the same way: closed unless the getter's own `this`
6848
- // mentions themselves escape (three's `InterleavedBufferAttribute.count`
7314
+ // mentions themselves escape (`InterleavedAttribute.count`
6849
7315
  // is `return this.data.count`, which recurses into this same arm for
6850
7316
  // `this.data`). `sourceClassKeyReadPlanOf` only sees the checker's
6851
7317
  // STATIC declared members, so a reflective definition that could
@@ -6857,8 +7323,8 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6857
7323
  // allocation-origins proof for the receiver, and every getter body it
6858
7324
  // hands back is walked through this proof's own `receiverUse`. Asked
6859
7325
  // 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.
7326
+ // thousands of reads the selected-data arm already accepted -- one large
7327
+ // library compile went from ~3 min to over 8 min at 23 GB before this ordering.
6862
7328
  const key = accessKeyOf(parent);
6863
7329
  let readerClosedHeld = null;
6864
7330
  const readerClosed = () => {
@@ -6946,7 +7412,7 @@ const closedMemberCallableUses = (checker, flow, member, countedCalls, givenRece
6946
7412
  // `a && b`, `a || b`, `a ?? b` and `c ? a : b` select one operand and
6947
7413
  // return it. ToBoolean and the nullish test execute no user code, so the
6948
7414
  // only thing that leaves is whatever the expression evaluates to -- follow
6949
- // that, and nothing else. Three's logging shim guards its optional stack
7415
+ // that, and nothing else. A logging shim that guards its optional stack
6950
7416
  // trace with `stackTrace && stackTrace.isStackTrace`, and refusing the
6951
7417
  // whole shape made that test the terminal of 35 escapes.
6952
7418
  if ((ts.isBinaryExpression(parent) &&