@geastack/compiler 1.0.37 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (536) hide show
  1. package/dist/cli-emit.js +5 -0
  2. package/dist/cli.js +10 -0
  3. package/dist/compiler.d.ts +10 -3
  4. package/dist/compiler.js +364 -224
  5. package/dist/conversion/build.d.ts +13 -1
  6. package/dist/conversion/build.js +336 -141
  7. package/dist/conversion/graph-validation.d.ts +7 -2
  8. package/dist/conversion/graph-validation.js +36 -22
  9. package/dist/conversion/native-sum.js +106 -17
  10. package/dist/diagnostics/sweep.js +1 -1
  11. package/dist/ir/callable-class-flow.d.ts +0 -11
  12. package/dist/ir/callable-class-flow.js +970 -169
  13. package/dist/ir/certificate.d.ts +1 -1
  14. package/dist/ir/certificate.js +12 -1
  15. package/dist/ir/certify/carrier-keys.d.ts +17 -1
  16. package/dist/ir/certify/carrier-keys.js +35 -2
  17. package/dist/ir/certify/function-source.js +2 -1
  18. package/dist/ir/certify/has-property-key.d.ts +6 -0
  19. package/dist/ir/certify/has-property-key.js +8 -1
  20. package/dist/ir/certify/property-access-keys.js +2 -1
  21. package/dist/ir/certify/runtime-helper.js +2 -1
  22. package/dist/ir/emission-representations.d.ts +2 -2
  23. package/dist/ir/emission-representations.js +9 -3
  24. package/dist/ir/generic-call-entry.d.ts +3 -1
  25. package/dist/ir/logical-receivers.js +29 -1
  26. package/dist/ir/lower-completion.js +11 -6
  27. package/dist/ir/lower-destructuring.js +3 -2
  28. package/dist/ir/native-host-method-reads.d.ts +5 -0
  29. package/dist/ir/native-host-method-reads.js +30 -21
  30. package/dist/ir/operation-conversions.js +4 -1
  31. package/dist/ir/publish-conversion-recipes.js +12 -1
  32. package/dist/plugins/apple/jsx.js +1 -1
  33. package/dist/plugins/gea/component-classes.js +1 -1
  34. package/dist/plugins/gea/component-inline.js +1 -1
  35. package/dist/plugins/gea/contract.d.ts +1 -1
  36. package/dist/plugins/gea/contract.js +1 -1
  37. package/dist/plugins/gea/host.js +27 -1
  38. package/dist/plugins/gea/lower.js +8 -1
  39. package/dist/plugins/gea/producer.js +1 -1
  40. package/dist/plugins/gea/reactive-slots.d.ts +1 -1
  41. package/dist/plugins/gea/reactive-slots.js +1 -1
  42. package/dist/plugins/load.js +51 -22
  43. package/dist/preflight/run.d.ts +12 -1
  44. package/dist/preflight/run.js +65 -29
  45. package/dist/projection/native-callable-data.js +2 -1
  46. package/dist/representation/plan.js +102 -4
  47. package/dist/semantics/alias-this-field-declaration-transform.js +1 -1
  48. package/dist/semantics/ambient-type-realization-transform.js +1 -1
  49. package/dist/semantics/ambient.d.ts +1 -1
  50. package/dist/semantics/ambient.js +1 -1
  51. package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +1 -1
  52. package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +1 -1
  53. package/dist/semantics/call-invalidated-narrowing.d.ts +1 -1
  54. package/dist/semantics/call-invalidated-narrowing.js +4 -2
  55. package/dist/semantics/callable-own-data-slots.d.ts +6 -0
  56. package/dist/semantics/callable-own-data-slots.js +177 -101
  57. package/dist/semantics/class-alias.d.ts +1 -1
  58. package/dist/semantics/class-alias.js +1 -1
  59. package/dist/semantics/class-heritage.d.ts +1 -1
  60. package/dist/semantics/class-heritage.js +1 -1
  61. package/dist/semantics/commonjs-wrapper.d.ts +4 -3
  62. package/dist/semantics/commonjs-wrapper.js +50 -7
  63. package/dist/semantics/constructor-function-class-source-transform.js +1 -1
  64. package/dist/semantics/constructor-slot-subclasses.d.ts +1 -1
  65. package/dist/semantics/constructor-slot-subclasses.js +1 -1
  66. package/dist/semantics/declaration-overlay-transform.js +3 -2
  67. package/dist/semantics/declared-integers.d.ts +1 -1
  68. package/dist/semantics/declared-integers.js +1 -1
  69. package/dist/semantics/define-property-source-transform.js +1 -1
  70. package/dist/semantics/diagnostic-source-preparation.d.ts +1 -1
  71. package/dist/semantics/documentation-ranges.d.ts +1 -1
  72. package/dist/semantics/documentation-ranges.js +1 -1
  73. package/dist/semantics/dynamic-fallback.d.ts +1 -1
  74. package/dist/semantics/dynamic-fallback.js +1 -1
  75. package/dist/semantics/frontend-timing.js +19 -0
  76. package/dist/semantics/frontend.d.ts +2 -2
  77. package/dist/semantics/frontend.js +127 -54
  78. package/dist/semantics/host-declaration-provenance.d.ts +1 -1
  79. package/dist/semantics/host-methods.d.ts +1 -1
  80. package/dist/semantics/host-methods.js +1 -1
  81. package/dist/semantics/host-protocols.d.ts +1 -1
  82. package/dist/semantics/host-protocols.js +1 -1
  83. package/dist/semantics/inherited-accessor.d.ts +1 -1
  84. package/dist/semantics/inherited-accessor.js +1 -1
  85. package/dist/semantics/interface-families.d.ts +1 -1
  86. package/dist/semantics/interface-families.js +1 -1
  87. package/dist/semantics/interface-implementors.d.ts +1 -1
  88. package/dist/semantics/interface-implementors.js +1 -1
  89. package/dist/semantics/jsdoc-namepath-transform.js +1 -1
  90. package/dist/semantics/jsx-runtime-provider.d.ts +1 -1
  91. package/dist/semantics/jsx-runtime-provider.js +1 -1
  92. package/dist/semantics/known-caller-predicate-parameters.d.ts +1 -1
  93. package/dist/semantics/known-caller-predicate-parameters.js +1 -1
  94. package/dist/semantics/model/edges.d.ts +124 -0
  95. package/dist/semantics/model/edges.js +192 -0
  96. package/dist/semantics/model/graph.d.ts +26 -2
  97. package/dist/semantics/model/graph.js +54 -0
  98. package/dist/semantics/model/sealed-facts.d.ts +19 -0
  99. package/dist/semantics/model/sealed-facts.js +221 -0
  100. package/dist/semantics/model/selected-signature.d.ts +1 -1
  101. package/dist/semantics/model/selected-signature.js +1 -1
  102. package/dist/semantics/module-resolution.d.ts +1 -1
  103. package/dist/semantics/module-resolution.js +1 -1
  104. package/dist/semantics/native-function-signatures.d.ts +1 -1
  105. package/dist/semantics/native-function-signatures.js +1 -1
  106. package/dist/semantics/native-object-data-slots.js +20 -4
  107. package/dist/semantics/new-callee-class-tag-source-transform.js +1 -1
  108. package/dist/semantics/node-project.d.ts +1 -1
  109. package/dist/semantics/node-project.js +1 -1
  110. package/dist/semantics/node-source-hooks.js +1 -1
  111. package/dist/semantics/normalize/absent-globals.d.ts +1 -1
  112. package/dist/semantics/normalize/absent-globals.js +1 -1
  113. package/dist/semantics/normalize/any-cast-member-call.d.ts +1 -1
  114. package/dist/semantics/normalize/any-cast-member-call.js +1 -1
  115. package/dist/semantics/normalize/arguments-objects.d.ts +1 -1
  116. package/dist/semantics/normalize/arguments-objects.js +1 -1
  117. package/dist/semantics/normalize/asserted-argument-arms.d.ts +1 -1
  118. package/dist/semantics/normalize/asserted-argument-arms.js +1 -1
  119. package/dist/semantics/normalize/asserted-arm-absence.d.ts +1 -1
  120. package/dist/semantics/normalize/asserted-arm-absence.js +1 -1
  121. package/dist/semantics/normalize/assignment-patterns.d.ts +1 -1
  122. package/dist/semantics/normalize/assignment-patterns.js +1 -1
  123. package/dist/semantics/normalize/bag-absence.d.ts +1 -1
  124. package/dist/semantics/normalize/bag-absence.js +1 -1
  125. package/dist/semantics/normalize/binding-fixpoint.js +9 -2
  126. package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +1 -1
  127. package/dist/semantics/normalize/bivariant-slot-parameter.js +1 -1
  128. package/dist/semantics/normalize/callable-data-write.d.ts +1 -1
  129. package/dist/semantics/normalize/callable-data-write.js +1 -1
  130. package/dist/semantics/normalize/callback-parameter-contracts.d.ts +1 -1
  131. package/dist/semantics/normalize/callback-parameter-contracts.js +1 -1
  132. package/dist/semantics/normalize/cells/agreement.d.ts +18 -1
  133. package/dist/semantics/normalize/cells/agreement.js +8 -0
  134. package/dist/semantics/normalize/cells/candidates.d.ts +1 -1
  135. package/dist/semantics/normalize/cells/candidates.js +1 -1
  136. package/dist/semantics/normalize/cells/facts.d.ts +1 -1
  137. package/dist/semantics/normalize/cells/facts.js +1 -1
  138. package/dist/semantics/normalize/cells/index.d.ts +2 -2
  139. package/dist/semantics/normalize/cells/index.js +1 -1
  140. package/dist/semantics/normalize/cells/model.d.ts +1 -1
  141. package/dist/semantics/normalize/cells/policies/bag.d.ts +1 -1
  142. package/dist/semantics/normalize/cells/policies/collection.d.ts +1 -1
  143. package/dist/semantics/normalize/cells/policies/collection.js +1 -1
  144. package/dist/semantics/normalize/cells/policies/field.d.ts +1 -1
  145. package/dist/semantics/normalize/cells/policies/field.js +1 -1
  146. package/dist/semantics/normalize/cells/policies/index.d.ts +1 -1
  147. package/dist/semantics/normalize/cells/policies/local.d.ts +1 -1
  148. package/dist/semantics/normalize/cells/policies/local.js +1 -1
  149. package/dist/semantics/normalize/cells/policies/parameter.d.ts +1 -1
  150. package/dist/semantics/normalize/cells/policies/parameter.js +1 -1
  151. package/dist/semantics/normalize/cells/policies/return.d.ts +1 -1
  152. package/dist/semantics/normalize/cells/policies/return.js +1 -1
  153. package/dist/semantics/normalize/cells/policies/shared.d.ts +1 -1
  154. package/dist/semantics/normalize/cells/policy.d.ts +1 -1
  155. package/dist/semantics/normalize/census.d.ts +1 -1
  156. package/dist/semantics/normalize/census.js +45 -12
  157. package/dist/semantics/normalize/class-instance-record-statement.d.ts +1 -1
  158. package/dist/semantics/normalize/class-instance-record-statement.js +1 -1
  159. package/dist/semantics/normalize/collection-bindings.d.ts +1 -1
  160. package/dist/semantics/normalize/collection-bindings.js +1 -1
  161. package/dist/semantics/normalize/commonjs-module-record.d.ts +1 -1
  162. package/dist/semantics/normalize/commonjs-module-record.js +1 -1
  163. package/dist/semantics/normalize/commonjs-require.d.ts +1 -1
  164. package/dist/semantics/normalize/commonjs-require.js +1 -1
  165. package/dist/semantics/normalize/contribution.d.ts +4 -3
  166. package/dist/semantics/normalize/contribution.js +145 -42
  167. package/dist/semantics/normalize/dead-event-emissions.d.ts +1 -1
  168. package/dist/semantics/normalize/dead-event-emissions.js +1 -1
  169. package/dist/semantics/normalize/dead-method-copies.d.ts +1 -1
  170. package/dist/semantics/normalize/dead-method-copies.js +1 -1
  171. package/dist/semantics/normalize/dead-typeof-guards.d.ts +1 -1
  172. package/dist/semantics/normalize/dead-typeof-guards.js +1 -1
  173. package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +1 -1
  174. package/dist/semantics/normalize/deferred-intrinsic-protocols.js +1 -1
  175. package/dist/semantics/normalize/derived-expression-type.d.ts +1 -1
  176. package/dist/semantics/normalize/derived-expression-type.js +4 -4
  177. package/dist/semantics/normalize/evaluation-order.d.ts +1 -1
  178. package/dist/semantics/normalize/evaluation-order.js +1 -1
  179. package/dist/semantics/normalize/field-bindings.d.ts +1 -1
  180. package/dist/semantics/normalize/field-bindings.js +4 -3
  181. package/dist/semantics/normalize/flow/array-element-continuation.d.ts +1 -1
  182. package/dist/semantics/normalize/flow/array-element-continuation.js +3 -3
  183. package/dist/semantics/normalize/flow/callable-array-origins.d.ts +1 -1
  184. package/dist/semantics/normalize/flow/callable-array-origins.js +1 -1
  185. package/dist/semantics/normalize/flow/callable-completions.d.ts +1 -1
  186. package/dist/semantics/normalize/flow/callable-completions.js +1 -1
  187. package/dist/semantics/normalize/flow/callable-reach.d.ts +1 -1
  188. package/dist/semantics/normalize/flow/callable-reach.js +73 -52
  189. package/dist/semantics/normalize/flow/class-family-member-read.d.ts +1 -1
  190. package/dist/semantics/normalize/flow/class-family-member-read.js +3 -3
  191. package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +1 -1
  192. package/dist/semantics/normalize/flow/collection-value-continuation.js +1 -1
  193. package/dist/semantics/normalize/flow/component-solver.d.ts +181 -3
  194. package/dist/semantics/normalize/flow/component-solver.js +705 -164
  195. package/dist/semantics/normalize/flow/computed-key-set.d.ts +1 -1
  196. package/dist/semantics/normalize/flow/computed-key-set.js +1 -1
  197. package/dist/semantics/normalize/flow/export-importers.d.ts +1 -1
  198. package/dist/semantics/normalize/flow/export-importers.js +13 -3
  199. package/dist/semantics/normalize/flow/host-text-sink.d.ts +1 -1
  200. package/dist/semantics/normalize/flow/host-text-sink.js +1 -1
  201. package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.d.ts +1 -1
  202. package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +1 -1
  203. package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +1 -1
  204. package/dist/semantics/normalize/flow/intrinsic-data-definition.js +1 -1
  205. package/dist/semantics/normalize/flow/invocation-facts.d.ts +1 -1
  206. package/dist/semantics/normalize/flow/invocation-facts.js +1 -1
  207. package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +1 -1
  208. package/dist/semantics/normalize/flow/member-call-forwarding.js +1 -1
  209. package/dist/semantics/normalize/flow/model.d.ts +1 -1
  210. package/dist/semantics/normalize/flow/model.js +5 -1
  211. package/dist/semantics/normalize/flow/native-collection-protocol.d.ts +1 -1
  212. package/dist/semantics/normalize/flow/native-collection-protocol.js +1 -1
  213. package/dist/semantics/normalize/flow/node-path-token.d.ts +1 -1
  214. package/dist/semantics/normalize/flow/object-binding-continuation.d.ts +1 -1
  215. package/dist/semantics/normalize/flow/object-binding-continuation.js +1 -1
  216. package/dist/semantics/normalize/flow/origin-authority.d.ts +1 -1
  217. package/dist/semantics/normalize/flow/owned-class-receivers.d.ts +1 -1
  218. package/dist/semantics/normalize/flow/owned-class-receivers.js +1 -1
  219. package/dist/semantics/normalize/flow/parameter-values.d.ts +1 -1
  220. package/dist/semantics/normalize/flow/parameter-values.js +1 -1
  221. package/dist/semantics/normalize/flow/record-alias-closure.d.ts +1 -1
  222. package/dist/semantics/normalize/flow/record-alias-closure.js +1 -1
  223. package/dist/semantics/normalize/flow/seeded-origins.d.ts +1 -1
  224. package/dist/semantics/normalize/flow/seeded-origins.js +1 -1
  225. package/dist/semantics/normalize/flow/source-accessor-descriptor.d.ts +1 -1
  226. package/dist/semantics/normalize/flow/source-accessor-descriptor.js +1 -1
  227. package/dist/semantics/normalize/flow/source-callable-own-data.d.ts +1 -1
  228. package/dist/semantics/normalize/flow/source-callable-own-data.js +1 -1
  229. package/dist/semantics/normalize/flow/source-callable-readonly-set.d.ts +1 -1
  230. package/dist/semantics/normalize/flow/source-callable-readonly-set.js +1 -1
  231. package/dist/semantics/normalize/flow/source-class-data.d.ts +1 -1
  232. package/dist/semantics/normalize/flow/source-class-data.js +1 -1
  233. package/dist/semantics/normalize/flow/source-class-instanceof.d.ts +1 -1
  234. package/dist/semantics/normalize/flow/source-class-instanceof.js +1 -1
  235. package/dist/semantics/normalize/flow/source-class-static-data.d.ts +1 -1
  236. package/dist/semantics/normalize/flow/source-class-static-data.js +1 -1
  237. package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +1 -1
  238. package/dist/semantics/normalize/flow/source-construction-frames.d.ts +1 -1
  239. package/dist/semantics/normalize/flow/source-construction-frames.js +1 -1
  240. package/dist/semantics/normalize/flow/source-descriptor-protocol.d.ts +1 -1
  241. package/dist/semantics/normalize/flow/source-descriptor-protocol.js +1 -1
  242. package/dist/semantics/normalize/flow/source-executing-parameter-values.d.ts +1 -1
  243. package/dist/semantics/normalize/flow/source-executing-parameter-values.js +1 -1
  244. package/dist/semantics/normalize/flow/source-global-binding.d.ts +1 -1
  245. package/dist/semantics/normalize/flow/source-global-binding.js +1 -1
  246. package/dist/semantics/normalize/flow/source-intrinsic-member-data.d.ts +1 -1
  247. package/dist/semantics/normalize/flow/source-intrinsic-member-data.js +1 -1
  248. package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +1 -1
  249. package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +24 -32
  250. package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +1 -1
  251. package/dist/semantics/normalize/flow/source-invocation-receiver.js +1 -1
  252. package/dist/semantics/normalize/flow/source-native-class-alias.d.ts +1 -1
  253. package/dist/semantics/normalize/flow/source-native-class-alias.js +1 -1
  254. package/dist/semantics/normalize/flow/source-native-iterable-integrity.d.ts +1 -1
  255. package/dist/semantics/normalize/flow/source-native-iterable-integrity.js +1 -1
  256. package/dist/semantics/normalize/flow/source-native-origin.d.ts +1 -1
  257. package/dist/semantics/normalize/flow/source-native-origin.js +1 -1
  258. package/dist/semantics/normalize/flow/source-normal-predecessor.d.ts +1 -1
  259. package/dist/semantics/normalize/flow/source-normal-predecessor.js +1 -1
  260. package/dist/semantics/normalize/flow/source-property-key.d.ts +1 -1
  261. package/dist/semantics/normalize/flow/source-property-key.js +1 -1
  262. package/dist/semantics/normalize/flow/source-prototype-method-identity.d.ts +1 -1
  263. package/dist/semantics/normalize/flow/source-prototype-method-identity.js +1 -1
  264. package/dist/semantics/normalize/flow/source-proxy-operation.d.ts +1 -1
  265. package/dist/semantics/normalize/flow/source-proxy-operation.js +1 -1
  266. package/dist/semantics/normalize/flow/source-raw-constructor-entry.d.ts +1 -1
  267. package/dist/semantics/normalize/flow/source-raw-constructor-entry.js +1 -1
  268. package/dist/semantics/normalize/flow/source-read-protocol.d.ts +1 -1
  269. package/dist/semantics/normalize/flow/source-read-protocol.js +1 -1
  270. package/dist/semantics/normalize/flow/source-record-data.d.ts +1 -1
  271. package/dist/semantics/normalize/flow/source-record-data.js +1 -1
  272. package/dist/semantics/normalize/flow/source-value-session.d.ts +33 -3
  273. package/dist/semantics/normalize/flow/source-value-session.js +381 -173
  274. package/dist/semantics/normalize/flow/standard-prototype-method-source.d.ts +1 -1
  275. package/dist/semantics/normalize/flow/standard-prototype-method-source.js +1 -1
  276. package/dist/semantics/normalize/flow/targets.d.ts +1 -1
  277. package/dist/semantics/normalize/flow/targets.js +1 -1
  278. package/dist/semantics/normalize/flow/value-flow.d.ts +1 -1
  279. package/dist/semantics/normalize/flow/value-flow.js +243 -52
  280. package/dist/semantics/normalize/flow/value-provenance.d.ts +1 -1
  281. package/dist/semantics/normalize/flow/value-provenance.js +1 -1
  282. package/dist/semantics/normalize/fresh-dictionary-storage.d.ts +1 -1
  283. package/dist/semantics/normalize/fresh-dictionary-storage.js +1 -1
  284. package/dist/semantics/normalize/fresh-ordinary-object.d.ts +1 -1
  285. package/dist/semantics/normalize/fresh-ordinary-object.js +1 -1
  286. package/dist/semantics/normalize/fresh-table-last-use.d.ts +1 -1
  287. package/dist/semantics/normalize/fresh-table-last-use.js +1 -1
  288. package/dist/semantics/normalize/gating.d.ts +3 -3
  289. package/dist/semantics/normalize/gating.js +17 -20
  290. package/dist/semantics/normalize/generic-function-choice.d.ts +1 -1
  291. package/dist/semantics/normalize/generic-function-choice.js +1 -1
  292. package/dist/semantics/normalize/global-host-mutations.d.ts +1 -1
  293. package/dist/semantics/normalize/global-host-mutations.js +420 -138
  294. package/dist/semantics/normalize/host-effect-contracts.d.ts +1 -1
  295. package/dist/semantics/normalize/host-effect-contracts.js +1 -1
  296. package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +1 -1
  297. package/dist/semantics/normalize/host-mutation-key-reader.d.ts +1 -1
  298. package/dist/semantics/normalize/host-mutation-key-reader.js +1 -1
  299. package/dist/semantics/normalize/identities.d.ts +41 -1
  300. package/dist/semantics/normalize/identities.js +75 -9
  301. package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +1 -1
  302. package/dist/semantics/normalize/implicit-arguments-tuple.js +1 -1
  303. package/dist/semantics/normalize/implicit-arguments.d.ts +1 -1
  304. package/dist/semantics/normalize/implicit-arguments.js +1 -1
  305. package/dist/semantics/normalize/installed-global-properties.d.ts +1 -1
  306. package/dist/semantics/normalize/installed-global-properties.js +1 -1
  307. package/dist/semantics/normalize/instantiation.d.ts +1 -1
  308. package/dist/semantics/normalize/instantiation.js +1 -1
  309. package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +1 -1
  310. package/dist/semantics/normalize/intrinsic-accessor-getter.js +1 -1
  311. package/dist/semantics/normalize/intrinsic-property-call.d.ts +1 -1
  312. package/dist/semantics/normalize/intrinsic-property-call.js +1 -1
  313. package/dist/semantics/normalize/intrinsic-prototype.d.ts +1 -1
  314. package/dist/semantics/normalize/intrinsic-prototype.js +1 -1
  315. package/dist/semantics/normalize/intrinsic-return-identity.d.ts +1 -1
  316. package/dist/semantics/normalize/intrinsic-return-identity.js +1 -1
  317. package/dist/semantics/normalize/intrinsic-static-member.d.ts +1 -1
  318. package/dist/semantics/normalize/jsdoc-type-names.d.ts +1 -1
  319. package/dist/semantics/normalize/jsdoc-type-names.js +1 -1
  320. package/dist/semantics/normalize/local-bindings.d.ts +1 -1
  321. package/dist/semantics/normalize/local-bindings.js +3 -2
  322. package/dist/semantics/normalize/logical-object-truthiness.d.ts +1 -1
  323. package/dist/semantics/normalize/logical-object-truthiness.js +1 -1
  324. package/dist/semantics/normalize/logical-result-type.d.ts +1 -1
  325. package/dist/semantics/normalize/logical-result-type.js +1 -1
  326. package/dist/semantics/normalize/merged-declaration.d.ts +1 -1
  327. package/dist/semantics/normalize/merged-declaration.js +1 -1
  328. package/dist/semantics/normalize/namespace-paths.d.ts +1 -1
  329. package/dist/semantics/normalize/namespace-paths.js +1 -1
  330. package/dist/semantics/normalize/never-override-result.d.ts +1 -1
  331. package/dist/semantics/normalize/never-override-result.js +1 -1
  332. package/dist/semantics/normalize/normalize.d.ts +23 -4
  333. package/dist/semantics/normalize/normalize.js +125 -15
  334. package/dist/semantics/normalize/null-blind-parameter.d.ts +1 -1
  335. package/dist/semantics/normalize/null-blind-parameter.js +1 -1
  336. package/dist/semantics/normalize/nullable-memo.d.ts +28 -0
  337. package/dist/semantics/normalize/nullable-memo.js +99 -0
  338. package/dist/semantics/normalize/object-bag-bindings.d.ts +1 -1
  339. package/dist/semantics/normalize/object-bag-bindings.js +15 -4
  340. package/dist/semantics/normalize/omitted-stated-parameter.d.ts +1 -1
  341. package/dist/semantics/normalize/omitted-stated-parameter.js +1 -1
  342. package/dist/semantics/normalize/open-type-form.d.ts +1 -1
  343. package/dist/semantics/normalize/open-type-form.js +1 -1
  344. package/dist/semantics/normalize/override-field-arms.d.ts +1 -1
  345. package/dist/semantics/normalize/override-field-arms.js +1 -1
  346. package/dist/semantics/normalize/parameter-bindings.d.ts +1 -52
  347. package/dist/semantics/normalize/parameter-bindings.js +105 -10
  348. package/dist/semantics/normalize/parameter-slot.d.ts +1 -1
  349. package/dist/semantics/normalize/parameter-slot.js +1 -1
  350. package/dist/semantics/normalize/physical-overload-result.d.ts +1 -1
  351. package/dist/semantics/normalize/physical-overload-result.js +1 -1
  352. package/dist/semantics/normalize/primitive-property-absence.d.ts +1 -1
  353. package/dist/semantics/normalize/producer-context.d.ts +1 -1
  354. package/dist/semantics/normalize/producers/allocations.d.ts +1 -1
  355. package/dist/semantics/normalize/producers/allocations.js +1 -1
  356. package/dist/semantics/normalize/producers/binding-kind.d.ts +1 -1
  357. package/dist/semantics/normalize/producers/binding-kind.js +1 -1
  358. package/dist/semantics/normalize/producers/bindings.d.ts +1 -1
  359. package/dist/semantics/normalize/producers/bindings.js +1 -1
  360. package/dist/semantics/normalize/producers/boundary.d.ts +1 -1
  361. package/dist/semantics/normalize/producers/boundary.js +1 -1
  362. package/dist/semantics/normalize/producers/cited-value-type.d.ts +1 -1
  363. package/dist/semantics/normalize/producers/cited-value-type.js +1 -1
  364. package/dist/semantics/normalize/producers/class-lifecycle.js +1 -1
  365. package/dist/semantics/normalize/producers/computations.js +1 -1
  366. package/dist/semantics/normalize/producers/conditional-guard.d.ts +1 -1
  367. package/dist/semantics/normalize/producers/control-loops.d.ts +1 -1
  368. package/dist/semantics/normalize/producers/control-loops.js +1 -1
  369. package/dist/semantics/normalize/producers/control.d.ts +1 -1
  370. package/dist/semantics/normalize/producers/control.js +1 -1
  371. package/dist/semantics/normalize/producers/declaration-lifecycle.js +1 -1
  372. package/dist/semantics/normalize/producers/destructuring.d.ts +1 -1
  373. package/dist/semantics/normalize/producers/destructuring.js +1 -1
  374. package/dist/semantics/normalize/producers/dynamic-language.js +1 -1
  375. package/dist/semantics/normalize/producers/enums.d.ts +1 -1
  376. package/dist/semantics/normalize/producers/enums.js +1 -1
  377. package/dist/semantics/normalize/producers/erasure.d.ts +1 -1
  378. package/dist/semantics/normalize/producers/erasure.js +1 -1
  379. package/dist/semantics/normalize/producers/exact-arms.d.ts +1 -1
  380. package/dist/semantics/normalize/producers/exact-arms.js +1 -1
  381. package/dist/semantics/normalize/producers/intrinsic-accessor-getter.d.ts +1 -1
  382. package/dist/semantics/normalize/producers/invocations.d.ts +1 -1
  383. package/dist/semantics/normalize/producers/invocations.js +1 -1
  384. package/dist/semantics/normalize/producers/iteration-yield.d.ts +1 -1
  385. package/dist/semantics/normalize/producers/iteration-yield.js +1 -1
  386. package/dist/semantics/normalize/producers/jsx.js +1 -1
  387. package/dist/semantics/normalize/producers/logical-merge-type.d.ts +1 -1
  388. package/dist/semantics/normalize/producers/logical-merge-type.js +1 -1
  389. package/dist/semantics/normalize/producers/mint.js +88 -5
  390. package/dist/semantics/normalize/producers/native-callable-readonly-set.d.ts +1 -1
  391. package/dist/semantics/normalize/producers/native-own-assignment.d.ts +1 -1
  392. package/dist/semantics/normalize/producers/native-own-assignment.js +1 -1
  393. package/dist/semantics/normalize/producers/nullish.d.ts +1 -1
  394. package/dist/semantics/normalize/producers/nullish.js +1 -1
  395. package/dist/semantics/normalize/producers/object-assignment.d.ts +1 -1
  396. package/dist/semantics/normalize/producers/object-assignment.js +1 -1
  397. package/dist/semantics/normalize/producers/object-tag.d.ts +1 -1
  398. package/dist/semantics/normalize/producers/object-tag.js +1 -1
  399. package/dist/semantics/normalize/producers/optional-chain.d.ts +1 -1
  400. package/dist/semantics/normalize/producers/optional-chain.js +1 -1
  401. package/dist/semantics/normalize/producers/properties.d.ts +1 -1
  402. package/dist/semantics/normalize/producers/properties.js +1 -1
  403. package/dist/semantics/normalize/producers/protocol.d.ts +1 -1
  404. package/dist/semantics/normalize/producers/protocol.js +1 -1
  405. package/dist/semantics/normalize/producers/references.d.ts +1 -1
  406. package/dist/semantics/normalize/producers/references.js +1 -1
  407. package/dist/semantics/normalize/producers/shared.d.ts +1 -1
  408. package/dist/semantics/normalize/producers/shared.js +1 -1
  409. package/dist/semantics/normalize/producers/spread-arguments.d.ts +1 -1
  410. package/dist/semantics/normalize/producers/spread-arguments.js +1 -1
  411. package/dist/semantics/normalize/producers/tagged-template.d.ts +1 -1
  412. package/dist/semantics/normalize/producers/tagged-template.js +1 -1
  413. package/dist/semantics/normalize/producers/tuple-spread.d.ts +1 -1
  414. package/dist/semantics/normalize/producers/tuple-spread.js +1 -1
  415. package/dist/semantics/normalize/property-key-domain.d.ts +8 -1
  416. package/dist/semantics/normalize/property-key-domain.js +74 -47
  417. package/dist/semantics/normalize/reachability.d.ts +1 -1
  418. package/dist/semantics/normalize/reachability.js +3 -2
  419. package/dist/semantics/normalize/reassigned-bindings.d.ts +1 -1
  420. package/dist/semantics/normalize/record-home-arms.d.ts +1 -1
  421. package/dist/semantics/normalize/record-home-arms.js +1 -1
  422. package/dist/semantics/normalize/record-link-families.d.ts +1 -1
  423. package/dist/semantics/normalize/record-link-families.js +1 -1
  424. package/dist/semantics/normalize/record-stand-in-arms.d.ts +1 -1
  425. package/dist/semantics/normalize/record-stand-in-arms.js +1 -1
  426. package/dist/semantics/normalize/record-storage-families.d.ts +1 -1
  427. package/dist/semantics/normalize/record-storage-families.js +1 -1
  428. package/dist/semantics/normalize/return-bindings.d.ts +1 -1
  429. package/dist/semantics/normalize/return-bindings.js +1 -1
  430. package/dist/semantics/normalize/return-paths.d.ts +1 -1
  431. package/dist/semantics/normalize/return-paths.js +1 -1
  432. package/dist/semantics/normalize/round-tables.d.ts +21 -0
  433. package/dist/semantics/normalize/round-tables.js +59 -0
  434. package/dist/semantics/normalize/script-global-redefinition.d.ts +1 -1
  435. package/dist/semantics/normalize/script-global-redefinition.js +1 -1
  436. package/dist/semantics/normalize/shared-array-storage.d.ts +1 -1
  437. package/dist/semantics/normalize/shared-array-storage.js +1 -1
  438. package/dist/semantics/normalize/sloppy-absence.d.ts +1 -1
  439. package/dist/semantics/normalize/sloppy-absence.js +1 -1
  440. package/dist/semantics/normalize/source-native-iterable.d.ts +2 -2
  441. package/dist/semantics/normalize/source-native-iterable.js +4 -2
  442. package/dist/semantics/normalize/source-object-prototype-absence.d.ts +1 -1
  443. package/dist/semantics/normalize/source-object-prototype-absence.js +1 -1
  444. package/dist/semantics/normalize/specialization.d.ts +1 -1
  445. package/dist/semantics/normalize/specialization.js +1 -1
  446. package/dist/semantics/normalize/specialized-source-frames.d.ts +1 -1
  447. package/dist/semantics/normalize/specialized-source-frames.js +12 -4
  448. package/dist/semantics/normalize/structural-any-binding-consumer.d.ts +1 -1
  449. package/dist/semantics/normalize/structural-any-binding-consumer.js +1 -1
  450. package/dist/semantics/normalize/structural-array-element.d.ts +1 -1
  451. package/dist/semantics/normalize/structural-array-element.js +1 -1
  452. package/dist/semantics/normalize/structural-array-read.d.ts +1 -1
  453. package/dist/semantics/normalize/structural-array-read.js +1 -1
  454. package/dist/semantics/normalize/structural-callable.d.ts +1 -1
  455. package/dist/semantics/normalize/structural-callable.js +1 -1
  456. package/dist/semantics/normalize/structural-creation-order.d.ts +1 -1
  457. package/dist/semantics/normalize/structural-creation-order.js +1 -1
  458. package/dist/semantics/normalize/structural-declarations.d.ts +1 -1
  459. package/dist/semantics/normalize/structural-declarations.js +1 -1
  460. package/dist/semantics/normalize/structural-declared-body.d.ts +1 -1
  461. package/dist/semantics/normalize/structural-declared-body.js +1 -1
  462. package/dist/semantics/normalize/structural-generics.d.ts +1 -1
  463. package/dist/semantics/normalize/structural-generics.js +1 -1
  464. package/dist/semantics/normalize/structural-indexed-access.d.ts +1 -1
  465. package/dist/semantics/normalize/structural-indexed-access.js +1 -1
  466. package/dist/semantics/normalize/structural-instantiated-member.d.ts +1 -1
  467. package/dist/semantics/normalize/structural-instantiated-member.js +199 -68
  468. package/dist/semantics/normalize/structural-joins.d.ts +1 -1
  469. package/dist/semantics/normalize/structural-layout-relevance.d.ts +1 -1
  470. package/dist/semantics/normalize/structural-layout-relevance.js +1 -1
  471. package/dist/semantics/normalize/structural-layout-type.d.ts +1 -1
  472. package/dist/semantics/normalize/structural-layout-type.js +14 -2
  473. package/dist/semantics/normalize/structural-leaves.d.ts +1 -1
  474. package/dist/semantics/normalize/structural-leaves.js +1 -1
  475. package/dist/semantics/normalize/structural-local-union.d.ts +1 -1
  476. package/dist/semantics/normalize/structural-local-union.js +21 -16
  477. package/dist/semantics/normalize/structural-members.d.ts +1 -1
  478. package/dist/semantics/normalize/structural-members.js +1 -1
  479. package/dist/semantics/normalize/structural-mutable-field.d.ts +1 -2
  480. package/dist/semantics/normalize/structural-mutable-field.js +17 -4
  481. package/dist/semantics/normalize/structural-mutable-method.d.ts +1 -1
  482. package/dist/semantics/normalize/structural-mutable-method.js +1 -1
  483. package/dist/semantics/normalize/structural-parts.d.ts +1 -1
  484. package/dist/semantics/normalize/structural-parts.js +1 -1
  485. package/dist/semantics/normalize/structural-receiver.d.ts +1 -1
  486. package/dist/semantics/normalize/structural-receiver.js +1 -1
  487. package/dist/semantics/normalize/structural-rules.d.ts +4 -4
  488. package/dist/semantics/normalize/structural-rules.js +30 -12
  489. package/dist/semantics/normalize/structural-self-reference.d.ts +1 -1
  490. package/dist/semantics/normalize/structural-self-reference.js +1 -1
  491. package/dist/semantics/normalize/structural.d.ts +1 -1
  492. package/dist/semantics/normalize/structural.js +2467 -2239
  493. package/dist/semantics/normalize/suppressed-write-arms.d.ts +1 -1
  494. package/dist/semantics/normalize/suppressed-write-arms.js +1 -1
  495. package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +1 -1
  496. package/dist/semantics/normalize/symbol-keyed-this-slots.js +1 -1
  497. package/dist/semantics/normalize/unreduced-type-form.d.ts +1 -1
  498. package/dist/semantics/normalize/unreduced-type-form.js +1 -1
  499. package/dist/semantics/normalize/unresolvable-names.d.ts +1 -1
  500. package/dist/semantics/normalize/unresolvable-names.js +1 -1
  501. package/dist/semantics/normalize/unshared-array-result.d.ts +1 -1
  502. package/dist/semantics/normalize/unshared-array-result.js +1 -1
  503. package/dist/semantics/package-sources.d.ts +1 -1
  504. package/dist/semantics/package-sources.js +1 -1
  505. package/dist/semantics/program.d.ts +1 -1
  506. package/dist/semantics/program.js +11 -5
  507. package/dist/semantics/prototype-install-source-transform.js +1 -1
  508. package/dist/semantics/prototype-object-class-source-transform.js +1 -1
  509. package/dist/semantics/prototype-reparenting.d.ts +1 -1
  510. package/dist/semantics/prototype-reparenting.js +1 -1
  511. package/dist/semantics/shared-declaration-files.d.ts +1 -1
  512. package/dist/semantics/source-transform-exports.js +1 -1
  513. package/dist/semantics/stable-checker.d.ts +9 -1
  514. package/dist/semantics/stable-checker.js +21 -5
  515. package/dist/semantics/subclass-member-overlay-transform.js +46 -5
  516. package/dist/semantics/symbol-keyed-expando-source-transform.js +1 -1
  517. package/dist/semantics/this-constructor-source-transform.js +1 -1
  518. package/dist/semantics/typescript.d.ts +12 -0
  519. package/dist/semantics/typescript.js +12 -0
  520. package/dist/semantics/uncached-jsdoc-tags.d.ts +16 -0
  521. package/dist/semantics/uncached-jsdoc-tags.js +23 -0
  522. package/dist/semantics/unchecked-guard-argument-copies.d.ts +1 -1
  523. package/dist/semantics/unchecked-guard-argument-copies.js +1 -1
  524. package/dist/semantics/unchecked-write-member-declarations.d.ts +1 -1
  525. package/dist/semantics/unchecked-write-member-declarations.js +1 -1
  526. package/dist/semantics/uninstantiable-classes.d.ts +1 -1
  527. package/dist/semantics/uninstantiable-classes.js +1 -1
  528. package/dist/targets/cpp/conversions.js +137 -87
  529. package/dist/targets/cpp/emit-in.js +2 -1
  530. package/dist/targets/cpp/emit-iterator.d.ts +6 -5
  531. package/dist/targets/cpp/emit-iterator.js +23 -13
  532. package/dist/targets/cpp/emit-narrowing.d.ts +8 -0
  533. package/dist/targets/cpp/emit-narrowing.js +11 -1
  534. package/dist/targets/cpp/emit-record-view.d.ts +9 -0
  535. package/dist/targets/cpp/emit-record-view.js +12 -1
  536. package/package.json +7 -1
@@ -18,3 +18,195 @@ export const edgeSource = (edge, operationOfResult) => {
18
18
  };
19
19
  /** The operation an edge terminates at. */
20
20
  export const edgeTarget = (edge) => edge.to;
21
+ /**
22
+ * A function sealing one chain into shared scopes. Prefixes are recognised by
23
+ * the identity of their links, which the gating walk reuses for every chain it
24
+ * extends from the same nesting.
25
+ */
26
+ export const gateScopeSealer = () => {
27
+ const root = new Map();
28
+ const children = new Map();
29
+ const enter = (enclosing, link) => {
30
+ let next = enclosing === null ? root : children.get(enclosing);
31
+ if (next === undefined) {
32
+ next = new Map();
33
+ children.set(enclosing, next);
34
+ }
35
+ let scope = next.get(link);
36
+ if (scope === undefined) {
37
+ scope = { link, enclosing, depth: enclosing === null ? 1 : enclosing.depth + 1 };
38
+ next.set(link, scope);
39
+ }
40
+ return scope;
41
+ };
42
+ return (chain) => chain.reduce(enter, null);
43
+ };
44
+ const gateEdge = (gate, to) => {
45
+ switch (gate.kind) {
46
+ case 'loop':
47
+ return { kind: 'loop', loop: gate.loop, to };
48
+ case 'loop-latch':
49
+ return { kind: 'loop-latch', loop: gate.loop, to };
50
+ case 'region':
51
+ return { kind: 'region', region: gate.region, part: gate.part, to };
52
+ case 'guard':
53
+ return { kind: 'conditional', guard: gate.guard, to, takenWhen: gate.takenWhen };
54
+ }
55
+ };
56
+ const valueEdge = (operand, to) => operand.source.kind === 'result'
57
+ ? { kind: 'value', result: operand.source.result, to, role: operand.role, ordinal: operand.ordinal }
58
+ : null;
59
+ /** The edges one stated entry stands for: itself, or an operation's value edges in operand order. */
60
+ export function* edgesStatedBy(entry) {
61
+ if (!('family' in entry)) {
62
+ yield entry;
63
+ return;
64
+ }
65
+ for (const operand of entry.operands) {
66
+ const edge = valueEdge(operand, entry.id);
67
+ if (edge !== null)
68
+ yield edge;
69
+ }
70
+ }
71
+ /**
72
+ * The edge table of a sealed graph: the producers' own edges, then one edge per
73
+ * scope of every gated operation's chain.
74
+ *
75
+ * The gating walk states a scope once per OPERATION inside it, so an operation
76
+ * nested three scopes deep owns three edges that differ from its siblings' only
77
+ * in `to`. Materialized, that was most of the table -- 820k conditional edges
78
+ * for a 48K-line app, 50 MB that lived from normalization to certification.
79
+ * Here each gated operation holds its innermost scope -- chains share their
80
+ * enclosing scopes -- and the gate edges are minted as a consumer walks past
81
+ * them. A producer's value edges are the operation's own result-citing
82
+ * operands restated, so a run of them that restates exactly that is held as
83
+ * the operation. Either way a consumer sees the same edges, with the same
84
+ * fields in the same order, in the same sequence as the flat table had; one
85
+ * that keeps an edge keeps an ordinary object.
86
+ */
87
+ export class SemanticEdgeTable {
88
+ stated;
89
+ gated;
90
+ length;
91
+ byKind = new Map();
92
+ constructor(stated, gated) {
93
+ this.stated = stated;
94
+ this.gated = gated;
95
+ let length = 0;
96
+ for (const entry of stated) {
97
+ if (!('family' in entry))
98
+ length++;
99
+ else
100
+ for (const operand of entry.operands)
101
+ if (operand.source.kind === 'result')
102
+ length++;
103
+ }
104
+ for (const scope of gated.innermost)
105
+ length += scope.depth;
106
+ this.length = length;
107
+ }
108
+ *[Symbol.iterator]() {
109
+ yield* this.statedEdges();
110
+ const { operations, innermost } = this.gated;
111
+ const chain = [];
112
+ for (let index = 0; index < operations.length; index++) {
113
+ const to = operations[index];
114
+ let scope = innermost[index];
115
+ chain.length = scope.depth;
116
+ for (let depth = scope.depth - 1; scope !== null; depth--, scope = scope.enclosing)
117
+ chain[depth] = scope;
118
+ for (const outer of chain)
119
+ yield gateEdge(outer.link, to);
120
+ }
121
+ }
122
+ find(predicate) {
123
+ for (const edge of this)
124
+ if (predicate(edge))
125
+ return edge;
126
+ return undefined;
127
+ }
128
+ /** The producers' own edges of one kind no value run or gate stands for, in table order. */
129
+ edgesOfKind(kind) {
130
+ let found = this.byKind.get(kind);
131
+ if (found === undefined) {
132
+ found = this.stated.filter((entry) => !('family' in entry) && entry.kind === kind);
133
+ this.byKind.set(kind, found);
134
+ }
135
+ return found;
136
+ }
137
+ /** The producers' own edges: the table's head, in table order. */
138
+ *statedEdges() {
139
+ for (const entry of this.stated) {
140
+ if (!('family' in entry))
141
+ yield entry;
142
+ else
143
+ for (const operand of entry.operands) {
144
+ const edge = valueEdge(operand, entry.id);
145
+ if (edge !== null)
146
+ yield edge;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ /**
152
+ * The producers' own edges, in table order, without walking past the gate
153
+ * edges. The gating walk never states an `evaluation`, `value`, `effect` or
154
+ * `completion` edge, so a scan for one of those kinds sees exactly what a scan
155
+ * of the whole table would -- without minting every gate edge, most of a large
156
+ * program's table, only to look at it and throw it away.
157
+ */
158
+ export const producerEdges = (edges) => edges instanceof SemanticEdgeTable ? edges.statedEdges() : edges;
159
+ /**
160
+ * Every edge of one such kind, in table order. A sealed table answers from an
161
+ * index it builds on first use -- a list of the edges it already holds -- so a
162
+ * lookup per `break` or per destructured element no longer walks the table.
163
+ */
164
+ export const edgesOfKind = (edges, kind) => edges instanceof SemanticEdgeTable
165
+ ? edges.edgesOfKind(kind)
166
+ : [...edges].filter((edge) => edge.kind === kind);
167
+ /**
168
+ * The producers' edges with every run that restates an operation's value
169
+ * edges -- each result-citing operand in order, nothing else -- replaced by
170
+ * that operation, appended to `stated`. Anything that differs in the
171
+ * slightest stays an edge.
172
+ */
173
+ export const compactStatedEdges = (edges, operationOf, stated = []) => {
174
+ let index = 0;
175
+ while (index < edges.length) {
176
+ const edge = edges[index];
177
+ if ('family' in edge) {
178
+ stated.push(edge);
179
+ index++;
180
+ continue;
181
+ }
182
+ const operation = edge.kind === 'value' ? operationOf(edge.to) : undefined;
183
+ let run = 0;
184
+ if (operation !== undefined) {
185
+ for (const operand of operation.operands) {
186
+ if (operand.source.kind !== 'result')
187
+ continue;
188
+ const candidate = edges[index + run];
189
+ if (candidate === undefined ||
190
+ 'family' in candidate ||
191
+ candidate.kind !== 'value' ||
192
+ candidate.to !== operation.id ||
193
+ candidate.result !== operand.source.result ||
194
+ candidate.role !== operand.role ||
195
+ candidate.ordinal !== operand.ordinal) {
196
+ run = 0;
197
+ break;
198
+ }
199
+ run++;
200
+ }
201
+ }
202
+ if (run > 0) {
203
+ stated.push(operation);
204
+ index += run;
205
+ }
206
+ else {
207
+ stated.push(edge);
208
+ index++;
209
+ }
210
+ }
211
+ return stated;
212
+ };
@@ -1,5 +1,5 @@
1
1
  import type { OperationFamily, OperationId, RegionId, SemanticResultId, StructuralTypeId } from '../../identity/ids.js';
2
- import type { SemanticEdge } from './edges.js';
2
+ import type { SemanticEdges } from './edges.js';
3
3
  import type { FamilyReport } from './coverage.js';
4
4
  import type { SemanticOperation } from './operations.js';
5
5
  import type { SemanticCaller } from './operands.js';
@@ -24,11 +24,35 @@ export interface SemanticGraph {
24
24
  readonly regions: ReadonlyMap<RegionId, SemanticRegion>;
25
25
  readonly structuralTypes: ReadonlyMap<StructuralTypeId, StructuralType>;
26
26
  readonly operations: ReadonlyMap<OperationId, SemanticOperation>;
27
- readonly edges: readonly SemanticEdge[];
27
+ readonly edges: SemanticEdges;
28
28
  readonly coverage: ReadonlyMap<OperationFamily, FamilyReport>;
29
29
  /** Every published result, so a consumer never re-derives one from an operation. */
30
30
  readonly results: ReadonlyMap<SemanticResultId, OperationId>;
31
31
  }
32
+ /**
33
+ * The sealed graph's result index, read off its operation table.
34
+ *
35
+ * A result's identity names its operation (`semanticResultId`), so the
36
+ * operation table already answers "who publishes this result" -- a second
37
+ * map from every result to its operation was 14 MB for a 48K-line app, held
38
+ * from normalization to certification to repeat what the identities say.
39
+ * Only a result whose identity does not name its own publisher is kept
40
+ * explicitly. Iteration visits operations in table order and each one's
41
+ * results in its own order: exactly the order the results were registered in.
42
+ */
43
+ export declare class PublishedResults implements ReadonlyMap<SemanticResultId, OperationId> {
44
+ private readonly operations;
45
+ private readonly foreign;
46
+ readonly size: number;
47
+ constructor(operations: ReadonlyMap<OperationId, SemanticOperation>, foreign: ReadonlyMap<SemanticResultId, OperationId>, size: number);
48
+ get(result: SemanticResultId): OperationId | undefined;
49
+ has(result: SemanticResultId): boolean;
50
+ entries(): MapIterator<[SemanticResultId, OperationId]>;
51
+ keys(): MapIterator<SemanticResultId>;
52
+ values(): MapIterator<OperationId>;
53
+ [Symbol.iterator](): MapIterator<[SemanticResultId, OperationId]>;
54
+ forEach(callback: (value: OperationId, key: SemanticResultId, map: ReadonlyMap<SemanticResultId, OperationId>) => void, thisArg?: unknown): void;
55
+ }
32
56
  /** Adjacency built once from the edge table, for authority-connected traversal. */
33
57
  export interface SemanticConnectivity {
34
58
  readonly outgoing: ReadonlyMap<OperationId, readonly OperationId[]>;
@@ -1,6 +1,60 @@
1
1
  import { operationOfResult } from '../../identity/ids.js';
2
2
  import { edgeSource } from './edges.js';
3
3
  import { validateFamilyReport } from './coverage.js';
4
+ /**
5
+ * The sealed graph's result index, read off its operation table.
6
+ *
7
+ * A result's identity names its operation (`semanticResultId`), so the
8
+ * operation table already answers "who publishes this result" -- a second
9
+ * map from every result to its operation was 14 MB for a 48K-line app, held
10
+ * from normalization to certification to repeat what the identities say.
11
+ * Only a result whose identity does not name its own publisher is kept
12
+ * explicitly. Iteration visits operations in table order and each one's
13
+ * results in its own order: exactly the order the results were registered in.
14
+ */
15
+ export class PublishedResults {
16
+ operations;
17
+ foreign;
18
+ size;
19
+ constructor(operations, foreign, size) {
20
+ this.operations = operations;
21
+ this.foreign = foreign;
22
+ this.size = size;
23
+ }
24
+ get(result) {
25
+ const operation = this.operations.get(operationOfResult(result));
26
+ if (operation !== undefined)
27
+ for (const published of operation.results)
28
+ if (published.id === result)
29
+ return operation.id;
30
+ return this.foreign.get(result);
31
+ }
32
+ has(result) {
33
+ return this.get(result) !== undefined;
34
+ }
35
+ *entries() {
36
+ for (const operation of this.operations.values())
37
+ for (const result of operation.results)
38
+ yield [result.id, operation.id];
39
+ }
40
+ *keys() {
41
+ for (const operation of this.operations.values())
42
+ for (const result of operation.results)
43
+ yield result.id;
44
+ }
45
+ *values() {
46
+ for (const operation of this.operations.values())
47
+ for (let index = 0; index < operation.results.length; index++)
48
+ yield operation.id;
49
+ }
50
+ [Symbol.iterator]() {
51
+ return this.entries();
52
+ }
53
+ forEach(callback, thisArg) {
54
+ for (const [key, value] of this.entries())
55
+ callback.call(thisArg, value, key, this);
56
+ }
57
+ }
4
58
  export const buildConnectivity = (graph) => {
5
59
  const outgoing = new Map();
6
60
  const incoming = new Map();
@@ -0,0 +1,19 @@
1
+ import type { SemanticOperation } from './operations.js';
2
+ /**
3
+ * The engine's own interned copy of a string.
4
+ *
5
+ * Every identity in the graph is looked up in a `Map` sooner or later, and V8
6
+ * internalizes a string the first time it is used as a `Map` key: the string
7
+ * table gets the characters and the original is left behind as a 24-byte
8
+ * forwarding object that every holder keeps pointing at. A 48K-line app's
9
+ * graph carried 830k of them, 19 MB, plus the unflattened concatenation trees
10
+ * some identities were still built as. A property key is always interned, so
11
+ * reading one back is how a script reaches the table's copy. Same characters,
12
+ * so no reader can tell the difference.
13
+ */
14
+ export declare const internedText: <T extends string>(text: T) => T;
15
+ /**
16
+ * A function interning one operation's facts in place. Meant for one sealing:
17
+ * its pools go when the caller drops it.
18
+ */
19
+ export declare const internSealedFacts: () => ((operation: SemanticOperation) => SemanticOperation);
@@ -0,0 +1,221 @@
1
+ /**
2
+ * The engine's own interned copy of a string.
3
+ *
4
+ * Every identity in the graph is looked up in a `Map` sooner or later, and V8
5
+ * internalizes a string the first time it is used as a `Map` key: the string
6
+ * table gets the characters and the original is left behind as a 24-byte
7
+ * forwarding object that every holder keeps pointing at. A 48K-line app's
8
+ * graph carried 830k of them, 19 MB, plus the unflattened concatenation trees
9
+ * some identities were still built as. A property key is always interned, so
10
+ * reading one back is how a script reaches the table's copy. Same characters,
11
+ * so no reader can tell the difference.
12
+ */
13
+ export const internedText = (text) => (Object.keys({ [text]: 0 })[0] ?? text);
14
+ /** String-valued identity fields of an operation, interned in place. */
15
+ const operationIdentities = ['id', 'declaration', 'classDeclaration', 'classConstructorBodyOf', 'callable'];
16
+ /** Every string inside a fact that is about to be shared, interned in place; frozen parts are left as they are. */
17
+ const internStrings = (value) => {
18
+ if (value === null || typeof value !== 'object' || Object.isFrozen(value))
19
+ return;
20
+ const fields = value;
21
+ for (const name of Object.keys(fields)) {
22
+ const field = fields[name];
23
+ if (typeof field === 'string')
24
+ fields[name] = internedText(field);
25
+ else
26
+ internStrings(field);
27
+ }
28
+ };
29
+ /** The fields of an operation whose values are interned. */
30
+ const operationFacts = [
31
+ 'effects',
32
+ 'completion',
33
+ 'descriptor',
34
+ 'resultDivergence',
35
+ 'selectedSignature',
36
+ 'target',
37
+ 'conversionRoles',
38
+ 'caller'
39
+ ];
40
+ /**
41
+ * Two values are interchangeable for a reader when they have the same own
42
+ * keys in the same order, the same primitives (`-0` kept apart from `0`,
43
+ * `undefined` from absent) and the same nesting. Only plain records, arrays
44
+ * and primitives are compared; `hashOf` is `null` for anything else, and that
45
+ * value is left alone.
46
+ *
47
+ * The pool is keyed by a hash, with the values themselves telling a collision
48
+ * apart, rather than by a spelled-out key: a key per distinct fact was held to
49
+ * the end of production, the frontend's peak -- 54k of them on a 48K-line app,
50
+ * 9 MB of text.
51
+ */
52
+ const mix = (hash, code) => Math.imul(hash ^ code, 16777619);
53
+ const mixText = (hash, text) => {
54
+ let mixed = mix(hash, text.length);
55
+ for (let at = 0; at < text.length; at++)
56
+ mixed = mix(mixed, text.charCodeAt(at));
57
+ return mixed;
58
+ };
59
+ const hashInto = (hash, value) => {
60
+ if (value === null)
61
+ return mix(hash, 1);
62
+ switch (typeof value) {
63
+ case 'string':
64
+ return mixText(mix(hash, 2), value);
65
+ case 'number':
66
+ return mixText(mix(hash, 3), Object.is(value, -0) ? '-0' : String(value));
67
+ case 'boolean':
68
+ return mix(hash, value ? 4 : 5);
69
+ case 'undefined':
70
+ return mix(hash, 6);
71
+ case 'object':
72
+ break;
73
+ default:
74
+ return null;
75
+ }
76
+ if (Array.isArray(value)) {
77
+ let mixed = mix(hash, 7);
78
+ for (const item of value)
79
+ if ((mixed = hashInto(mixed, item)) === null)
80
+ return null;
81
+ return mix(mixed, value.length);
82
+ }
83
+ if (Object.getPrototypeOf(value) !== Object.prototype)
84
+ return null;
85
+ let mixed = mix(hash, 8);
86
+ for (const name of Object.keys(value)) {
87
+ mixed = hashInto(mixText(mixed, name), value[name]);
88
+ if (mixed === null)
89
+ return null;
90
+ }
91
+ return mix(mixed, 9);
92
+ };
93
+ const hashOf = (value) => hashInto(0x811c9dc5, value);
94
+ /** Whether two values `hashOf` accepts are interchangeable for a reader. */
95
+ const sameValue = (left, right) => {
96
+ if (left === right)
97
+ return Object.is(left, right);
98
+ if (typeof left !== 'object' || typeof right !== 'object' || left === null || right === null)
99
+ return Object.is(left, right);
100
+ if (Array.isArray(left)) {
101
+ if (!Array.isArray(right) || left.length !== right.length)
102
+ return false;
103
+ for (let at = 0; at < left.length; at++)
104
+ if (!sameValue(left[at], right[at]))
105
+ return false;
106
+ return true;
107
+ }
108
+ if (Array.isArray(right))
109
+ return false;
110
+ const names = Object.keys(left);
111
+ const others = Object.keys(right);
112
+ if (names.length !== others.length)
113
+ return false;
114
+ for (let at = 0; at < names.length; at++) {
115
+ const name = names[at];
116
+ if (name !== others[at] || !sameValue(left[name], right[name]))
117
+ return false;
118
+ }
119
+ return true;
120
+ };
121
+ /** The one empty list a sealed operation's operands or results can be; frozen, as nothing may grow it. */
122
+ const noneSealed = Object.freeze([]);
123
+ /**
124
+ * A function interning one operation's facts in place. Meant for one sealing:
125
+ * its pools go when the caller drops it.
126
+ */
127
+ export const internSealedFacts = () => {
128
+ // Keyed by content alone: remembering every object already seen would hold
129
+ // an entry per operand while the graph is being sealed, at the frontend's peak.
130
+ const pool = new Map();
131
+ // Hashes that collided: every value pooled under one, in pooling order.
132
+ const collided = new Map();
133
+ const canonical = (value) => {
134
+ if (value === null || typeof value !== 'object')
135
+ return value;
136
+ const hash = hashOf(value);
137
+ if (hash === null)
138
+ return value;
139
+ const pooled = pool.get(hash);
140
+ if (pooled === undefined)
141
+ pool.set(hash, value);
142
+ else if (sameValue(pooled, value))
143
+ return pooled;
144
+ else {
145
+ const others = collided.get(hash);
146
+ const other = others?.find((candidate) => sameValue(candidate, value));
147
+ if (other !== undefined)
148
+ return other;
149
+ if (others)
150
+ others.push(value);
151
+ else
152
+ collided.set(hash, [value]);
153
+ }
154
+ internStrings(value);
155
+ return value;
156
+ };
157
+ // An operand's source is shared first, so equal operands then compare
158
+ // their sources by identity.
159
+ const sharedOperand = (operand) => {
160
+ if (!Object.isFrozen(operand)) {
161
+ const source = canonical(operand.source);
162
+ if (source !== operand.source)
163
+ operand.source = source;
164
+ }
165
+ return canonical(operand);
166
+ };
167
+ const internOperand = (operand) => {
168
+ // The source object itself keeps its identity (see above); only the
169
+ // identity text it carries is swapped for the interned copy.
170
+ const { source } = operand;
171
+ if (source.kind === 'result' && !Object.isFrozen(source))
172
+ source.result = internedText(source.result);
173
+ if (Object.isFrozen(operand))
174
+ return;
175
+ const evaluation = canonical(operand.evaluation);
176
+ if (evaluation !== operand.evaluation)
177
+ operand.evaluation = evaluation;
178
+ };
179
+ return (operation) => {
180
+ if (!Object.isFrozen(operation)) {
181
+ const fields = operation;
182
+ for (const field of operationIdentities) {
183
+ const value = fields[field];
184
+ if (typeof value === 'string')
185
+ fields[field] = internedText(value);
186
+ }
187
+ for (const field of operationFacts) {
188
+ if (!(field in fields))
189
+ continue;
190
+ const value = fields[field];
191
+ const shared = canonical(value);
192
+ if (shared !== value)
193
+ fields[field] = shared;
194
+ }
195
+ // A list a producer grew by pushing keeps the capacity its first push
196
+ // reserved -- seventeen slots for a call's two or three arguments. A
197
+ // copy is exactly as long as its contents, and every empty list is one.
198
+ const sealed = operation.operands.length > 0 ? operation.operands.slice() : noneSealed;
199
+ fields['operands'] = sealed;
200
+ if (operation.results.length === 0)
201
+ fields['results'] = noneSealed;
202
+ for (const result of operation.results)
203
+ if (!Object.isFrozen(result))
204
+ result.id = internedText(result.id);
205
+ const shareable = !('nativeOwnAssignment' in fields);
206
+ for (let at = 0; at < sealed.length; at++) {
207
+ const operand = sealed[at];
208
+ internOperand(operand);
209
+ if (shareable && operand.source.kind !== 'result')
210
+ sealed[at] = sharedOperand(operand);
211
+ }
212
+ return operation;
213
+ }
214
+ for (const result of operation.results)
215
+ if (!Object.isFrozen(result))
216
+ result.id = internedText(result.id);
217
+ for (const operand of operation.operands)
218
+ internOperand(operand);
219
+ return operation;
220
+ };
221
+ };
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import ts from '#typescript';
2
2
  import type { DeclarationId, StructuralTypeId } from '../../identity/ids.js';
3
3
  import type { SignatureParameter } from './structural-types.js';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import ts from '#typescript';
2
2
  /**
3
3
  * Fail closed when the invocation result and the selected return type disagree
4
4
  * for a reason the language does not license.
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import ts from '#typescript';
2
2
  import { type PackageSource } from './package-sources.js';
3
3
  export declare const isDeclarationPath: (file: string) => boolean;
4
4
  export declare const moduleExtension: (file: string) => ts.Extension;
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import ts from '#typescript';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { createPackageSourceHost } from './package-sources.js';
4
4
  export const isDeclarationPath = (file) => /\.d\.(?:ts|mts|cts)$/.test(file);
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import ts from '#typescript';
2
2
  import type { DeclarationId } from '../identity/ids.js';
3
3
  import type { NativeHostFunctionDeclaration } from '../plugins/model.js';
4
4
  import { type InspectedNativeSignature } from '../native-signatures.js';
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import ts from '#typescript';
2
2
  import { inspectNativeFunctionSignature } from '../native-signatures.js';
3
3
  import { hasExactHostDeclaration } from './host-declaration-provenance.js';
4
4
  import { declaredIntegerWidthOf } from './declared-integers.js';
@@ -5,6 +5,8 @@ import { recordObjectShapeOf } from '../representation/unwritten-record-members.
5
5
  import { objectPrototypeMemberNames } from '../representation/record-fields.js';
6
6
  import { canonicalIndexLiteral } from '../representation/array-index.js';
7
7
  const censuses = new WeakMap();
8
+ /** The one empty row list every schema without writers, reads, blockers or observers shares. */
9
+ const noRows = Object.freeze([]);
8
10
  const keyOf = (value) => value?.source.kind === 'constant' && (value.source.literal === 'string' || value.source.literal === 'number') ? value.source.text : null;
9
11
  const sourceFrameEdgesOf = (graph, writes) => {
10
12
  const parameters = new Map();
@@ -650,11 +652,11 @@ export const nativeObjectDataSlotSchemasOf = (graph) => {
650
652
  {
651
653
  allocation,
652
654
  key,
653
- writers: writers.get(allocation)?.get(key) ?? [],
655
+ writers: writers.get(allocation)?.get(key) ?? noRows,
654
656
  ...(stored?.has(key) === true ? { storedValues: stored.get(key) } : {}),
655
- reads: reads.get(allocation)?.get(key) ?? [],
656
- blockers: blockers.get(allocation) ?? [],
657
- observers: observers.get(allocation) ?? []
657
+ reads: reads.get(allocation)?.get(key) ?? noRows,
658
+ blockers: blockers.get(allocation) ?? noRows,
659
+ observers: observers.get(allocation) ?? noRows
658
660
  }
659
661
  ])));
660
662
  }
@@ -673,6 +675,20 @@ export const nativeObjectDataSlotSchemasOf = (graph) => {
673
675
  continue;
674
676
  namedDataDefinitions.set(operation.id, key);
675
677
  }
678
+ // The fixpoint is done growing alias sets, and nearly every result holds one
679
+ // allocation: share one set per allocation rather than keep one per result
680
+ // for the rest of the compile.
681
+ const singletons = new Map();
682
+ for (const [result, held] of aliases) {
683
+ if (held.size !== 1)
684
+ continue;
685
+ const allocation = held.values().next().value;
686
+ const shared = singletons.get(allocation);
687
+ if (shared === undefined)
688
+ singletons.set(allocation, held);
689
+ else
690
+ aliases.set(result, shared);
691
+ }
676
692
  const census = { origins, aliases, complete, schemas, namedDataDefinitions };
677
693
  censuses.set(graph, census);
678
694
  return census;
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import ts from '#typescript';
2
2
  const isJavaScriptFile = (fileName) => fileName.endsWith('.js') || fileName.endsWith('.mjs') || fileName.endsWith('.cjs');
3
3
  const returnsAValue = (body) => body.statements.some((statement) => ts.isReturnStatement(statement) && statement.expression !== undefined);
4
4
  const alreadyTagged = (node) => ts.getJSDocTags(node).some((tag) => tag.tagName.text === 'class' || tag.tagName.text === 'constructor');
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import ts from '#typescript';
2
2
  export interface NodeProject {
3
3
  readonly root: string;
4
4
  readonly manifest: Record<string, unknown>;
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import ts from '#typescript';
2
2
  import { dirname, resolve, basename, extname } from 'node:path';
3
3
  import { createPackageSourceHost } from './package-sources.js';
4
4
  const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : {};
@@ -3,7 +3,7 @@
3
3
  import { registerHooks, isBuiltin } from 'node:module';
4
4
  import { fileURLToPath, pathToFileURL } from 'node:url';
5
5
  import { resolve, dirname, sep } from 'node:path';
6
- import ts from 'typescript';
6
+ import ts from '#typescript';
7
7
  import { createModuleResolver } from './module-resolution.js';
8
8
  import { defaultCompilerOptions } from './program.js';
9
9
  const serialized = process.env.GEATSC_SOURCE_CONTEXT;
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import ts from '#typescript';
2
2
  import type { NamespacePathCensus } from './namespace-paths.js';
3
3
  /**
4
4
  * The ambient globals an installed host declares it does NOT provide.