@geastack/compiler 1.0.27 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (946) hide show
  1. package/dist/cli-coverage.js +2 -2
  2. package/dist/cli-emit.js +36 -12
  3. package/dist/compiler.d.ts +11 -9
  4. package/dist/compiler.js +264 -43
  5. package/dist/conversion/algebra.d.ts +84 -4
  6. package/dist/conversion/algebra.js +39 -0
  7. package/dist/conversion/array-view.d.ts +63 -0
  8. package/dist/conversion/array-view.js +186 -0
  9. package/dist/conversion/build.d.ts +8 -8
  10. package/dist/conversion/build.js +56 -50
  11. package/dist/conversion/certified-iterator-object-view.d.ts +13 -0
  12. package/dist/conversion/certified-iterator-object-view.js +31 -0
  13. package/dist/conversion/certified-iterator-protocols.d.ts +23 -0
  14. package/dist/conversion/certified-iterator-protocols.js +50 -0
  15. package/dist/conversion/checked-native-field-read.d.ts +7 -0
  16. package/dist/conversion/checked-native-field-read.js +36 -0
  17. package/dist/conversion/constructor-identity-family.d.ts +6 -6
  18. package/dist/conversion/constructor-identity-family.js +3 -3
  19. package/dist/conversion/derive.js +11 -8
  20. package/dist/conversion/dictionary-view.d.ts +114 -0
  21. package/dist/conversion/dictionary-view.js +275 -0
  22. package/dist/conversion/document-record-view.d.ts +89 -0
  23. package/dist/conversion/document-record-view.js +269 -0
  24. package/dist/conversion/dynamic-result-carriers.d.ts +6 -0
  25. package/dist/conversion/dynamic-result-carriers.js +43 -0
  26. package/dist/conversion/dynamic-wrapper.d.ts +52 -0
  27. package/dist/conversion/dynamic-wrapper.js +82 -0
  28. package/dist/conversion/impossible-field-read.d.ts +9 -0
  29. package/dist/conversion/impossible-field-read.js +28 -0
  30. package/dist/conversion/iterable-object-view.d.ts +1 -1
  31. package/dist/conversion/iterator-object-view.d.ts +2 -2
  32. package/dist/conversion/native-absence.d.ts +4 -0
  33. package/dist/conversion/native-absence.js +4 -0
  34. package/dist/conversion/native-buffer-method.d.ts +16 -0
  35. package/dist/conversion/native-buffer-method.js +37 -0
  36. package/dist/conversion/native-callable-adapter.d.ts +13 -0
  37. package/dist/conversion/native-callable-adapter.js +73 -0
  38. package/dist/conversion/native-descriptor-snapshot.d.ts +30 -0
  39. package/dist/conversion/native-descriptor-snapshot.js +75 -0
  40. package/dist/conversion/native-entry-writer.d.ts +21 -0
  41. package/dist/conversion/native-entry-writer.js +32 -0
  42. package/dist/conversion/native-field-view.d.ts +42 -0
  43. package/dist/conversion/native-field-view.js +145 -0
  44. package/dist/conversion/native-logical-receiver.d.ts +11 -0
  45. package/dist/conversion/native-logical-receiver.js +19 -0
  46. package/dist/conversion/native-method.d.ts +43 -0
  47. package/dist/conversion/native-method.js +56 -0
  48. package/dist/conversion/native-object-sample.d.ts +30 -0
  49. package/dist/conversion/native-object-sample.js +37 -0
  50. package/dist/conversion/native-payload-transport.d.ts +1 -1
  51. package/dist/conversion/native-payload-transport.js +1 -1
  52. package/dist/conversion/native-record-products.d.ts +15 -0
  53. package/dist/conversion/native-record-products.js +73 -0
  54. package/dist/conversion/native-selection.d.ts +18 -1
  55. package/dist/conversion/native-selection.js +117 -4
  56. package/dist/conversion/native-sum.d.ts +27 -0
  57. package/dist/conversion/native-sum.js +74 -9
  58. package/dist/conversion/native-view-origins.d.ts +12 -0
  59. package/dist/conversion/native-view-origins.js +97 -0
  60. package/dist/conversion/nodes.d.ts +75 -7
  61. package/dist/conversion/nodes.js +694 -19
  62. package/dist/conversion/number-storage.d.ts +8 -0
  63. package/dist/conversion/number-storage.js +8 -0
  64. package/dist/conversion/operand-view.js +10 -1
  65. package/dist/conversion/promise-adoption.d.ts +15 -0
  66. package/dist/conversion/promise-adoption.js +29 -0
  67. package/dist/conversion/protocol-iterator.d.ts +3 -3
  68. package/dist/conversion/recipe-closure.d.ts +14 -0
  69. package/dist/conversion/recipe-closure.js +135 -0
  70. package/dist/conversion/record-view.d.ts +51 -26
  71. package/dist/conversion/record-view.js +160 -97
  72. package/dist/conversion/registry.d.ts +18 -2
  73. package/dist/conversion/sibling-class.d.ts +4 -0
  74. package/dist/conversion/sibling-class.js +7 -0
  75. package/dist/conversion/structural-plan.d.ts +87 -0
  76. package/dist/conversion/structural-plan.js +480 -0
  77. package/dist/ir/absent-class-arm.d.ts +1 -1
  78. package/dist/ir/absent-class-arm.js +1 -1
  79. package/dist/ir/async-result-conventions.d.ts +15 -0
  80. package/dist/ir/async-result-conventions.js +140 -0
  81. package/dist/ir/borrowed-call-arguments.d.ts +3 -3
  82. package/dist/ir/borrowed-call-arguments.js +9 -9
  83. package/dist/ir/build.d.ts +20 -29
  84. package/dist/ir/build.js +116 -19
  85. package/dist/ir/call-dispatch.js +153 -40
  86. package/dist/ir/call-entry.d.ts +14 -3
  87. package/dist/ir/call-entry.js +63 -5
  88. package/dist/ir/callable-class-flow.d.ts +48 -3
  89. package/dist/ir/callable-class-flow.js +1509 -81
  90. package/dist/ir/callable-flow-candidates.d.ts +25 -0
  91. package/dist/ir/callable-flow-candidates.js +135 -0
  92. package/dist/ir/callable-identity-demand.d.ts +2 -2
  93. package/dist/ir/callable-identity-demand.js +33 -1
  94. package/dist/ir/callable-member-candidates.d.ts +1 -1
  95. package/dist/ir/callable-member-candidates.js +2 -2
  96. package/dist/ir/callable-records.js +1 -0
  97. package/dist/ir/callable-site-escape.js +3 -4
  98. package/dist/ir/captures.js +1 -1
  99. package/dist/ir/certificate.d.ts +1 -0
  100. package/dist/ir/certificate.js +2 -1
  101. package/dist/ir/certify/carrier-keys.d.ts +2 -2
  102. package/dist/ir/certify/carrier-keys.js +4 -4
  103. package/dist/ir/certify/has-property-key.d.ts +3 -3
  104. package/dist/ir/certify/has-property-key.js +3 -3
  105. package/dist/ir/certify/parallel-region.d.ts +26 -0
  106. package/dist/ir/certify/parallel-region.js +1331 -0
  107. package/dist/ir/certify/property-access-keys.d.ts +11 -11
  108. package/dist/ir/certify/property-access-keys.js +11 -11
  109. package/dist/ir/certify/property-access.js +7 -9
  110. package/dist/ir/certify.d.ts +66 -3
  111. package/dist/ir/certify.js +1197 -36
  112. package/dist/ir/class-allocation-domain.d.ts +9 -0
  113. package/dist/ir/class-allocation-domain.js +111 -0
  114. package/dist/ir/class-evaluation.d.ts +2 -3
  115. package/dist/ir/class-evaluation.js +2 -3
  116. package/dist/ir/class-static-fields.d.ts +12 -1
  117. package/dist/ir/class-static-fields.js +25 -0
  118. package/dist/ir/closed-normal-results.d.ts +18 -0
  119. package/dist/ir/closed-normal-results.js +208 -0
  120. package/dist/ir/construct-entry.js +1 -0
  121. package/dist/ir/construction-only-fields.d.ts +20 -1
  122. package/dist/ir/construction-only-fields.js +95 -9
  123. package/dist/ir/convert-carriers.d.ts +7 -0
  124. package/dist/ir/convert-carriers.js +12 -0
  125. package/dist/ir/coroutine-bodies.d.ts +74 -0
  126. package/dist/ir/coroutine-bodies.js +93 -0
  127. package/dist/ir/dead-logical-merge.d.ts +7 -0
  128. package/dist/ir/dead-logical-merge.js +84 -0
  129. package/dist/ir/dead-values.d.ts +7 -5
  130. package/dist/ir/dead-values.js +34 -5
  131. package/dist/ir/deferral.d.ts +3 -1
  132. package/dist/ir/deferral.js +19 -6
  133. package/dist/ir/dense-loops.d.ts +96 -7
  134. package/dist/ir/dense-loops.js +333 -17
  135. package/dist/ir/descriptor-own-protocol.d.ts +12 -0
  136. package/dist/ir/descriptor-own-protocol.js +35 -0
  137. package/dist/ir/dynamic-constructor-conversions.d.ts +17 -0
  138. package/dist/ir/dynamic-constructor-conversions.js +52 -0
  139. package/dist/ir/emission-representations.js +44 -2
  140. package/dist/ir/facts.d.ts +14 -2
  141. package/dist/ir/facts.js +23 -9
  142. package/dist/ir/fixed-data-definition-attributes.d.ts +10 -0
  143. package/dist/ir/fixed-data-definition-attributes.js +200 -0
  144. package/dist/ir/fixed-data-definition.d.ts +23 -5
  145. package/dist/ir/fixed-data-definition.js +80 -2
  146. package/dist/ir/function-reflection-demand.d.ts +11 -0
  147. package/dist/ir/function-reflection-demand.js +71 -0
  148. package/dist/ir/generic-call-entry.d.ts +18 -0
  149. package/dist/ir/generic-call-entry.js +94 -0
  150. package/dist/ir/hoist.d.ts +16 -3
  151. package/dist/ir/hoist.js +121 -8
  152. package/dist/ir/host-method-aliases.d.ts +15 -0
  153. package/dist/ir/host-method-aliases.js +61 -0
  154. package/dist/ir/host-namespace-reads.d.ts +24 -0
  155. package/dist/ir/host-namespace-reads.js +151 -0
  156. package/dist/ir/host-promise-conversions.d.ts +5 -0
  157. package/dist/ir/host-promise-conversions.js +61 -0
  158. package/dist/ir/host-template-conversions.d.ts +34 -0
  159. package/dist/ir/host-template-conversions.js +357 -0
  160. package/dist/ir/instance-reparenting.d.ts +3 -4
  161. package/dist/ir/instantiation.d.ts +1 -1
  162. package/dist/ir/instantiation.js +1 -1
  163. package/dist/ir/integer-storage.d.ts +19 -9
  164. package/dist/ir/integer-storage.js +158 -44
  165. package/dist/ir/integers.d.ts +34 -7
  166. package/dist/ir/integers.js +240 -7
  167. package/dist/ir/integrity-restrictions.d.ts +4 -4
  168. package/dist/ir/integrity-restrictions.js +7 -4
  169. package/dist/ir/internal-operation-conversions.d.ts +7 -0
  170. package/dist/ir/internal-operation-conversions.js +195 -0
  171. package/dist/ir/intrinsic-call-facts.d.ts +40 -0
  172. package/dist/ir/intrinsic-call-facts.js +176 -0
  173. package/dist/ir/key-order-observation.d.ts +1 -1
  174. package/dist/ir/lazy-splits.d.ts +20 -0
  175. package/dist/ir/lazy-splits.js +58 -0
  176. package/dist/ir/literal-set-membership.d.ts +2 -2
  177. package/dist/ir/literal-set-membership.js +2 -2
  178. package/dist/ir/logical-receivers.d.ts +15 -0
  179. package/dist/ir/logical-receivers.js +98 -0
  180. package/dist/ir/lower-allocation.js +16 -13
  181. package/dist/ir/lower-destructuring.js +7 -6
  182. package/dist/ir/lower-graph.d.ts +4 -4
  183. package/dist/ir/lower-graph.js +2 -2
  184. package/dist/ir/lower-invocation.d.ts +2 -2
  185. package/dist/ir/lower-invocation.js +99 -57
  186. package/dist/ir/lower-narrow.js +35 -13
  187. package/dist/ir/lower-operands.d.ts +40 -11
  188. package/dist/ir/lower-operands.js +206 -87
  189. package/dist/ir/lower-property.js +31 -8
  190. package/dist/ir/lower.js +9 -9
  191. package/dist/ir/merge-conversions.d.ts +18 -0
  192. package/dist/ir/merge-conversions.js +106 -0
  193. package/dist/ir/model.d.ts +138 -28
  194. package/dist/ir/native-accessor-definition.d.ts +104 -0
  195. package/dist/ir/native-accessor-definition.js +735 -0
  196. package/dist/ir/native-array-descriptor-snapshot.d.ts +45 -0
  197. package/dist/ir/native-array-descriptor-snapshot.js +380 -0
  198. package/dist/ir/native-array-insertion.d.ts +16 -0
  199. package/dist/ir/native-array-insertion.js +42 -0
  200. package/dist/ir/native-callable-argument.d.ts +38 -0
  201. package/dist/ir/native-callable-argument.js +128 -0
  202. package/dist/ir/native-callable-data-flow.d.ts +9 -0
  203. package/dist/ir/native-callable-data-flow.js +59 -0
  204. package/dist/ir/native-callable-data-owner.d.ts +45 -0
  205. package/dist/ir/native-callable-data-owner.js +755 -0
  206. package/dist/ir/native-callable-data-reads.d.ts +45 -0
  207. package/dist/ir/native-callable-data-reads.js +282 -0
  208. package/dist/ir/native-callable-data-slots.d.ts +78 -0
  209. package/dist/ir/native-callable-data-slots.js +403 -0
  210. package/dist/ir/native-callable-data-write.d.ts +58 -0
  211. package/dist/ir/native-callable-data-write.js +254 -0
  212. package/dist/ir/native-callable-integrity.d.ts +23 -0
  213. package/dist/ir/native-callable-integrity.js +77 -0
  214. package/dist/ir/native-callable-own-property.d.ts +42 -0
  215. package/dist/ir/native-callable-own-property.js +505 -0
  216. package/dist/ir/native-callable-prototype.d.ts +38 -0
  217. package/dist/ir/native-callable-prototype.js +307 -0
  218. package/dist/ir/native-callable-readonly-set.d.ts +25 -0
  219. package/dist/ir/native-callable-readonly-set.js +238 -0
  220. package/dist/ir/native-class-accessor.d.ts +3 -3
  221. package/dist/ir/native-class-accessor.js +3 -3
  222. package/dist/ir/native-class-construction.js +2 -2
  223. package/dist/ir/native-constructor-reads.d.ts +15 -0
  224. package/dist/ir/native-constructor-reads.js +156 -0
  225. package/dist/ir/native-constructor-static.d.ts +18 -0
  226. package/dist/ir/native-constructor-static.js +61 -0
  227. package/dist/ir/native-data-definition.d.ts +43 -0
  228. package/dist/ir/native-data-definition.js +222 -0
  229. package/dist/ir/native-document-array-entries.d.ts +15 -0
  230. package/dist/ir/native-document-array-entries.js +37 -0
  231. package/dist/ir/native-document-entries.d.ts +21 -0
  232. package/dist/ir/native-document-entries.js +74 -0
  233. package/dist/ir/native-entry-field-views.d.ts +18 -0
  234. package/dist/ir/native-entry-field-views.js +62 -0
  235. package/dist/ir/native-field-view-domains.d.ts +43 -0
  236. package/dist/ir/native-field-view-domains.js +300 -0
  237. package/dist/ir/native-field-view-facts.d.ts +97 -0
  238. package/dist/ir/native-field-view-facts.js +341 -0
  239. package/dist/ir/native-fixed-layout.js +1 -1
  240. package/dist/ir/native-host-construction.d.ts +4 -6
  241. package/dist/ir/native-host-construction.js +4 -6
  242. package/dist/ir/native-host-method-reads.d.ts +13 -0
  243. package/dist/ir/native-host-method-reads.js +53 -0
  244. package/dist/ir/native-iterator-field-views.d.ts +15 -0
  245. package/dist/ir/native-iterator-field-views.js +39 -0
  246. package/dist/ir/native-iterator-receivers.d.ts +8 -0
  247. package/dist/ir/native-iterator-receivers.js +59 -0
  248. package/dist/ir/native-logical-receiver-body.d.ts +8 -0
  249. package/dist/ir/native-logical-receiver-body.js +23 -0
  250. package/dist/ir/native-method-frames.d.ts +18 -0
  251. package/dist/ir/native-method-frames.js +127 -0
  252. package/dist/ir/native-method-read-source.d.ts +16 -0
  253. package/dist/ir/native-method-read-source.js +61 -0
  254. package/dist/ir/native-object-data-slots.d.ts +60 -0
  255. package/dist/ir/native-object-data-slots.js +493 -0
  256. package/dist/ir/native-object-sample.d.ts +32 -0
  257. package/dist/ir/native-object-sample.js +113 -0
  258. package/dist/ir/native-own-assignment.d.ts +123 -0
  259. package/dist/ir/native-own-assignment.js +529 -0
  260. package/dist/ir/native-property-coercibility.d.ts +3 -0
  261. package/dist/ir/native-property-coercibility.js +10 -0
  262. package/dist/ir/native-property-key-texts.d.ts +11 -0
  263. package/dist/ir/native-property-key-texts.js +41 -0
  264. package/dist/ir/native-property-presence-effects.d.ts +11 -0
  265. package/dist/ir/native-property-presence-effects.js +19 -0
  266. package/dist/ir/native-property-presence.d.ts +27 -0
  267. package/dist/ir/native-property-presence.js +275 -0
  268. package/dist/ir/native-prototype-calls.d.ts +19 -0
  269. package/dist/ir/native-prototype-calls.js +53 -0
  270. package/dist/ir/native-prototype-conversions.d.ts +5 -0
  271. package/dist/ir/native-prototype-conversions.js +46 -0
  272. package/dist/ir/native-prototype-presence-demand.d.ts +9 -0
  273. package/dist/ir/native-prototype-presence-demand.js +58 -0
  274. package/dist/ir/native-record-index.d.ts +1 -1
  275. package/dist/ir/native-union-method-targets.d.ts +8 -0
  276. package/dist/ir/native-union-method-targets.js +69 -0
  277. package/dist/ir/no-normal-call-completion.d.ts +15 -0
  278. package/dist/ir/no-normal-call-completion.js +184 -0
  279. package/dist/ir/non-normal-receiver.d.ts +39 -0
  280. package/dist/ir/non-normal-receiver.js +253 -0
  281. package/dist/ir/operation-conversions.d.ts +29 -0
  282. package/dist/ir/operation-conversions.js +484 -0
  283. package/dist/ir/operation-index.d.ts +1 -1
  284. package/dist/ir/presence-proof.d.ts +1 -1
  285. package/dist/ir/presence-proof.js +1 -0
  286. package/dist/ir/program-conversions.d.ts +48 -0
  287. package/dist/ir/program-conversions.js +221 -0
  288. package/dist/ir/program-facts.d.ts +4 -1
  289. package/dist/ir/program-facts.js +9 -7
  290. package/dist/ir/promise-reaction-conversions.d.ts +6 -0
  291. package/dist/ir/promise-reaction-conversions.js +92 -0
  292. package/dist/ir/property-read-conversions.d.ts +10 -0
  293. package/dist/ir/property-read-conversions.js +124 -0
  294. package/dist/ir/proven-branches.d.ts +2 -1
  295. package/dist/ir/proven-branches.js +97 -10
  296. package/dist/ir/publish-conversion-recipes.d.ts +27 -0
  297. package/dist/ir/publish-conversion-recipes.js +246 -0
  298. package/dist/ir/publish-native-field-view-facts.d.ts +17 -0
  299. package/dist/ir/publish-native-field-view-facts.js +119 -0
  300. package/dist/ir/queries.js +42 -4
  301. package/dist/ir/read-only-dictionary.d.ts +38 -0
  302. package/dist/ir/read-only-dictionary.js +281 -0
  303. package/dist/ir/reflection-demand.d.ts +2 -0
  304. package/dist/ir/reflection-demand.js +600 -44
  305. package/dist/ir/shake.d.ts +3 -0
  306. package/dist/ir/shake.js +24 -14
  307. package/dist/ir/shared-empty-records.js +1 -1
  308. package/dist/ir/short-circuit-threading.d.ts +23 -0
  309. package/dist/ir/short-circuit-threading.js +133 -0
  310. package/dist/ir/spread-conversions.d.ts +27 -0
  311. package/dist/ir/spread-conversions.js +134 -0
  312. package/dist/ir/spread-copy-elision.d.ts +2 -2
  313. package/dist/ir/spread-copy-elision.js +7 -4
  314. package/dist/ir/string-layout-reuse.d.ts +9 -8
  315. package/dist/ir/string-layout-reuse.js +8 -16
  316. package/dist/ir/string-length-reuse.d.ts +20 -4
  317. package/dist/ir/string-length-reuse.js +57 -13
  318. package/dist/ir/transfer.d.ts +5 -5
  319. package/dist/ir/transfer.js +53 -31
  320. package/dist/ir/typed-property-access.d.ts +2 -0
  321. package/dist/ir/typed-property-access.js +21 -8
  322. package/dist/ir/virtual-call-frames.d.ts +7 -0
  323. package/dist/ir/virtual-call-frames.js +8 -0
  324. package/dist/native-signatures.d.ts +45 -0
  325. package/dist/native-signatures.js +368 -0
  326. package/dist/plugins/gea/host.d.ts +6 -1
  327. package/dist/plugins/gea/host.js +30 -1
  328. package/dist/plugins/gea/lower.js +9 -3
  329. package/dist/plugins/gea/members.js +1 -1
  330. package/dist/plugins/gea/plugin.js +2 -1
  331. package/dist/plugins/gea/prelude.d.ts +1 -1
  332. package/dist/plugins/gea/prelude.js +1 -1
  333. package/dist/plugins/gea/reactive-slots.js +6 -6
  334. package/dist/plugins/gea/render-bridge.js +5 -6
  335. package/dist/plugins/gea/user-agent-styles.js +1 -1
  336. package/dist/plugins/installed.d.ts +2 -2
  337. package/dist/plugins/installed.js +2 -2
  338. package/dist/plugins/load.js +1 -1
  339. package/dist/plugins/model.d.ts +21 -36
  340. package/dist/plugins/webgl/host.d.ts +23 -23
  341. package/dist/plugins/webgl/host.js +25 -26
  342. package/dist/plugins/webgl/plugin.d.ts +16 -19
  343. package/dist/plugins/webgl/plugin.js +16 -23
  344. package/dist/project-preparation.js +12 -14
  345. package/dist/projection/abi.js +13 -10
  346. package/dist/projection/bindings.d.ts +8 -0
  347. package/dist/projection/bindings.js +36 -5
  348. package/dist/projection/callee.d.ts +17 -15
  349. package/dist/projection/callee.js +108 -81
  350. package/dist/projection/class-property-presence.d.ts +1 -1
  351. package/dist/projection/class-property-presence.js +1 -1
  352. package/dist/projection/classes.d.ts +2 -0
  353. package/dist/projection/classes.js +4 -1
  354. package/dist/projection/dispatch.d.ts +19 -3
  355. package/dist/projection/dispatch.js +39 -16
  356. package/dist/projection/fields.d.ts +14 -2
  357. package/dist/projection/fields.js +100 -38
  358. package/dist/projection/function-source.d.ts +5 -0
  359. package/dist/projection/function-source.js +15 -0
  360. package/dist/projection/immediate-callees.d.ts +12 -0
  361. package/dist/projection/immediate-callees.js +36 -0
  362. package/dist/projection/index-protocols.d.ts +12 -0
  363. package/dist/projection/index-protocols.js +39 -0
  364. package/dist/projection/instance-test.d.ts +8 -0
  365. package/dist/projection/instance-test.js +3 -1
  366. package/dist/projection/method-values.d.ts +7 -0
  367. package/dist/projection/method-values.js +29 -0
  368. package/dist/projection/native-accessor-access.d.ts +26 -0
  369. package/dist/projection/native-accessor-access.js +18 -0
  370. package/dist/projection/native-callable-data.d.ts +24 -0
  371. package/dist/projection/native-callable-data.js +101 -0
  372. package/dist/projection/native-expando.d.ts +3 -0
  373. package/dist/projection/native-expando.js +13 -0
  374. package/dist/projection/native-object-data.d.ts +47 -0
  375. package/dist/projection/native-object-data.js +203 -0
  376. package/dist/projection/native-prototype-methods.d.ts +22 -0
  377. package/dist/projection/native-prototype-methods.js +161 -0
  378. package/dist/projection/regexp-fields.d.ts +35 -0
  379. package/dist/projection/regexp-fields.js +80 -0
  380. package/dist/projection/slots.d.ts +5 -1
  381. package/dist/projection/slots.js +89 -10
  382. package/dist/representation/derive.d.ts +5 -7
  383. package/dist/representation/derive.js +78 -78
  384. package/dist/representation/difference.js +1 -1
  385. package/dist/representation/host-abi.d.ts +2 -2
  386. package/dist/representation/host-abi.js +4 -5
  387. package/dist/representation/host-templates.d.ts +6 -2
  388. package/dist/representation/host-templates.js +8 -2
  389. package/dist/representation/intersection.d.ts +3 -3
  390. package/dist/representation/intersection.js +3 -3
  391. package/dist/representation/merge.js +1 -1
  392. package/dist/representation/model.d.ts +27 -22
  393. package/dist/representation/model.js +35 -22
  394. package/dist/representation/native-callable-data-storage.d.ts +85 -0
  395. package/dist/representation/native-callable-data-storage.js +398 -0
  396. package/dist/representation/native-data-properties.d.ts +14 -0
  397. package/dist/representation/native-data-properties.js +52 -0
  398. package/dist/representation/native-logical-receiver.d.ts +36 -0
  399. package/dist/representation/native-logical-receiver.js +92 -0
  400. package/dist/representation/object-shape.d.ts +1 -1
  401. package/dist/representation/object-shape.js +1 -1
  402. package/dist/representation/optional.js +2 -2
  403. package/dist/representation/physical-carrier.d.ts +25 -0
  404. package/dist/representation/physical-carrier.js +153 -0
  405. package/dist/representation/policies.d.ts +16 -10
  406. package/dist/representation/policies.js +5 -1
  407. package/dist/representation/primitives.js +3 -0
  408. package/dist/representation/promise-resolution.d.ts +19 -0
  409. package/dist/representation/promise-resolution.js +50 -0
  410. package/dist/representation/prototype-domains.d.ts +43 -0
  411. package/dist/representation/prototype-domains.js +226 -0
  412. package/dist/representation/proxy-carriers.d.ts +3 -3
  413. package/dist/representation/proxy-carriers.js +2 -3
  414. package/dist/representation/publish.d.ts +4 -0
  415. package/dist/representation/publish.js +73 -42
  416. package/dist/representation/record-fields.d.ts +2 -2
  417. package/dist/representation/record-fields.js +2 -2
  418. package/dist/representation/static-field-cells.d.ts +1 -1
  419. package/dist/representation/structural-method-abi.d.ts +6 -0
  420. package/dist/representation/structural-method-abi.js +13 -0
  421. package/dist/representation/unassigned-binding-cells.d.ts +3 -3
  422. package/dist/representation/union.js +19 -4
  423. package/dist/representation/unwritten-record-members.d.ts +6 -6
  424. package/dist/representation/unwritten-record-members.js +1 -1
  425. package/dist/representation/value-records.js +77 -5
  426. package/dist/representation/verify.js +1 -1
  427. package/dist/representation/well-known-symbols.d.ts +3 -0
  428. package/dist/representation/well-known-symbols.js +11 -0
  429. package/dist/semantics/alias-this-field-declaration-transform.js +3 -3
  430. package/dist/semantics/ambient-type-realization-transform.d.ts +19 -20
  431. package/dist/semantics/ambient-type-realization-transform.js +20 -12
  432. package/dist/semantics/ambient.d.ts +13 -13
  433. package/dist/semantics/ambient.js +12 -12
  434. package/dist/semantics/borrowed-builtin-call-bind-source-transform.d.ts +5 -0
  435. package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +110 -52
  436. package/dist/semantics/borrowed-method-receiver-copy-source-transform.d.ts +4 -4
  437. package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +4 -4
  438. package/dist/semantics/call-invalidated-narrowing.js +2 -2
  439. package/dist/semantics/callable-origins.d.ts +49 -1
  440. package/dist/semantics/callable-origins.js +148 -32
  441. package/dist/semantics/callable-own-data-slots.d.ts +122 -0
  442. package/dist/semantics/callable-own-data-slots.js +421 -0
  443. package/dist/semantics/class-alias.d.ts +4 -4
  444. package/dist/semantics/class-alias.js +4 -4
  445. package/dist/semantics/class-heritage.d.ts +8 -7
  446. package/dist/semantics/class-heritage.js +8 -7
  447. package/dist/semantics/commonjs-wrapper.js +5 -2
  448. package/dist/semantics/constructor-function-class-source-transform.js +2 -3
  449. package/dist/semantics/constructor-slot-subclasses.d.ts +1 -1
  450. package/dist/semantics/constructor-slot-subclasses.js +5 -5
  451. package/dist/semantics/declaration-overlay-transform.d.ts +9 -12
  452. package/dist/semantics/declaration-overlay-transform.js +135 -142
  453. package/dist/semantics/declared-integers.d.ts +24 -0
  454. package/dist/semantics/declared-integers.js +34 -0
  455. package/dist/semantics/define-property-source-transform.js +21 -8
  456. package/dist/semantics/dynamic-fallback.d.ts +1 -1
  457. package/dist/semantics/dynamic-fallback.js +1 -1
  458. package/dist/semantics/frontend.d.ts +12 -16
  459. package/dist/semantics/frontend.js +187 -75
  460. package/dist/semantics/host-methods.d.ts +3 -3
  461. package/dist/semantics/host-methods.js +1 -1
  462. package/dist/semantics/host-protocols.d.ts +3 -3
  463. package/dist/semantics/host-protocols.js +26 -26
  464. package/dist/semantics/interface-families.d.ts +2 -2
  465. package/dist/semantics/interface-families.js +46 -47
  466. package/dist/semantics/interface-implementors.d.ts +12 -15
  467. package/dist/semantics/interface-implementors.js +12 -15
  468. package/dist/semantics/jsdoc-namepath-transform.js +7 -7
  469. package/dist/semantics/model/operands.d.ts +18 -3
  470. package/dist/semantics/model/operands.js +41 -0
  471. package/dist/semantics/model/operations.d.ts +82 -1
  472. package/dist/semantics/model/selected-signature.d.ts +24 -3
  473. package/dist/semantics/model/structural-type-table.js +24 -6
  474. package/dist/semantics/model/structural-types.d.ts +10 -8
  475. package/dist/semantics/model/structural-types.js +7 -5
  476. package/dist/semantics/module-resolution.js +3 -2
  477. package/dist/semantics/native-callable-readonly-set.d.ts +17 -0
  478. package/dist/semantics/native-callable-readonly-set.js +1 -0
  479. package/dist/semantics/native-function-signatures.d.ts +14 -0
  480. package/dist/semantics/native-function-signatures.js +96 -0
  481. package/dist/semantics/native-object-data-slots.d.ts +72 -0
  482. package/dist/semantics/native-object-data-slots.js +679 -0
  483. package/dist/semantics/native-own-assignment.d.ts +62 -0
  484. package/dist/semantics/native-own-assignment.js +1 -0
  485. package/dist/semantics/normalize/absent-globals.d.ts +8 -8
  486. package/dist/semantics/normalize/absent-globals.js +5 -5
  487. package/dist/semantics/normalize/arguments-objects.d.ts +3 -1
  488. package/dist/semantics/normalize/arguments-objects.js +1 -1
  489. package/dist/semantics/normalize/asserted-argument-arms.d.ts +7 -7
  490. package/dist/semantics/normalize/asserted-arm-absence.d.ts +1 -2
  491. package/dist/semantics/normalize/asserted-arm-absence.js +1 -2
  492. package/dist/semantics/normalize/binding-fixpoint.js +3 -3
  493. package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +2 -2
  494. package/dist/semantics/normalize/bivariant-slot-parameter.js +6 -6
  495. package/dist/semantics/normalize/callable-data-write.d.ts +46 -0
  496. package/dist/semantics/normalize/callable-data-write.js +182 -0
  497. package/dist/semantics/normalize/census.js +5 -5
  498. package/dist/semantics/normalize/class-instance-record-statement.d.ts +1 -1
  499. package/dist/semantics/normalize/class-instance-record-statement.js +1 -1
  500. package/dist/semantics/normalize/collection-bindings.d.ts +11 -13
  501. package/dist/semantics/normalize/collection-bindings.js +60 -33
  502. package/dist/semantics/normalize/commonjs-module-record.d.ts +7 -4
  503. package/dist/semantics/normalize/commonjs-module-record.js +93 -4
  504. package/dist/semantics/normalize/contribution.js +4 -4
  505. package/dist/semantics/normalize/dead-method-copies.d.ts +5 -5
  506. package/dist/semantics/normalize/dead-typeof-guards.d.ts +2 -2
  507. package/dist/semantics/normalize/dead-typeof-guards.js +6 -6
  508. package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +22 -13
  509. package/dist/semantics/normalize/deferred-intrinsic-protocols.js +85 -13
  510. package/dist/semantics/normalize/derived-expression-type.d.ts +129 -91
  511. package/dist/semantics/normalize/derived-expression-type.js +419 -192
  512. package/dist/semantics/normalize/field-bindings.d.ts +4 -4
  513. package/dist/semantics/normalize/field-bindings.js +334 -67
  514. package/dist/semantics/normalize/flow/array-element-continuation.d.ts +2 -2
  515. package/dist/semantics/normalize/flow/array-element-continuation.js +35 -18
  516. package/dist/semantics/normalize/flow/callable-array-origins.d.ts +1 -1
  517. package/dist/semantics/normalize/flow/callable-array-origins.js +3 -3
  518. package/dist/semantics/normalize/flow/callable-completions.d.ts +2 -2
  519. package/dist/semantics/normalize/flow/callable-completions.js +2 -2
  520. package/dist/semantics/normalize/flow/callable-reach.d.ts +19 -6
  521. package/dist/semantics/normalize/flow/callable-reach.js +722 -289
  522. package/dist/semantics/normalize/flow/class-family-member-read.js +24 -29
  523. package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +2 -2
  524. package/dist/semantics/normalize/flow/collection-value-continuation.js +2 -2
  525. package/dist/semantics/normalize/flow/component-solver.d.ts +19 -16
  526. package/dist/semantics/normalize/flow/component-solver.js +138 -69
  527. package/dist/semantics/normalize/flow/computed-key-set.d.ts +6 -7
  528. package/dist/semantics/normalize/flow/computed-key-set.js +20 -1
  529. package/dist/semantics/normalize/flow/export-importers.js +4 -4
  530. package/dist/semantics/normalize/flow/host-text-sink.d.ts +3 -2
  531. package/dist/semantics/normalize/flow/host-text-sink.js +4 -3
  532. package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +3 -2
  533. package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +2 -2
  534. package/dist/semantics/normalize/flow/intrinsic-data-definition.js +3 -3
  535. package/dist/semantics/normalize/flow/invocation-facts.d.ts +3 -2
  536. package/dist/semantics/normalize/flow/invocation-facts.js +3 -3
  537. package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +12 -6
  538. package/dist/semantics/normalize/flow/member-call-forwarding.js +94 -21
  539. package/dist/semantics/normalize/flow/model.d.ts +5 -5
  540. package/dist/semantics/normalize/flow/model.js +11 -11
  541. package/dist/semantics/normalize/flow/node-path-token.js +3 -3
  542. package/dist/semantics/normalize/flow/origin-authority.d.ts +3 -3
  543. package/dist/semantics/normalize/flow/owned-class-receivers.js +8 -7
  544. package/dist/semantics/normalize/flow/parameter-values.js +6 -6
  545. package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +30 -4
  546. package/dist/semantics/normalize/flow/proof-hypotheses.js +56 -5
  547. package/dist/semantics/normalize/flow/proof-memo-settlement.d.ts +21 -0
  548. package/dist/semantics/normalize/flow/proof-memo-settlement.js +32 -0
  549. package/dist/semantics/normalize/flow/record-alias-closure.d.ts +1 -1
  550. package/dist/semantics/normalize/flow/record-alias-closure.js +1 -1
  551. package/dist/semantics/normalize/flow/seeded-origins.d.ts +4 -4
  552. package/dist/semantics/normalize/flow/seeded-origins.js +4 -4
  553. package/dist/semantics/normalize/flow/source-accessor-descriptor.d.ts +22 -0
  554. package/dist/semantics/normalize/flow/source-accessor-descriptor.js +210 -0
  555. package/dist/semantics/normalize/flow/source-callable-own-data.d.ts +33 -0
  556. package/dist/semantics/normalize/flow/source-callable-own-data.js +238 -0
  557. package/dist/semantics/normalize/flow/source-callable-readonly-set.d.ts +26 -0
  558. package/dist/semantics/normalize/flow/source-callable-readonly-set.js +337 -0
  559. package/dist/semantics/normalize/flow/source-class-data.d.ts +7 -7
  560. package/dist/semantics/normalize/flow/source-class-data.js +25 -26
  561. package/dist/semantics/normalize/flow/source-class-static-data.d.ts +2 -2
  562. package/dist/semantics/normalize/flow/source-class-static-data.js +2 -2
  563. package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +15 -0
  564. package/dist/semantics/normalize/flow/source-commonjs-exports.js +7 -0
  565. package/dist/semantics/normalize/flow/source-descriptor-protocol.d.ts +20 -0
  566. package/dist/semantics/normalize/flow/source-descriptor-protocol.js +75 -0
  567. package/dist/semantics/normalize/flow/source-executing-parameter-values.d.ts +8 -0
  568. package/dist/semantics/normalize/flow/source-executing-parameter-values.js +93 -0
  569. package/dist/semantics/normalize/flow/source-global-binding.d.ts +13 -0
  570. package/dist/semantics/normalize/flow/source-global-binding.js +42 -0
  571. package/dist/semantics/normalize/flow/source-intrinsic-member-data.d.ts +27 -0
  572. package/dist/semantics/normalize/flow/source-intrinsic-member-data.js +178 -0
  573. package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +1 -1
  574. package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +31 -11
  575. package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +7 -3
  576. package/dist/semantics/normalize/flow/source-invocation-receiver.js +30 -2
  577. package/dist/semantics/normalize/flow/source-native-class-alias.d.ts +7 -0
  578. package/dist/semantics/normalize/flow/source-native-class-alias.js +91 -0
  579. package/dist/semantics/normalize/flow/source-normal-predecessor.d.ts +10 -0
  580. package/dist/semantics/normalize/flow/source-normal-predecessor.js +90 -0
  581. package/dist/semantics/normalize/flow/source-property-key.d.ts +3 -0
  582. package/dist/semantics/normalize/flow/source-property-key.js +7 -0
  583. package/dist/semantics/normalize/flow/source-read-protocol.d.ts +20 -0
  584. package/dist/semantics/normalize/flow/source-read-protocol.js +108 -0
  585. package/dist/semantics/normalize/flow/source-record-data.js +31 -30
  586. package/dist/semantics/normalize/flow/source-value-session.d.ts +106 -3
  587. package/dist/semantics/normalize/flow/source-value-session.js +1172 -218
  588. package/dist/semantics/normalize/flow/standard-prototype-method-source.d.ts +16 -0
  589. package/dist/semantics/normalize/flow/standard-prototype-method-source.js +64 -0
  590. package/dist/semantics/normalize/flow/targets.d.ts +13 -14
  591. package/dist/semantics/normalize/flow/targets.js +20 -23
  592. package/dist/semantics/normalize/flow/value-flow.d.ts +2 -4
  593. package/dist/semantics/normalize/flow/value-flow.js +4 -13
  594. package/dist/semantics/normalize/flow/value-provenance.d.ts +23 -3
  595. package/dist/semantics/normalize/flow/value-provenance.js +44 -4
  596. package/dist/semantics/normalize/fresh-dictionary-storage.d.ts +32 -0
  597. package/dist/semantics/normalize/fresh-dictionary-storage.js +530 -0
  598. package/dist/semantics/normalize/fresh-indexed-storage.d.ts +43 -0
  599. package/dist/semantics/normalize/fresh-indexed-storage.js +88 -0
  600. package/dist/semantics/normalize/fresh-ordinary-object.d.ts +8 -0
  601. package/dist/semantics/normalize/fresh-ordinary-object.js +27 -0
  602. package/dist/semantics/normalize/gating.js +2 -2
  603. package/dist/semantics/normalize/global-host-mutations.js +770 -261
  604. package/dist/semantics/normalize/host-effect-contracts.d.ts +1 -1
  605. package/dist/semantics/normalize/host-effect-contracts.js +1 -1
  606. package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +2 -2
  607. package/dist/semantics/normalize/host-mutation-computed-keys.js +8 -0
  608. package/dist/semantics/normalize/host-mutation-key-reader.d.ts +6 -11
  609. package/dist/semantics/normalize/host-mutation-key-reader.js +11 -28
  610. package/dist/semantics/normalize/host-mutation-keys.d.ts +11 -7
  611. package/dist/semantics/normalize/host-mutation-keys.js +26 -15
  612. package/dist/semantics/normalize/identities.js +20 -17
  613. package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +8 -3
  614. package/dist/semantics/normalize/implicit-arguments-tuple.js +21 -4
  615. package/dist/semantics/normalize/installed-global-properties.d.ts +17 -0
  616. package/dist/semantics/normalize/installed-global-properties.js +214 -0
  617. package/dist/semantics/normalize/instantiation.js +6 -6
  618. package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +1 -1
  619. package/dist/semantics/normalize/intrinsic-property-call.d.ts +6 -1
  620. package/dist/semantics/normalize/intrinsic-property-call.js +19 -0
  621. package/dist/semantics/normalize/intrinsic-prototype.d.ts +7 -0
  622. package/dist/semantics/normalize/intrinsic-prototype.js +10 -0
  623. package/dist/semantics/normalize/intrinsic-return-identity.d.ts +5 -0
  624. package/dist/semantics/normalize/intrinsic-return-identity.js +29 -0
  625. package/dist/semantics/normalize/jsdoc-type-names.js +59 -63
  626. package/dist/semantics/normalize/keyof.js +3 -3
  627. package/dist/semantics/normalize/local-bindings.d.ts +4 -4
  628. package/dist/semantics/normalize/local-bindings.js +60 -61
  629. package/dist/semantics/normalize/logical-object-truthiness.d.ts +8 -0
  630. package/dist/semantics/normalize/logical-object-truthiness.js +20 -0
  631. package/dist/semantics/normalize/merged-declaration.d.ts +3 -3
  632. package/dist/semantics/normalize/merged-declaration.js +3 -3
  633. package/dist/semantics/normalize/never-override-result.d.ts +2 -3
  634. package/dist/semantics/normalize/never-override-result.js +2 -3
  635. package/dist/semantics/normalize/null-blind-parameter.d.ts +2 -2
  636. package/dist/semantics/normalize/null-blind-parameter.js +2 -2
  637. package/dist/semantics/normalize/object-bag-bindings.d.ts +19 -19
  638. package/dist/semantics/normalize/object-bag-bindings.js +334 -141
  639. package/dist/semantics/normalize/omitted-stated-parameter.d.ts +8 -8
  640. package/dist/semantics/normalize/omitted-stated-parameter.js +8 -9
  641. package/dist/semantics/normalize/override-field-arms.d.ts +3 -3
  642. package/dist/semantics/normalize/override-field-arms.js +15 -16
  643. package/dist/semantics/normalize/parameter-bindings.d.ts +13 -12
  644. package/dist/semantics/normalize/parameter-bindings.js +173 -139
  645. package/dist/semantics/normalize/parameter-slot.d.ts +9 -10
  646. package/dist/semantics/normalize/parameter-slot.js +16 -17
  647. package/dist/semantics/normalize/physical-overload-result.d.ts +8 -8
  648. package/dist/semantics/normalize/physical-overload-result.js +10 -10
  649. package/dist/semantics/normalize/producer-context.d.ts +27 -12
  650. package/dist/semantics/normalize/producers/allocations.js +5 -1
  651. package/dist/semantics/normalize/producers/bindings.js +8 -7
  652. package/dist/semantics/normalize/producers/class-lifecycle.js +52 -7
  653. package/dist/semantics/normalize/producers/computations.js +27 -3
  654. package/dist/semantics/normalize/producers/control.js +5 -5
  655. package/dist/semantics/normalize/producers/declaration-lifecycle.js +4 -4
  656. package/dist/semantics/normalize/producers/destructuring.js +10 -5
  657. package/dist/semantics/normalize/producers/erasure.d.ts +9 -0
  658. package/dist/semantics/normalize/producers/erasure.js +22 -0
  659. package/dist/semantics/normalize/producers/invocations.d.ts +1 -1
  660. package/dist/semantics/normalize/producers/invocations.js +200 -55
  661. package/dist/semantics/normalize/producers/logical-merge-type.d.ts +2 -2
  662. package/dist/semantics/normalize/producers/logical-merge-type.js +12 -12
  663. package/dist/semantics/normalize/producers/native-callable-readonly-set.d.ts +6 -0
  664. package/dist/semantics/normalize/producers/native-callable-readonly-set.js +24 -0
  665. package/dist/semantics/normalize/producers/native-own-assignment.d.ts +14 -0
  666. package/dist/semantics/normalize/producers/native-own-assignment.js +153 -0
  667. package/dist/semantics/normalize/producers/properties.js +153 -20
  668. package/dist/semantics/normalize/producers/protocol.js +4 -4
  669. package/dist/semantics/normalize/producers/references.js +21 -19
  670. package/dist/semantics/normalize/producers/shared.d.ts +1 -1
  671. package/dist/semantics/normalize/producers/shared.js +59 -58
  672. package/dist/semantics/normalize/producers/spread-arguments.js +7 -3
  673. package/dist/semantics/normalize/producers/tuple-spread.d.ts +2 -2
  674. package/dist/semantics/normalize/producers/tuple-spread.js +5 -5
  675. package/dist/semantics/normalize/property-key-domain.d.ts +6 -6
  676. package/dist/semantics/normalize/property-key-domain.js +7 -7
  677. package/dist/semantics/normalize/reachability.d.ts +6 -7
  678. package/dist/semantics/normalize/reachability.js +60 -62
  679. package/dist/semantics/normalize/record-home-arms.js +2 -3
  680. package/dist/semantics/normalize/record-link-families.d.ts +1 -1
  681. package/dist/semantics/normalize/record-link-families.js +1 -1
  682. package/dist/semantics/normalize/record-stand-in-arms.d.ts +4 -5
  683. package/dist/semantics/normalize/return-bindings.d.ts +19 -9
  684. package/dist/semantics/normalize/return-bindings.js +49 -41
  685. package/dist/semantics/normalize/script-global-redefinition.d.ts +1 -1
  686. package/dist/semantics/normalize/script-global-redefinition.js +1 -1
  687. package/dist/semantics/normalize/shared-array-storage.d.ts +4 -5
  688. package/dist/semantics/normalize/shared-array-storage.js +7 -8
  689. package/dist/semantics/normalize/sloppy-absence.d.ts +6 -3
  690. package/dist/semantics/normalize/sloppy-absence.js +7 -3
  691. package/dist/semantics/normalize/source-object-prototype-absence.d.ts +7 -0
  692. package/dist/semantics/normalize/source-object-prototype-absence.js +19 -0
  693. package/dist/semantics/normalize/specialization.d.ts +10 -10
  694. package/dist/semantics/normalize/specialization.js +107 -112
  695. package/dist/semantics/normalize/specialized-source-frames.d.ts +11 -0
  696. package/dist/semantics/normalize/specialized-source-frames.js +41 -0
  697. package/dist/semantics/normalize/structural-array-element.d.ts +5 -5
  698. package/dist/semantics/normalize/structural-array-element.js +40 -39
  699. package/dist/semantics/normalize/structural-array-read.js +3 -3
  700. package/dist/semantics/normalize/structural-callable.d.ts +15 -1
  701. package/dist/semantics/normalize/structural-callable.js +35 -3
  702. package/dist/semantics/normalize/structural-creation-order.d.ts +2 -2
  703. package/dist/semantics/normalize/structural-declarations.d.ts +22 -21
  704. package/dist/semantics/normalize/structural-declarations.js +42 -42
  705. package/dist/semantics/normalize/structural-declared-body.js +10 -11
  706. package/dist/semantics/normalize/structural-indexed-access.js +2 -2
  707. package/dist/semantics/normalize/structural-instantiated-member.d.ts +9 -10
  708. package/dist/semantics/normalize/structural-instantiated-member.js +43 -30
  709. package/dist/semantics/normalize/structural-joins.d.ts +4 -16
  710. package/dist/semantics/normalize/structural-joins.js +5 -65
  711. package/dist/semantics/normalize/structural-layout-relevance.d.ts +5 -5
  712. package/dist/semantics/normalize/structural-layout-relevance.js +22 -23
  713. package/dist/semantics/normalize/structural-layout-type.d.ts +1 -1
  714. package/dist/semantics/normalize/structural-layout-type.js +140 -107
  715. package/dist/semantics/normalize/structural-local-union.d.ts +1 -1
  716. package/dist/semantics/normalize/structural-local-union.js +38 -12
  717. package/dist/semantics/normalize/structural-mutable-field.d.ts +9 -0
  718. package/dist/semantics/normalize/structural-mutable-field.js +152 -0
  719. package/dist/semantics/normalize/structural-parts.d.ts +6 -0
  720. package/dist/semantics/normalize/structural-parts.js +35 -32
  721. package/dist/semantics/normalize/structural-receiver.d.ts +3 -3
  722. package/dist/semantics/normalize/structural-receiver.js +12 -13
  723. package/dist/semantics/normalize/structural-self-reference.d.ts +12 -11
  724. package/dist/semantics/normalize/structural-self-reference.js +24 -25
  725. package/dist/semantics/normalize/structural.d.ts +13 -3
  726. package/dist/semantics/normalize/structural.js +400 -201
  727. package/dist/semantics/normalize/suppressed-write-arms.d.ts +10 -11
  728. package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +6 -6
  729. package/dist/semantics/normalize/symbol-keyed-this-slots.js +4 -4
  730. package/dist/semantics/normalize/unresolvable-names.d.ts +2 -3
  731. package/dist/semantics/normalize/unresolvable-names.js +2 -2
  732. package/dist/semantics/normalize/unshared-array-result.d.ts +4 -4
  733. package/dist/semantics/normalize/unshared-array-result.js +4 -4
  734. package/dist/semantics/package-sources.js +2 -3
  735. package/dist/semantics/program.d.ts +10 -13
  736. package/dist/semantics/program.js +80 -26
  737. package/dist/semantics/property-key.d.ts +9 -0
  738. package/dist/semantics/property-key.js +25 -0
  739. package/dist/semantics/prototype-object-class-source-transform.js +2 -2
  740. package/dist/semantics/prototype-reparenting.d.ts +1 -1
  741. package/dist/semantics/prototype-reparenting.js +1 -1
  742. package/dist/semantics/shared-declaration-files.d.ts +6 -1
  743. package/dist/semantics/shared-declaration-files.js +2 -2
  744. package/dist/semantics/source-transform-protocol.d.ts +26 -0
  745. package/dist/semantics/source-transform-protocol.js +1 -0
  746. package/dist/semantics/stable-checker.js +9 -13
  747. package/dist/semantics/subclass-member-overlay-transform.d.ts +2 -2
  748. package/dist/semantics/subclass-member-overlay-transform.js +89 -88
  749. package/dist/semantics/this-constructor-source-transform.js +2 -2
  750. package/dist/semantics/unchecked-guard-argument-copies.d.ts +3 -3
  751. package/dist/semantics/unchecked-write-member-declarations.d.ts +9 -11
  752. package/dist/semantics/unchecked-write-member-declarations.js +11 -13
  753. package/dist/semantics/uninstantiable-classes.d.ts +1 -1
  754. package/dist/semantics/uninstantiable-classes.js +1 -1
  755. package/dist/targets/cpp/balanced-units.d.ts +1 -1
  756. package/dist/targets/cpp/balanced-units.js +1 -1
  757. package/dist/targets/cpp/borrowed-arm-projections.d.ts +2 -3
  758. package/dist/targets/cpp/borrowed-arm-projections.js +2 -3
  759. package/dist/targets/cpp/borrowed-call-entry.js +3 -3
  760. package/dist/targets/cpp/captures.d.ts +2 -2
  761. package/dist/targets/cpp/captures.js +4 -4
  762. package/dist/targets/cpp/char-code-buffers.d.ts +1 -1
  763. package/dist/targets/cpp/char-code-buffers.js +4 -1
  764. package/dist/targets/cpp/class-layout.d.ts +7 -17
  765. package/dist/targets/cpp/class-layout.js +6 -13
  766. package/dist/targets/cpp/class-properties/computed-method-value.d.ts +1 -1
  767. package/dist/targets/cpp/class-properties/computed-method-value.js +5 -27
  768. package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +49 -59
  769. package/dist/targets/cpp/class-properties/emit-class-properties.js +68 -232
  770. package/dist/targets/cpp/class-properties/native-method-read.d.ts +5 -0
  771. package/dist/targets/cpp/class-properties/native-method-read.js +60 -0
  772. package/dist/targets/cpp/class-properties/native-prototype.d.ts +3 -1
  773. package/dist/targets/cpp/class-properties/native-prototype.js +5 -6
  774. package/dist/targets/cpp/class-ref-transport.d.ts +1 -11
  775. package/dist/targets/cpp/class-ref-transport.js +1 -9
  776. package/dist/targets/cpp/conversions.js +613 -252
  777. package/dist/targets/cpp/coroutine-bodies.d.ts +1 -97
  778. package/dist/targets/cpp/coroutine-bodies.js +1 -187
  779. package/dist/targets/cpp/document.js +1 -1
  780. package/dist/targets/cpp/emit-allocation.d.ts +0 -38
  781. package/dist/targets/cpp/emit-allocation.js +63 -88
  782. package/dist/targets/cpp/emit-array-view.d.ts +7 -0
  783. package/dist/targets/cpp/emit-array-view.js +47 -0
  784. package/dist/targets/cpp/emit-arrays.d.ts +9 -52
  785. package/dist/targets/cpp/emit-arrays.js +177 -113
  786. package/dist/targets/cpp/emit-binding-reference.d.ts +10 -0
  787. package/dist/targets/cpp/emit-binding-reference.js +19 -1
  788. package/dist/targets/cpp/emit-bindings.js +19 -24
  789. package/dist/targets/cpp/emit-buffers.d.ts +8 -4
  790. package/dist/targets/cpp/emit-buffers.js +88 -47
  791. package/dist/targets/cpp/emit-callable-view.d.ts +6 -0
  792. package/dist/targets/cpp/emit-callable-view.js +133 -0
  793. package/dist/targets/cpp/emit-callable.d.ts +11 -1
  794. package/dist/targets/cpp/emit-callable.js +225 -266
  795. package/dist/targets/cpp/emit-carrier-members.d.ts +2 -2
  796. package/dist/targets/cpp/emit-carrier-members.js +42 -35
  797. package/dist/targets/cpp/emit-certified-conversion.d.ts +7 -0
  798. package/dist/targets/cpp/emit-certified-conversion.js +27 -0
  799. package/dist/targets/cpp/emit-context.d.ts +123 -64
  800. package/dist/targets/cpp/emit-context.js +147 -44
  801. package/dist/targets/cpp/emit-descriptor-snapshot.d.ts +10 -0
  802. package/dist/targets/cpp/emit-descriptor-snapshot.js +60 -0
  803. package/dist/targets/cpp/emit-dictionary-view.d.ts +6 -0
  804. package/dist/targets/cpp/emit-dictionary-view.js +102 -0
  805. package/dist/targets/cpp/emit-document-record-view.d.ts +3 -0
  806. package/dist/targets/cpp/emit-document-record-view.js +104 -0
  807. package/dist/targets/cpp/emit-dynamic-properties.d.ts +42 -17
  808. package/dist/targets/cpp/emit-dynamic-properties.js +118 -72
  809. package/dist/targets/cpp/emit-equality.d.ts +2 -1
  810. package/dist/targets/cpp/emit-equality.js +65 -45
  811. package/dist/targets/cpp/emit-exceptions.js +1 -1
  812. package/dist/targets/cpp/emit-in.js +22 -11
  813. package/dist/targets/cpp/emit-instanceof.js +15 -14
  814. package/dist/targets/cpp/emit-integers.d.ts +40 -3
  815. package/dist/targets/cpp/emit-integers.js +76 -5
  816. package/dist/targets/cpp/emit-iterable-object-view.d.ts +2 -0
  817. package/dist/targets/cpp/emit-iterable-object-view.js +15 -11
  818. package/dist/targets/cpp/emit-iterator-object-view.d.ts +2 -0
  819. package/dist/targets/cpp/emit-iterator-object-view.js +24 -16
  820. package/dist/targets/cpp/emit-iterator.d.ts +2 -0
  821. package/dist/targets/cpp/emit-iterator.js +115 -43
  822. package/dist/targets/cpp/emit-json.js +6 -6
  823. package/dist/targets/cpp/emit-jsx.js +2 -2
  824. package/dist/targets/cpp/emit-live-field-view.d.ts +26 -0
  825. package/dist/targets/cpp/emit-live-field-view.js +50 -0
  826. package/dist/targets/cpp/emit-narrowing.d.ts +60 -139
  827. package/dist/targets/cpp/emit-narrowing.js +694 -624
  828. package/dist/targets/cpp/emit-native-accessor-definition.d.ts +10 -0
  829. package/dist/targets/cpp/emit-native-accessor-definition.js +94 -0
  830. package/dist/targets/cpp/emit-native-callable-data.d.ts +23 -0
  831. package/dist/targets/cpp/emit-native-callable-data.js +117 -0
  832. package/dist/targets/cpp/emit-native-document-entry.d.ts +4 -0
  833. package/dist/targets/cpp/emit-native-document-entry.js +52 -0
  834. package/dist/targets/cpp/emit-native-field-view.d.ts +26 -0
  835. package/dist/targets/cpp/emit-native-field-view.js +217 -0
  836. package/dist/targets/cpp/emit-native-method.d.ts +16 -0
  837. package/dist/targets/cpp/emit-native-method.js +90 -0
  838. package/dist/targets/cpp/emit-native-object-data.d.ts +7 -0
  839. package/dist/targets/cpp/emit-native-object-data.js +66 -0
  840. package/dist/targets/cpp/emit-native-object-sample.d.ts +8 -0
  841. package/dist/targets/cpp/emit-native-object-sample.js +34 -0
  842. package/dist/targets/cpp/emit-native-own-assignment.d.ts +7 -0
  843. package/dist/targets/cpp/emit-native-own-assignment.js +119 -0
  844. package/dist/targets/cpp/emit-native-selection.d.ts +2 -2
  845. package/dist/targets/cpp/emit-native-selection.js +14 -5
  846. package/dist/targets/cpp/emit-number-storage.d.ts +2 -0
  847. package/dist/targets/cpp/emit-number-storage.js +1 -0
  848. package/dist/targets/cpp/emit-presence.d.ts +3 -4
  849. package/dist/targets/cpp/emit-presence.js +43 -21
  850. package/dist/targets/cpp/emit-properties.js +224 -111
  851. package/dist/targets/cpp/emit-protocol-iterator.d.ts +2 -0
  852. package/dist/targets/cpp/emit-protocol-iterator.js +45 -23
  853. package/dist/targets/cpp/emit-record-view.d.ts +5 -10
  854. package/dist/targets/cpp/emit-record-view.js +223 -269
  855. package/dist/targets/cpp/emit-return.js +33 -8
  856. package/dist/targets/cpp/emit-scopes.d.ts +2 -2
  857. package/dist/targets/cpp/emit-sum-widening.js +13 -5
  858. package/dist/targets/cpp/emit-tonumber.d.ts +1 -1
  859. package/dist/targets/cpp/emit-tonumber.js +3 -3
  860. package/dist/targets/cpp/emit-tostring.d.ts +20 -2
  861. package/dist/targets/cpp/emit-tostring.js +131 -28
  862. package/dist/targets/cpp/emit-typeof.d.ts +4 -0
  863. package/dist/targets/cpp/emit-typeof.js +29 -1
  864. package/dist/targets/cpp/emit-union-properties.d.ts +6 -23
  865. package/dist/targets/cpp/emit-union-properties.js +127 -235
  866. package/dist/targets/cpp/emit.d.ts +4 -1
  867. package/dist/targets/cpp/emit.js +336 -119
  868. package/dist/targets/cpp/error-types.d.ts +1 -3
  869. package/dist/targets/cpp/error-types.js +1 -2
  870. package/dist/targets/cpp/evaluated-once.d.ts +4 -4
  871. package/dist/targets/cpp/evaluated-once.js +5 -5
  872. package/dist/targets/cpp/function-source-reads.d.ts +2 -15
  873. package/dist/targets/cpp/function-source-reads.js +3 -38
  874. package/dist/targets/cpp/host/core-globals.d.ts +5 -0
  875. package/dist/targets/cpp/host/core-globals.js +10 -0
  876. package/dist/targets/cpp/host/emit-host-arity.js +1 -1
  877. package/dist/targets/cpp/host/emit-host-invoke.js +73 -23
  878. package/dist/targets/cpp/host/emit-host-object.d.ts +2 -1
  879. package/dist/targets/cpp/host/emit-host-object.js +328 -145
  880. package/dist/targets/cpp/host/emit-host-properties.js +4 -6
  881. package/dist/targets/cpp/host/emit-host-reflect.js +29 -5
  882. package/dist/targets/cpp/host/emit-host-value.d.ts +1 -1
  883. package/dist/targets/cpp/host/emit-host-value.js +2 -2
  884. package/dist/targets/cpp/host/host-members.d.ts +11 -0
  885. package/dist/targets/cpp/host/host-members.js +27 -5
  886. package/dist/targets/cpp/host/host-method-aliases.d.ts +1 -30
  887. package/dist/targets/cpp/host/host-method-aliases.js +1 -76
  888. package/dist/targets/cpp/host/native-protocols.js +1 -1
  889. package/dist/targets/cpp/host/object-protocol.d.ts +1 -1
  890. package/dist/targets/cpp/host/object-protocol.js +24 -24
  891. package/dist/targets/cpp/host-namespace-reads.d.ts +1 -83
  892. package/dist/targets/cpp/host-namespace-reads.js +1 -113
  893. package/dist/targets/cpp/manifest/capabilities.js +33 -33
  894. package/dist/targets/cpp/manifest.d.ts +5 -0
  895. package/dist/targets/cpp/manifest.js +38 -14
  896. package/dist/targets/cpp/native-collection-base.js +7 -6
  897. package/dist/targets/cpp/native-debug-source.d.ts +15 -0
  898. package/dist/targets/cpp/native-debug-source.js +21 -0
  899. package/dist/targets/cpp/native-error-base.d.ts +1 -1
  900. package/dist/targets/cpp/native-error-base.js +1 -1
  901. package/dist/targets/cpp/native-narrowing-transport.d.ts +2 -0
  902. package/dist/targets/cpp/native-narrowing-transport.js +25 -5
  903. package/dist/targets/cpp/native-view-targets.d.ts +3 -0
  904. package/dist/targets/cpp/native-view-targets.js +5 -0
  905. package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +3 -33
  906. package/dist/targets/cpp/prototype/emit-prototype-array.js +40 -22
  907. package/dist/targets/cpp/prototype/emit-prototype-date.d.ts +1 -58
  908. package/dist/targets/cpp/prototype/emit-prototype-date.js +14 -97
  909. package/dist/targets/cpp/prototype/emit-prototype-error.d.ts +20 -0
  910. package/dist/targets/cpp/prototype/emit-prototype-error.js +2 -2
  911. package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +3 -27
  912. package/dist/targets/cpp/prototype/emit-prototype-invoke.js +60 -52
  913. package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +1 -41
  914. package/dist/targets/cpp/prototype/emit-prototype-iterator.js +4 -43
  915. package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +2 -13
  916. package/dist/targets/cpp/prototype/emit-prototype-promise.js +10 -58
  917. package/dist/targets/cpp/prototype/emit-prototype-regexp.d.ts +4 -25
  918. package/dist/targets/cpp/prototype/emit-prototype-regexp.js +16 -81
  919. package/dist/targets/cpp/prototype/emit-prototype-string.d.ts +1 -1
  920. package/dist/targets/cpp/prototype/emit-prototype-string.js +17 -28
  921. package/dist/targets/cpp/prototype/prototype-method-reads.js +4 -80
  922. package/dist/targets/cpp/reactive-dependencies.d.ts +12 -6
  923. package/dist/targets/cpp/reactive-dependencies.js +62 -42
  924. package/dist/targets/cpp/reactive-origins.js +12 -0
  925. package/dist/targets/cpp/records.d.ts +133 -14
  926. package/dist/targets/cpp/records.js +345 -153
  927. package/dist/targets/cpp/regexp-types.d.ts +1 -26
  928. package/dist/targets/cpp/regexp-types.js +4 -29
  929. package/dist/targets/cpp/segment-scopes.d.ts +30 -0
  930. package/dist/targets/cpp/segment-scopes.js +294 -0
  931. package/dist/targets/cpp/translation-unit.d.ts +21 -2
  932. package/dist/targets/cpp/translation-unit.js +121 -276
  933. package/dist/targets/cpp/types.d.ts +8 -3
  934. package/dist/targets/cpp/types.js +30 -6
  935. package/dist/targets/cpp/virtual-callees.d.ts +18 -0
  936. package/dist/targets/cpp/virtual-callees.js +27 -0
  937. package/dist/targets/cpp/virtual-methods.d.ts +7 -7
  938. package/dist/targets/cpp/virtual-methods.js +213 -58
  939. package/package.json +8 -3
  940. package/src/targets/cpp/runtime/gea_dictionary_view.h +204 -0
  941. package/src/targets/cpp/runtime/gea_document_view.h +845 -0
  942. package/src/targets/cpp/runtime/gea_dynamic_proxy.h +66 -23
  943. package/src/targets/cpp/runtime/gea_eval.h +6 -6
  944. package/src/targets/cpp/runtime/gea_runtime.h +7550 -1166
  945. package/dist/targets/cpp/direct-call-receivers.d.ts +0 -37
  946. package/dist/targets/cpp/direct-call-receivers.js +0 -79
@@ -1,26 +1,48 @@
1
1
  import { callableCompletionSummaryOf } from './flow/callable-completions.js';
2
+ import { relative } from 'node:path';
2
3
  import ts from 'typescript';
3
4
  import { globalSymbolBehindModuleAmbientConst, isAmbientDeclaration, moduleAmbientGlobalSatisfiesDeclaration } from '../ambient.js';
4
- import { unwrapErasedExpression } from './producers/erasure.js';
5
+ import { outermostErasureOf, unwrapErasedExpression } from './producers/erasure.js';
5
6
  import { scriptGlobalValueRedefinitionOf } from './script-global-redefinition.js';
6
7
  import { reflectiveDefinitionMayInstallGetterOf, sourceClassDataMemberPlanOf } from './flow/source-class-data.js';
7
8
  import { sourceRecordSlotValuesOf } from './flow/source-record-data.js';
8
9
  import { isRealCallableDeclaration, runtimeParametersOf } from './flow/targets.js';
9
10
  import { isVacuousOrigin, seededOriginSolver } from './flow/seeded-origins.js';
10
- import { closedCallableAuthorityOf, closedValueOriginAuthorityOf } from './flow/callable-reach.js';
11
+ import { closedCallableAuthorityOf, closedValueOriginAuthorityOf, hasClosedValueUses, sourceInvocationFactHasJointTargets } from './flow/callable-reach.js';
12
+ import { sourceValueSessionOf } from './flow/source-value-session.js';
13
+ import { sourceBindingValuesOf } from './flow/value-provenance.js';
14
+ import { sourceExecutingParameterValuesOf } from './flow/source-executing-parameter-values.js';
15
+ import { standardPrototypeMethodSourceOf } from './flow/standard-prototype-method-source.js';
16
+ import { sourceCallableObjectOf, sourceCallableOwnDataWriteOf } from './flow/source-callable-own-data.js';
17
+ import { sourceIntrinsicMemberInvocationOf } from './flow/source-intrinsic-member-data.js';
11
18
  import { sourceConstructorSelectionsOf, sourceConstructorReturnValuesOf } from './flow/member-call-forwarding.js';
12
19
  import { wholeProgram } from './reachability.js';
13
20
  import { createPropertyKeyDomains } from './property-key-domain.js';
14
- import { HostMutationTaint, everyKey, keySetTouches, namedKey, numericKeys } from './host-mutation-keys.js';
21
+ import { HostMutationTaint, everyKey, keySetTouches, namedKey, numericKeys, programSymbolKeys } from './host-mutation-keys.js';
15
22
  import { attachDeferredIntrinsicProtocolLedger, createDeferredIntrinsicProtocolLedger, deferredIntrinsicProtocolLedgerOf, failedIntrinsicProtocolRequirements } from './deferred-intrinsic-protocols.js';
16
23
  import { symbolIsStandardLibraryMutator, symbolStatesHostInert, symbolWritesNoIntrinsicProperty } from './host-effect-contracts.js';
17
- import { createMutationKeyReader, hostAccessorNamesOf, isProgramDeclaredSymbolKey, keyOfName } from './host-mutation-key-reader.js';
24
+ import { createMutationKeyReader, hostAccessorNamesOf, keyOfName } from './host-mutation-key-reader.js';
25
+ import { programSymbolOriginOf } from './callable-data-write.js';
26
+ import { intrinsicAccessorGetterChainOf } from './intrinsic-accessor-getter.js';
27
+ // A source file named the way a reader finds it: from the directory the compiler runs in.
28
+ const displayPath = (fileName) => relative(process.cwd(), fileName);
18
29
  const staticKeyOf = (node) => {
19
30
  if (ts.isPropertyAccessExpression(node))
20
31
  return node.name.text;
21
32
  const argument = node.argumentExpression;
22
33
  return ts.isStringLiteralLike(argument) || ts.isNumericLiteral(argument) ? argument.text : null;
23
34
  };
35
+ /** A function declaration with no body in an ambient context: a declaration file, or under `declare` (`declare global { ... }`). */
36
+ const isBodilessAmbientFunction = (declaration) => {
37
+ if (!ts.isFunctionDeclaration(declaration) || declaration.body !== undefined)
38
+ return false;
39
+ if (declaration.getSourceFile().isDeclarationFile)
40
+ return true;
41
+ for (let current = declaration; current !== undefined; current = current.parent)
42
+ if (ts.canHaveModifiers(current) && (ts.getCombinedModifierFlags(current) & ts.ModifierFlags.Ambient) !== 0)
43
+ return true;
44
+ return false;
45
+ };
24
46
  const staticKeyExpression = (expression) => {
25
47
  const current = unwrapErasedExpression(expression);
26
48
  return ts.isStringLiteralLike(current) || ts.isNumericLiteral(current) ? current.text : null;
@@ -44,35 +66,6 @@ const isIntrinsicGlobalThis = (node, names) => {
44
66
  const expression = unwrapErasedExpression(node);
45
67
  return ts.isIdentifier(expression) && names.isIntrinsicGlobalThis(expression);
46
68
  };
47
- const isDirectAssignmentTarget = (node) => {
48
- let current = node;
49
- let parent = current.parent;
50
- while (true) {
51
- const nested = (ts.isParenthesizedExpression(parent) && parent.expression === current) ||
52
- (ts.isPropertyAssignment(parent) && parent.initializer === current) ||
53
- (ts.isShorthandPropertyAssignment(parent) && parent.name === current) ||
54
- (ts.isSpreadAssignment(parent) && parent.expression === current) ||
55
- (ts.isSpreadElement(parent) && parent.expression === current) ||
56
- (ts.isObjectLiteralExpression(parent) && parent.properties.includes(current)) ||
57
- (ts.isArrayLiteralExpression(parent) && parent.elements.includes(current));
58
- if (!nested)
59
- break;
60
- current = parent;
61
- parent = current.parent;
62
- }
63
- if (ts.isDeleteExpression(parent) && parent.expression === current)
64
- return true;
65
- if ((ts.isPrefixUnaryExpression(parent) || ts.isPostfixUnaryExpression(parent)) &&
66
- parent.operand === current &&
67
- (parent.operator === ts.SyntaxKind.PlusPlusToken || parent.operator === ts.SyntaxKind.MinusMinusToken)) {
68
- return true;
69
- }
70
- return ((ts.isBinaryExpression(parent) &&
71
- parent.left === current &&
72
- parent.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
73
- parent.operatorToken.kind <= ts.SyntaxKind.LastAssignment) ||
74
- ((ts.isForOfStatement(parent) || ts.isForInStatement(parent)) && parent.initializer === current));
75
- };
76
69
  const initialCensusSeed = {
77
70
  names: new Set(),
78
71
  all: false,
@@ -113,6 +106,14 @@ computedKeysOf = () => null,
113
106
  */
114
107
  staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
115
108
  const tainted = new HostMutationTaint();
109
+ const invocationRequirements = new Map();
110
+ const invocationLedger = deferredIntrinsicProtocolLedgerOf(flow) ?? createDeferredIntrinsicProtocolLedger();
111
+ if (!deferredIntrinsicProtocolLedgerOf(flow))
112
+ attachDeferredIntrinsicProtocolLedger(flow, invocationLedger);
113
+ const retainRequirements = (node, requirements) => {
114
+ const previous = invocationRequirements.get(node) ?? [];
115
+ invocationRequirements.set(node, [...previous, ...requirements.filter((requirement) => !previous.includes(requirement))]);
116
+ };
116
117
  // Every intrinsic member name this run trusted, and every key its visit
117
118
  // wrote on a surface, a global binding or an intrinsic object: see
118
119
  // `IntrinsicTrustSeed`.
@@ -131,6 +132,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
131
132
  return {
132
133
  names: new Set([...surface.names, ...(own?.names ?? [])]),
133
134
  numeric: surface.numeric || (own?.numeric ?? false),
135
+ programSymbols: surface.programSymbols === true || own?.programSymbols === true,
134
136
  every: surface.every || (own?.every ?? false)
135
137
  };
136
138
  };
@@ -153,7 +155,16 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
153
155
  const intrinsicReflectionIsIntact = () => !allIntrinsicTrustInvalidated && !intrinsicSurfaceMemberReplaced;
154
156
  /** `GEA_PROGRAM_BODY_CALLS=0` files the wildcard for every unnamed callee again, so one build can be measured with and without the rule. */
155
157
  const programBodyCallsEnabled = process.env['GEA_PROGRAM_BODY_CALLS'] !== '0';
156
- const callRunsOnlyProgramBodies = (call) => programBodyCallsEnabled && programBodyOnlyCalls.has(call) && intrinsicReflectionIsIntact();
158
+ // These entries authenticate a real own-data installation and its exact
159
+ // source frame, independently of the intentionally replaced library
160
+ // member. Their captured obligations still owe final census discharge.
161
+ const sourceIntrinsicReplacementCalls = new Set();
162
+ const sourceJointInvocationCalls = new Set();
163
+ const sourceIntrinsicInstallations = new Set();
164
+ const callRunsOnlyProgramBodies = (call) => programBodyCallsEnabled &&
165
+ ((programBodyOnlyCalls.has(call) && intrinsicReflectionIsIntact()) ||
166
+ sourceIntrinsicReplacementCalls.has(call) ||
167
+ sourceJointInvocationIsClosed(call));
157
168
  const wildcardReasonCounts = new Map();
158
169
  /** `GEA_PROGRAM_BODY_DEBUG=1`: every wildcard site, so the residue can be ranked by shape without the full mutation log. */
159
170
  const wildcardSites = [];
@@ -168,7 +179,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
168
179
  wildcardReasonCounts.set(reason, (wildcardReasonCounts.get(reason) ?? 0) + 1);
169
180
  const file = node.getSourceFile();
170
181
  const position = file.getLineAndCharacterOfPosition(node.getStart(file));
171
- const where = `${file.fileName.replace(/^.*\/(examples|compiler)\//, '$1/')}:${position.line + 1}`;
182
+ const where = `${displayPath(file.fileName)}:${position.line + 1}`;
172
183
  wildcardSites.push(`${reason} :: ${where} ${node.getText(file).slice(0, 90).replace(/\s+/g, ' ')}`);
173
184
  }
174
185
  tainted.taintSurface(everyKey);
@@ -202,6 +213,46 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
202
213
  };
203
214
  const reachableFlowCalls = flow.calls.filter((site) => flowSiteIsReachable(site.call));
204
215
  const reachableWrites = flow.allWrites.filter((write) => flowSiteIsReachable(write.site));
216
+ // Write positions come from the shared edge inventory, including erased
217
+ // wrappers and destructuring. Reclassifying parent syntax here missed
218
+ // `(Symbol as any) = replacement` and preserved a false stock-factory proof.
219
+ const directWriteTargets = new Set();
220
+ for (const write of reachableWrites) {
221
+ if (write.propertyAccess !== null) {
222
+ directWriteTargets.add(write.propertyAccess);
223
+ continue;
224
+ }
225
+ if (write.slot !== 'whole' || write.naming === null)
226
+ continue;
227
+ if (write.edge === 'identifier-assignment' ||
228
+ write.edge === 'compound-assignment' ||
229
+ write.edge === 'logical-assignment' ||
230
+ write.edge === 'destructuring' ||
231
+ write.edge === 'destructuring-default' ||
232
+ write.edge === 'iteration-binding')
233
+ directWriteTargets.add(write.naming);
234
+ }
235
+ const isDirectAssignmentTarget = (node) => directWriteTargets.has(node);
236
+ // The JS binder adds expando-owner identifiers to a library symbol's
237
+ // declarations. They describe these runtime writes, not a new value binding.
238
+ // Keep only names on the shared write-address spine; a source declaration
239
+ // that really shadows the binding remains outside the standard identity.
240
+ const writtenAddressNames = new Set();
241
+ for (const write of reachableWrites) {
242
+ let address = write.propertyAccess ?? write.naming;
243
+ while (address !== null) {
244
+ const current = unwrapErasedExpression(address);
245
+ if (ts.isIdentifier(current)) {
246
+ writtenAddressNames.add(current);
247
+ break;
248
+ }
249
+ if (ts.isPropertyAccessExpression(current) && ts.isIdentifier(current.name))
250
+ writtenAddressNames.add(current.name);
251
+ if (!ts.isPropertyAccessExpression(current) && !ts.isElementAccessExpression(current))
252
+ break;
253
+ address = current.expression;
254
+ }
255
+ }
205
256
  const nodes = [];
206
257
  for (const file of files) {
207
258
  if (file.isDeclarationFile)
@@ -218,8 +269,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
218
269
  // `ts.isExpression` is a pure SYNTAX-KIND test: `Identifier` is one shared
219
270
  // node kind between value and type positions, so it answers `true` for the
220
271
  // `globalThis` naming a dotted TYPE too -- the qualifier of a
221
- // `ts.QualifiedName` (`globalThis.ResponseInit`'s type annotation, spelled
222
- // by `@hono/node-server`'s own `context.ts`). A `QualifiedName` navigates a
272
+ // `ts.QualifiedName` (a `globalThis.ResponseInit` type annotation, as a
273
+ // library may spell it). A `QualifiedName` navigates a
223
274
  // NAMESPACE to look up a type member; it never asks what `globalThis` is AS
224
275
  // A VALUE, so `checker.getTypeAtLocation` on the qualifier answers `any` --
225
276
  // and an `any` `intrinsicGlobalType` makes `isTypeAssignableTo(x,
@@ -227,12 +278,12 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
227
278
  // authenticating every one of them (`isAuthenticatedEquivalentGlobal`) as
228
279
  // the global object itself. That was the whole of a false
229
280
  // `Buffer.from`/`Buffer.isBuffer`/`Buffer.alloc` "opaque or global method
230
- // receiver" wildcard on `hono-bridge`: nothing in the reachable program
231
- // reads `globalThis` as a value, but hono's `context.ts` spells `init?:
281
+ // receiver" wildcard on a program where nothing reachable reads
282
+ // `globalThis` as a value, but one library file spells `init?:
232
283
  // globalThis.ResponseInit`, and this loop took that type-only occurrence as
233
284
  // its evidence of the real thing.
234
285
  //
235
- // A bare `typeof globalThis` type QUERY (`node-globals.ts`'s `var global:
286
+ // A bare `typeof globalThis` type QUERY (a host global script's `var global:
236
287
  // typeof globalThis`) is not the same hazard and must NOT be excluded the
237
288
  // same way: `typeof X` has to resolve `X` as a value to build its type, so
238
289
  // `getTypeAtLocation` on a `TypeQueryNode`'s `exprName` answers with
@@ -321,8 +372,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
321
372
  * own "does this file have a top-level `import`/`export`" answer, so it is
322
373
  * the same fact the runtime uses to decide the file's own module-ness.
323
374
  * A file with neither is a SCRIPT and is sloppy unless it opens with its
324
- * own `'use strict'` directive prologue -- `node-compat/runtime/node/globals.ts`
325
- * and `whatwg-streams.ts` are exactly this: deliberately-authored scripts,
375
+ * own `'use strict'` directive prologue -- runtime polyfill files that
376
+ * install globals are often exactly this: deliberately-authored scripts,
326
377
  * not modules, so they must NOT be read as strict just because the rest of
327
378
  * the program is ESM.
328
379
  *
@@ -449,7 +500,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
449
500
  // anywhere in a program took `Object` with it, and every proof that asks
450
501
  // whether `Object.getOwnPropertyDescriptor` is intact answered no.
451
502
  return (declarations.some((declaration) => declaration.getSourceFile().hasNoDefaultLib) &&
452
- declarations.every((declaration) => declaration.getSourceFile().hasNoDefaultLib || ts.isInterfaceDeclaration(declaration)));
503
+ declarations.every((declaration) => declaration.getSourceFile().hasNoDefaultLib ||
504
+ ts.isInterfaceDeclaration(declaration) ||
505
+ (ts.isIdentifier(declaration) && writtenAddressNames.has(declaration))));
453
506
  };
454
507
  const hasStandardLibraryDeclaration = (symbol) => (symbol.declarations ?? []).some((declaration) => declaration.getSourceFile().hasNoDefaultLib);
455
508
  const isStandardLibraryDeclaration = (declaration) => !!declaration && declaration.getSourceFile().hasNoDefaultLib;
@@ -465,7 +518,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
465
518
  if (!symbol || !isStandardLibrarySymbol(symbol))
466
519
  return;
467
520
  const type = checker.getTypeOfSymbolAtLocation(symbol, location);
468
- if (type.getConstructSignatures().length > 0 || symbol.name === 'Reflect') {
521
+ // Call-only factories and namespace objects own replaceable members too;
522
+ // their aliases must participate in the same mutation authority as constructors.
523
+ if (type.getConstructSignatures().length > 0 || symbol.name === 'Reflect' || symbol.name === 'Symbol' || symbol.name === 'JSON') {
469
524
  canonicalConstructors.set(symbol, symbol);
470
525
  const declaration = identities.symbolValueDeclarationId(symbol, location);
471
526
  if (declaration !== null)
@@ -706,11 +761,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
706
761
  // `null`/`undefined` in the union is not the global object -- it is not
707
762
  // ANY object, native or otherwise -- so it must not force the whole union
708
763
  // to answer "not proven native" the way an unauthenticated member
709
- // correctly does. Before this, `NativeWebGL2RenderingContext | null` (the
710
- // checker's own type for `_gl` at every call the compiler had not already
764
+ // correctly does. Before this, `NativeHostContext | null` (the
765
+ // checker's own type for a host-context field at every call the compiler had not already
711
766
  // null-narrowed) answered `false` here on the strength of the `null`
712
767
  // member alone, even though the SAME symbol, read at a narrowed site with
713
- // type `NativeWebGL2RenderingContext`, already authenticates. Allowing a
768
+ // type `NativeHostContext`, already authenticates. Allowing a
714
769
  // primitive member (which is what `null`/`undefined` are, per
715
770
  // `primitiveResult`'s mask) to satisfy its own slot mirrors the identical
716
771
  // allowance `objectResult`/`representedObjectResult` already make below --
@@ -797,36 +852,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
797
852
  .keysOfKeyExpression(expression.argumentExpression)
798
853
  .every((key) => key.kind === 'numeric' || (key.kind === 'name' && String(Number(key.name)) === key.name));
799
854
  };
800
- /**
801
- * A key that is a PROGRAM-DECLARED unique symbol names no string member,
802
- * ever -- the same argument `isDefinitelyNumericElementKey` makes one step
803
- * above, and a stronger one: a symbol is not a string and never converts to
804
- * one implicitly, so `o[sym] = v` cannot be the write that replaces
805
- * `__proto__`, `prototype`, or any named intrinsic member, whatever `o`
806
- * turns out to be at run time. `invalidateAllIntrinsicTrust` exists for
807
- * exactly those names and has nothing to fire on here.
808
- *
809
- * ⛔ Program-declared is the whole guard. A WELL-KNOWN symbol -- the
810
- * `unique symbol`s the standard library declares on `SymbolConstructor` --
811
- * is the opposite case: `X.prototype[Symbol.iterator] = f` genuinely
812
- * redefines intrinsic behavior under a key whose name is not a string, so
813
- * it stays on the invalidating path. `hasStandardLibraryDeclaration` is the
814
- * same test `intrinsicPrototypeDeclarationOf` uses to decide whether a
815
- * member belongs to the standard library at all. A bare `symbol`-typed key
816
- * (not unique) names an unknown symbol, so it fails closed too.
817
- *
818
- * Measured on hono. `@hono/node-server`'s `request.ts` attaches its private
819
- * state with module-level `Symbol()` keys through a `Record<string | symbol,
820
- * any>` parameter -- `request[bodyConsumedDirectlyKey] = true` at line 279.
821
- * That one write set `allIntrinsicTrustInvalidated` for the WHOLE program,
822
- * so `intrinsicReflectionIsIntact()` was false everywhere after it, so
823
- * `callRunsOnlyProgramBodies` refused at every call site, and 697 sites took
824
- * a wildcard for it -- 329 `opaque or global method receiver`, 368 `global
825
- * contained in unknown call argument`. All 39 `Buffer.*` reads were in that
826
- * set, and none of them has anything to do with `request.ts`.
855
+ /** Stock factory provenance, rather than a unique-symbol checker spelling,
856
+ * keeps private symbol writes separate from named intrinsic replacement.
857
+ * Factory integrity is discharged by the shared final census fixed point.
827
858
  */
828
- const isDefinitelyProgramSymbolElementKey = (expression) => ts.isElementAccessExpression(expression) &&
829
- isProgramDeclaredSymbolKey(publishedTypeAt(unwrapErasedExpression(expression.argumentExpression)));
859
+ const isDefinitelyProgramSymbolElementKey = (expression) => ts.isElementAccessExpression(expression) && isProgramSymbolKeyExpression(expression.argumentExpression);
830
860
  const overwrittenIntrinsicSymbols = new Set();
831
861
  const propertyKeyDomains = createPropertyKeyDomains(checker, flow, flowSiteIsReachable, publishedTypeAt);
832
862
  // A computed key set, with Object.prototype's possible enumerable keys
@@ -850,9 +880,81 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
850
880
  keys.push(keyOfName(name));
851
881
  if (inherited.numeric)
852
882
  keys.push(numericKeys);
883
+ if (inherited.programSymbols)
884
+ keys.push(programSymbolKeys);
853
885
  }
854
886
  return keys;
855
- }, publishedTypeAt);
887
+ }, publishedTypeAt, (key) => {
888
+ if (trustSeed.noComputedKeys)
889
+ return false;
890
+ const origin = programSymbolOriginOf(key, {
891
+ checker,
892
+ isStandardLibraryDeclaration: (declaration) => declaration.getSourceFile().hasNoDefaultLib
893
+ });
894
+ if (origin === null)
895
+ return false;
896
+ computedKeyRequirements.push(...origin.requirements);
897
+ return true;
898
+ });
899
+ /** The names a computed read of the intrinsic global object can select, when the key set is closed and holds only names. */
900
+ const globalReadKeysOf = (access, owner) => {
901
+ if (!ts.isElementAccessExpression(access) || staticKeyOf(access) !== null || !isIntrinsicGlobalThis(owner, names))
902
+ return null;
903
+ const keyNames = [];
904
+ for (const key of keyReader.keysOfKeyExpression(access.argumentExpression)) {
905
+ if (key.kind !== 'name')
906
+ return null;
907
+ keyNames.push(key.name);
908
+ }
909
+ return keyNames.length > 0 ? keyNames : null;
910
+ };
911
+ /**
912
+ * `globalField('navigator')`, where `globalField(name)` returns
913
+ * `globalThis[name]`: the call's result is the global's `navigator` slot,
914
+ * not every slot every other call of the helper reads. One shared return
915
+ * node merges `globalField('window')` -- the global object itself -- into
916
+ * every caller's result, so a context-free link made each `nav.method()` a
917
+ * possibly-global receiver. Only the exact shape: the returned read is keyed
918
+ * by the callee's own never-reassigned parameter, in a module body (strict,
919
+ * so `arguments` cannot alias it), and this call passes a string literal.
920
+ */
921
+ const callSiteGlobalReadKeysOf = (call, returned) => {
922
+ const access = unwrapErasedExpression(returned);
923
+ if (!ts.isElementAccessExpression(access) || staticKeyOf(access) !== null)
924
+ return null;
925
+ if (!isIntrinsicGlobalThis(unwrapErasedExpression(access.expression), names))
926
+ return null;
927
+ const key = unwrapErasedExpression(access.argumentExpression);
928
+ if (!ts.isIdentifier(key))
929
+ return null;
930
+ const parameter = bindingOf(key);
931
+ if (!parameter || !ts.isParameter(parameter) || parameter.dotDotDotToken || parameter.initializer || !ts.isIdentifier(parameter.name))
932
+ return null;
933
+ const owner = parameter.parent;
934
+ let enclosing = access.parent;
935
+ while (enclosing && !ts.isFunctionLike(enclosing))
936
+ enclosing = enclosing.parent;
937
+ if (!ts.isFunctionLike(owner) || enclosing !== owner)
938
+ return null;
939
+ if (!ts.isExternalModule(owner.getSourceFile()))
940
+ return null;
941
+ if (flow.writesToDeclaration(parameter).some((write) => write.slot === 'whole' && write.edge !== 'call-argument'))
942
+ return null;
943
+ const index = owner.parameters.indexOf(parameter);
944
+ if (call.arguments.slice(0, index + 1).some(ts.isSpreadElement))
945
+ return null;
946
+ const actual = call.arguments[index];
947
+ const literal = actual === undefined ? undefined : unwrapErasedExpression(actual);
948
+ return literal !== undefined && ts.isStringLiteralLike(literal) ? [literal.text] : null;
949
+ };
950
+ const linkReturnedValue = (call, returned, node) => {
951
+ const keys = ts.isCallExpression(call) ? callSiteGlobalReadKeysOf(call, returned) : null;
952
+ if (keys === null)
953
+ return link(valueNodeOf(returned), node);
954
+ const read = unwrapErasedExpression(returned);
955
+ for (const key of keys)
956
+ select(valueNodeOf(read.expression), key, node);
957
+ };
856
958
  /** The keys an intrinsic mutator call writes on its target, from syntax alone. */
857
959
  const staticMutatorKeys = (call, mutator) => {
858
960
  if (mutator === 'Object.defineProperty' ||
@@ -902,9 +1004,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
902
1004
  * replacement" states it as exactly `Object.keys = replacement`.
903
1005
  *
904
1006
  * `isIntrinsicSurface` is the wrong instrument for it: that predicate is
905
- * true of every NATIVE host object as well, so three's `_gl.<slot> = v` on
906
- * the realized `NativeWebGL2RenderingContext` set this for the three.js app on the
907
- * first frame it drew. Replacing a slot on a host object says nothing about
1007
+ * true of every NATIVE host object as well, so a library's `_ctx.<slot> = v`
1008
+ * on a realized native host context object set this on the first frame
1009
+ * that program drew. Replacing a slot on a host object says nothing about
908
1010
  * whether `Object.keys` still answers own keys.
909
1011
  */
910
1012
  let intrinsicSurfaceMemberReplaced = false;
@@ -1012,7 +1114,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1012
1114
  if (visited.has(current))
1013
1115
  continue;
1014
1116
  visited.add(current);
1015
- const direct = intrinsicPrototypeDeclarationOf(current);
1117
+ const direct = intrinsicPrototypeDeclarationOf(current) ?? intrinsicCallableDeclarationOf(current);
1016
1118
  if (direct !== null) {
1017
1119
  identities.add(direct);
1018
1120
  continue;
@@ -1042,6 +1144,23 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1042
1144
  checker.getPropertyOfType(checker.getTypeAtLocation(unwrapErasedExpression(current.expression)), 'prototype');
1043
1145
  return symbol && hasStandardLibraryDeclaration(symbol) ? identities.symbolDeclarationId(symbol) : null;
1044
1146
  };
1147
+ // A primordial method is itself a mutable Function object. Its own slots
1148
+ // participate in the same alias graph as the prototype/namespace that
1149
+ // initially owns it; Function.prototype integrity alone cannot guard them.
1150
+ const intrinsicCallableDeclarationOf = (expression) => {
1151
+ const current = unwrapErasedExpression(expression);
1152
+ if (!ts.isPropertyAccessExpression(current) && !ts.isElementAccessExpression(current))
1153
+ return null;
1154
+ const holder = unwrapErasedExpression(current.expression);
1155
+ if (intrinsicPrototypeDeclarationOf(holder) === null && constructorFactsOf(holder).size === 0)
1156
+ return null;
1157
+ const symbol = memberSymbolOf(current);
1158
+ if (symbol === null ||
1159
+ !isStandardLibrarySymbol(symbol) ||
1160
+ checker.getTypeOfSymbolAtLocation(symbol, current).getCallSignatures().length === 0)
1161
+ return null;
1162
+ return identities.symbolDeclarationId(symbol);
1163
+ };
1045
1164
  const markIntrinsicPrototypeMutation = (target) => {
1046
1165
  for (const id of intrinsicPrototypesOf(target))
1047
1166
  tainted.add(id);
@@ -1053,9 +1172,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1053
1172
  };
1054
1173
  /**
1055
1174
  * A write of an unknown key through a receiver only the STRUCTURAL fallback
1056
- * places on an intrinsic surface -- bson's `obj: Record<string, unknown> =
1057
- * Object.create(null)`, the driver's `dest: Document` -- is decided after
1058
- * the alias graph, not here. `Document`'s `[key: string]: any` accepts every
1175
+ * places on an intrinsic surface -- `obj: Record<string, unknown> =
1176
+ * Object.create(null)`, or a `dest: Bag` parameter -- is decided after
1177
+ * the alias graph, not here. `Bag`'s `[key: string]: any` accepts every
1059
1178
  * object type, so the type test says yes for every such receiver; only the
1060
1179
  * value's provenance can say no, and the provenance proof
1061
1180
  * (`isFreshProgramObject` below) needs the closed caller frames and source
@@ -1069,6 +1188,16 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1069
1188
  * clear it, and a re-run would only cost the time.
1070
1189
  */
1071
1190
  const deferredSurfaceWrites = [];
1191
+ const deferredDescriptorTargets = new Set();
1192
+ const isIntrinsicAccessorGetterDescriptorCall = (call) => {
1193
+ let current = call;
1194
+ for (let depth = 0; depth < 4 && current.parent !== undefined; depth++) {
1195
+ current = current.parent;
1196
+ if (ts.isPropertyAccessExpression(current) && current.name.text === 'get')
1197
+ return intrinsicAccessorGetterChainOf(checker, current)?.parts.includes(call) === true;
1198
+ }
1199
+ return false;
1200
+ };
1072
1201
  const invalidateForSurfaceWrite = (receiver, site) => {
1073
1202
  if (allIntrinsicTrustInvalidated)
1074
1203
  return;
@@ -1077,15 +1206,17 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1077
1206
  else
1078
1207
  deferredSurfaceWrites.push(receiver);
1079
1208
  };
1080
- /**
1081
- * `Object.defineProperty(o, kDecorated, ...)` with a program-declared unique
1082
- * symbol: the same argument `isDefinitelyProgramSymbolElementKey` makes for
1083
- * `o[sym] = v`. The key names no string member and is not `__proto__`, so
1084
- * whatever `o` is, it replaces no intrinsic member a static call resolves to.
1209
+ /** A proven stock program symbol names no string-resolved member. Its
1210
+ * inherited symbol interception remains visible in the program-symbol domain.
1085
1211
  */
1086
- const isProgramSymbolKeyExpression = (expression) => expression !== undefined && isProgramDeclaredSymbolKey(publishedTypeAt(unwrapErasedExpression(expression)));
1212
+ const isProgramSymbolKeyExpression = (expression) => {
1213
+ if (expression === undefined)
1214
+ return false;
1215
+ const keys = keyReader.keysOfKeyExpression(expression);
1216
+ return keys.length > 0 && keys.every((key) => key.kind === 'program-symbol');
1217
+ };
1087
1218
  const markOverwrittenMember = (target, key, keyExpression) => {
1088
- markIntrinsicPrototypeKeys(target, key === null ? [everyKey] : [key === '__proto__' ? everyKey : namedKey(key)]);
1219
+ markIntrinsicPrototypeKeys(target, key === null ? keyReader.keysOfKeyExpression(keyExpression) : [key === '__proto__' ? everyKey : namedKey(key)]);
1089
1220
  if (key === null) {
1090
1221
  if (!isProgramSymbolKeyExpression(keyExpression) && isIntrinsicSurface(target))
1091
1222
  invalidateForSurfaceWrite(target, target);
@@ -1134,6 +1265,17 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1134
1265
  !isDefinitelyNumericElementKey(node) &&
1135
1266
  !isDefinitelyProgramSymbolElementKey(node) &&
1136
1267
  isIntrinsicSurface(node.expression)) {
1268
+ const actualKeys = keyReader.keysOfAccess(node);
1269
+ if (actualKeys.length > 0 && actualKeys.every((key) => key.kind !== 'every')) {
1270
+ for (const key of actualKeys) {
1271
+ if (key.kind !== 'name')
1272
+ continue;
1273
+ const member = actualSymbol(checker.getPropertyOfType(checker.getTypeAtLocation(node.expression), key.name));
1274
+ if (member)
1275
+ overwrittenIntrinsicSymbols.add(member);
1276
+ }
1277
+ continue;
1278
+ }
1137
1279
  const domain = ts.isElementAccessExpression(node) ? propertyKeyDomains.of(node.argumentExpression) : null;
1138
1280
  // A prototype replacement can affect every method, regardless of its
1139
1281
  // name. Other computed writes invalidate only the names they can reach.
@@ -1181,11 +1323,27 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1181
1323
  const declaration = bindingOf(expression);
1182
1324
  if (!declaration || !ts.isVariableDeclaration(declaration) || !declaration.initializer)
1183
1325
  return null;
1184
- const declarationList = declaration.parent;
1185
- if (!ts.isVariableDeclarationList(declarationList) || (declarationList.flags & ts.NodeFlags.Const) === 0)
1326
+ if (trustSeed.rejectedCallableProofs.has(declaration))
1186
1327
  return null;
1187
- const writes = flow.writesToDeclaration(declaration).filter((write) => flowSiteIsReachable(write.site));
1188
- return writes.every((write) => write.edge === 'declaration-initializer') ? declaration.initializer : null;
1328
+ const proof = invocationLedger.capture(() => sourceBindingValuesOf(checker, flow, declaration));
1329
+ if (proof.value?.length !== 1 || proof.value[0] !== declaration.initializer)
1330
+ return null;
1331
+ retainRequirements(declaration, proof.requirements);
1332
+ return declaration.initializer;
1333
+ };
1334
+ const standardPrototypeMethodIsDistinct = (expression) => {
1335
+ const current = unwrapErasedExpression(expression);
1336
+ if (allIntrinsicTrustInvalidated || trustSeed.rejectedCallableProofs.has(current))
1337
+ return false;
1338
+ const method = standardPrototypeMethodSourceOf(checker, current, isStandardLibraryDeclaration);
1339
+ if (method === null)
1340
+ return false;
1341
+ const proof = invocationLedger.capture(() => invocationLedger.requirePrototypeKeys(method.intrinsic, { names: [method.key] }, current));
1342
+ if (!proof.value)
1343
+ return false;
1344
+ retainRequirements(current, proof.requirements);
1345
+ invocationLedger.include(proof.requirements);
1346
+ return true;
1189
1347
  };
1190
1348
  const authenticatedNativeConstructor = (expression, seen = new Set()) => {
1191
1349
  const current = unwrapErasedExpression(expression);
@@ -1283,8 +1441,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1283
1441
  * graph records (`AliasTerm` `proxy`). Anything else keeps the ordinary
1284
1442
  * `new` rule: a library constructor with no body is opaque.
1285
1443
  *
1286
- * mongodb's optional-dependency stub (`makeErrorModule` in `deps.ts`) is
1287
- * one: a proxy over `{ kModuleError }` whose `get` trap throws.
1444
+ * An optional-dependency stub is the typical case: a proxy over
1445
+ * `{ kModuleError }` whose `get` trap throws.
1288
1446
  */
1289
1447
  const proxyConstructorSymbol = (() => {
1290
1448
  const anchor = files[0];
@@ -1454,7 +1612,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1454
1612
  // does there -- home-object lookup changes which body runs, never which
1455
1613
  // object it runs on -- so every fact this walk proves from the ancestor
1456
1614
  // chain (a real class, not a declaration file) holds for `super` exactly
1457
- // as it does for `this`. Three's `copy(s) { super.copy(s); ... }` reads
1615
+ // as it does for `this`. A `copy(s) { super.copy(s); ... }` override reads
1458
1616
  // `super` as a method call's receiver; refusing it here (the ThisKeyword
1459
1617
  // only gate this used to be) left it "opaque", which is what widened the
1460
1618
  // final host-mutation census to `*` for the whole clone-idiom family.
@@ -1620,7 +1778,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1620
1778
  // patch has replaced it -- the same two facts `authenticatedCallable`
1621
1779
  // asks of an intrinsic. Without this every `fetch(url).text()` was an
1622
1780
  // opaque method receiver, and one of them wildcarded every host global
1623
- // in the program (examples/apps/weather, 2026-09-06).
1781
+ // in the program.
1624
1782
  return (ts.isFunctionDeclaration(binding) &&
1625
1783
  !binding.body &&
1626
1784
  writes.length === 0 &&
@@ -1683,7 +1841,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1683
1841
  return publishingRepresentations.get(current) ?? null;
1684
1842
  publishingRepresentations.set(current, expected);
1685
1843
  let result = null;
1686
- if (authenticatedIntrinsicPrototype(current)) {
1844
+ if (standardPrototypeMethodIsDistinct(current)) {
1845
+ result = 'object';
1846
+ }
1847
+ else if (authenticatedIntrinsicPrototype(current)) {
1687
1848
  result = 'object';
1688
1849
  }
1689
1850
  else if (standardGlobalValue(current) && !isProvenGlobalObject(current)) {
@@ -1725,8 +1886,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1725
1886
  result = expected;
1726
1887
  }
1727
1888
  // MEASURED DEAD END (2026-09-15): a parameter with real callers whose
1728
- // argument values do not all resolve -- `WebGLMaterials.js`'s
1729
- // `material`, forwarded many levels deep through other parameters of
1889
+ // argument values do not all resolve -- a `material`-style parameter
1890
+ // forwarded many levels deep through other parameters of
1730
1891
  // the identical shape -- cannot be trusted from `expected` alone by
1731
1892
  // relaxing the branch above to "no resolved value disagreed". Tried
1732
1893
  // exactly that; it broke `new NativeView()` off a REASSIGNED
@@ -1753,15 +1914,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1753
1914
  //
1754
1915
  // The TYPE could not answer this: `representedObjectResult` asks whether
1755
1916
  // the type's symbol is declared by a class, and an object literal's
1756
- // anonymous type is declared by the literal itself. That gap made three's
1757
- // whole renderer unprovable, because every one of its modules is a
1758
- // REVEALING MODULE factory -- `function WebGLProperties() { ... return {
1759
- // get, remove, update, dispose } }` -- so the `new Properties()` above
1760
- // reaches `localResultIsPublished` with `localReturns = [ <the literal> ]`
1761
- // and asked this function what that literal publishes. Answering `null`
1762
- // left `properties`, `textures`, `state`, `objects`, `info` and the rest
1763
- // of `WebGLRenderer`'s slots opaque, and every method call on them owed a
1764
- // wildcard.
1917
+ // anonymous type is declared by the literal itself. That gap made a whole
1918
+ // library written as REVEALING MODULE factories unprovable --
1919
+ // `function Properties() { ... return { get, remove, update, dispose } }`
1920
+ // -- because the `new Properties()` above reaches
1921
+ // `localResultIsPublished` with `localReturns = [ <the literal> ]` and
1922
+ // asked this function what that literal publishes. Answering `null` left
1923
+ // every slot holding such a record opaque, and every method call on them
1924
+ // owed a wildcard.
1765
1925
  //
1766
1926
  // Asking the EXPRESSION rather than its type is what keeps this from
1767
1927
  // laundering an identity: a cast (`globalThis as unknown as typeof lit`)
@@ -1863,12 +2023,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
1863
2023
  // not only at `primitive`.
1864
2024
  //
1865
2025
  // Restricting this arm to primitives was not a rule about evidence, it
1866
- // was the shape the arm happened to be written in. It cost the three.js app 153
1867
- // of its 364 `opaque or global method receiver` wildcards: every
1868
- // `this.position.copy( v )`, `geometry.attributes.position.set(...)`
1869
- // and `material.color.setHex(...)` -- receivers typed `Vector3`,
1870
- // `BufferAttribute`, `Color` -- read as "this might be the global
1871
- // object", and one such read taints EVERY intrinsic member query in the
2026
+ // was the shape the arm happened to be written in. It cost a large share
2027
+ // of a program's `opaque or global method receiver` wildcards: every
2028
+ // `this.position.copy( v )` or `shape.points.set(...)` -- receivers
2029
+ // typed by a program class stored in a field -- read as "this might be
2030
+ // the global object", and one such read taints EVERY intrinsic member query in the
1872
2031
  // program, which is what makes `Object.keys` fail authentication in a
1873
2032
  // program that never touches `Object.prototype`.
1874
2033
  result = expected;
@@ -2104,6 +2263,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2104
2263
  if (!isIntrinsicSurface(target) && !standardGlobalValue(target))
2105
2264
  return;
2106
2265
  if (key === null) {
2266
+ const actualKeys = keyExpression === undefined ? [] : keyReader.keysOfKeyExpression(keyExpression);
2267
+ if (actualKeys.length > 0 && actualKeys.every((one) => one.kind !== 'every')) {
2268
+ markIntrinsicPrototypeKeys(target, actualKeys);
2269
+ for (const actual of actualKeys)
2270
+ if (actual.kind === 'name')
2271
+ markOverwrittenMember(target, actual.name);
2272
+ return;
2273
+ }
2107
2274
  if (standardGlobalValue(target))
2108
2275
  invalidateAllIntrinsicTrust(target);
2109
2276
  else if (!isProgramSymbolKeyExpression(keyExpression))
@@ -2308,10 +2475,6 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2308
2475
  const callDeclarationAt = (call) => overwrittenCalls.has(call) ? undefined : (reachableCallOfNode.get(call)?.declaration ?? checker.getResolvedSignature(call)?.declaration);
2309
2476
  // Receiver, parameter and stored-call closure must consume the same proof
2310
2477
  // context. A private named-function-only enumeration loses stored methods.
2311
- const invocationRequirements = new Map();
2312
- const invocationLedger = deferredIntrinsicProtocolLedgerOf(flow) ?? createDeferredIntrinsicProtocolLedger();
2313
- if (!deferredIntrinsicProtocolLedgerOf(flow))
2314
- attachDeferredIntrinsicProtocolLedger(flow, invocationLedger);
2315
2478
  const callableFrames = closedCallableAuthorityOf(checker, flow, publishedTypeAt, (owner) => argumentsUsesByOwner.get(owner), (call) => {
2316
2479
  if (!isAuthenticatedInvocationWrapper(call))
2317
2480
  return false;
@@ -2324,6 +2487,15 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2324
2487
  const sourceInvocationFacts = new Map();
2325
2488
  const sourceFrameOwnedCalls = new Set();
2326
2489
  const refusedSourceInvocationCalls = new Set();
2490
+ const sourceJointInvocationIsClosed = (call) => {
2491
+ const fact = sourceInvocationFacts.get(call);
2492
+ return (sourceJointInvocationCalls.has(call) &&
2493
+ fact !== undefined &&
2494
+ !trustSeed.rejectedCallableProofs.has(call) &&
2495
+ !incompleteSourceInvocationCalls.has(call) &&
2496
+ !refusedSourceInvocationCalls.has(call) &&
2497
+ sourceInvocationFactHasJointTargets(flow, fact));
2498
+ };
2327
2499
  /**
2328
2500
  * Source-owned calls whose EVERY candidate callee is a body compiled here.
2329
2501
  *
@@ -2334,10 +2506,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2334
2506
  * wildcard is owed only where the callee may be EXTERNAL (an ambient host
2335
2507
  * function, a replaced intrinsic, a value this program never allocated),
2336
2508
  * because external code is not walked and could write any key on anything
2337
- * it is handed. Refusing to tell those two apart is what made 354 refused
2338
- * source invocations in three's renderer -- `properties.remove( texture )`
2339
- * and its kin -- file `*` for the whole program, which in turn refused all
2340
- * 27 `Object.prototype` key obligations and blocked the three.js app's certificate.
2509
+ * it is handed. Refusing to tell those two apart is what made hundreds of
2510
+ * refused source invocations -- `properties.remove( item )` and its kin --
2511
+ * file `*` for the whole program, which in turn refused every
2512
+ * `Object.prototype` key obligation and blocked the certificate.
2341
2513
  *
2342
2514
  * `every`, not `some`: one ambient candidate is a possible external callee
2343
2515
  * and the wildcard is owed again. Candidates are the checker's and the
@@ -2400,21 +2572,21 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2400
2572
  declaration.body !== undefined;
2401
2573
  // A body is only what this call reaches while nothing can put a
2402
2574
  // different callable in its place: the member slot that holds it, and
2403
- // the class binding the slot belongs to, must be unwritten. Three's
2575
+ // the class binding the slot belongs to, must be unwritten. The
2404
2576
  // `Writer.prototype.write = external` and `Light = opaque()` are
2405
2577
  // exactly these two replacements, and both make the callee external
2406
2578
  // again (`global-this-host-bindings.test.ts` states both).
2407
2579
  const selectionIsIntact = (declaration) => {
2408
2580
  // Only a WHOLE-cell write replaces what a cell holds. A write to a
2409
- // member of it does not: `Object3D.DEFAULT_UP = new Vector3()` is a
2581
+ // member of it does not: `Node.DEFAULT_AXIS = new Point()` is a
2410
2582
  // static field on the class, and counting it made every
2411
- // `this.scene.add( ... )`, `pilot.add( ... )` and `super.copy( ... )`
2412
- // in three read as a call through a replaceable callable.
2583
+ // `this.root.add( ... )` and `super.copy( ... )` on that class
2584
+ // read as a call through a replaceable callable.
2413
2585
  // `isIntrinsicSurface` above already filters writes the same way.
2414
2586
  //
2415
2587
  // A slot's OWN defining write does not replace what it holds either.
2416
- // `Foo.prototype.bar = function () { ... }` -- three's whole pre-class
2417
- // renderer -- writes the slot exactly once, with this very callable;
2588
+ // `Foo.prototype.bar = function () { ... }` -- the whole pre-class
2589
+ // library idiom -- writes the slot exactly once, with this very callable;
2418
2590
  // counting that write refused the call for being replaceable by
2419
2591
  // itself. A second write, with anything else, still refuses.
2420
2592
  const replaced = (node) => flow
@@ -2456,14 +2628,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2456
2628
  const selected = site.checkerDeclaration;
2457
2629
  const candidates = [selected, ...site.targets];
2458
2630
  // The checker cannot always NAME a declaration, and its silence is not a
2459
- // statement that the callee is open. Three's factory-record idiom --
2460
- // `function WebGLProperties() { function get( o ) { ... }; return { has,
2461
- // get, ... } }`, then `properties.get( material )` -- types
2462
- // `new WebGLProperties()` as `any`, because TS only infers a constructed
2631
+ // statement that the callee is open. The factory-record idiom --
2632
+ // `function Properties() { function get( o ) { ... }; return { has,
2633
+ // get, ... } }`, then `properties.get( item )` -- types
2634
+ // `new Properties()` as `any`, because TS only infers a constructed
2463
2635
  // type from a `this.x = ...` body. `getResolvedSignature` names no
2464
- // declaration for ANY call on that record, so this whole family (~182 of
2465
- // the three.js app's 198 wildcard sites) reached the census as
2466
- // `no-checker-declaration`.
2636
+ // declaration for ANY call on that record, so this whole family (most
2637
+ // of a program's wildcard sites, where the idiom is pervasive) reached
2638
+ // the census as `no-checker-declaration`.
2467
2639
  //
2468
2640
  // `callable-reach.ts` already proves these closed from the ALLOCATION
2469
2641
  // rather than from the checker's type: the record literal is reached from
@@ -2472,8 +2644,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2472
2644
  // selection -- it refuses when the slot is replaced or the allocation
2473
2645
  // merges with anything opaque -- so it admits the call on its own.
2474
2646
  // `selectionIsIntact` is also a reason to ASK the allocation proof, not only
2475
- // a missing body: `scene.onBeforeRender( ... )` names a compiled
2476
- // `Object3D.prototype.onBeforeRender`, but its slot is written elsewhere, so
2647
+ // a missing body: `node.onBeforeDraw( ... )` names a compiled
2648
+ // `Node.prototype.onBeforeDraw`, but its slot is written elsewhere, so
2477
2649
  // the checker's pick alone is not what this call reaches. The allocation
2478
2650
  // proof answers the stronger question -- every value the slot can hold is a
2479
2651
  // body compiled here -- so a replaced-but-closed slot still admits.
@@ -2507,8 +2679,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2507
2679
  // `[PB-REJECT]` line even though the authority had refused it and it
2508
2680
  // never entered `programBodyOnlyCalls`. That is the whole of the
2509
2681
  // `admitted=842 set=281` gap, and it is why every ranking taken off
2510
- // this channel pointed at ambient builtins: on `hono-hello` 500 of
2511
- // the 885 asking sites are in this bucket and NONE of them appeared
2682
+ // this channel pointed at ambient builtins: on one server program most
2683
+ // of the asking sites were in this bucket and NONE of them appeared
2512
2684
  // in the rejection list -- `this.emit( 'error', e )` 39,
2513
2685
  // `outgoing.writeHead` 9, `incoming.on`/`off`, `super.on`/`once`/
2514
2686
  // `emit`, `this.push`. Ranked wrong, they sent two sessions after the
@@ -2537,7 +2709,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2537
2709
  if (why !== 'admitted') {
2538
2710
  const file = site.call.getSourceFile();
2539
2711
  const position = file.getLineAndCharacterOfPosition(site.call.getStart(file));
2540
- const where = `${file.fileName.replace(/^.*\/(examples|compiler)\//, '$1/')}:${position.line + 1}`;
2712
+ const where = `${displayPath(file.fileName)}:${position.line + 1}`;
2541
2713
  programBodyRejections.push(`${why} :: ${where} ${site.call.getText(file).slice(0, 80).replace(/\s+/g, ' ')}`);
2542
2714
  }
2543
2715
  }
@@ -2576,7 +2748,22 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2576
2748
  continue;
2577
2749
  }
2578
2750
  }
2579
- const frameFact = ts.isCallExpression(site.call) && !site.operands.explicitThis ? invocationFact : null;
2751
+ const frameFact = ts.isCallExpression(site.call) && invocationFact !== null && !invocationFact.operands.explicitThis ? invocationFact : null;
2752
+ if (frameFact !== null && frameFact.frames.every(frameForwardingIsModelled)) {
2753
+ if (sourceInvocationFactHasJointTargets(flow, frameFact))
2754
+ sourceJointInvocationCalls.add(frameFact.call);
2755
+ const proof = invocationLedger.capture(() => sourceIntrinsicMemberInvocationOf(checker, flow, frameFact));
2756
+ if (proof.value !== null) {
2757
+ sourceIntrinsicReplacementCalls.add(frameFact.call);
2758
+ sourceIntrinsicInstallations.add(proof.value.installation);
2759
+ invocationRequirements.set(frameFact.call, [...(invocationRequirements.get(frameFact.call) ?? []), ...proof.requirements]);
2760
+ }
2761
+ }
2762
+ if (frameFact !== null &&
2763
+ frameFact.operands !== site.operands &&
2764
+ frameFact.frames.length > 0 &&
2765
+ frameFact.frames.every(frameForwardingIsModelled))
2766
+ programBodyOnlyCalls.add(site.call);
2580
2767
  if (frameFact !== null) {
2581
2768
  sourceFrameOwnedCalls.add(site.call);
2582
2769
  if (frameFact.frames.some((frame) => !frameForwardingIsModelled(frame)))
@@ -2605,16 +2792,17 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2605
2792
  overwrittenCalls.add(site.call);
2606
2793
  continue;
2607
2794
  }
2608
- const argumentsArray = site.operands.args;
2609
- const callable = site.operands.callee;
2610
- const thisArgument = site.operands.receiver;
2795
+ const actualOperands = frameFact?.operands ?? site.operands;
2796
+ const argumentsArray = actualOperands.args;
2797
+ const callable = actualOperands.callee;
2798
+ const thisArgument = actualOperands.receiver;
2611
2799
  const reachableCall = {
2612
2800
  call: site.call,
2613
2801
  declaration,
2614
2802
  callable,
2615
2803
  arguments: argumentsArray,
2616
2804
  thisArgument,
2617
- explicitThis: site.explicitThis,
2805
+ explicitThis: actualOperands.explicitThis ? site.explicitThis : null,
2618
2806
  frame
2619
2807
  };
2620
2808
  reachableCalls.push(reachableCall);
@@ -2695,8 +2883,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2695
2883
  * sites -- `enumeratedThisReceiversOf`'s own question, asked of an argument
2696
2884
  * instead of a receiver. A parameter nobody reassigns is not "no
2697
2885
  * information": `writesOf` only sees body-local writes, and an unannotated
2698
- * module-private helper (three's `renderObject( object, scene, camera,
2699
- * geometry, material, group )`) is never reassigned yet is called from
2886
+ * module-private helper (`drawItem( item, view, style, group )`) is never
2887
+ * reassigned yet is called from
2700
2888
  * every one of its own call sites with a real, known value. Filing that as
2701
2889
  * "no evidence" and sealing to `OPAQUE_UNKNOWN` is the fail-open half of
2702
2890
  * `containsGlobal` this proof closes: `callableFrames.parameterValuesOf`
@@ -2711,11 +2899,16 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2711
2899
  if (!isRealCallableDeclaration(owner) || trustSeed.rejectedCallableProofs.has(owner))
2712
2900
  return null;
2713
2901
  try {
2902
+ const executing = invocationLedger.capture(() => sourceExecutingParameterValuesOf(checker, flow, parameter));
2903
+ if (executing.value !== null) {
2904
+ retainRequirements(owner, executing.requirements);
2905
+ return executing.value;
2906
+ }
2714
2907
  // `callableFrames.parameterValuesOf` is a live, actively-edited proof
2715
2908
  // (`flow/callable-reach.ts`'s `closedCallerSitesUncached` /
2716
2909
  // `baseMemberOf`); measured against a bare `new`-invoked JS constructor
2717
- // function with nested function-declaration helpers -- three.js's own
2718
- // `WebGLRenderer` shape -- it can throw rather than return `null`
2910
+ // function with nested function-declaration helpers -- the pre-class
2911
+ // library constructor shape -- it can throw rather than return `null`
2719
2912
  // (`checker.getBaseTypes` on a non-class constructor type). A caller
2720
2913
  // proof this file cannot evaluate is exactly the "cannot be closed"
2721
2914
  // case the soundness rule already names: catch it and fail CLOSED,
@@ -2724,7 +2917,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
2724
2917
  // this fix existed.
2725
2918
  const proof = invocationLedger.capture(() => callableFrames.parameterValuesOf(parameter));
2726
2919
  if (proof.value !== null)
2727
- invocationRequirements.set(owner, proof.requirements);
2920
+ retainRequirements(owner, proof.requirements);
2728
2921
  return proof.value;
2729
2922
  }
2730
2923
  catch {
@@ -3444,8 +3637,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3444
3637
  visited.add(declaration);
3445
3638
  if (declaration.getSourceFile().isDeclarationFile)
3446
3639
  return false;
3447
- // A pre-class constructor FUNCTION -- three's `function WebGLRenderer()`,
3448
- // `function WebGLTextures()` -- has no implicit base call at all: any
3640
+ // A pre-class constructor FUNCTION -- `function Renderer()`,
3641
+ // `function Textures()` -- has no implicit base call at all: any
3449
3642
  // `Base.call( this )` in its body is an ordinary call, not a completion
3450
3643
  // this construction takes its value from. So there is no chain to walk,
3451
3644
  // and the only escape is the function's own `return someObject`, which
@@ -3493,8 +3686,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3493
3686
  const sourceFact = ts.isCallExpression(current) && sourceFrameOwnedCalls.has(current) ? sourceInvocationFacts.get(current) : undefined;
3494
3687
  if (sourceFact) {
3495
3688
  for (const frame of sourceFact.frames) {
3496
- for (const returned of [...frame.completionSummary.values, ...frame.completionSummary.yields])
3497
- link(valueNodeOf(returned), node);
3689
+ for (const returned of frame.completionSummary.values)
3690
+ linkReturnedValue(current, returned, node);
3691
+ for (const yielded of frame.completionSummary.yields)
3692
+ link(valueNodeOf(yielded), node);
3498
3693
  }
3499
3694
  }
3500
3695
  else {
@@ -3505,7 +3700,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3505
3700
  if (!flow.callableBodyIsIndexed(declaration))
3506
3701
  node.seeds.add(opaqueTerm);
3507
3702
  for (const returned of observableCompletionValuesOf(declaration))
3508
- link(valueNodeOf(returned), node);
3703
+ linkReturnedValue(current, returned, node);
3509
3704
  }
3510
3705
  }
3511
3706
  }
@@ -3552,7 +3747,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3552
3747
  const owner = unwrapErasedExpression(current.expression);
3553
3748
  const argumentsStorage = ts.isIdentifier(owner) ? argumentsStorageOfExpression.get(owner) : undefined;
3554
3749
  const declaration = isIntrinsicGlobalThis(owner, names) || !ts.isIdentifier(owner) ? null : (argumentsStorage ?? bindingOf(owner));
3555
- if (declaration === null)
3750
+ // `globalThis[name]` under a closed key set reads exactly those keys --
3751
+ // a `globalField('navigator')`-style helper. An unknown key set still
3752
+ // selects every key, the global object itself among them.
3753
+ const keys = declaration === null ? globalReadKeysOf(current, owner) : null;
3754
+ if (keys !== null)
3755
+ for (const key of keys)
3756
+ select(valueNodeOf(current.expression), key, node);
3757
+ else if (declaration === null)
3556
3758
  select(valueNodeOf(current.expression), staticKeyOf(current), node);
3557
3759
  else
3558
3760
  link(storageSelectionNodeOf(declaration, staticKeyOf(current)), node);
@@ -3576,7 +3778,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3576
3778
  // completes normally: the backend throws `MODULE_NOT_FOUND` in its place
3577
3779
  // (`gea::commonjs::absentPackage`). It hands its binding no value at all,
3578
3780
  // so it contributes no origin -- the `catch` arm's value is the only one
3579
- // mongodb's `getGcpMetadata()` can return.
3781
+ // a `try { return require( 'optional-peer' ) } catch { ... }` loader
3782
+ // can return.
3580
3783
  if (staticCommonJsRequireOutcomeOf(current) === 'absent-package')
3581
3784
  return;
3582
3785
  const call = reachableCallOfNode.get(current);
@@ -3600,13 +3803,13 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3600
3803
  for (const frame of frames)
3601
3804
  if (frame.completions.kind === 'values')
3602
3805
  for (const value of frame.completions.values)
3603
- link(valueNodeOf(value), node);
3806
+ linkReturnedValue(current, value, node);
3604
3807
  return;
3605
3808
  }
3606
3809
  node.seeds.add(representedNonGlobalTerm);
3607
3810
  if (representation === 'object' && declaration && !declaration.getSourceFile().isDeclarationFile && body) {
3608
3811
  for (const returned of observableCompletionValuesOf(declaration))
3609
- link(valueNodeOf(returned), node);
3812
+ linkReturnedValue(current, returned, node);
3610
3813
  }
3611
3814
  }
3612
3815
  else if (!declaration || declaration.getSourceFile().isDeclarationFile || !body || !flow.callableBodyIsIndexed(declaration)) {
@@ -3625,7 +3828,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3625
3828
  link(valueNodeOf(call.thisArgument), valueNodeOf(thisExpression));
3626
3829
  }
3627
3830
  for (const returned of observableCompletionValuesOf(declaration))
3628
- link(valueNodeOf(returned), node);
3831
+ linkReturnedValue(current, returned, node);
3629
3832
  }
3630
3833
  return;
3631
3834
  }
@@ -3656,7 +3859,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3656
3859
  // body, which `observableCompletionValuesOf` enumerates and links, and
3657
3860
  // a base whose construction returns, which `sourceConstructionReturnsOf`
3658
3861
  // handled above. Seeding `opaque` here instead made every unrepresented
3659
- // three.js instance -- every `new Vector3()`, every `new Scene()` --
3862
+ // library instance -- every `new Point()`, every `new Node()` --
3660
3863
  // a value that might be `globalThis`, so every method call on one and
3661
3864
  // every key written through one taints the intrinsic surface.
3662
3865
  else
@@ -3701,7 +3904,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3701
3904
  const receivers = enumeratedThisReceiversOf(current);
3702
3905
  if (receivers === null) {
3703
3906
  // No enumerated caller means this `this` reaches here through a
3704
- // dispatch the census cannot trace -- exactly `@hono/node-server`'s
3907
+ // dispatch the census cannot trace -- exactly the
3705
3908
  // `Object.defineProperty(requestPrototype, 'body', { get() { return
3706
3909
  // this[...] } })` shape, where the getter is installed dynamically
3707
3910
  // and never appears as a resolvable call target. The checker types
@@ -3892,7 +4095,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3892
4095
  shown++;
3893
4096
  const file = declaration.getSourceFile();
3894
4097
  const { line, character } = file.getLineAndCharacterOfPosition(declaration.getStart(file));
3895
- process.stderr.write(` storage decl :: ${file.fileName.replace(/^.*\/(examples|compiler|node-compat)\//, '$1/')}:${line + 1}:${character + 1} ${ts.SyntaxKind[declaration.kind]} ${declaration.getText(file).slice(0, 70).replace(/\s+/g, ' ')}\n`);
4098
+ process.stderr.write(` storage decl :: ${displayPath(file.fileName)}:${line + 1}:${character + 1} ${ts.SyntaxKind[declaration.kind]} ${declaration.getText(file).slice(0, 70).replace(/\s+/g, ' ')}\n`);
3896
4099
  }
3897
4100
  process.stderr.write(` total storage declarations mapping to biggest component: ${total} of ${storageValueNodes.size}\n`);
3898
4101
  }
@@ -3916,7 +4119,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3916
4119
  if (node.expression) {
3917
4120
  const file = node.expression.getSourceFile();
3918
4121
  const { line, character } = file.getLineAndCharacterOfPosition(node.expression.getStart(file));
3919
- return `${file.fileName.replace(/^.*\/(examples|compiler|node-compat)\//, '$1/')}:${line + 1}:${character + 1} ${node.expression.getText(file).slice(0, 80)}`;
4122
+ return `${displayPath(file.fileName)}:${line + 1}:${character + 1} ${node.expression.getText(file).slice(0, 80)}`;
3920
4123
  }
3921
4124
  }
3922
4125
  return `<synthetic component ${component.id}>`;
@@ -3943,7 +4146,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
3943
4146
  for (const [declaration, count] of topWalks) {
3944
4147
  const file = declaration.getSourceFile();
3945
4148
  const { line, character } = file.getLineAndCharacterOfPosition(declaration.getStart(file));
3946
- process.stderr.write(` fn-walk count=${count} :: ${file.fileName.replace(/^.*\/(examples|compiler|node-compat)\//, '$1/')}:${line + 1}:${character + 1} ${declaration.getText(file).slice(0, 60).replace(/\s+/g, ' ')}\n`);
4149
+ process.stderr.write(` fn-walk count=${count} :: ${displayPath(file.fileName)}:${line + 1}:${character + 1} ${declaration.getText(file).slice(0, 60).replace(/\s+/g, ' ')}\n`);
3947
4150
  }
3948
4151
  };
3949
4152
  const componentOfExpression = (expression) => {
@@ -4272,7 +4475,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
4272
4475
  // A rest whose own source component carries this same term re-enters
4273
4476
  // this rule with a strictly larger key every round: `k -> k + offset`
4274
4477
  // never repeats, so `addSelector`'s (source, key, mode) dedup can
4275
- // never fire and the key space grows without bound -- one Hono
4478
+ // never fire and the key space grows without bound -- one library
4276
4479
  // component minted millions of selectors this way, all naming the
4277
4480
  // same target, until the V8 Map hit its 2^24 cap. The unknown-key
4278
4481
  // selector is the terminating answer: it matches EVERY key, so it
@@ -4390,11 +4593,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
4390
4593
  * the value came from. It says nothing about what the value is, so on its
4391
4594
  * own it reads `header.slice(...)` -- `header: string` -- as a call that
4392
4595
  * might be running host code off the global object, and files a wildcard
4393
- * over every authenticated global for it. On `hono-hello` that is most of
4394
- * the wildcard: of the receivers reaching here, 23 are typed `string`, and
4395
- * the rest are `string[]`, `RegExp`, `Buffer`, `Promise<void>`,
4396
- * `Record<string, string>` and hono's own `Router<T>` -- none of which the
4397
- * global object inhabits.
4596
+ * over every authenticated global for it. On a typical server program that
4597
+ * is most of the wildcard: the receivers reaching here are typed `string`,
4598
+ * `string[]`, `RegExp`, `Buffer`, `Promise<void>`, `Record<string, string>`
4599
+ * and the library's own generic classes -- none of which the global object
4600
+ * inhabits.
4398
4601
  *
4399
4602
  * So ask the checker its own question: is the intrinsic global type
4400
4603
  * assignable to this expression's type? Where it is not, the value is not
@@ -4453,11 +4656,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
4453
4656
  * those, the global object is never a value anything holds -- and then an
4454
4657
  * unplaced value has nothing global to have come from.
4455
4658
  *
4456
- * This is exactly what `hono` does at all three of its `globalThis` sites:
4457
- * `const global = globalThis as any` in `helper/adapter/index.ts` and
4458
- * `jsx/context.ts`, read only as `global?.process?.env`, and
4459
- * `const { process, Deno } = globalThis as any` in `utils/color.ts`, which
4460
- * binds the members and not the object. The assertion to `any` is why the
4659
+ * This is the common library pattern for runtime detection:
4660
+ * `const global = globalThis as any`, read only as `global?.process?.env`,
4661
+ * and `const { process, Deno } = globalThis as any`, which binds the
4662
+ * members and not the object. The assertion to `any` is why the
4461
4663
  * type question cannot settle these: `globalObjectMayInhabit` has to keep
4462
4664
  * answering yes for a top type. The escape question settles them instead.
4463
4665
  *
@@ -4488,8 +4690,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
4488
4690
  if (ts.isExpressionStatement(parent))
4489
4691
  return true;
4490
4692
  // The TARGET of a direct reflection mutator -- `Object.defineProperty(
4491
- // globalThis, 'Request', { value })`, which is how @hono/node-server
4492
- // installs its lightweight Request/Response -- does not hand the object
4693
+ // globalThis, 'Request', { value })`, which is how a server adapter
4694
+ // installs a lightweight Request/Response -- does not hand the object
4493
4695
  // to code this census cannot see: the mutator branch in `visit` reads
4494
4696
  // exactly that call, stamps its keys on the target and files them through
4495
4697
  // `taintMutationKeys`, so its effect is modelled where it is spelled. What
@@ -4497,7 +4699,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
4497
4699
  // expression is the global object in whatever position IT occupies, and
4498
4700
  // the answer is that position's. Counting the argument as an escape made
4499
4701
  // every unplaced argument in the program a possible global (`error`,
4500
- // `chunk`, `name`) and stamped 110 wildcards over hono-hello.
4702
+ // `chunk`, `name`) and stamped a wildcard at each one.
4501
4703
  if (ts.isCallExpression(parent) && parent.arguments[0] === node && directMutator(parent.expression) !== null) {
4502
4704
  return benignGlobalPosition(parent, seen);
4503
4705
  }
@@ -4615,8 +4817,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
4615
4817
  // Buffer` name -- names a binding without reading or evaluating it:
4616
4818
  // no value flows, so nothing escapes. `isProvenGlobalObject` resolves
4617
4819
  // the same symbol and type here as it would at a real reference, and
4618
- // without this guard it answered every one of `node-globals.ts` and
4619
- // `buffer-types.ts`'s ambient declarations for `Buffer`/`process` as a
4820
+ // without this guard it answered every one of a host's global and
4821
+ // buffer declaration files' ambient declarations for `Buffer`/`process` as a
4620
4822
  // "may be globalThis" ESCAPE -- not because any code ever handed the
4621
4823
  // global object anywhere, but because declaring the binding's name
4622
4824
  // was mistaken for reading it. That false escape made this
@@ -4644,8 +4846,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
4644
4846
  }
4645
4847
  // A mention inside a TYPE never runs: `typeof globalThis.Response` and
4646
4848
  // `globalThis.Buffer` in a type query name the global object to spell a
4647
- // type, and no value flows. `node-globals.ts` is written almost entirely
4648
- // in those, and hono's `Response`/`WebSocket` declarations are too.
4849
+ // type, and no value flows. A host's global script may be written almost entirely
4850
+ // in those, and library `Response`/`WebSocket` declarations often are too.
4649
4851
  if (insideTypeContext(node))
4650
4852
  continue;
4651
4853
  if (isProvenGlobalObject(node) && !benignGlobalPosition(node, new Set())) {
@@ -4816,18 +5018,12 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
4816
5018
  return false;
4817
5019
  if (incompleteSourceInvocationCalls.has(call) || refusedSourceInvocationCalls.has(call))
4818
5020
  return false;
4819
- // The frame proof this closure relies on is itself a checker-selected
4820
- // body, the same kind of static selection `intrinsicReflectionIsIntact`'s
4821
- // own doc comment says a replaced `Object.keys`/`getOwnPropertyNames`
4822
- // revokes whole-program and all-or-nothing -- "which intrinsic was
4823
- // replaced does not bound which slot the replacement can reach." That was
4824
- // already wired into `callRunsOnlyProgramBodies` but not here: a source
4825
- // call closed by this proof kept its authenticated effect even after
4826
- // reflection broke, so `owner.run(globalThis)` stayed trusted after
4827
- // `Object.keys = replacement` (`global-this-host-bindings.test.ts`:
4828
- // "own-key reflection dependencies revoke source slot closure after
4829
- // method replacement").
4830
- return sourceInvocationFacts.has(call) && intrinsicReflectionIsIntact();
5021
+ // Legacy checker selection depends on intact reflection. Exact joint
5022
+ // source targets have their own allocation, writer and frame closure;
5023
+ // their registered receipt and final ledger discharge survive an unrelated
5024
+ // intrinsic member replacement without licensing a stale checker body.
5025
+ return (sourceInvocationFacts.has(call) &&
5026
+ (intrinsicReflectionIsIntact() || sourceIntrinsicReplacementCalls.has(call) || sourceJointInvocationIsClosed(call)));
4831
5027
  };
4832
5028
  const callHasAuthenticatedExternalEffect = (call) => {
4833
5029
  if (ts.isCallExpression(call) && (refusedSourceInvocationCalls.has(call) || incompleteSourceInvocationCalls.has(call)))
@@ -4998,6 +5194,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
4998
5194
  markWildcard(site, unknownReason);
4999
5195
  return;
5000
5196
  }
5197
+ if (key.kind === 'program-symbol')
5198
+ return;
5001
5199
  for (const name of key.kind === 'numeric' ? ['NaN', 'Infinity'] : [key.name]) {
5002
5200
  noteWritten(namedKey(name));
5003
5201
  for (const id of globalBindingsNamed(name, site))
@@ -5021,19 +5219,19 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5021
5219
  return;
5022
5220
  }
5023
5221
  if (process.env['GEA_DEBUG_GLOBAL_MUTATION'] === 'keys') {
5024
- debugSite(site, `${reason} [key ${key.kind === 'name' ? key.name : '<numeric>'}]`);
5222
+ debugSite(site, `${reason} [key ${key.kind === 'name' ? key.name : key.kind === 'numeric' ? '<numeric>' : '<program-symbol>'}]`);
5025
5223
  }
5026
5224
  if (process.env['GEA_PROGRAM_BODY_DEBUG']) {
5027
5225
  // A numeric key is a failure clause of its own (`surface:|numeric`), so it
5028
5226
  // needs an origin row too; it is spelled the way the clause names it.
5029
- const name = key.kind === 'name' ? key.name : '|numeric';
5227
+ const name = key.kind === 'name' ? key.name : key.kind === 'numeric' ? '|numeric' : '|program-symbols';
5030
5228
  const seen = surfaceKeyOrigins.get(name);
5031
5229
  if (seen)
5032
5230
  seen.count++;
5033
5231
  else {
5034
5232
  const file = site.getSourceFile();
5035
5233
  const position = file.getLineAndCharacterOfPosition(site.getStart(file));
5036
- const where = `${file.fileName.replace(/^.*\/(examples|compiler)\//, '$1/')}:${position.line + 1}`;
5234
+ const where = `${displayPath(file.fileName)}:${position.line + 1}`;
5037
5235
  surfaceKeyOrigins.set(name, { count: 1, site: `${where} ${site.getText(file).slice(0, 70).replace(/\s+/g, ' ')}` });
5038
5236
  }
5039
5237
  }
@@ -5103,7 +5301,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5103
5301
  // A checker-selected body is a possible target, not a closed target set.
5104
5302
  // Source invocations use the shared proof, including its revocations.
5105
5303
  // A call whose callee cell only ever holds `null`/`undefined` throws
5106
- // before any body runs (three's `texture.onUpdate( texture )`): nothing
5304
+ // before any body runs (an unset `item.onUpdate( item )` hook): nothing
5107
5305
  // receives the arguments, so there is no callee to authenticate.
5108
5306
  const asks = directMutator(node.expression) === null &&
5109
5307
  (isUntrustedMutator(node.expression) || !callHasAuthenticatedExternalEffect(node)) &&
@@ -5129,10 +5327,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5129
5327
  * `Array.prototype` to a callee this census cannot name is itself a possible
5130
5328
  * mutation of that prototype. What it stamped was `every`: any key at all.
5131
5329
  * That is the right answer for ONE kind of callee and far too strong for the
5132
- * other, and on `hono-hello` the difference was the whole certificate --
5133
- * `GEA_NO_WILDCARD=1` cleared both remaining roots and left ZERO named key
5134
- * blocking anything, so every obligation that program failed, failed on this
5135
- * `every` and on nothing else.
5330
+ * other, and on a real server program the difference was the whole
5331
+ * certificate -- `GEA_NO_WILDCARD=1` cleared both remaining roots and left
5332
+ * ZERO named key blocking anything, so every obligation that program failed,
5333
+ * failed on this `every` and on nothing else.
5136
5334
  *
5137
5335
  * The argument. Every callee is either a body this compiler compiled or a
5138
5336
  * host native behind a bodiless declaration. A COMPILED body's writes are
@@ -5186,8 +5384,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5186
5384
  /**
5187
5385
  * A reflection mutator with an unplaceable target was a THIRD whole-program
5188
5386
  * veto on the narrowing, and it was wrong: it double-counted an event the
5189
- * census already models exactly, and on `hono-hello` it alone refused all
5190
- * 1,135 asking calls -- the entire narrowing, on a syntactic property.
5387
+ * census already models exactly, and on a real server program it alone
5388
+ * refused every asking call -- the entire narrowing, on a syntactic
5389
+ * property.
5191
5390
  *
5192
5391
  * `Object.defineProperty( t, 'x', … )`, `Reflect.set( t, 'x', v )` and
5193
5392
  * `Object.assign( t, { x } )` are unplaceable-receiver writes with a
@@ -5353,7 +5552,57 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5353
5552
  });
5354
5553
  return callable ? symbol : null;
5355
5554
  };
5356
- const untaggedAmbientCallableSymbolOf = (node) => untaggedAmbientCallableSymbol(actualSymbol(checker.getSymbolAtLocation(node)), node);
5555
+ const ownCallableReadAnswers = new Map();
5556
+ const sourceOwnCallableReadIsClosed = (read) => {
5557
+ if (trustSeed.rejectedCallableProofs.has(read))
5558
+ return false;
5559
+ const known = ownCallableReadAnswers.get(read);
5560
+ if (known !== undefined)
5561
+ return known;
5562
+ const proof = invocationLedger.capture(() => {
5563
+ const owner = sourceCallableObjectOf(checker, flow, read.expression);
5564
+ const key = staticKeyOf(read);
5565
+ if (owner === null || key === null || sourceCallableOwnDataWriteOf(checker, flow, owner, key, read) === null)
5566
+ return false;
5567
+ const values = sourceValueSessionOf(checker, flow).valuesOf(read);
5568
+ return (values !== null &&
5569
+ values.length > 0 &&
5570
+ values.every((value) => isRealCallableDeclaration(value) &&
5571
+ !value.getSourceFile().isDeclarationFile &&
5572
+ value.body !== undefined &&
5573
+ flow.callableBodyIsIndexed(value)));
5574
+ });
5575
+ if (proof.value)
5576
+ invocationRequirements.set(read, proof.requirements);
5577
+ ownCallableReadAnswers.set(read, proof.value);
5578
+ return proof.value;
5579
+ };
5580
+ const untaggedAmbientCallableSymbolOf = (node) => {
5581
+ const read = node.parent;
5582
+ if (ts.isPropertyAccessExpression(read) && read.name === node && sourceOwnCallableReadIsClosed(read))
5583
+ return null;
5584
+ const symbol = actualSymbol(checker.getSymbolAtLocation(node));
5585
+ const element = constDestructuredElementOf(symbol);
5586
+ if (element !== null)
5587
+ return element.name === node ? null : destructuredCallableOf(element);
5588
+ return untaggedAmbientCallableSymbol(symbol, node);
5589
+ };
5590
+ /**
5591
+ * `const { initialize } = peer` binds the member once and never again,
5592
+ * so every mention of the local IS the member: a bare call of it is a
5593
+ * direct call of the ambient callable (stamped as one), and only a mention
5594
+ * in a value position hands the callable out. Judged per mention, like a
5595
+ * spelled `peer.initialize`, rather than as one escape at the pattern.
5596
+ */
5597
+ const constDestructuredElementOf = (symbol) => {
5598
+ const declaration = symbol?.valueDeclaration;
5599
+ if (!declaration || !ts.isBindingElement(declaration) || !ts.isIdentifier(declaration.name) || declaration.dotDotDotToken)
5600
+ return null;
5601
+ if (!ts.isObjectBindingPattern(declaration.parent) || !ts.isVariableDeclaration(declaration.parent.parent))
5602
+ return null;
5603
+ const list = declaration.parent.parent.parent;
5604
+ return ts.isVariableDeclarationList(list) && (list.flags & ts.NodeFlags.Const) !== 0 ? declaration : null;
5605
+ };
5357
5606
  /**
5358
5607
  * `resp[ 'text' ]` names the same member as `resp.text` and resolves to no
5359
5608
  * symbol at the literal, and `const { text } = resp` extracts the member as
@@ -5367,8 +5616,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5367
5616
  *
5368
5617
  * "Is the receiver declared in ambient text" was the wrong question:
5369
5618
  * `Record< string, HandlerSet >` is an ambient ALIAS over a program value
5370
- * type, so it answered yes for every one of hono's trie-router node reads
5371
- * and nothing else. The question the position actually asks is what the read
5619
+ * type, so it answered yes for every read of a router's trie nodes and
5620
+ * nothing else. The question the position actually asks is what the read
5372
5621
  * can HAND BACK -- the index-signature value types, or, when the type
5373
5622
  * declares none, its properties -- and only an ambient callable there is a
5374
5623
  * host function. `Record< string, ProgramType >` answers no.
@@ -5386,6 +5635,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5386
5635
  const access = node.parent;
5387
5636
  if (!ts.isElementAccessExpression(access) || access.argumentExpression !== node)
5388
5637
  return null;
5638
+ if (sourceOwnCallableReadIsClosed(access))
5639
+ return null;
5389
5640
  const outer = access.parent;
5390
5641
  if ((ts.isCallExpression(outer) || ts.isNewExpression(outer)) && outer.expression === access)
5391
5642
  return null;
@@ -5403,15 +5654,24 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5403
5654
  const source = ts.isVariableDeclaration(owner) ? owner.initializer : undefined;
5404
5655
  if (!source)
5405
5656
  return null;
5657
+ // The receiver rule `unknownCalleeStampIsNarrowed` applies to a spelled
5658
+ // `source.member`: a member taken off a value whose provenance is only
5659
+ // program allocations is a program value, whatever the declarations say.
5660
+ // `const { initialize } = optional`, where `optional` only ever holds the
5661
+ // program's own `{ kModuleError }` stub for a types-only peer package.
5662
+ // A source the alias graph never modelled proves nothing either way.
5663
+ const receiver = valueNodes.has(unwrapErasedExpression(source)) ? aliasFacts(source) : null;
5664
+ if (receiver && !receiver.opaque && !receiver.global && !receiver.represented && receiver.prototypes.size === 0)
5665
+ return null;
5406
5666
  const name = element.propertyName ?? element.name;
5407
5667
  if (!ts.isIdentifier(name) && !ts.isStringLiteralLike(name))
5408
5668
  return null;
5409
5669
  const property = checker.getTypeAtLocation(source).getProperty(name.text);
5410
5670
  // A destructured member is always extracted as a value; there is no
5411
5671
  // callee position to exempt.
5412
- const receiver = checker.getTypeAtLocation(source);
5672
+ const sourceType = checker.getTypeAtLocation(source);
5413
5673
  if (!property)
5414
- return unresolvedKeyYieldsAmbientCallable(receiver) ? (receiver.getSymbol() ?? null) : null;
5674
+ return unresolvedKeyYieldsAmbientCallable(sourceType) ? (sourceType.getSymbol() ?? null) : null;
5415
5675
  return untaggedAmbientCallableSymbol(actualSymbol(property), name);
5416
5676
  };
5417
5677
  /**
@@ -5426,8 +5686,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5426
5686
  * a value handed to code that could call it against a program object --
5427
5687
  * `extends` runs it through `super( ... )`, which is a direct callee.
5428
5688
  *
5429
- * Measured: without these three, `hono-hello` reported 141 escapes, every
5430
- * one of them a `Symbol.iterator` / `Number.isInteger` / `Array.isArray` /
5689
+ * Measured: without these three, a real server program reported over a
5690
+ * hundred escapes, every one of them a `Symbol.iterator` / `Number.isInteger` / `Array.isArray` /
5431
5691
  * `Object.keys` receiver or an `x instanceof Error`, and not one of them a
5432
5692
  * callable escaping as a value.
5433
5693
  */
@@ -5449,6 +5709,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5449
5709
  return true;
5450
5710
  if (ts.isExpressionWithTypeArguments(parent) && ts.isHeritageClause(parent.parent))
5451
5711
  return true;
5712
+ // `import { CGRectMake } from '...'` and `export { CGRectMake }` bind a
5713
+ // name; they read nothing. Every mention of the bound name is a node of
5714
+ // its own, judged where it is written.
5715
+ if (ts.isImportSpecifier(parent) || ts.isImportClause(parent) || ts.isNamespaceImport(parent) || ts.isExportSpecifier(parent))
5716
+ return true;
5452
5717
  // `encrypted.sort = sort`: a plain store to (or `delete` of) a member
5453
5718
  // never performs [[Get]] on it, so the library callable that member names
5454
5719
  // on the receiver's type is not read, let alone handed out. A compound or
@@ -5465,7 +5730,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5465
5730
  /**
5466
5731
  * An ambient declaration whose VALUE is program code.
5467
5732
  *
5468
- * `node-globals.ts` spells the global timers as `const setTimeout: typeof
5733
+ * A host's global script may spell the timers as `const setTimeout: typeof
5469
5734
  * import( './timers.js' ).setTimeout` -- an ambient declaration over a
5470
5735
  * PROGRAM function that has a body in a source file. Reading the declaration
5471
5736
  * alone calls that a host native and stamps `every` on every intrinsic its
@@ -5493,7 +5758,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5493
5758
  }));
5494
5759
  };
5495
5760
  /**
5496
- * mongodb's `export declare interface TypedEventEmitter<E> extends
5761
+ * A library's `export declare interface TypedEventEmitter<E> extends
5497
5762
  * EventEmitter { listeners(...): E[K][] }` merged into `export class
5498
5763
  * TypedEventEmitter<E> extends EventEmitter {}`. A method signature on an
5499
5764
  * interface puts no value anywhere: at run time `emitter.listeners` is
@@ -5549,14 +5814,15 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5549
5814
  * denylist answers "this library callable escaped as a VALUE and can install
5550
5815
  * a key", and a `ReturnsCallable` row is not a value position at all -- it is
5551
5816
  * recorded at a DIRECT CALLEE, whose receiver and result are program code.
5552
- * `programFn.bind( this )` was classified `lib-mutator` and flipped
5553
- * `hono-hello`'s whole verdict on that category error.
5817
+ * `programFn.bind( this )` was classified `lib-mutator` and flipped a
5818
+ * whole program's verdict on that category error.
5554
5819
  */
5555
5820
  const noteHostCallableEscape = (node, symbol, kind) => {
5556
5821
  const file = node.getSourceFile();
5557
5822
  const at = file.getLineAndCharacterOfPosition(node.getStart(file));
5558
5823
  hostCallableEscapes.push({
5559
- where: `${file.fileName.replace(/^.*\/(node_modules|examples|compiler|node-compat)\//, '$1/')}:${at.line + 1}`,
5824
+ source: node,
5825
+ where: `${displayPath(file.fileName)}:${at.line + 1}`,
5560
5826
  name: symbol.getName(),
5561
5827
  kind,
5562
5828
  library: (symbol.declarations ?? []).some((declaration) => isStandardLibraryDeclaration(declaration)),
@@ -5572,6 +5838,108 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5572
5838
  * here. Never set it for a kept build.
5573
5839
  */
5574
5840
  const ignoresLibraryEscapes = process.env['GEA_HOST_ESCAPE_IGNORE_LIB'] === '1';
5841
+ const retainedLibraryCallableAnswers = new Map();
5842
+ const retainedLibraryCallablePending = new Set();
5843
+ const retainLibrarySourceProtocol = (root) => {
5844
+ const method = standardPrototypeMethodSourceOf(checker, root, isStandardLibraryDeclaration);
5845
+ if (method !== null)
5846
+ return invocationLedger.requirePrototypeKeys(method.intrinsic, { names: [method.key] }, root);
5847
+ if (ts.isCallExpression(root)) {
5848
+ const bound = boundCallableTarget(root);
5849
+ return (bound !== null &&
5850
+ root.arguments.length === 1 &&
5851
+ !root.arguments.some(ts.isSpreadElement) &&
5852
+ retainLibrarySourceProtocol(unwrapErasedExpression(bound.target)) &&
5853
+ retainLibrarySourceProtocol(unwrapErasedExpression(bound.receiver)) &&
5854
+ invocationLedger.requirePrototypeKeys('Function', { names: ['bind'] }, root));
5855
+ }
5856
+ if (!ts.isPropertyAccessExpression(root))
5857
+ return false;
5858
+ const owner = intrinsicConstructorSeedOf(root.expression);
5859
+ const symbol = memberSymbolOf(root);
5860
+ const intrinsic = owner?.getName();
5861
+ if (intrinsic !== 'Object' && intrinsic !== 'Reflect' && intrinsic !== 'JSON')
5862
+ return false;
5863
+ return (owner !== null &&
5864
+ symbol !== null &&
5865
+ isStandardLibrarySymbol(symbol) &&
5866
+ authenticatedCalleeIdentity(root) &&
5867
+ invocationLedger.requireMember(intrinsic, root.name.text, root));
5868
+ };
5869
+ const retainedLibraryCallableIsClosed = (expression) => {
5870
+ const root = unwrapErasedExpression(expression);
5871
+ if (trustSeed.rejectedCallableProofs.has(root) || retainedLibraryCallablePending.has(root))
5872
+ return false;
5873
+ const previous = retainedLibraryCallableAnswers.get(root);
5874
+ if (previous !== undefined) {
5875
+ if (previous.closed)
5876
+ invocationLedger.include(previous.requirements);
5877
+ return previous.closed;
5878
+ }
5879
+ retainedLibraryCallablePending.add(root);
5880
+ let closed = false;
5881
+ let requirements = [];
5882
+ try {
5883
+ const proof = invocationLedger.capture(() => {
5884
+ if (!retainLibrarySourceProtocol(root))
5885
+ return false;
5886
+ const terminal = (reference) => {
5887
+ const current = outermostErasureOf(reference);
5888
+ const value = unwrapErasedExpression(current);
5889
+ const parent = current.parent;
5890
+ if (ts.isVariableDeclaration(parent) && parent.initializer === current) {
5891
+ const values = sourceBindingValuesOf(checker, flow, parent);
5892
+ return values?.length === 1 && values[0] === parent.initializer ? null : false;
5893
+ }
5894
+ if (ts.isCallExpression(parent) && parent.expression === current)
5895
+ return flow.calls.some((site) => site.call === parent) && authenticatedCalleeIdentity(current);
5896
+ // This family is an actual retained Function. A primitive assertion
5897
+ // or checker Never cannot turn its opaque publication into an inert
5898
+ // use before the shared receiver walk sees that transport edge.
5899
+ if (!insideTypeContext(current) && primitiveResult(checker.getTypeAtLocation(current)))
5900
+ return false;
5901
+ const factory = (ts.isPropertyAccessExpression(parent) || ts.isElementAccessExpression(parent)) && parent.expression === current
5902
+ ? parent.parent
5903
+ : parent;
5904
+ if (!ts.isCallExpression(factory))
5905
+ return null;
5906
+ const bound = boundCallableTarget(factory);
5907
+ if (bound === null ||
5908
+ factory.arguments.length !== 1 ||
5909
+ factory.arguments.some(ts.isSpreadElement) ||
5910
+ (unwrapErasedExpression(bound.target) !== value && unwrapErasedExpression(bound.receiver) !== value))
5911
+ return null;
5912
+ if (!authenticatedCalleeIdentity(bound.target) ||
5913
+ !receiverHasPublishedRepresentation(bound.receiver) ||
5914
+ !invocationLedger.requirePrototypeKeys('Function', { names: ['bind'] }, factory))
5915
+ return false;
5916
+ return retainedLibraryCallableIsClosed(factory);
5917
+ };
5918
+ return hasClosedValueUses(checker, flow, [root], terminal, publishedTypeAt, (owner) => argumentsUsesByOwner.get(owner));
5919
+ });
5920
+ closed = proof.value;
5921
+ if (closed) {
5922
+ requirements = proof.requirements;
5923
+ retainRequirements(root, proof.requirements);
5924
+ invocationLedger.include(proof.requirements);
5925
+ }
5926
+ return closed;
5927
+ }
5928
+ finally {
5929
+ retainedLibraryCallablePending.delete(root);
5930
+ retainedLibraryCallableAnswers.set(root, { closed, requirements });
5931
+ }
5932
+ };
5933
+ const retainedLibraryEscapeIsClosed = (escape) => {
5934
+ if (!escape.library || !escape.mutator || escape.kind === 'ReturnsCallable')
5935
+ return false;
5936
+ const node = escape.source;
5937
+ if (ts.isIdentifier(node)) {
5938
+ const parent = node.parent;
5939
+ return retainedLibraryCallableIsClosed(ts.isPropertyAccessExpression(parent) && parent.name === node ? parent : node);
5940
+ }
5941
+ return ts.isStringLiteralLike(node) && ts.isElementAccessExpression(node.parent) ? retainedLibraryCallableIsClosed(node.parent) : false;
5942
+ };
5575
5943
  let hostCallableEscapeAnswer = null;
5576
5944
  const untaggedHostCallableEscapesAsValue = () => {
5577
5945
  if (hostCallableEscapeAnswer !== null)
@@ -5586,6 +5954,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5586
5954
  continue;
5587
5955
  }
5588
5956
  if (ts.isBindingElement(node)) {
5957
+ // A const local's mentions are judged one by one below.
5958
+ if (constDestructuredElementOf(actualSymbol(checker.getSymbolAtLocation(node.name))) === node)
5959
+ continue;
5589
5960
  const destructured = destructuredCallableOf(node);
5590
5961
  if (destructured)
5591
5962
  noteHostCallableEscape(node, destructured, 'Destructured');
@@ -5621,7 +5992,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5621
5992
  // return `( ...args: A ) => R` -- a concrete function type built from
5622
5993
  // type parameters, which no type-parameter or top-type rule can retire
5623
5994
  // -- so `.some( ... )` matched an overload the printed `lib.es5.d.ts:357`
5624
- // row did not even name, and `bind` alone refused every call on hono.
5995
+ // row did not even name, and `bind` alone refused every call in a
5996
+ // program that binds its handlers.
5625
5997
  if (forwardingLibraryMember(node, symbol))
5626
5998
  continue;
5627
5999
  if (symbol.declarations?.some(returnHandsBackCallable))
@@ -5634,15 +6006,15 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5634
6006
  // decodeURIComponent`, `emitter.on( 'x', console.error )` hand out
5635
6007
  // spec-defined functions whose most dangerous power is running program
5636
6008
  // code -- censused where that code is written -- not installing a key.
5637
- const counted = hostCallableEscapes.filter((escape) => (!escape.library || escape.mutator) && !(ignoresLibraryEscapes && escape.library));
6009
+ const counted = hostCallableEscapes.filter((escape) => (!escape.library || escape.mutator) && !(ignoresLibraryEscapes && escape.library) && !retainedLibraryEscapeIsClosed(escape));
5638
6010
  hostCallableEscapeAnswer = counted.length > 0;
5639
6011
  return hostCallableEscapeAnswer;
5640
6012
  };
5641
6013
  /**
5642
6014
  * Which clause refused the narrowing, counted per call. `objects=0` with no
5643
6015
  * per-clause row is unreadable: three whole-program facts and one per-call
5644
- * one can each veto, and on `hono-hello` the first landing of this gate
5645
- * admitted ZERO calls with no way to say which of the four did it.
6016
+ * one can each veto, and on a real server program the first landing of
6017
+ * this gate admitted ZERO calls with no way to say which of the four did it.
5646
6018
  */
5647
6019
  const argumentStampRefusals = new Map();
5648
6020
  const hostNativeCallees = new Map();
@@ -5681,9 +6053,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5681
6053
  // it off a host object -- and every host object enters this graph opaque
5682
6054
  // (a bodiless call or construction, a declaration-file value, a class
5683
6055
  // chain that is not source-owned). A receiver whose provenance is only
5684
- // program allocations reads program values or library members. mongodb's
5685
- // `gcpMetadata.instance( ... )` is typed by the types-only `gcp-metadata`
5686
- // declarations, but the value is `getGcpMetadata()`'s: the absent
6056
+ // program allocations reads program values or library members. A
6057
+ // `peer.instance( ... )` call is typed by a types-only peer package's
6058
+ // declarations, but the value is the program's loader's: the absent
5687
6059
  // package's `require` throws, and the `catch` hands back a program proxy.
5688
6060
  // Represented and intrinsic receivers keep the declaration's answer.
5689
6061
  const calleeRead = unwrapErasedExpression(call.expression);
@@ -5729,8 +6101,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5729
6101
  // `visit`'s own mutator branch is the one authority, filing their keys (or
5730
6102
  // `every`, for an open key or an unreadable source) into
5731
6103
  // `visitWrittenKeys`, which is exactly what the narrowed stamp then reads.
5732
- // So nothing is lost by narrowing here, and 141 of `hono-hello`'s asking
5733
- // calls stop stamping `every` on every intrinsic their arguments reach.
6104
+ // So nothing is lost by narrowing here, and most of a server program's
6105
+ // asking calls stop stamping `every` on every intrinsic their arguments reach.
5734
6106
  //
5735
6107
  // An untagged HOST native keeps `every`: its writes are in no source file,
5736
6108
  // so `visitWrittenKeys` bounds nothing about it. That is the whole of the
@@ -5878,16 +6250,12 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5878
6250
  * `programBodyOnlyCalls` requires of a program body -- guarded the same
5879
6251
  * way that authority is, against a selection the program merely ASSERTED
5880
6252
  * rather than one the checker derived from a real declaration.
5881
- * `updateRanges.sort(...)` (an unannotated JS parameter's field, typed
5882
- * `{start,count}[]` by the checker) and `materialShaders.has/add(...)`
5883
- * (typed `Set<WebGLShaderStage>`) resolve this way without ever getting a
6253
+ * `ranges.sort(...)` (an unannotated JS parameter's field, typed
6254
+ * `{start,count}[]` by the checker) and `stages.has/add(...)`
6255
+ * (typed `Set<Stage>`) resolve this way without ever getting a
5884
6256
  * `publishedRepresentationOf` proof, which is why they reached this
5885
6257
  * wildcard at all -- and neither passes through an assertion to get there.
5886
6258
  */
5887
- // TEMPORARY BISECT SWITCH -- not for landing. Three rules landed together and
5888
- // one of them clears `entries.has('key')` in the spec suite, which must stay
5889
- // wildcarded. `GEA_NO_KEYSET_INERT=1` turns this one off so ONE build can
5890
- // test both arms instead of two.
5891
6259
  // DISABLED. This rule cleared the receiver wildcard whenever the CHECKER resolved a
5892
6260
  // key-set-inert standard-library method (`sort`/`has`/`add`/`slice`/`subarray`) off the
5893
6261
  // receiver's static type. That type can be fabricated: `new (construct as new () =>
@@ -5895,8 +6263,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5895
6263
  // receiver that is genuinely unknown at runtime, and the spec test `erased generic
5896
6264
  // constructor assertions retain the intrinsic callable identity` requires that call to
5897
6265
  // stay wildcarded. Guarding it with `receiverTypeIsAssertionSeeded` did not close the
5898
- // hole. Kept here, inert, because the shapes it targeted (`updateRanges.sort`,
5899
- // `materialShaders.has/add`) are real.
6266
+ // hole. Kept here, inert, because the shapes it targeted (`ranges.sort`,
6267
+ // `cache.has/add`) are real.
5900
6268
  //
5901
6269
  // MEASURED DEAD END (2026-09-15): the obvious repair -- authenticate this leg on a
5902
6270
  // representation proof instead of a checker type -- is not merely hard, it is
@@ -5913,7 +6281,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5913
6281
  // establishing the receiver's own representation assumes the declared shape matches
5914
6282
  // THIS runtime value, which is the same class of error as trusting the fabricated `Map`
5915
6283
  // type in the counter-example above. The real fix is to close the opacity upstream --
5916
- // trace `updateRanges`/`attribute` to real allocations across all call sites in the
6284
+ // trace `ranges`/`attribute` to real allocations across all call sites in the
5917
6285
  // parameter-carrier census -- so that `facts.opaque` stops being true here at all.
5918
6286
  const keySetInertEnabled = false;
5919
6287
  const calleeHasNoKeySetEffect = (callee) => {
@@ -5929,16 +6297,77 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5929
6297
  !intrinsicSymbolIsOverwritten(symbol) &&
5930
6298
  !receiverTypeIsAssertionSeeded(callee.expression));
5931
6299
  };
6300
+ /**
6301
+ * `g.fetch(url)` with `g` the global object, where every global binding the
6302
+ * key names is a bodiless ambient function declaration: unless the program
6303
+ * writes that key, the read yields the host or library function itself, and
6304
+ * calling it through the global object is the bare call `fetch(url)`. A
6305
+ * global operation receives the global object as `this` either way, and a
6306
+ * native host function takes no receiver at all. The arguments were
6307
+ * censused above exactly as for the bare call, so the receiver leg adds
6308
+ * nothing. Whether the program writes the key is known only once the visit
6309
+ * ends (`flushAmbientGlobalFunctionCalls`).
6310
+ *
6311
+ * Only a PROVEN global receiver: for an opaque one the callee itself is
6312
+ * unknown whatever the key names. A key naming anything else -- a `var`, a
6313
+ * program binding, no binding at all -- keeps the unconditional wildcard,
6314
+ * and so does an `Object.prototype` key: lib.dom declares a global
6315
+ * `function toString()`, but the global object inherits that member, and
6316
+ * nothing here proves which object along its chain answers the read. A key
6317
+ * a host accessor owns may run host code on the read itself.
6318
+ */
6319
+ let objectPrototypeType;
6320
+ const ambientGlobalFunctionKeyOf = (callee) => {
6321
+ const key = staticKeyOf(callee);
6322
+ if (key === null || hostAccessorNames.has(key))
6323
+ return null;
6324
+ if (objectPrototypeType === undefined) {
6325
+ const object = checker.resolveName('Object', undefined, ts.SymbolFlags.Value, false);
6326
+ const prototype = object ? checker.getTypeOfSymbol(object).getProperty('prototype') : undefined;
6327
+ objectPrototypeType = prototype ? checker.getTypeOfSymbol(prototype) : null;
6328
+ }
6329
+ if (objectPrototypeType === null || checker.getPropertyOfType(objectPrototypeType, key) !== undefined)
6330
+ return null;
6331
+ const bound = globalBindingsNamed(key, callee);
6332
+ const symbols = [
6333
+ checker.resolveName(key, undefined, ts.SymbolFlags.Value, false),
6334
+ intrinsicGlobalType ? checker.getPropertyOfType(intrinsicGlobalType, key) : undefined
6335
+ ].filter((symbol) => symbol !== undefined);
6336
+ if (symbols.length === 0)
6337
+ return null;
6338
+ const ids = new Set();
6339
+ for (const symbol of symbols) {
6340
+ const declarations = symbol.declarations ?? [];
6341
+ if (declarations.length === 0 || !declarations.every(isBodilessAmbientFunction))
6342
+ return null;
6343
+ const id = identities.symbolValueDeclarationId(symbol, callee);
6344
+ if (id !== null)
6345
+ ids.add(id);
6346
+ }
6347
+ return bound.every((id) => ids.has(id)) ? key : null;
6348
+ };
6349
+ const ambientGlobalFunctionCalls = [];
6350
+ const flushAmbientGlobalFunctionCalls = () => {
6351
+ const written = visitWrittenKeys.surfaceKeys;
6352
+ for (const { call, key } of ambientGlobalFunctionCalls)
6353
+ if (written.every || written.names.has(key))
6354
+ markWildcard(call, 'global method receiver whose key the program writes');
6355
+ };
5932
6356
  const visit = (node) => {
5933
6357
  if (reachable.memberIsPruned(node))
5934
6358
  return;
5935
6359
  if ((ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) && isDirectAssignmentTarget(node)) {
5936
6360
  const keys = keyReader.keysOfAccess(node);
5937
- for (const declaration of aliasFacts(node.expression).prototypes)
5938
- for (const key of keys) {
5939
- noteWritten(key);
5940
- tainted.taintObject(declaration, key);
5941
- }
6361
+ // An authenticated standard own writable data descriptor intercepts
6362
+ // this exact store. It changes the namespace's own member, not a key on
6363
+ // every prototype reachable from the constructor's public type. All
6364
+ // other stores retain the conservative inherited/opaque effect path.
6365
+ if (!sourceIntrinsicInstallations.has(node))
6366
+ for (const declaration of aliasFacts(node.expression).prototypes)
6367
+ for (const key of keys) {
6368
+ noteWritten(key);
6369
+ tainted.taintObject(declaration, key);
6370
+ }
5942
6371
  taintIntrinsicMember(node.expression, keys);
5943
6372
  }
5944
6373
  if ((ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) && mayAliasGlobal(node.expression)) {
@@ -5952,6 +6381,29 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
5952
6381
  tainted.add(declaration);
5953
6382
  }
5954
6383
  if (ts.isCallExpression(node)) {
6384
+ const declaration = callDeclarationAt(node);
6385
+ if (declaration !== undefined &&
6386
+ ts.isMethodSignature(declaration) &&
6387
+ ts.isInterfaceDeclaration(declaration.parent) &&
6388
+ declaration.parent.name.text === 'ObjectConstructor' &&
6389
+ isStandardLibraryDeclaration(declaration) &&
6390
+ ts.isIdentifier(declaration.name) &&
6391
+ declaration.name.text === 'getOwnPropertyDescriptor' &&
6392
+ authenticatedCalleeIdentity(reachableCallOfNode.get(node)?.callable ?? node.expression)) {
6393
+ // This intrinsic reads the target's own descriptor without invoking
6394
+ // its getter, but an unknown target may itself be a Proxy. Callee
6395
+ // integrity does not authenticate the target's operation protocol.
6396
+ //
6397
+ // The first link of an intrinsic accessor-getter chain is exempt: its
6398
+ // target is `Object.getPrototypeOf(<TypedArray>.prototype)`, and the
6399
+ // chain's own authentication (`authenticatedIntrinsicAccessorGetterOf`)
6400
+ // already refuses unless that prototype's [[Prototype]] was never
6401
+ // replaced (`setPrototypeOf` records every key) -- the only way it
6402
+ // could become a Proxy.
6403
+ const target = node.arguments[0];
6404
+ if (target && aliasFacts(target).opaque && !isIntrinsicAccessorGetterDescriptorCall(node))
6405
+ deferredDescriptorTargets.add(target);
6406
+ }
5955
6407
  const mutator = directMutator(node.expression);
5956
6408
  if (mutator) {
5957
6409
  // Reflect.set may define the property on its explicit receiver even
@@ -6033,10 +6485,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6033
6485
  // interface, `Array.prototype.push`, `String.prototype.split` and
6034
6486
  // their neighbours, with the receiver authenticated by
6035
6487
  // `!mayAliasGlobal` -- works on a fixture and clears NOTHING on
6036
- // `hono-hello`. The rule's whole population there refuses as
6488
+ // a real server program. The rule's whole population there refuses as
6037
6489
  // `not-standard-library`: the calls that actually reach this loop
6038
6490
  // are `this.emit( 'error', e )`, `stream.on( 'data', cb )`,
6039
- // `socket.destroy()` -- node-compat's OWN class methods, whose
6491
+ // `socket.destroy()` -- the program's OWN class methods, whose
6040
6492
  // bodies are program bodies. The fix for those is
6041
6493
  // `callRunsOnlyProgramBodies` authenticating a closed dispatch
6042
6494
  // family, not a wider builtin table here.
@@ -6050,8 +6502,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6050
6502
  // names the RULE and `[KEY-BLOCK]` names the blocked object, but
6051
6503
  // between them sits the only question left once the rule is known
6052
6504
  // -- which of this loop's refused callees reached that object --
6053
- // and nothing answered it. On `hono-hello` two objects are
6054
- // stamped at all, and 42 refused calls could have done it.
6505
+ // and nothing answered it. On a real program a couple of objects
6506
+ // are stamped at all, and dozens of refused calls could have
6507
+ // done it.
6055
6508
  if (process.env['GEA_DEBUG_GLOBAL_MUTATION']) {
6056
6509
  let callees = everyStampOrigins.get(declaration);
6057
6510
  if (!callees)
@@ -6070,7 +6523,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6070
6523
  if (process.env['GEA_ARGUMENT_WILDCARD_DEBUG'] && facts) {
6071
6524
  const file = argument.getSourceFile();
6072
6525
  const position = file.getLineAndCharacterOfPosition(argument.getStart(file));
6073
- const where = `${file.fileName.replace(/^.*\/(examples|compiler)\//, '$1/')}:${position.line + 1}:${position.character + 1}`;
6526
+ const where = `${displayPath(file.fileName)}:${position.line + 1}:${position.character + 1}`;
6074
6527
  process.stderr.write(`[ARGUMENT] ${where} trips=${containsGlobal(current)} global=${facts.global} opaque=${facts.opaque} ` +
6075
6528
  `represented=${facts.represented} published=${publishedRepresentationOf(current)} ` +
6076
6529
  `type=${checker.typeToString(checker.getTypeAtLocation(current))} text=${argument.getText(file).slice(0, 80).replace(/\s+/g, ' ')}\n`);
@@ -6125,10 +6578,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6125
6578
  // global object, the key would name a host member -- an ambient
6126
6579
  // declaration, which disqualifies the call from
6127
6580
  // `programBodyOnlyCalls` -- or nothing at all, and the call throws
6128
- // before any body runs. Three's renderer reaches 167 methods
6129
- // through receivers this census cannot place (`Color`, `Vector3`,
6130
- // `WebGLProgram` values returned by a refused call), and each one
6131
- // was filing `*` for the whole program.
6581
+ // before any body runs. A large library reaches hundreds of methods
6582
+ // through receivers this census cannot place (class instances
6583
+ // returned by a refused call), and each one was filing `*` for the
6584
+ // whole program.
6132
6585
  //
6133
6586
  // A callee the checker resolved to a key-set-inert standard-library
6134
6587
  // method (`calleeHasNoKeySetEffect`) clears this leg the same way:
@@ -6172,10 +6625,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6172
6625
  : 'bodiless-or-unclosed';
6173
6626
  const file = node.getSourceFile();
6174
6627
  const position = file.getLineAndCharacterOfPosition(node.getStart(file));
6175
- const where = `${file.fileName.replace(/^.*\/(examples|compiler)\//, '$1/')}:${position.line + 1}`;
6628
+ const where = `${displayPath(file.fileName)}:${position.line + 1}`;
6176
6629
  process.stderr.write(`[RECEIVER-WILDCARD] ${bucket} :: ${where} ${node.getText(file).slice(0, 90).replace(/\s+/g, ' ')}\n`);
6177
6630
  }
6178
- markWildcard(node, 'opaque or global method receiver');
6631
+ const ambientKey = aliasFacts(callee.expression).global ? ambientGlobalFunctionKeyOf(callee) : null;
6632
+ if (ambientKey !== null)
6633
+ ambientGlobalFunctionCalls.push({ call: node, key: ambientKey });
6634
+ else
6635
+ markWildcard(node, 'opaque or global method receiver');
6179
6636
  }
6180
6637
  }
6181
6638
  ts.forEachChild(node, visit);
@@ -6228,6 +6685,33 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6228
6685
  const symbol = actualSymbol(checker.getSymbolAtLocation(current.name));
6229
6686
  return !!symbol && symbol === expected && !allIntrinsicTrustInvalidated && !intrinsicSymbolIsOverwritten(symbol);
6230
6687
  };
6688
+ const jsonSymbol = (() => {
6689
+ const anchor = files[0];
6690
+ const symbol = anchor ? checker.resolveName('JSON', anchor, ts.SymbolFlags.Value, false) : undefined;
6691
+ return symbol && hasStandardLibraryDeclaration(symbol) ? symbol : null;
6692
+ })();
6693
+ /**
6694
+ * `JSON.parse(text)` with no reviver: every object it answers is a fresh
6695
+ * ordinary object or array built by the parser -- never a Proxy, never an
6696
+ * intrinsic, never a value the program held before. A reviver could return
6697
+ * anything, so its form is not a seed.
6698
+ */
6699
+ const trustedJsonParseWithoutReviver = (call) => {
6700
+ if (call.arguments.length !== 1 || ts.isSpreadElement(call.arguments[0]))
6701
+ return false;
6702
+ const current = unwrapErasedExpression(call.expression);
6703
+ if (!jsonSymbol || !ts.isPropertyAccessExpression(current))
6704
+ return false;
6705
+ if (actualSymbol(checker.getSymbolAtLocation(unwrapErasedExpression(current.expression))) !== jsonSymbol)
6706
+ return false;
6707
+ const expected = actualSymbol(checker.getTypeOfSymbol(jsonSymbol).getProperty('parse'));
6708
+ const symbol = actualSymbol(checker.getSymbolAtLocation(current.name));
6709
+ return (!!symbol &&
6710
+ symbol === expected &&
6711
+ !allIntrinsicTrustInvalidated &&
6712
+ !intrinsicSymbolIsOverwritten(jsonSymbol) &&
6713
+ !intrinsicSymbolIsOverwritten(symbol));
6714
+ };
6231
6715
  const neverReassigned = (declaration) => writesOf(declaration).every((write) => write.slot !== 'whole' ||
6232
6716
  write.edge === 'declaration-initializer' ||
6233
6717
  write.edge === 'call-argument' ||
@@ -6314,7 +6798,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6314
6798
  const wellKnown = owner != null &&
6315
6799
  hasStandardLibraryDeclaration(owner) &&
6316
6800
  (checker.getTypeAtLocation(expression).flags & ts.TypeFlags.UniqueESSymbol) !== 0;
6317
- if (!wellKnown && !isProgramDeclaredSymbolKey(publishedTypeAt(expression)))
6801
+ if (!wellKnown && !isProgramSymbolKeyExpression(expression))
6318
6802
  every = true;
6319
6803
  }
6320
6804
  else
@@ -6523,7 +7007,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6523
7007
  return refused;
6524
7008
  }
6525
7009
  if (ts.isCallExpression(current)) {
6526
- if (trustedObjectStatic(current.expression, 'create'))
7010
+ if (trustedObjectStatic(current.expression, 'create') || trustedJsonParseWithoutReviver(current))
6527
7011
  return { seed: true, admitted: true, dependencies: [] };
6528
7012
  const target = current.arguments[0];
6529
7013
  if (trustedObjectStatic(current.expression, 'assign') && target && !ts.isSpreadElement(target))
@@ -6539,6 +7023,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6539
7023
  }
6540
7024
  return through(values);
6541
7025
  }
7026
+ if (ts.isNewExpression(current) && sourceClassConstructionIsFresh(current))
7027
+ return { seed: true, admitted: true, dependencies: [] };
6542
7028
  if (ts.isIdentifier(current)) {
6543
7029
  const declaration = bindingOf(current);
6544
7030
  if (!declaration || (!ts.isParameter(declaration) && !ts.isVariableDeclaration(declaration)))
@@ -6547,6 +7033,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6547
7033
  return through([]);
6548
7034
  return through([declaration]);
6549
7035
  }
7036
+ // A stock prototype data method is a distinct Function object, not the
7037
+ // intrinsic constructor or prototype it was read from. This is the same
7038
+ // conditional identity used by authenticated receiver continuations.
7039
+ if (standardPrototypeMethodIsDistinct(current))
7040
+ return { seed: true, admitted: true, dependencies: [] };
6550
7041
  const stored = storedReads && ts.isPropertyAccessExpression(current) ? valueStoredJustBefore(current) : null;
6551
7042
  if (stored)
6552
7043
  return through([stored]);
@@ -6577,6 +7068,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6577
7068
  visit(statement);
6578
7069
  }
6579
7070
  flushNarrowedArgumentStamps();
7071
+ flushAmbientGlobalFunctionCalls();
6580
7072
  // With '*' every consumer refuses already. Otherwise: no name this run
6581
7073
  // trusted may have been written by its own visit; a `for-in` key set holds
6582
7074
  // every key Object.prototype may carry; and a key set's intrinsic
@@ -6586,14 +7078,15 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6586
7078
  // file their intrinsic requirements with `invocationRequirements`.
6587
7079
  const unprovenSurfaceWrite = allIntrinsicTrustInvalidated
6588
7080
  ? undefined
6589
- : deferredSurfaceWrites.find((receiver) => freshProgramObjectOrigin(receiver) === 'refused');
7081
+ : [...deferredSurfaceWrites, ...deferredDescriptorTargets].find((receiver) => freshProgramObjectOrigin(receiver) === 'refused');
6590
7082
  if (unprovenSurfaceWrite && process.env['GEA_DEBUG_GLOBAL_MUTATION'])
6591
- debugSite(unprovenSurfaceWrite, 'surface write receiver is not a fresh program object; invalidates all intrinsic trust');
7083
+ debugSite(unprovenSurfaceWrite, 'intrinsic effect receiver has no complete ordinary origin; invalidates all intrinsic trust');
6592
7084
  const written = visitWrittenKeys.surfaceKeys;
6593
7085
  const distrusted = [...trustedIntrinsicNames].filter((name) => !trustSeed.names.has(name) && keySetTouches(written, { names: [name] }));
6594
7086
  const objectPrototypeKeys = inheritedObjectPrototypeKeys ? objectPrototypeKeysOf(tainted) : trustSeed.objectPrototypeKeys;
6595
7087
  const inheritedGrew = (objectPrototypeKeys.every && !trustSeed.objectPrototypeKeys.every) ||
6596
7088
  (objectPrototypeKeys.numeric && !trustSeed.objectPrototypeKeys.numeric) ||
7089
+ (objectPrototypeKeys.programSymbols === true && trustSeed.objectPrototypeKeys.programSymbols !== true) ||
6597
7090
  [...objectPrototypeKeys.names].some((name) => !trustSeed.objectPrototypeKeys.names.has(name));
6598
7091
  const assumptionFailed = computedKeyRequirements.length > 0 &&
6599
7092
  failedIntrinsicProtocolRequirements({
@@ -6603,9 +7096,24 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6603
7096
  isStandardLibraryDeclaration: (declaration) => isStandardLibraryDeclaration(declaration)
6604
7097
  }, computedKeyRequirements).length > 0;
6605
7098
  const rejectedCallableProofs = new Set(trustSeed.rejectedCallableProofs);
6606
- for (const [call, requirements] of invocationRequirements)
6607
- if (failedIntrinsicProtocolRequirements({ checker, identities, globalHostMutationTaint: tainted, isStandardLibraryDeclaration }, requirements).length > 0)
7099
+ for (const [call, requirements] of invocationRequirements) {
7100
+ const fact = ts.isCallExpression(call) ? sourceInvocationFacts.get(call) : undefined;
7101
+ // A Script Function is also a property of the actual global object.
7102
+ // Binding integrity does not close its callers once that object enters
7103
+ // argument storage: the source reference inventory does not count
7104
+ // calls obtained from those implicit properties. Reject the conditional
7105
+ // frame using the same finalized identity graph that follows arguments
7106
+ // actual arguments, including aliases forwarded through source parameters.
7107
+ // A logical receiver has its own complete receiverUses continuation above;
7108
+ // binding it to a known body is not an argument-storage publication. Its
7109
+ // writes, returns and opaque escapes remain in the receiver alias census.
7110
+ const publishesGlobalCallable = fact !== undefined &&
7111
+ requirements.some((requirement) => requirement.sourceGlobalBinding !== undefined) &&
7112
+ fact.operands.args.some((operand) => aliasFacts(unwrapErasedExpression(operand)).global);
7113
+ if (publishesGlobalCallable ||
7114
+ failedIntrinsicProtocolRequirements({ checker, identities, globalHostMutationTaint: tainted, isStandardLibraryDeclaration }, requirements).length > 0)
6608
7115
  rejectedCallableProofs.add(call);
7116
+ }
6609
7117
  const invocationFailed = rejectedCallableProofs.size > trustSeed.rejectedCallableProofs.size;
6610
7118
  const distrustAll = written.every || unprovenSurfaceWrite !== undefined;
6611
7119
  if (distrusted.length > 0 || (distrustAll && !trustSeed.all) || inheritedGrew || assumptionFailed || invocationFailed) {
@@ -6618,6 +7126,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
6618
7126
  objectPrototypeKeys: {
6619
7127
  names: new Set([...trustSeed.objectPrototypeKeys.names, ...objectPrototypeKeys.names]),
6620
7128
  numeric: trustSeed.objectPrototypeKeys.numeric || objectPrototypeKeys.numeric,
7129
+ programSymbols: trustSeed.objectPrototypeKeys.programSymbols === true || objectPrototypeKeys.programSymbols === true,
6621
7130
  every: trustSeed.objectPrototypeKeys.every || objectPrototypeKeys.every
6622
7131
  },
6623
7132
  noComputedKeys: trustSeed.noComputedKeys || assumptionFailed,