@geastack/compiler 1.0.15
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.
- package/LICENSE +202 -0
- package/README.md +149 -0
- package/dist/cli-analyze.d.ts +1 -0
- package/dist/cli-analyze.js +61 -0
- package/dist/cli-coverage.d.ts +1 -0
- package/dist/cli-coverage.js +329 -0
- package/dist/cli-emit.d.ts +10 -0
- package/dist/cli-emit.js +398 -0
- package/dist/cli-module-graph.d.ts +18 -0
- package/dist/cli-module-graph.js +123 -0
- package/dist/cli-package-source.d.ts +5 -0
- package/dist/cli-package-source.js +116 -0
- package/dist/cli-project.d.ts +2 -0
- package/dist/cli-project.js +60 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +199 -0
- package/dist/compiler.d.ts +228 -0
- package/dist/compiler.js +1029 -0
- package/dist/conversion/algebra.d.ts +218 -0
- package/dist/conversion/algebra.js +155 -0
- package/dist/conversion/build.d.ts +67 -0
- package/dist/conversion/build.js +1378 -0
- package/dist/conversion/derive.d.ts +37 -0
- package/dist/conversion/derive.js +260 -0
- package/dist/conversion/graph-validation.d.ts +8 -0
- package/dist/conversion/graph-validation.js +97 -0
- package/dist/conversion/native-callable-adapter.d.ts +13 -0
- package/dist/conversion/native-callable-adapter.js +53 -0
- package/dist/conversion/native-class-reference.d.ts +12 -0
- package/dist/conversion/native-class-reference.js +39 -0
- package/dist/conversion/native-payload-transport.d.ts +25 -0
- package/dist/conversion/native-payload-transport.js +33 -0
- package/dist/conversion/native-selection.d.ts +49 -0
- package/dist/conversion/native-selection.js +135 -0
- package/dist/conversion/native-sum.d.ts +42 -0
- package/dist/conversion/native-sum.js +115 -0
- package/dist/conversion/nodes.d.ts +55 -0
- package/dist/conversion/nodes.js +91 -0
- package/dist/conversion/operand-view.d.ts +14 -0
- package/dist/conversion/operand-view.js +20 -0
- package/dist/conversion/record-view.d.ts +157 -0
- package/dist/conversion/record-view.js +273 -0
- package/dist/conversion/registry.d.ts +217 -0
- package/dist/conversion/registry.js +1 -0
- package/dist/diagnostics/model.d.ts +76 -0
- package/dist/diagnostics/model.js +60 -0
- package/dist/diagnostics/sweep.d.ts +31 -0
- package/dist/diagnostics/sweep.js +112 -0
- package/dist/identity/ids.d.ts +179 -0
- package/dist/identity/ids.js +212 -0
- package/dist/ir/absent-class-arm.d.ts +48 -0
- package/dist/ir/absent-class-arm.js +157 -0
- package/dist/ir/borrow-effects.d.ts +23 -0
- package/dist/ir/borrow-effects.js +151 -0
- package/dist/ir/borrowed-call-arguments.d.ts +40 -0
- package/dist/ir/borrowed-call-arguments.js +117 -0
- package/dist/ir/build.d.ts +168 -0
- package/dist/ir/build.js +459 -0
- package/dist/ir/call-dispatch.d.ts +38 -0
- package/dist/ir/call-dispatch.js +502 -0
- package/dist/ir/call-entry.d.ts +142 -0
- package/dist/ir/call-entry.js +386 -0
- package/dist/ir/callable-class-flow.d.ts +27 -0
- package/dist/ir/callable-class-flow.js +1386 -0
- package/dist/ir/callable-field-slots.d.ts +22 -0
- package/dist/ir/callable-field-slots.js +166 -0
- package/dist/ir/callable-identity-demand.d.ts +52 -0
- package/dist/ir/callable-identity-demand.js +460 -0
- package/dist/ir/callable-member-candidates.d.ts +9 -0
- package/dist/ir/callable-member-candidates.js +39 -0
- package/dist/ir/callable-records.d.ts +21 -0
- package/dist/ir/callable-records.js +411 -0
- package/dist/ir/captures.d.ts +26 -0
- package/dist/ir/captures.js +335 -0
- package/dist/ir/certificate.d.ts +45 -0
- package/dist/ir/certificate.js +47 -0
- package/dist/ir/certify/carrier-keys.d.ts +73 -0
- package/dist/ir/certify/carrier-keys.js +221 -0
- package/dist/ir/certify/function-source.d.ts +4 -0
- package/dist/ir/certify/function-source.js +28 -0
- package/dist/ir/certify/has-property-key.d.ts +88 -0
- package/dist/ir/certify/has-property-key.js +116 -0
- package/dist/ir/certify/instanceof-key.d.ts +24 -0
- package/dist/ir/certify/instanceof-key.js +35 -0
- package/dist/ir/certify/property-access-keys.d.ts +172 -0
- package/dist/ir/certify/property-access-keys.js +291 -0
- package/dist/ir/certify/property-access.d.ts +3 -0
- package/dist/ir/certify/property-access.js +597 -0
- package/dist/ir/certify/runtime-helper.d.ts +3 -0
- package/dist/ir/certify/runtime-helper.js +326 -0
- package/dist/ir/certify/typeof-operand.d.ts +14 -0
- package/dist/ir/certify/typeof-operand.js +16 -0
- package/dist/ir/certify.d.ts +123 -0
- package/dist/ir/certify.js +481 -0
- package/dist/ir/class-evaluation.d.ts +26 -0
- package/dist/ir/class-evaluation.js +50 -0
- package/dist/ir/class-static-fields.d.ts +60 -0
- package/dist/ir/class-static-fields.js +108 -0
- package/dist/ir/construct-entry.d.ts +26 -0
- package/dist/ir/construct-entry.js +117 -0
- package/dist/ir/dead-values.d.ts +90 -0
- package/dist/ir/dead-values.js +184 -0
- package/dist/ir/deferral.d.ts +99 -0
- package/dist/ir/deferral.js +409 -0
- package/dist/ir/dense-loops.d.ts +230 -0
- package/dist/ir/dense-loops.js +697 -0
- package/dist/ir/dominance.d.ts +82 -0
- package/dist/ir/dominance.js +268 -0
- package/dist/ir/emission-representations.d.ts +71 -0
- package/dist/ir/emission-representations.js +350 -0
- package/dist/ir/facts.d.ts +218 -0
- package/dist/ir/facts.js +181 -0
- package/dist/ir/fixed-data-definition.d.ts +19 -0
- package/dist/ir/fixed-data-definition.js +49 -0
- package/dist/ir/generator-split.d.ts +38 -0
- package/dist/ir/generator-split.js +329 -0
- package/dist/ir/hoist.d.ts +55 -0
- package/dist/ir/hoist.js +375 -0
- package/dist/ir/instantiation.d.ts +61 -0
- package/dist/ir/instantiation.js +137 -0
- package/dist/ir/integer-storage.d.ts +170 -0
- package/dist/ir/integer-storage.js +822 -0
- package/dist/ir/integers.d.ts +161 -0
- package/dist/ir/integers.js +539 -0
- package/dist/ir/integrity-restrictions.d.ts +50 -0
- package/dist/ir/integrity-restrictions.js +118 -0
- package/dist/ir/local-iterators.d.ts +4 -0
- package/dist/ir/local-iterators.js +27 -0
- package/dist/ir/lower-allocation.d.ts +4 -0
- package/dist/ir/lower-allocation.js +325 -0
- package/dist/ir/lower-completion.d.ts +15 -0
- package/dist/ir/lower-completion.js +25 -0
- package/dist/ir/lower-destructuring.d.ts +5 -0
- package/dist/ir/lower-destructuring.js +693 -0
- package/dist/ir/lower-element.d.ts +29 -0
- package/dist/ir/lower-element.js +111 -0
- package/dist/ir/lower-exceptions.d.ts +47 -0
- package/dist/ir/lower-exceptions.js +92 -0
- package/dist/ir/lower-flow.d.ts +137 -0
- package/dist/ir/lower-flow.js +600 -0
- package/dist/ir/lower-graph.d.ts +218 -0
- package/dist/ir/lower-graph.js +687 -0
- package/dist/ir/lower-invocation.d.ts +4 -0
- package/dist/ir/lower-invocation.js +514 -0
- package/dist/ir/lower-narrow.d.ts +53 -0
- package/dist/ir/lower-narrow.js +320 -0
- package/dist/ir/lower-operands.d.ts +272 -0
- package/dist/ir/lower-operands.js +461 -0
- package/dist/ir/lower-property.d.ts +21 -0
- package/dist/ir/lower-property.js +132 -0
- package/dist/ir/lower-protocol.d.ts +11 -0
- package/dist/ir/lower-protocol.js +118 -0
- package/dist/ir/lower-short-circuit.d.ts +41 -0
- package/dist/ir/lower-short-circuit.js +63 -0
- package/dist/ir/lower.d.ts +82 -0
- package/dist/ir/lower.js +1346 -0
- package/dist/ir/model.d.ts +1474 -0
- package/dist/ir/model.js +6 -0
- package/dist/ir/native-absent-property.d.ts +3 -0
- package/dist/ir/native-absent-property.js +13 -0
- package/dist/ir/native-array-transport.d.ts +7 -0
- package/dist/ir/native-array-transport.js +46 -0
- package/dist/ir/native-callable-bind.d.ts +9 -0
- package/dist/ir/native-callable-bind.js +30 -0
- package/dist/ir/native-carrier-predicate.d.ts +34 -0
- package/dist/ir/native-carrier-predicate.js +49 -0
- package/dist/ir/native-class-accessor.d.ts +18 -0
- package/dist/ir/native-class-accessor.js +52 -0
- package/dist/ir/native-class-construction.d.ts +16 -0
- package/dist/ir/native-class-construction.js +71 -0
- package/dist/ir/native-class-initialization.d.ts +15 -0
- package/dist/ir/native-class-initialization.js +56 -0
- package/dist/ir/native-class-origins.d.ts +13 -0
- package/dist/ir/native-class-origins.js +237 -0
- package/dist/ir/native-dictionary-transport.d.ts +6 -0
- package/dist/ir/native-dictionary-transport.js +37 -0
- package/dist/ir/native-enumeration.d.ts +14 -0
- package/dist/ir/native-enumeration.js +26 -0
- package/dist/ir/native-equality.d.ts +10 -0
- package/dist/ir/native-equality.js +18 -0
- package/dist/ir/native-field-owner.d.ts +37 -0
- package/dist/ir/native-field-owner.js +183 -0
- package/dist/ir/native-fixed-layout.d.ts +41 -0
- package/dist/ir/native-fixed-layout.js +232 -0
- package/dist/ir/native-host-construction.d.ts +53 -0
- package/dist/ir/native-host-construction.js +62 -0
- package/dist/ir/native-key-query.d.ts +4 -0
- package/dist/ir/native-key-query.js +38 -0
- package/dist/ir/native-merge-transport.d.ts +25 -0
- package/dist/ir/native-merge-transport.js +71 -0
- package/dist/ir/native-record-index-transport.d.ts +11 -0
- package/dist/ir/native-record-index-transport.js +34 -0
- package/dist/ir/native-record-index.d.ts +12 -0
- package/dist/ir/native-record-index.js +27 -0
- package/dist/ir/native-reflect-field.d.ts +5 -0
- package/dist/ir/native-reflect-field.js +33 -0
- package/dist/ir/native-sequence-transport.d.ts +7 -0
- package/dist/ir/native-sequence-transport.js +53 -0
- package/dist/ir/numeric-intrinsics.d.ts +13 -0
- package/dist/ir/numeric-intrinsics.js +57 -0
- package/dist/ir/object-value-conversions.d.ts +20 -0
- package/dist/ir/object-value-conversions.js +50 -0
- package/dist/ir/physical-class-reflection.d.ts +9 -0
- package/dist/ir/physical-class-reflection.js +57 -0
- package/dist/ir/presence-proof.d.ts +42 -0
- package/dist/ir/presence-proof.js +490 -0
- package/dist/ir/program-facts.d.ts +106 -0
- package/dist/ir/program-facts.js +319 -0
- package/dist/ir/proven-branches.d.ts +16 -0
- package/dist/ir/proven-branches.js +219 -0
- package/dist/ir/queries.d.ts +41 -0
- package/dist/ir/queries.js +213 -0
- package/dist/ir/reflection-demand.d.ts +64 -0
- package/dist/ir/reflection-demand.js +1394 -0
- package/dist/ir/refusal.d.ts +43 -0
- package/dist/ir/refusal.js +28 -0
- package/dist/ir/shake.d.ts +37 -0
- package/dist/ir/shake.js +1078 -0
- package/dist/ir/static-callables.d.ts +11 -0
- package/dist/ir/static-callables.js +163 -0
- package/dist/ir/string-layout-reuse.d.ts +13 -0
- package/dist/ir/string-layout-reuse.js +39 -0
- package/dist/ir/string-length-reuse.d.ts +8 -0
- package/dist/ir/string-length-reuse.js +47 -0
- package/dist/ir/transfer.d.ts +78 -0
- package/dist/ir/transfer.js +270 -0
- package/dist/ir/type-query-results.d.ts +25 -0
- package/dist/ir/type-query-results.js +96 -0
- package/dist/ir/typed-property-access.d.ts +100 -0
- package/dist/ir/typed-property-access.js +161 -0
- package/dist/ir/verify.d.ts +19 -0
- package/dist/ir/verify.js +355 -0
- package/dist/plugins/apple/constructors.d.ts +112 -0
- package/dist/plugins/apple/constructors.js +217 -0
- package/dist/plugins/apple/host.d.ts +181 -0
- package/dist/plugins/apple/host.js +262 -0
- package/dist/plugins/apple/jsx.d.ts +2 -0
- package/dist/plugins/apple/jsx.js +293 -0
- package/dist/plugins/apple/members.d.ts +16 -0
- package/dist/plugins/apple/members.js +190 -0
- package/dist/plugins/apple/plugin.d.ts +2 -0
- package/dist/plugins/apple/plugin.js +156 -0
- package/dist/plugins/gea/component-classes.d.ts +25 -0
- package/dist/plugins/gea/component-classes.js +162 -0
- package/dist/plugins/gea/component-inline.d.ts +13 -0
- package/dist/plugins/gea/component-inline.js +532 -0
- package/dist/plugins/gea/constructors.d.ts +23 -0
- package/dist/plugins/gea/constructors.js +100 -0
- package/dist/plugins/gea/contract.d.ts +150 -0
- package/dist/plugins/gea/contract.js +195 -0
- package/dist/plugins/gea/element-ref.d.ts +31 -0
- package/dist/plugins/gea/element-ref.js +45 -0
- package/dist/plugins/gea/host.d.ts +520 -0
- package/dist/plugins/gea/host.js +762 -0
- package/dist/plugins/gea/lower.d.ts +6 -0
- package/dist/plugins/gea/lower.js +195 -0
- package/dist/plugins/gea/members.d.ts +22 -0
- package/dist/plugins/gea/members.js +221 -0
- package/dist/plugins/gea/plugin.d.ts +22 -0
- package/dist/plugins/gea/plugin.js +307 -0
- package/dist/plugins/gea/prelude.d.ts +78 -0
- package/dist/plugins/gea/prelude.js +153 -0
- package/dist/plugins/gea/producer.d.ts +5 -0
- package/dist/plugins/gea/producer.js +52 -0
- package/dist/plugins/gea/reactive-slots.d.ts +49 -0
- package/dist/plugins/gea/reactive-slots.js +578 -0
- package/dist/plugins/gea/render-bridge.d.ts +6 -0
- package/dist/plugins/gea/render-bridge.js +281 -0
- package/dist/plugins/gea/slots.d.ts +15 -0
- package/dist/plugins/gea/slots.js +36 -0
- package/dist/plugins/gea/template-analysis.d.ts +151 -0
- package/dist/plugins/gea/template-analysis.js +346 -0
- package/dist/plugins/gea/user-agent-styles.d.ts +9 -0
- package/dist/plugins/gea/user-agent-styles.js +94 -0
- package/dist/plugins/installed.d.ts +19 -0
- package/dist/plugins/installed.js +21 -0
- package/dist/plugins/load.d.ts +7 -0
- package/dist/plugins/load.js +207 -0
- package/dist/plugins/model.d.ts +735 -0
- package/dist/plugins/model.js +47 -0
- package/dist/plugins/webgl/host.d.ts +77 -0
- package/dist/plugins/webgl/host.js +162 -0
- package/dist/plugins/webgl/plugin.d.ts +40 -0
- package/dist/plugins/webgl/plugin.js +99 -0
- package/dist/preflight/obligations.d.ts +206 -0
- package/dist/preflight/obligations.js +36 -0
- package/dist/preflight/report.d.ts +20 -0
- package/dist/preflight/report.js +61 -0
- package/dist/preflight/run.d.ts +39 -0
- package/dist/preflight/run.js +403 -0
- package/dist/project-preparation.d.ts +33 -0
- package/dist/project-preparation.js +314 -0
- package/dist/projection/abi.d.ts +82 -0
- package/dist/projection/abi.js +349 -0
- package/dist/projection/apply-arguments.d.ts +12 -0
- package/dist/projection/apply-arguments.js +20 -0
- package/dist/projection/bindings.d.ts +250 -0
- package/dist/projection/bindings.js +340 -0
- package/dist/projection/callee.d.ts +196 -0
- package/dist/projection/callee.js +444 -0
- package/dist/projection/class-property-presence.d.ts +28 -0
- package/dist/projection/class-property-presence.js +58 -0
- package/dist/projection/class-prototype.d.ts +5 -0
- package/dist/projection/class-prototype.js +23 -0
- package/dist/projection/class-storage.d.ts +26 -0
- package/dist/projection/class-storage.js +236 -0
- package/dist/projection/classes.d.ts +283 -0
- package/dist/projection/classes.js +944 -0
- package/dist/projection/coercions.d.ts +20 -0
- package/dist/projection/coercions.js +33 -0
- package/dist/projection/dispatch.d.ts +167 -0
- package/dist/projection/dispatch.js +379 -0
- package/dist/projection/fields.d.ts +123 -0
- package/dist/projection/fields.js +383 -0
- package/dist/projection/instance-test.d.ts +78 -0
- package/dist/projection/instance-test.js +156 -0
- package/dist/projection/slots.d.ts +146 -0
- package/dist/projection/slots.js +663 -0
- package/dist/projection/synthesized-abi.d.ts +61 -0
- package/dist/projection/synthesized-abi.js +94 -0
- package/dist/representation/array-index.d.ts +14 -0
- package/dist/representation/array-index.js +17 -0
- package/dist/representation/callable-object.d.ts +3 -0
- package/dist/representation/callable-object.js +6 -0
- package/dist/representation/collections.d.ts +84 -0
- package/dist/representation/collections.js +139 -0
- package/dist/representation/derive.d.ts +159 -0
- package/dist/representation/derive.js +2546 -0
- package/dist/representation/difference.d.ts +30 -0
- package/dist/representation/difference.js +240 -0
- package/dist/representation/field-descriptor-policy.d.ts +19 -0
- package/dist/representation/field-descriptor-policy.js +39 -0
- package/dist/representation/function-constructor.d.ts +13 -0
- package/dist/representation/function-constructor.js +9 -0
- package/dist/representation/host-abi.d.ts +32 -0
- package/dist/representation/host-abi.js +97 -0
- package/dist/representation/host-templates.d.ts +67 -0
- package/dist/representation/host-templates.js +94 -0
- package/dist/representation/intersection.d.ts +84 -0
- package/dist/representation/intersection.js +149 -0
- package/dist/representation/literal-destination.d.ts +43 -0
- package/dist/representation/literal-destination.js +133 -0
- package/dist/representation/merge.d.ts +18 -0
- package/dist/representation/merge.js +83 -0
- package/dist/representation/model.d.ts +1160 -0
- package/dist/representation/model.js +1019 -0
- package/dist/representation/numeric-index.d.ts +13 -0
- package/dist/representation/numeric-index.js +29 -0
- package/dist/representation/object-shape.d.ts +109 -0
- package/dist/representation/object-shape.js +123 -0
- package/dist/representation/optional.d.ts +12 -0
- package/dist/representation/optional.js +87 -0
- package/dist/representation/plan.d.ts +60 -0
- package/dist/representation/plan.js +78 -0
- package/dist/representation/policies.d.ts +589 -0
- package/dist/representation/policies.js +107 -0
- package/dist/representation/primitive-domain.d.ts +1 -0
- package/dist/representation/primitive-domain.js +1 -0
- package/dist/representation/primitives.d.ts +44 -0
- package/dist/representation/primitives.js +78 -0
- package/dist/representation/publish.d.ts +49 -0
- package/dist/representation/publish.js +648 -0
- package/dist/representation/record-fields.d.ts +96 -0
- package/dist/representation/record-fields.js +116 -0
- package/dist/representation/template-object.d.ts +11 -0
- package/dist/representation/template-object.js +26 -0
- package/dist/representation/union.d.ts +30 -0
- package/dist/representation/union.js +324 -0
- package/dist/representation/value-records.d.ts +3 -0
- package/dist/representation/value-records.js +307 -0
- package/dist/representation/verify.d.ts +17 -0
- package/dist/representation/verify.js +221 -0
- package/dist/semantics/alias-this-field-declaration-transform.d.ts +4 -0
- package/dist/semantics/alias-this-field-declaration-transform.js +207 -0
- package/dist/semantics/ambient-type-realization-transform.d.ts +62 -0
- package/dist/semantics/ambient-type-realization-transform.js +168 -0
- package/dist/semantics/ambient.d.ts +24 -0
- package/dist/semantics/ambient.js +119 -0
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.d.ts +4 -0
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +341 -0
- package/dist/semantics/callable-origins.d.ts +46 -0
- package/dist/semantics/callable-origins.js +354 -0
- package/dist/semantics/class-alias.d.ts +7 -0
- package/dist/semantics/class-alias.js +37 -0
- package/dist/semantics/class-heritage.d.ts +34 -0
- package/dist/semantics/class-heritage.js +104 -0
- package/dist/semantics/commonjs-wrapper.d.ts +69 -0
- package/dist/semantics/commonjs-wrapper.js +231 -0
- package/dist/semantics/constructor-slot-subclasses.d.ts +28 -0
- package/dist/semantics/constructor-slot-subclasses.js +112 -0
- package/dist/semantics/declaration-overlay-transform.d.ts +35 -0
- package/dist/semantics/declaration-overlay-transform.js +2157 -0
- package/dist/semantics/define-property-source-transform.d.ts +4 -0
- package/dist/semantics/define-property-source-transform.js +437 -0
- package/dist/semantics/diagnostic-source-preparation.d.ts +24 -0
- package/dist/semantics/diagnostic-source-preparation.js +82 -0
- package/dist/semantics/documentation-ranges.d.ts +22 -0
- package/dist/semantics/documentation-ranges.js +36 -0
- package/dist/semantics/dynamic-fallback.d.ts +86 -0
- package/dist/semantics/dynamic-fallback.js +249 -0
- package/dist/semantics/frontend-timing.d.ts +6 -0
- package/dist/semantics/frontend-timing.js +35 -0
- package/dist/semantics/frontend.d.ts +504 -0
- package/dist/semantics/frontend.js +1157 -0
- package/dist/semantics/host-declaration-provenance.d.ts +11 -0
- package/dist/semantics/host-declaration-provenance.js +18 -0
- package/dist/semantics/host-methods.d.ts +24 -0
- package/dist/semantics/host-methods.js +74 -0
- package/dist/semantics/host-protocols.d.ts +429 -0
- package/dist/semantics/host-protocols.js +1501 -0
- package/dist/semantics/inherited-accessor.d.ts +7 -0
- package/dist/semantics/inherited-accessor.js +48 -0
- package/dist/semantics/interface-families.d.ts +70 -0
- package/dist/semantics/interface-families.js +180 -0
- package/dist/semantics/interface-implementors.d.ts +53 -0
- package/dist/semantics/interface-implementors.js +87 -0
- package/dist/semantics/jsdoc-namepath-transform.d.ts +4 -0
- package/dist/semantics/jsdoc-namepath-transform.js +85 -0
- package/dist/semantics/model/coverage.d.ts +68 -0
- package/dist/semantics/model/coverage.js +73 -0
- package/dist/semantics/model/edges.d.ts +103 -0
- package/dist/semantics/model/edges.js +20 -0
- package/dist/semantics/model/graph.d.ts +55 -0
- package/dist/semantics/model/graph.js +129 -0
- package/dist/semantics/model/operands.d.ts +159 -0
- package/dist/semantics/model/operands.js +26 -0
- package/dist/semantics/model/operations.d.ts +496 -0
- package/dist/semantics/model/operations.js +2 -0
- package/dist/semantics/model/primitive-domain.d.ts +26 -0
- package/dist/semantics/model/primitive-domain.js +38 -0
- package/dist/semantics/model/selected-signature.d.ts +261 -0
- package/dist/semantics/model/selected-signature.js +55 -0
- package/dist/semantics/model/structural-type-table.d.ts +93 -0
- package/dist/semantics/model/structural-type-table.js +237 -0
- package/dist/semantics/model/structural-types.d.ts +367 -0
- package/dist/semantics/model/structural-types.js +200 -0
- package/dist/semantics/module-resolution.d.ts +23 -0
- package/dist/semantics/module-resolution.js +227 -0
- package/dist/semantics/new-callee-class-tag-source-transform.d.ts +4 -0
- package/dist/semantics/new-callee-class-tag-source-transform.js +64 -0
- package/dist/semantics/node-project.d.ts +13 -0
- package/dist/semantics/node-project.js +107 -0
- package/dist/semantics/node-source-hooks.d.ts +1 -0
- package/dist/semantics/node-source-hooks.js +63 -0
- package/dist/semantics/normalize/absent-globals.d.ts +143 -0
- package/dist/semantics/normalize/absent-globals.js +191 -0
- package/dist/semantics/normalize/arguments-objects.d.ts +43 -0
- package/dist/semantics/normalize/arguments-objects.js +60 -0
- package/dist/semantics/normalize/asserted-arm-absence.d.ts +28 -0
- package/dist/semantics/normalize/asserted-arm-absence.js +61 -0
- package/dist/semantics/normalize/assignment-patterns.d.ts +70 -0
- package/dist/semantics/normalize/assignment-patterns.js +147 -0
- package/dist/semantics/normalize/bag-absence.d.ts +8 -0
- package/dist/semantics/normalize/bag-absence.js +42 -0
- package/dist/semantics/normalize/binding-fixpoint.d.ts +36 -0
- package/dist/semantics/normalize/binding-fixpoint.js +140 -0
- package/dist/semantics/normalize/callback-parameter-contracts.d.ts +16 -0
- package/dist/semantics/normalize/callback-parameter-contracts.js +91 -0
- package/dist/semantics/normalize/cells/agreement.d.ts +46 -0
- package/dist/semantics/normalize/cells/agreement.js +34 -0
- package/dist/semantics/normalize/cells/candidates.d.ts +17 -0
- package/dist/semantics/normalize/cells/candidates.js +35 -0
- package/dist/semantics/normalize/cells/facts.d.ts +19 -0
- package/dist/semantics/normalize/cells/facts.js +90 -0
- package/dist/semantics/normalize/cells/index.d.ts +10 -0
- package/dist/semantics/normalize/cells/index.js +6 -0
- package/dist/semantics/normalize/cells/model.d.ts +98 -0
- package/dist/semantics/normalize/cells/model.js +2 -0
- package/dist/semantics/normalize/cells/policies/bag.d.ts +44 -0
- package/dist/semantics/normalize/cells/policies/bag.js +114 -0
- package/dist/semantics/normalize/cells/policies/collection.d.ts +42 -0
- package/dist/semantics/normalize/cells/policies/collection.js +218 -0
- package/dist/semantics/normalize/cells/policies/field.d.ts +28 -0
- package/dist/semantics/normalize/cells/policies/field.js +40 -0
- package/dist/semantics/normalize/cells/policies/index.d.ts +49 -0
- package/dist/semantics/normalize/cells/policies/index.js +58 -0
- package/dist/semantics/normalize/cells/policies/local.d.ts +18 -0
- package/dist/semantics/normalize/cells/policies/local.js +37 -0
- package/dist/semantics/normalize/cells/policies/parameter.d.ts +28 -0
- package/dist/semantics/normalize/cells/policies/parameter.js +39 -0
- package/dist/semantics/normalize/cells/policies/return.d.ts +26 -0
- package/dist/semantics/normalize/cells/policies/return.js +45 -0
- package/dist/semantics/normalize/cells/policies/shared.d.ts +33 -0
- package/dist/semantics/normalize/cells/policies/shared.js +45 -0
- package/dist/semantics/normalize/cells/policy.d.ts +72 -0
- package/dist/semantics/normalize/cells/policy.js +18 -0
- package/dist/semantics/normalize/cells/registry.d.ts +14 -0
- package/dist/semantics/normalize/cells/registry.js +17 -0
- package/dist/semantics/normalize/census-refusal.d.ts +62 -0
- package/dist/semantics/normalize/census-refusal.js +27 -0
- package/dist/semantics/normalize/census.d.ts +109 -0
- package/dist/semantics/normalize/census.js +667 -0
- package/dist/semantics/normalize/collection-bindings.d.ts +278 -0
- package/dist/semantics/normalize/collection-bindings.js +677 -0
- package/dist/semantics/normalize/commonjs-module-record.d.ts +21 -0
- package/dist/semantics/normalize/commonjs-module-record.js +289 -0
- package/dist/semantics/normalize/commonjs-require.d.ts +13 -0
- package/dist/semantics/normalize/commonjs-require.js +1527 -0
- package/dist/semantics/normalize/contribution.d.ts +63 -0
- package/dist/semantics/normalize/contribution.js +172 -0
- package/dist/semantics/normalize/dead-typeof-guards.d.ts +64 -0
- package/dist/semantics/normalize/dead-typeof-guards.js +152 -0
- package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +57 -0
- package/dist/semantics/normalize/deferred-intrinsic-protocols.js +109 -0
- package/dist/semantics/normalize/derived-expression-type.d.ts +1070 -0
- package/dist/semantics/normalize/derived-expression-type.js +3463 -0
- package/dist/semantics/normalize/evaluation-order.d.ts +16 -0
- package/dist/semantics/normalize/evaluation-order.js +37 -0
- package/dist/semantics/normalize/field-bindings.d.ts +167 -0
- package/dist/semantics/normalize/field-bindings.js +1125 -0
- package/dist/semantics/normalize/flow/array-element-continuation.d.ts +27 -0
- package/dist/semantics/normalize/flow/array-element-continuation.js +1452 -0
- package/dist/semantics/normalize/flow/callable-array-origins.d.ts +42 -0
- package/dist/semantics/normalize/flow/callable-array-origins.js +318 -0
- package/dist/semantics/normalize/flow/callable-completions.d.ts +45 -0
- package/dist/semantics/normalize/flow/callable-completions.js +82 -0
- package/dist/semantics/normalize/flow/callable-reach.d.ts +237 -0
- package/dist/semantics/normalize/flow/callable-reach.js +7174 -0
- package/dist/semantics/normalize/flow/class-family-member-read.d.ts +16 -0
- package/dist/semantics/normalize/flow/class-family-member-read.js +992 -0
- package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +21 -0
- package/dist/semantics/normalize/flow/collection-value-continuation.js +192 -0
- package/dist/semantics/normalize/flow/component-solver.d.ts +199 -0
- package/dist/semantics/normalize/flow/component-solver.js +587 -0
- package/dist/semantics/normalize/flow/computed-key-set.d.ts +84 -0
- package/dist/semantics/normalize/flow/computed-key-set.js +660 -0
- package/dist/semantics/normalize/flow/export-importers.d.ts +24 -0
- package/dist/semantics/normalize/flow/export-importers.js +269 -0
- package/dist/semantics/normalize/flow/host-text-sink.d.ts +25 -0
- package/dist/semantics/normalize/flow/host-text-sink.js +87 -0
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.d.ts +84 -0
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +180 -0
- package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +35 -0
- package/dist/semantics/normalize/flow/intrinsic-data-definition.js +140 -0
- package/dist/semantics/normalize/flow/invocation-facts.d.ts +98 -0
- package/dist/semantics/normalize/flow/invocation-facts.js +257 -0
- package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +122 -0
- package/dist/semantics/normalize/flow/member-call-forwarding.js +835 -0
- package/dist/semantics/normalize/flow/model.d.ts +357 -0
- package/dist/semantics/normalize/flow/model.js +177 -0
- package/dist/semantics/normalize/flow/native-collection-protocol.d.ts +24 -0
- package/dist/semantics/normalize/flow/native-collection-protocol.js +252 -0
- package/dist/semantics/normalize/flow/node-path-token.d.ts +3 -0
- package/dist/semantics/normalize/flow/node-path-token.js +53 -0
- package/dist/semantics/normalize/flow/object-binding-continuation.d.ts +11 -0
- package/dist/semantics/normalize/flow/object-binding-continuation.js +42 -0
- package/dist/semantics/normalize/flow/origin-authority.d.ts +56 -0
- package/dist/semantics/normalize/flow/origin-authority.js +2 -0
- package/dist/semantics/normalize/flow/owned-class-receivers.d.ts +35 -0
- package/dist/semantics/normalize/flow/owned-class-receivers.js +191 -0
- package/dist/semantics/normalize/flow/parameter-values.d.ts +27 -0
- package/dist/semantics/normalize/flow/parameter-values.js +251 -0
- package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +66 -0
- package/dist/semantics/normalize/flow/proof-hypotheses.js +162 -0
- package/dist/semantics/normalize/flow/record-alias-closure.d.ts +27 -0
- package/dist/semantics/normalize/flow/record-alias-closure.js +298 -0
- package/dist/semantics/normalize/flow/seeded-origins.d.ts +43 -0
- package/dist/semantics/normalize/flow/seeded-origins.js +54 -0
- package/dist/semantics/normalize/flow/source-class-data.d.ts +132 -0
- package/dist/semantics/normalize/flow/source-class-data.js +838 -0
- package/dist/semantics/normalize/flow/source-class-instanceof.d.ts +13 -0
- package/dist/semantics/normalize/flow/source-class-instanceof.js +37 -0
- package/dist/semantics/normalize/flow/source-class-static-data.d.ts +16 -0
- package/dist/semantics/normalize/flow/source-class-static-data.js +47 -0
- package/dist/semantics/normalize/flow/source-construction-frames.d.ts +12 -0
- package/dist/semantics/normalize/flow/source-construction-frames.js +118 -0
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +34 -0
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +78 -0
- package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +37 -0
- package/dist/semantics/normalize/flow/source-invocation-receiver.js +95 -0
- package/dist/semantics/normalize/flow/source-prototype-method-identity.d.ts +23 -0
- package/dist/semantics/normalize/flow/source-prototype-method-identity.js +81 -0
- package/dist/semantics/normalize/flow/source-record-data.d.ts +29 -0
- package/dist/semantics/normalize/flow/source-record-data.js +626 -0
- package/dist/semantics/normalize/flow/source-value-session.d.ts +77 -0
- package/dist/semantics/normalize/flow/source-value-session.js +3089 -0
- package/dist/semantics/normalize/flow/targets.d.ts +118 -0
- package/dist/semantics/normalize/flow/targets.js +405 -0
- package/dist/semantics/normalize/flow/value-flow.d.ts +36 -0
- package/dist/semantics/normalize/flow/value-flow.js +823 -0
- package/dist/semantics/normalize/flow/value-provenance.d.ts +31 -0
- package/dist/semantics/normalize/flow/value-provenance.js +112 -0
- package/dist/semantics/normalize/gating.d.ts +51 -0
- package/dist/semantics/normalize/gating.js +560 -0
- package/dist/semantics/normalize/generic-function-choice.d.ts +31 -0
- package/dist/semantics/normalize/generic-function-choice.js +115 -0
- package/dist/semantics/normalize/global-host-mutations.d.ts +51 -0
- package/dist/semantics/normalize/global-host-mutations.js +5989 -0
- package/dist/semantics/normalize/host-effect-contracts.d.ts +77 -0
- package/dist/semantics/normalize/host-effect-contracts.js +143 -0
- package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +38 -0
- package/dist/semantics/normalize/host-mutation-computed-keys.js +26 -0
- package/dist/semantics/normalize/host-mutation-key-reader.d.ts +66 -0
- package/dist/semantics/normalize/host-mutation-key-reader.js +192 -0
- package/dist/semantics/normalize/host-mutation-keys.d.ts +114 -0
- package/dist/semantics/normalize/host-mutation-keys.js +183 -0
- package/dist/semantics/normalize/identities.d.ts +172 -0
- package/dist/semantics/normalize/identities.js +426 -0
- package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +97 -0
- package/dist/semantics/normalize/implicit-arguments-tuple.js +197 -0
- package/dist/semantics/normalize/implicit-arguments.d.ts +11 -0
- package/dist/semantics/normalize/implicit-arguments.js +39 -0
- package/dist/semantics/normalize/instantiation.d.ts +73 -0
- package/dist/semantics/normalize/instantiation.js +399 -0
- package/dist/semantics/normalize/intrinsic-property-call.d.ts +18 -0
- package/dist/semantics/normalize/intrinsic-property-call.js +69 -0
- package/dist/semantics/normalize/intrinsic-prototype.d.ts +41 -0
- package/dist/semantics/normalize/intrinsic-prototype.js +87 -0
- package/dist/semantics/normalize/intrinsic-static-member.d.ts +14 -0
- package/dist/semantics/normalize/intrinsic-static-member.js +23 -0
- package/dist/semantics/normalize/jsdoc-type-names.d.ts +32 -0
- package/dist/semantics/normalize/jsdoc-type-names.js +512 -0
- package/dist/semantics/normalize/keyof.d.ts +32 -0
- package/dist/semantics/normalize/keyof.js +110 -0
- package/dist/semantics/normalize/local-bindings.d.ts +176 -0
- package/dist/semantics/normalize/local-bindings.js +1826 -0
- package/dist/semantics/normalize/logical-result-type.d.ts +16 -0
- package/dist/semantics/normalize/logical-result-type.js +102 -0
- package/dist/semantics/normalize/namespace-paths.d.ts +57 -0
- package/dist/semantics/normalize/namespace-paths.js +108 -0
- package/dist/semantics/normalize/normalize.d.ts +57 -0
- package/dist/semantics/normalize/normalize.js +68 -0
- package/dist/semantics/normalize/object-bag-bindings.d.ts +305 -0
- package/dist/semantics/normalize/object-bag-bindings.js +1290 -0
- package/dist/semantics/normalize/omitted-stated-parameter.d.ts +53 -0
- package/dist/semantics/normalize/omitted-stated-parameter.js +59 -0
- package/dist/semantics/normalize/open-type-form.d.ts +10 -0
- package/dist/semantics/normalize/open-type-form.js +32 -0
- package/dist/semantics/normalize/parameter-bindings.d.ts +361 -0
- package/dist/semantics/normalize/parameter-bindings.js +3339 -0
- package/dist/semantics/normalize/parameter-slot.d.ts +264 -0
- package/dist/semantics/normalize/parameter-slot.js +491 -0
- package/dist/semantics/normalize/physical-overload-result.d.ts +77 -0
- package/dist/semantics/normalize/physical-overload-result.js +99 -0
- package/dist/semantics/normalize/primitive-property-absence.d.ts +12 -0
- package/dist/semantics/normalize/primitive-property-absence.js +60 -0
- package/dist/semantics/normalize/producer-context.d.ts +376 -0
- package/dist/semantics/normalize/producer-context.js +1 -0
- package/dist/semantics/normalize/producers/allocations.d.ts +3 -0
- package/dist/semantics/normalize/producers/allocations.js +863 -0
- package/dist/semantics/normalize/producers/binding-kind.d.ts +37 -0
- package/dist/semantics/normalize/producers/binding-kind.js +36 -0
- package/dist/semantics/normalize/producers/bindings.d.ts +85 -0
- package/dist/semantics/normalize/producers/bindings.js +710 -0
- package/dist/semantics/normalize/producers/boundary.d.ts +34 -0
- package/dist/semantics/normalize/producers/boundary.js +123 -0
- package/dist/semantics/normalize/producers/class-lifecycle.d.ts +3 -0
- package/dist/semantics/normalize/producers/class-lifecycle.js +902 -0
- package/dist/semantics/normalize/producers/computations.d.ts +3 -0
- package/dist/semantics/normalize/producers/computations.js +613 -0
- package/dist/semantics/normalize/producers/control-loops.d.ts +30 -0
- package/dist/semantics/normalize/producers/control-loops.js +91 -0
- package/dist/semantics/normalize/producers/control.d.ts +30 -0
- package/dist/semantics/normalize/producers/control.js +923 -0
- package/dist/semantics/normalize/producers/declaration-lifecycle.d.ts +3 -0
- package/dist/semantics/normalize/producers/declaration-lifecycle.js +390 -0
- package/dist/semantics/normalize/producers/destructuring.d.ts +45 -0
- package/dist/semantics/normalize/producers/destructuring.js +1180 -0
- package/dist/semantics/normalize/producers/dynamic-language.d.ts +3 -0
- package/dist/semantics/normalize/producers/dynamic-language.js +70 -0
- package/dist/semantics/normalize/producers/erasure.d.ts +51 -0
- package/dist/semantics/normalize/producers/erasure.js +90 -0
- package/dist/semantics/normalize/producers/installed.d.ts +3 -0
- package/dist/semantics/normalize/producers/installed.js +55 -0
- package/dist/semantics/normalize/producers/invocations.d.ts +35 -0
- package/dist/semantics/normalize/producers/invocations.js +1796 -0
- package/dist/semantics/normalize/producers/iteration-yield.d.ts +59 -0
- package/dist/semantics/normalize/producers/iteration-yield.js +235 -0
- package/dist/semantics/normalize/producers/jsx.d.ts +3 -0
- package/dist/semantics/normalize/producers/jsx.js +360 -0
- package/dist/semantics/normalize/producers/mint.d.ts +39 -0
- package/dist/semantics/normalize/producers/mint.js +44 -0
- package/dist/semantics/normalize/producers/nullish.d.ts +16 -0
- package/dist/semantics/normalize/producers/nullish.js +27 -0
- package/dist/semantics/normalize/producers/object-assignment.d.ts +8 -0
- package/dist/semantics/normalize/producers/object-assignment.js +204 -0
- package/dist/semantics/normalize/producers/object-tag.d.ts +9 -0
- package/dist/semantics/normalize/producers/object-tag.js +119 -0
- package/dist/semantics/normalize/producers/optional-chain.d.ts +44 -0
- package/dist/semantics/normalize/producers/optional-chain.js +75 -0
- package/dist/semantics/normalize/producers/properties.d.ts +21 -0
- package/dist/semantics/normalize/producers/properties.js +1053 -0
- package/dist/semantics/normalize/producers/protocol.d.ts +67 -0
- package/dist/semantics/normalize/producers/protocol.js +695 -0
- package/dist/semantics/normalize/producers/references.d.ts +53 -0
- package/dist/semantics/normalize/producers/references.js +1027 -0
- package/dist/semantics/normalize/producers/shared.d.ts +561 -0
- package/dist/semantics/normalize/producers/shared.js +1683 -0
- package/dist/semantics/normalize/producers/spread-arguments.d.ts +72 -0
- package/dist/semantics/normalize/producers/spread-arguments.js +375 -0
- package/dist/semantics/normalize/producers/tagged-template.d.ts +5 -0
- package/dist/semantics/normalize/producers/tagged-template.js +307 -0
- package/dist/semantics/normalize/producers/tuple-spread.d.ts +189 -0
- package/dist/semantics/normalize/producers/tuple-spread.js +279 -0
- package/dist/semantics/normalize/property-key-domain.d.ts +36 -0
- package/dist/semantics/normalize/property-key-domain.js +150 -0
- package/dist/semantics/normalize/reachability.d.ts +189 -0
- package/dist/semantics/normalize/reachability.js +1057 -0
- package/dist/semantics/normalize/reassigned-bindings.d.ts +13 -0
- package/dist/semantics/normalize/reassigned-bindings.js +41 -0
- package/dist/semantics/normalize/record-storage-families.d.ts +11 -0
- package/dist/semantics/normalize/record-storage-families.js +109 -0
- package/dist/semantics/normalize/return-bindings.d.ts +260 -0
- package/dist/semantics/normalize/return-bindings.js +1311 -0
- package/dist/semantics/normalize/return-paths.d.ts +2 -0
- package/dist/semantics/normalize/return-paths.js +28 -0
- package/dist/semantics/normalize/script-global-redefinition.d.ts +44 -0
- package/dist/semantics/normalize/script-global-redefinition.js +75 -0
- package/dist/semantics/normalize/specialization.d.ts +201 -0
- package/dist/semantics/normalize/specialization.js +1824 -0
- package/dist/semantics/normalize/structural-array-element.d.ts +176 -0
- package/dist/semantics/normalize/structural-array-element.js +700 -0
- package/dist/semantics/normalize/structural-array-read.d.ts +13 -0
- package/dist/semantics/normalize/structural-array-read.js +124 -0
- package/dist/semantics/normalize/structural-callable.d.ts +12 -0
- package/dist/semantics/normalize/structural-callable.js +82 -0
- package/dist/semantics/normalize/structural-creation-order.d.ts +32 -0
- package/dist/semantics/normalize/structural-creation-order.js +111 -0
- package/dist/semantics/normalize/structural-declarations.d.ts +395 -0
- package/dist/semantics/normalize/structural-declarations.js +968 -0
- package/dist/semantics/normalize/structural-declared-body.d.ts +25 -0
- package/dist/semantics/normalize/structural-declared-body.js +147 -0
- package/dist/semantics/normalize/structural-generics.d.ts +56 -0
- package/dist/semantics/normalize/structural-generics.js +120 -0
- package/dist/semantics/normalize/structural-indexed-access.d.ts +11 -0
- package/dist/semantics/normalize/structural-indexed-access.js +126 -0
- package/dist/semantics/normalize/structural-instantiated-member.d.ts +64 -0
- package/dist/semantics/normalize/structural-instantiated-member.js +407 -0
- package/dist/semantics/normalize/structural-joins.d.ts +44 -0
- package/dist/semantics/normalize/structural-joins.js +143 -0
- package/dist/semantics/normalize/structural-layout-relevance.d.ts +29 -0
- package/dist/semantics/normalize/structural-layout-relevance.js +391 -0
- package/dist/semantics/normalize/structural-layout-type.d.ts +11 -0
- package/dist/semantics/normalize/structural-layout-type.js +1468 -0
- package/dist/semantics/normalize/structural-leaves.d.ts +49 -0
- package/dist/semantics/normalize/structural-leaves.js +125 -0
- package/dist/semantics/normalize/structural-local-union.d.ts +13 -0
- package/dist/semantics/normalize/structural-local-union.js +133 -0
- package/dist/semantics/normalize/structural-members.d.ts +26 -0
- package/dist/semantics/normalize/structural-members.js +84 -0
- package/dist/semantics/normalize/structural-mutable-method.d.ts +15 -0
- package/dist/semantics/normalize/structural-mutable-method.js +109 -0
- package/dist/semantics/normalize/structural-parts.d.ts +131 -0
- package/dist/semantics/normalize/structural-parts.js +737 -0
- package/dist/semantics/normalize/structural-receiver.d.ts +66 -0
- package/dist/semantics/normalize/structural-receiver.js +551 -0
- package/dist/semantics/normalize/structural-rules.d.ts +112 -0
- package/dist/semantics/normalize/structural-rules.js +93 -0
- package/dist/semantics/normalize/structural-self-reference.d.ts +150 -0
- package/dist/semantics/normalize/structural-self-reference.js +494 -0
- package/dist/semantics/normalize/structural.d.ts +202 -0
- package/dist/semantics/normalize/structural.js +4218 -0
- package/dist/semantics/normalize/unreduced-type-form.d.ts +41 -0
- package/dist/semantics/normalize/unreduced-type-form.js +53 -0
- package/dist/semantics/normalize/unresolvable-names.d.ts +56 -0
- package/dist/semantics/normalize/unresolvable-names.js +140 -0
- package/dist/semantics/package-sources.d.ts +16 -0
- package/dist/semantics/package-sources.js +365 -0
- package/dist/semantics/program.d.ts +151 -0
- package/dist/semantics/program.js +667 -0
- package/dist/semantics/prototype-install-source-transform.d.ts +4 -0
- package/dist/semantics/prototype-install-source-transform.js +341 -0
- package/dist/semantics/prototype-object-class-source-transform.d.ts +4 -0
- package/dist/semantics/prototype-object-class-source-transform.js +525 -0
- package/dist/semantics/prototype-reparenting.d.ts +50 -0
- package/dist/semantics/prototype-reparenting.js +317 -0
- package/dist/semantics/stable-checker.d.ts +10 -0
- package/dist/semantics/stable-checker.js +148 -0
- package/dist/semantics/subclass-member-overlay-transform.d.ts +35 -0
- package/dist/semantics/subclass-member-overlay-transform.js +1418 -0
- package/dist/semantics/symbol-keyed-expando-source-transform.d.ts +4 -0
- package/dist/semantics/symbol-keyed-expando-source-transform.js +66 -0
- package/dist/semantics/this-constructor-source-transform.d.ts +4 -0
- package/dist/semantics/this-constructor-source-transform.js +122 -0
- package/dist/semantics/uninstantiable-classes.d.ts +22 -0
- package/dist/semantics/uninstantiable-classes.js +75 -0
- package/dist/targets/cpp/balanced-units.d.ts +3 -0
- package/dist/targets/cpp/balanced-units.js +58 -0
- package/dist/targets/cpp/borrowed-call-entry.d.ts +30 -0
- package/dist/targets/cpp/borrowed-call-entry.js +68 -0
- package/dist/targets/cpp/captures.d.ts +68 -0
- package/dist/targets/cpp/captures.js +269 -0
- package/dist/targets/cpp/class-layout.d.ts +313 -0
- package/dist/targets/cpp/class-layout.js +483 -0
- package/dist/targets/cpp/class-properties/computed-method-value.d.ts +25 -0
- package/dist/targets/cpp/class-properties/computed-method-value.js +22 -0
- package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +216 -0
- package/dist/targets/cpp/class-properties/emit-class-properties.js +917 -0
- package/dist/targets/cpp/class-properties/native-prototype.d.ts +11 -0
- package/dist/targets/cpp/class-properties/native-prototype.js +101 -0
- package/dist/targets/cpp/class-ref-transport.d.ts +12 -0
- package/dist/targets/cpp/class-ref-transport.js +32 -0
- package/dist/targets/cpp/conversions.d.ts +3 -0
- package/dist/targets/cpp/conversions.js +2027 -0
- package/dist/targets/cpp/deferral-safety.d.ts +82 -0
- package/dist/targets/cpp/deferral-safety.js +86 -0
- package/dist/targets/cpp/direct-call-receivers.d.ts +37 -0
- package/dist/targets/cpp/direct-call-receivers.js +79 -0
- package/dist/targets/cpp/document.d.ts +74 -0
- package/dist/targets/cpp/document.js +106 -0
- package/dist/targets/cpp/emit-allocation.d.ts +60 -0
- package/dist/targets/cpp/emit-allocation.js +573 -0
- package/dist/targets/cpp/emit-arrays.d.ts +119 -0
- package/dist/targets/cpp/emit-arrays.js +1047 -0
- package/dist/targets/cpp/emit-binding-reference.d.ts +17 -0
- package/dist/targets/cpp/emit-binding-reference.js +120 -0
- package/dist/targets/cpp/emit-bindings.d.ts +158 -0
- package/dist/targets/cpp/emit-bindings.js +769 -0
- package/dist/targets/cpp/emit-buffers.d.ts +156 -0
- package/dist/targets/cpp/emit-buffers.js +573 -0
- package/dist/targets/cpp/emit-callable.d.ts +230 -0
- package/dist/targets/cpp/emit-callable.js +2154 -0
- package/dist/targets/cpp/emit-carrier-members.d.ts +406 -0
- package/dist/targets/cpp/emit-carrier-members.js +1224 -0
- package/dist/targets/cpp/emit-coercion.d.ts +26 -0
- package/dist/targets/cpp/emit-coercion.js +39 -0
- package/dist/targets/cpp/emit-context.d.ts +1882 -0
- package/dist/targets/cpp/emit-context.js +904 -0
- package/dist/targets/cpp/emit-dynamic-properties.d.ts +174 -0
- package/dist/targets/cpp/emit-dynamic-properties.js +1249 -0
- package/dist/targets/cpp/emit-equality.d.ts +39 -0
- package/dist/targets/cpp/emit-equality.js +472 -0
- package/dist/targets/cpp/emit-exceptions.d.ts +104 -0
- package/dist/targets/cpp/emit-exceptions.js +513 -0
- package/dist/targets/cpp/emit-field-owner.d.ts +4 -0
- package/dist/targets/cpp/emit-field-owner.js +27 -0
- package/dist/targets/cpp/emit-in.d.ts +31 -0
- package/dist/targets/cpp/emit-in.js +426 -0
- package/dist/targets/cpp/emit-instanceof.d.ts +19 -0
- package/dist/targets/cpp/emit-instanceof.js +601 -0
- package/dist/targets/cpp/emit-integers.d.ts +68 -0
- package/dist/targets/cpp/emit-integers.js +184 -0
- package/dist/targets/cpp/emit-iterator.d.ts +100 -0
- package/dist/targets/cpp/emit-iterator.js +1137 -0
- package/dist/targets/cpp/emit-json.d.ts +73 -0
- package/dist/targets/cpp/emit-json.js +823 -0
- package/dist/targets/cpp/emit-jsx.d.ts +74 -0
- package/dist/targets/cpp/emit-jsx.js +806 -0
- package/dist/targets/cpp/emit-mixed-binary.d.ts +51 -0
- package/dist/targets/cpp/emit-mixed-binary.js +60 -0
- package/dist/targets/cpp/emit-namespaces.d.ts +101 -0
- package/dist/targets/cpp/emit-namespaces.js +133 -0
- package/dist/targets/cpp/emit-narrowing.d.ts +738 -0
- package/dist/targets/cpp/emit-narrowing.js +3967 -0
- package/dist/targets/cpp/emit-native-equality.d.ts +3 -0
- package/dist/targets/cpp/emit-native-equality.js +14 -0
- package/dist/targets/cpp/emit-native-selection.d.ts +5 -0
- package/dist/targets/cpp/emit-native-selection.js +37 -0
- package/dist/targets/cpp/emit-object-tag.d.ts +4 -0
- package/dist/targets/cpp/emit-object-tag.js +108 -0
- package/dist/targets/cpp/emit-owned-record.d.ts +2 -0
- package/dist/targets/cpp/emit-owned-record.js +15 -0
- package/dist/targets/cpp/emit-presence.d.ts +78 -0
- package/dist/targets/cpp/emit-presence.js +376 -0
- package/dist/targets/cpp/emit-properties.d.ts +105 -0
- package/dist/targets/cpp/emit-properties.js +1640 -0
- package/dist/targets/cpp/emit-record-view.d.ts +20 -0
- package/dist/targets/cpp/emit-record-view.js +354 -0
- package/dist/targets/cpp/emit-return.d.ts +5 -0
- package/dist/targets/cpp/emit-return.js +237 -0
- package/dist/targets/cpp/emit-sum-widening.d.ts +10 -0
- package/dist/targets/cpp/emit-sum-widening.js +69 -0
- package/dist/targets/cpp/emit-tonumber.d.ts +38 -0
- package/dist/targets/cpp/emit-tonumber.js +177 -0
- package/dist/targets/cpp/emit-tostring.d.ts +92 -0
- package/dist/targets/cpp/emit-tostring.js +556 -0
- package/dist/targets/cpp/emit-typeof.d.ts +49 -0
- package/dist/targets/cpp/emit-typeof.js +317 -0
- package/dist/targets/cpp/emit-union-properties.d.ts +181 -0
- package/dist/targets/cpp/emit-union-properties.js +1281 -0
- package/dist/targets/cpp/emit.d.ts +45 -0
- package/dist/targets/cpp/emit.js +2225 -0
- package/dist/targets/cpp/error-types.d.ts +4 -0
- package/dist/targets/cpp/error-types.js +11 -0
- package/dist/targets/cpp/function-source-reads.d.ts +72 -0
- package/dist/targets/cpp/function-source-reads.js +148 -0
- package/dist/targets/cpp/host/atomics.d.ts +25 -0
- package/dist/targets/cpp/host/atomics.js +63 -0
- package/dist/targets/cpp/host/core-globals.d.ts +108 -0
- package/dist/targets/cpp/host/core-globals.js +158 -0
- package/dist/targets/cpp/host/dynamic-argument-members.d.ts +42 -0
- package/dist/targets/cpp/host/dynamic-argument-members.js +61 -0
- package/dist/targets/cpp/host/emit-host-arity.d.ts +139 -0
- package/dist/targets/cpp/host/emit-host-arity.js +232 -0
- package/dist/targets/cpp/host/emit-host-invoke.d.ts +91 -0
- package/dist/targets/cpp/host/emit-host-invoke.js +1105 -0
- package/dist/targets/cpp/host/emit-host-object.d.ts +55 -0
- package/dist/targets/cpp/host/emit-host-object.js +2206 -0
- package/dist/targets/cpp/host/emit-host-properties.d.ts +69 -0
- package/dist/targets/cpp/host/emit-host-properties.js +533 -0
- package/dist/targets/cpp/host/emit-host-reflect.d.ts +4 -0
- package/dist/targets/cpp/host/emit-host-reflect.js +180 -0
- package/dist/targets/cpp/host/emit-host-value.d.ts +120 -0
- package/dist/targets/cpp/host/emit-host-value.js +392 -0
- package/dist/targets/cpp/host/host-members.d.ts +505 -0
- package/dist/targets/cpp/host/host-members.js +819 -0
- package/dist/targets/cpp/host/host-method-aliases.d.ts +30 -0
- package/dist/targets/cpp/host/host-method-aliases.js +76 -0
- package/dist/targets/cpp/host/native-protocols.d.ts +47 -0
- package/dist/targets/cpp/host/native-protocols.js +183 -0
- package/dist/targets/cpp/host/object-protocol.d.ts +351 -0
- package/dist/targets/cpp/host/object-protocol.js +671 -0
- package/dist/targets/cpp/host-namespace-reads.d.ts +83 -0
- package/dist/targets/cpp/host-namespace-reads.js +113 -0
- package/dist/targets/cpp/manifest/capabilities.d.ts +39 -0
- package/dist/targets/cpp/manifest/capabilities.js +1484 -0
- package/dist/targets/cpp/manifest.d.ts +23 -0
- package/dist/targets/cpp/manifest.js +113 -0
- package/dist/targets/cpp/native-error-base.d.ts +38 -0
- package/dist/targets/cpp/native-error-base.js +74 -0
- package/dist/targets/cpp/native-narrowing-transport.d.ts +12 -0
- package/dist/targets/cpp/native-narrowing-transport.js +151 -0
- package/dist/targets/cpp/native-selection-helpers.d.ts +11 -0
- package/dist/targets/cpp/native-selection-helpers.js +46 -0
- package/dist/targets/cpp/native-symbol-keys.d.ts +8 -0
- package/dist/targets/cpp/native-symbol-keys.js +34 -0
- package/dist/targets/cpp/ownership.d.ts +43 -0
- package/dist/targets/cpp/ownership.js +38 -0
- package/dist/targets/cpp/owning-conversion-input.d.ts +14 -0
- package/dist/targets/cpp/owning-conversion-input.js +12 -0
- package/dist/targets/cpp/property-read-claims.d.ts +62 -0
- package/dist/targets/cpp/property-read-claims.js +23 -0
- package/dist/targets/cpp/property-store-claims.d.ts +62 -0
- package/dist/targets/cpp/property-store-claims.js +26 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +111 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.js +602 -0
- package/dist/targets/cpp/prototype/emit-prototype-date.d.ts +133 -0
- package/dist/targets/cpp/prototype/emit-prototype-date.js +515 -0
- package/dist/targets/cpp/prototype/emit-prototype-error.d.ts +13 -0
- package/dist/targets/cpp/prototype/emit-prototype-error.js +54 -0
- package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +34 -0
- package/dist/targets/cpp/prototype/emit-prototype-invoke.js +1003 -0
- package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +47 -0
- package/dist/targets/cpp/prototype/emit-prototype-iterator.js +250 -0
- package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +46 -0
- package/dist/targets/cpp/prototype/emit-prototype-promise.js +143 -0
- package/dist/targets/cpp/prototype/emit-prototype-regexp.d.ts +335 -0
- package/dist/targets/cpp/prototype/emit-prototype-regexp.js +853 -0
- package/dist/targets/cpp/prototype/emit-prototype-string.d.ts +42 -0
- package/dist/targets/cpp/prototype/emit-prototype-string.js +252 -0
- package/dist/targets/cpp/prototype/prototype-method-reads.d.ts +25 -0
- package/dist/targets/cpp/prototype/prototype-method-reads.js +182 -0
- package/dist/targets/cpp/reactive-dependencies.d.ts +140 -0
- package/dist/targets/cpp/reactive-dependencies.js +432 -0
- package/dist/targets/cpp/reactive-origins.d.ts +44 -0
- package/dist/targets/cpp/reactive-origins.js +82 -0
- package/dist/targets/cpp/records.d.ts +277 -0
- package/dist/targets/cpp/records.js +2427 -0
- package/dist/targets/cpp/recursive-containers.d.ts +43 -0
- package/dist/targets/cpp/recursive-containers.js +144 -0
- package/dist/targets/cpp/regexp-types.d.ts +56 -0
- package/dist/targets/cpp/regexp-types.js +59 -0
- package/dist/targets/cpp/substrate.d.ts +125 -0
- package/dist/targets/cpp/substrate.js +12 -0
- package/dist/targets/cpp/translation-unit.d.ts +219 -0
- package/dist/targets/cpp/translation-unit.js +2063 -0
- package/dist/targets/cpp/types.d.ts +280 -0
- package/dist/targets/cpp/types.js +1135 -0
- package/dist/targets/cpp/virtual-methods.d.ts +95 -0
- package/dist/targets/cpp/virtual-methods.js +264 -0
- package/package.json +95 -0
- package/src/targets/cpp/runtime/gea_dynamic_proxy.h +824 -0
- package/src/targets/cpp/runtime/gea_eval.h +1376 -0
- package/src/targets/cpp/runtime/gea_native_class_prototype.h +44 -0
- package/src/targets/cpp/runtime/gea_runtime.h +29222 -0
- package/src/targets/cpp/runtime/gea_runtime_builtins.cpp +55 -0
package/dist/compiler.js
ADDED
|
@@ -0,0 +1,1029 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { projectAbis } from './projection/abi.js';
|
|
3
|
+
import { projectBindingPlacements } from './projection/bindings.js';
|
|
4
|
+
import { physicalClassInstanceResolverOf, physicalClassLayoutsOf, projectClasses } from './projection/classes.js';
|
|
5
|
+
import { buildConversionGraph } from './conversion/build.js';
|
|
6
|
+
import { createConversionNodes } from './conversion/nodes.js';
|
|
7
|
+
import { sweepDiagnostics } from './diagnostics/sweep.js';
|
|
8
|
+
import { refusalsOf } from './ir/refusal.js';
|
|
9
|
+
import { mintCapabilityCertificate } from './ir/certificate.js';
|
|
10
|
+
import { runPreflight } from './preflight/run.js';
|
|
11
|
+
import { typeofOperandRepresentationOf } from './ir/certify/typeof-operand.js';
|
|
12
|
+
import { defaultOwnershipPolicy } from './representation/derive.js';
|
|
13
|
+
import { publishRepresentations } from './representation/publish.js';
|
|
14
|
+
import { valueRecordTypesOf } from './representation/value-records.js';
|
|
15
|
+
import { createAmbientTypeRealizationTransform } from './semantics/ambient-type-realization-transform.js';
|
|
16
|
+
import { declarationOverlayTransform } from './semantics/declaration-overlay-transform.js';
|
|
17
|
+
import { createSubclassMemberOverlayTransform } from './semantics/subclass-member-overlay-transform.js';
|
|
18
|
+
import { aliasThisFieldDeclarationTransform } from './semantics/alias-this-field-declaration-transform.js';
|
|
19
|
+
import { definePropertySourceTransform } from './semantics/define-property-source-transform.js';
|
|
20
|
+
import { prototypeInstallSourceTransform } from './semantics/prototype-install-source-transform.js';
|
|
21
|
+
import { prototypeObjectClassSourceTransform } from './semantics/prototype-object-class-source-transform.js';
|
|
22
|
+
import { jsdocNamepathTransform } from './semantics/jsdoc-namepath-transform.js';
|
|
23
|
+
import { thisConstructorSourceTransform } from './semantics/this-constructor-source-transform.js';
|
|
24
|
+
import { symbolKeyedExpandoSourceTransform } from './semantics/symbol-keyed-expando-source-transform.js';
|
|
25
|
+
import { newCalleeClassTagSourceTransform } from './semantics/new-callee-class-tag-source-transform.js';
|
|
26
|
+
import { borrowedBuiltinCallBindSourceTransform } from './semantics/borrowed-builtin-call-bind-source-transform.js';
|
|
27
|
+
import { runFrontend } from './semantics/frontend.js';
|
|
28
|
+
import { installedProducers } from './semantics/normalize/producers/installed.js';
|
|
29
|
+
import { installedPlugins } from './plugins/installed.js';
|
|
30
|
+
import { createSlotCensus } from './projection/slots.js';
|
|
31
|
+
import { hostMethodAliasDeclarations } from './projection/callee.js';
|
|
32
|
+
import { lowerToIr } from './ir/lower.js';
|
|
33
|
+
import { certifyIr } from './ir/certify.js';
|
|
34
|
+
import { publishCaptureFacts } from './ir/captures.js';
|
|
35
|
+
import { recordAccessorBodiesOf } from './projection/fields.js';
|
|
36
|
+
import { fillCallDispatchTargets } from './ir/call-dispatch.js';
|
|
37
|
+
import { virtualDispatchVerdictOf } from './projection/dispatch.js';
|
|
38
|
+
import { splitGeneratorBodies } from './ir/generator-split.js';
|
|
39
|
+
import { shakeProgram } from './ir/shake.js';
|
|
40
|
+
import { pruneProvenBranches } from './ir/proven-branches.js';
|
|
41
|
+
import { publishEmissionRepresentationsOf } from './ir/emission-representations.js';
|
|
42
|
+
import { finalizeTypedComputedReads, reflectionExposureOf } from './ir/reflection-demand.js';
|
|
43
|
+
import { finalizeAbsentClassArms } from './ir/absent-class-arm.js';
|
|
44
|
+
import { closePhysicalClassReflection } from './ir/physical-class-reflection.js';
|
|
45
|
+
import { createCppTargetManifest } from './targets/cpp/manifest.js';
|
|
46
|
+
import { coreHostConstants, coreHostFunctions, coreHostMembers } from './targets/cpp/host/host-members.js';
|
|
47
|
+
import { coreGlobalClasses, coreGlobalFunctions, coreNativeTypes } from './targets/cpp/host/core-globals.js';
|
|
48
|
+
import { createCppConversionRegistry } from './targets/cpp/conversions.js';
|
|
49
|
+
import { recordLayoutPolicyOf } from './projection/fields.js';
|
|
50
|
+
import { nativeClassFieldUsesOf, projectNativeClassStorage } from './projection/class-storage.js';
|
|
51
|
+
import { finalizeNativeFieldOwnership } from './ir/native-field-owner.js';
|
|
52
|
+
import { withPresenceChecks } from './ir/presence-proof.js';
|
|
53
|
+
import { cppDateType } from './targets/cpp/prototype/emit-prototype-date.js';
|
|
54
|
+
import { cppRegExpNativeTypes, cppStringObjectNativeType } from './targets/cpp/regexp-types.js';
|
|
55
|
+
import { cppErrorNativeType } from './targets/cpp/error-types.js';
|
|
56
|
+
import { renderTranslationUnit } from './targets/cpp/translation-unit.js';
|
|
57
|
+
/**
|
|
58
|
+
* The entry symbol the gea runtimes call, and so this compiler's default.
|
|
59
|
+
*
|
|
60
|
+
* `core/gea_app_entry.cpp` declares `extern void __gea_top_level();` and
|
|
61
|
+
* `Application::init` calls it; v1's compiler emits that name for the same
|
|
62
|
+
* reason. Defaulting to it is what makes an emitted unit start when the engine
|
|
63
|
+
* starts, rather than being a set of functions with a working program inside
|
|
64
|
+
* that nothing reaches.
|
|
65
|
+
*/
|
|
66
|
+
const defaultEntrySymbol = '__gea_top_level';
|
|
67
|
+
const union = (base, added) => new Set([...base, ...added]);
|
|
68
|
+
/**
|
|
69
|
+
* Every source transform a compilation applies, in order, for a given set of
|
|
70
|
+
* instantiated plugins.
|
|
71
|
+
*
|
|
72
|
+
* Exported because a PROBE that builds its own `ts.Program` to map results
|
|
73
|
+
* back to source must parse the files exactly the way the compilation did.
|
|
74
|
+
* Node identity is positional: the first transform that splices text into a
|
|
75
|
+
* file shifts every node after it, so a probe running a SHORTER list silently
|
|
76
|
+
* attributes a result to the wrong syntax and reads as a confident, wrong
|
|
77
|
+
* answer rather than as an error. That has already cost a full investigation
|
|
78
|
+
* here. One list, one home, cited by both.
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* How the subclass overlay reads a declarer: disk text, through this
|
|
82
|
+
* compilation's plugin transforms -- the same statements the checker will see
|
|
83
|
+
* for that file. See `DeclarerReader` for why the index cannot read raw disk
|
|
84
|
+
* text, and why only the plugin transforms apply. A plugin that throws on a
|
|
85
|
+
* file (an anchor it never compiled against) states nothing about it, so that
|
|
86
|
+
* file reads as it sits on disk.
|
|
87
|
+
*/
|
|
88
|
+
const declarerReaderFor = (plugins) => {
|
|
89
|
+
const transforms = plugins.flatMap((plugin) => (plugin.transformSource ? [plugin.transformSource] : []));
|
|
90
|
+
return (filePath) => {
|
|
91
|
+
const disk = readFileSync(filePath, 'utf8');
|
|
92
|
+
let text = disk;
|
|
93
|
+
try {
|
|
94
|
+
for (const transform of transforms)
|
|
95
|
+
text = transform({ fileName: filePath, text }) ?? text;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return disk;
|
|
99
|
+
}
|
|
100
|
+
return text;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export const sourceTransformsFor = (plugins) => [
|
|
104
|
+
// A prototype object instantiated with `Object.create` becomes its class
|
|
105
|
+
// first, so the installs and re-parenting below see a class prototype.
|
|
106
|
+
prototypeObjectClassSourceTransform,
|
|
107
|
+
definePropertySourceTransform,
|
|
108
|
+
// After it, so a descriptor it already turned into an assignment is not
|
|
109
|
+
// read again: methods and getters a script installs onto its own class
|
|
110
|
+
// become the class members they install (see the transform's comment).
|
|
111
|
+
prototypeInstallSourceTransform,
|
|
112
|
+
// `thisConstructorSourceTransform` runs right after: it is also a
|
|
113
|
+
// language-level rewrite of a call the checker has no special knowledge of
|
|
114
|
+
// (`new this.constructor(...)`, see the transform's own module comment),
|
|
115
|
+
// not a host's or plugin's data, so it applies to every compilation
|
|
116
|
+
// unconditionally, in the same tier as `definePropertySourceTransform`.
|
|
117
|
+
thisConstructorSourceTransform,
|
|
118
|
+
// `symbolKeyedExpandoSourceTransform` is the third language-level rewrite in
|
|
119
|
+
// this tier: it keeps the checker from crashing on a JS expando the binder
|
|
120
|
+
// cannot late-bind (see the transform's module comment). It only ever adds
|
|
121
|
+
// two parentheses, so it changes no other node's text and states no type.
|
|
122
|
+
symbolKeyedExpandoSourceTransform,
|
|
123
|
+
// `newCalleeClassTagSourceTransform` is the fourth: a plain JS function the
|
|
124
|
+
// program constructs with `new` is tagged `@class` so the checker's own
|
|
125
|
+
// constructor inference runs on it (see the transform's module comment).
|
|
126
|
+
newCalleeClassTagSourceTransform,
|
|
127
|
+
// `borrowedBuiltinCallBindSourceTransform` is the fifth: a borrowed built-in
|
|
128
|
+
// method (`Function.prototype.call.bind(Array.prototype.push)`, or the
|
|
129
|
+
// bare `Array.prototype.push.call(xs, v)` it also covers) is rewritten to
|
|
130
|
+
// the ordinary member call it always meant (`xs.push(v)`), so every layer
|
|
131
|
+
// after this one sees an expression it already knows how to compile
|
|
132
|
+
// natively -- see the transform's own module comment.
|
|
133
|
+
borrowedBuiltinCallBindSourceTransform,
|
|
134
|
+
// `jsdocNamepathTransform` runs before the overlay: it respells a name the
|
|
135
|
+
// source already stated into one the checker can bind, so the overlay --
|
|
136
|
+
// which reads the source's own tags to decide what it must bring into
|
|
137
|
+
// scope -- sees the name the program meant rather than a fragment
|
|
138
|
+
// TypeScript stopped reading halfway.
|
|
139
|
+
jsdocNamepathTransform,
|
|
140
|
+
// `declarationOverlayTransform` runs next, and for the same reason: a
|
|
141
|
+
// package's own `.d.ts` stating its JS module's parameter types is shipped
|
|
142
|
+
// DATA, not a host's vocabulary. It never overrides what the source itself
|
|
143
|
+
// says -- a parameter already annotated, or already carrying a `@param`, is
|
|
144
|
+
// left exactly as written -- so it speaks only where the program was silent.
|
|
145
|
+
declarationOverlayTransform,
|
|
146
|
+
// The subclass overlay runs on the overlay's output and before the ambient
|
|
147
|
+
// realization, so a member it declares is respelled too.
|
|
148
|
+
createSubclassMemberOverlayTransform(declarerReaderFor(plugins)),
|
|
149
|
+
// The alias-this field declaration runs after the subclass overlay so its
|
|
150
|
+
// "already declared" check sees any member the overlay just added, and
|
|
151
|
+
// never fights it over the same name. It states no type -- only that a
|
|
152
|
+
// field exists -- so ordering relative to the ambient realization below
|
|
153
|
+
// does not matter for it either way.
|
|
154
|
+
aliasThisFieldDeclarationTransform,
|
|
155
|
+
// `ambientTypeRealizationTransform` runs after the overlay so it sees the
|
|
156
|
+
// types that transform just injected, not only the program's own source. A
|
|
157
|
+
// package states, as data, that an ambient name a library documents is
|
|
158
|
+
// realised by a concrete class the package ships; nothing here names one.
|
|
159
|
+
createAmbientTypeRealizationTransform(new Map(plugins.flatMap((plugin) => [...plugin.capabilities.ambientTypeRealizations]))),
|
|
160
|
+
...plugins.flatMap((plugin) => (plugin.transformSource ? [plugin.transformSource] : []))
|
|
161
|
+
];
|
|
162
|
+
export const compile = (request) => {
|
|
163
|
+
// One instance per compilation. A plugin that learns something from a program
|
|
164
|
+
// and acts on it later has to remember it in between, and a registry of
|
|
165
|
+
// long-lived instances would let a fact derived from one program be read back
|
|
166
|
+
// while compiling another -- a defect that reproduces only in the order the
|
|
167
|
+
// programs happened to be compiled in.
|
|
168
|
+
// `GEA_STAGE_TIMING=1` prints what each stage of the pipeline below costs.
|
|
169
|
+
//
|
|
170
|
+
// There was no way to ask this. The stages are named in the header comment
|
|
171
|
+
// and nothing measured them, so "where does a compile spend its time" could
|
|
172
|
+
// only be answered by a CPU profile -- which attributes to FUNCTIONS, and
|
|
173
|
+
// therefore cannot say what share belongs to the frontend as against
|
|
174
|
+
// emission. A program that certifies (`voice-notes`) and one that does not
|
|
175
|
+
// (the three.js app, which stops before lowering) spend their time in completely
|
|
176
|
+
// different places, and that difference was invisible.
|
|
177
|
+
const stageStartedAt = process.env['GEA_STAGE_TIMING'] ? { at: performance.now() } : null;
|
|
178
|
+
const stage = (name) => {
|
|
179
|
+
if (!stageStartedAt)
|
|
180
|
+
return;
|
|
181
|
+
const now = performance.now();
|
|
182
|
+
process.stderr.write(`[STAGE] ${name.padEnd(16)} ${(now - stageStartedAt.at).toFixed(0)}ms\n`);
|
|
183
|
+
stageStartedAt.at = now;
|
|
184
|
+
};
|
|
185
|
+
const plugins = (request.plugins ?? installedPlugins).map((plugin) => plugin.instantiate(request.pluginOptions ?? new Map()));
|
|
186
|
+
// Which declared type names the installed hosts own, unioned once. It reaches
|
|
187
|
+
// the frontend because only the frontend can turn a name into a declaration
|
|
188
|
+
// identity, and it reaches the manifest below because only the manifest can
|
|
189
|
+
// say whether the target implements one.
|
|
190
|
+
// The backend's own carriers for the standard library's native classes,
|
|
191
|
+
// unioned into the same map an installed host's stated carriers arrive in --
|
|
192
|
+
// the identical union `coreHostMembers` and `coreGlobalFunctions` get, and
|
|
193
|
+
// for the identical reason: one map means one claim set and one member key
|
|
194
|
+
// space. A plugin row wins a collision, because a target that implements
|
|
195
|
+
// `TextDecoder` itself is describing its own platform.
|
|
196
|
+
const nativeTypes = new Map([...coreNativeTypes, ...plugins.flatMap((plugin) => [...plugin.capabilities.nativeTypes])]);
|
|
197
|
+
const nativeTypesByDeclaration = new Map(plugins.flatMap((plugin) => [...(plugin.capabilities.nativeTypesByDeclaration ?? new Map())]));
|
|
198
|
+
const hostNamespaceRootDeclarations = plugins.flatMap((plugin) => plugin.capabilities.hostNamespaceRootDeclarations ?? []);
|
|
199
|
+
const frontend = runFrontend({
|
|
200
|
+
...(request.packageSources ? { packageSources: request.packageSources } : {}),
|
|
201
|
+
declarationModules: new Set(plugins.flatMap((plugin) => [...(plugin.capabilities.declarationModules ?? [])])),
|
|
202
|
+
rootFileNames: request.rootFileNames,
|
|
203
|
+
projectFileName: request.projectFileName ?? null,
|
|
204
|
+
javaScriptSources: request.javaScriptSources ?? false,
|
|
205
|
+
dynamicFallback: request.dynamicFallback ?? false,
|
|
206
|
+
...(request.sourceOverlay ? { sourceOverlay: request.sourceOverlay } : {}),
|
|
207
|
+
...(request.moduleResolution ? { moduleResolution: request.moduleResolution } : {}),
|
|
208
|
+
...(request.statedModuleSet ? { statedModuleSet: true } : {}),
|
|
209
|
+
...(request.closedScriptScope ? { closedScriptScope: true } : {}),
|
|
210
|
+
producers: installedProducers((context) => plugins.flatMap((plugin) => plugin.producers(context))),
|
|
211
|
+
hostTypedArrayDeclarations: plugins.flatMap((plugin) => plugin.capabilities.typedArrayDeclarations ?? []),
|
|
212
|
+
nativeTypes,
|
|
213
|
+
nativeTypesByDeclaration,
|
|
214
|
+
hostSingletonDeclarations: new Map(plugins.flatMap((plugin) => [...(plugin.capabilities.hostSingletonDeclarations ?? new Map())])),
|
|
215
|
+
standardClasses: new Set(coreNativeTypes.keys()),
|
|
216
|
+
// What the installed hosts state they do NOT provide, unioned the same way
|
|
217
|
+
// their positive claims are. A name is absent only because a host said so:
|
|
218
|
+
// with no plugin stating one this set is empty and every ambient
|
|
219
|
+
// declaration is believed exactly as before.
|
|
220
|
+
absentGlobals: new Set(plugins.flatMap((plugin) => [...plugin.capabilities.absentGlobals])),
|
|
221
|
+
// The members the installed hosts reach on their own, unioned the same way
|
|
222
|
+
// every other plugin table here is. `reachability.ts` keeps an instance
|
|
223
|
+
// method only when live code names it, and a name only a lowering
|
|
224
|
+
// synthesizes is one no walk over the source can see.
|
|
225
|
+
hostReachedMemberKeys: new Set(plugins.flatMap((plugin) => [...plugin.capabilities.reachedMemberKeys])),
|
|
226
|
+
// The host functions of every host stating that its programs take the
|
|
227
|
+
// census wildcard; the frontend refuses the proofs when reachable code
|
|
228
|
+
// names one. One such host is enough: the wildcard taints the whole
|
|
229
|
+
// program's census, not only that host's reads.
|
|
230
|
+
hostFunctionsRefusingObjectPrototypeAbsenceProofs: new Set(plugins
|
|
231
|
+
.filter((plugin) => plugin.capabilities.refusesObjectPrototypeAbsenceProofs === true)
|
|
232
|
+
.flatMap((plugin) => [...plugin.capabilities.hostFunctions.keys()])),
|
|
233
|
+
hostNamespaceRoots: new Set(['Reflect', ...plugins.flatMap((plugin) => [...plugin.capabilities.hostNamespaces.roots])]),
|
|
234
|
+
hostNamespaceRootDeclarations,
|
|
235
|
+
// Every leaf path a plugin's own namespace tables publish -- see
|
|
236
|
+
// `FrontendInput.hostNamespacePaths` for what the frontend does with it.
|
|
237
|
+
// Threaded from the identical `hostNamespaces.methods`/`.properties` maps
|
|
238
|
+
// `hosts.namespaces` below is built from, so the frontend and the emitter
|
|
239
|
+
// agree on what counts as a namespace path without a second table stating
|
|
240
|
+
// it twice.
|
|
241
|
+
hostNamespacePaths: new Set([
|
|
242
|
+
'Reflect.get',
|
|
243
|
+
'Reflect.set',
|
|
244
|
+
'Reflect.has',
|
|
245
|
+
'Reflect.deleteProperty',
|
|
246
|
+
'Reflect.getOwnPropertyDescriptor',
|
|
247
|
+
'Reflect.ownKeys',
|
|
248
|
+
...plugins.flatMap((plugin) => [
|
|
249
|
+
...plugin.capabilities.hostNamespaces.methods.keys(),
|
|
250
|
+
...plugin.capabilities.hostNamespaces.properties.keys()
|
|
251
|
+
])
|
|
252
|
+
]),
|
|
253
|
+
// The type each host carries the one object behind its own roots in. The
|
|
254
|
+
// frontend is where it has to land, for the same reason `nativeTypes` does:
|
|
255
|
+
// only the frontend can turn a name a plugin states into the structural
|
|
256
|
+
// type the checker resolved that name's value to, which is the key
|
|
257
|
+
// `representation/derive.ts` can actually read.
|
|
258
|
+
hostNamespaceRootTypes: new Map([
|
|
259
|
+
['Reflect', 'gea::ReflectNamespace'],
|
|
260
|
+
...plugins.flatMap((plugin) => [...plugin.capabilities.hostNamespaceRootTypes])
|
|
261
|
+
]),
|
|
262
|
+
commonJsGlobals: new Map(plugins.flatMap((plugin) => [...(plugin.capabilities.commonJsGlobals ?? new Map())])),
|
|
263
|
+
commonJsBuiltinModules: new Map(plugins.flatMap((plugin) => [...(plugin.capabilities.commonJsBuiltinModules ?? new Map())])),
|
|
264
|
+
commonJsBuiltinModuleSources: new Map(plugins.flatMap((plugin) => [...(plugin.capabilities.commonJsBuiltinModuleSources ?? new Map())])),
|
|
265
|
+
hostMethodBindings: new Map(plugins.flatMap((plugin) => [...(plugin.capabilities.hostMethodBindings ?? [])])),
|
|
266
|
+
// `definePropertySourceTransform` runs first and unconditionally: it is a
|
|
267
|
+
// language-level rewrite (`Object.defineProperty`/`defineProperties` into
|
|
268
|
+
// the assignment they define), not a host's data, so it applies to every
|
|
269
|
+
// compilation the same way `fixedOptions` does in `program.ts`, ahead of
|
|
270
|
+
// whatever a plugin adds. In installation order after that, so a file
|
|
271
|
+
// offered to two plugins is offered to the second the way the first left
|
|
272
|
+
// it. Only a plugin that installs one appears here, so a compilation whose
|
|
273
|
+
// plugins state only data parses each file once past this first pass.
|
|
274
|
+
sourceTransforms: sourceTransformsFor(plugins)
|
|
275
|
+
});
|
|
276
|
+
// The frontend's host-protocol census reaches the deriver as a policy rather
|
|
277
|
+
// than as a table the deriver reads: `derive.ts` may not know what a JSX
|
|
278
|
+
// element is, and the frontend may not know what a carrier is. The policy is
|
|
279
|
+
// the whole of what crosses between them.
|
|
280
|
+
// Which record types this program never mutates, never identity-tests and
|
|
281
|
+
// never hands across a boundary -- the proof that carrying one BY VALUE is
|
|
282
|
+
// unobservable. Computed here, over the sealed graph, because it is a
|
|
283
|
+
// whole-program fact and `derive.ts` sees one type at a time.
|
|
284
|
+
const valueRecords = valueRecordTypesOf(frontend.graph);
|
|
285
|
+
// What each host says its own types derive from, unioned across the installed
|
|
286
|
+
// plugins by the same rule every other host table here is (`hosts` below).
|
|
287
|
+
// The rows are immediate base to immediate base; the walk to a full chain is
|
|
288
|
+
// done once, here, so the carrier states the transitive answer and nobody
|
|
289
|
+
// downstream has to walk anything (see `Representation`'s `native-handle`).
|
|
290
|
+
const hostBases = new Map(plugins.flatMap((plugin) => [...plugin.capabilities.nativeBases]));
|
|
291
|
+
const hostBaseChain = (native) => {
|
|
292
|
+
const chain = [];
|
|
293
|
+
const seen = new Set();
|
|
294
|
+
let current = native === null ? null : (hostBases.get(native) ?? null);
|
|
295
|
+
// A cycle is a host that stated one, and it is not this compiler's to
|
|
296
|
+
// resolve: the walk stops at the first carrier it has already seen, so a
|
|
297
|
+
// malformed table costs a shorter chain rather than a hang.
|
|
298
|
+
while (current !== null && !seen.has(current)) {
|
|
299
|
+
chain.push(current);
|
|
300
|
+
seen.add(current);
|
|
301
|
+
current = hostBases.get(current) ?? null;
|
|
302
|
+
}
|
|
303
|
+
return chain;
|
|
304
|
+
};
|
|
305
|
+
stage('frontend');
|
|
306
|
+
const representations = publishRepresentations(frontend.graph, {
|
|
307
|
+
// Only the OBJECT shape itself: a declared name for one reaches the same
|
|
308
|
+
// carrier by delegation inside the deriver, and answering `owned` for the
|
|
309
|
+
// NAME would make a `native-record-ref` -- a deliberately unexpanded
|
|
310
|
+
// layout -- a by-value incomplete type.
|
|
311
|
+
forShape: (shape, id) => (shape.kind === 'object' && valueRecords.has(id) ? 'owned' : defaultOwnershipPolicy.forShape(shape, id)),
|
|
312
|
+
forParameter: defaultOwnershipPolicy.forParameter
|
|
313
|
+
}, {
|
|
314
|
+
forDeclaration: (declaration) => frontend.hostProtocols.get(declaration) ?? null,
|
|
315
|
+
basesOf: (native) => hostBaseChain(native)
|
|
316
|
+
}, {
|
|
317
|
+
forDeclaration: (declaration) => frontend.typedArrayElements.get(declaration) ?? null
|
|
318
|
+
},
|
|
319
|
+
// `Promise<T>`'s own declaration identity, resolved once by the frontend
|
|
320
|
+
// independent of whether the program's own text ever names `Promise`
|
|
321
|
+
// (`frontend.ts`'s `promiseDeclarationOf`) -- an `async` function's
|
|
322
|
+
// return type mentions it with no textual reference the ambient-value
|
|
323
|
+
// seed walk that finds `hostProtocols`/`typedArrayElements` could ever
|
|
324
|
+
// pick up.
|
|
325
|
+
{
|
|
326
|
+
forDeclaration: (declaration) => declaration === frontend.promiseDeclaration
|
|
327
|
+
},
|
|
328
|
+
// `Map`/`Set`/`WeakMap`/`WeakSet`, resolved by the frontend the same way
|
|
329
|
+
// and for the same reason `promiseDeclaration` is -- see
|
|
330
|
+
// `keyedCollectionDeclarationsOf` (semantics/host-protocols.ts). It is a
|
|
331
|
+
// policy rather than a table for the reason stated above this call: the
|
|
332
|
+
// deriver may not know what the standard library is, and the frontend may
|
|
333
|
+
// not know what a carrier is.
|
|
334
|
+
{
|
|
335
|
+
forDeclaration: (declaration) => frontend.keyedCollections.get(declaration) ?? null
|
|
336
|
+
},
|
|
337
|
+
// `ArrayBuffer`/`DataView`, resolved by the frontend the same way and for
|
|
338
|
+
// the same reason -- see `standardBufferDeclarationsOf`
|
|
339
|
+
// (semantics/host-protocols.ts).
|
|
340
|
+
{
|
|
341
|
+
forDeclaration: (declaration) => frontend.standardBuffers.get(declaration) ?? null
|
|
342
|
+
},
|
|
343
|
+
// What carries a host namespace ROOT. Keyed by structural type, not by
|
|
344
|
+
// declaration, and that is not a stylistic difference from its four
|
|
345
|
+
// siblings above: a root is a VALUE, and `window`'s value type is the
|
|
346
|
+
// intersection `Window & typeof globalThis`, which names no declaration at
|
|
347
|
+
// all. See `HostNamespaceRootPolicy` (representation/policies.ts).
|
|
348
|
+
{
|
|
349
|
+
forType: (type) => frontend.hostNamespaceRoots.get(type) ?? null
|
|
350
|
+
},
|
|
351
|
+
// `Date`'s own declaration identity, resolved by the frontend the same way
|
|
352
|
+
// and for the same reason `promiseDeclaration` is (`dateDeclarationOf`,
|
|
353
|
+
// semantics/host-protocols.ts) -- a program can receive a Date through an
|
|
354
|
+
// imported signature and never name the type itself.
|
|
355
|
+
//
|
|
356
|
+
// This is the one policy that carries a C++ SPELLING, and the join is
|
|
357
|
+
// here on purpose: the declaration is the frontend's answer, the spelling
|
|
358
|
+
// is the backend's (`targets/cpp/prototype/emit-prototype-date.ts` owns every Date
|
|
359
|
+
// spelling this compiler has), and `derive.ts` may know neither. Date is
|
|
360
|
+
// an ECMAScript builtin from `lib.es5`, not a gea host protocol, so its
|
|
361
|
+
// spelling belongs to the compiler's own tables and never to a plugin
|
|
362
|
+
// package's `nativeTypes`.
|
|
363
|
+
{
|
|
364
|
+
forDeclaration: (declaration) => (declaration === frontend.dateDeclaration ? cppDateType : null)
|
|
365
|
+
},
|
|
366
|
+
// `Generator<T, TReturn, TNext>`'s own declaration identity, resolved once
|
|
367
|
+
// by the frontend for the identical reason `promiseDeclaration` is: a
|
|
368
|
+
// `function*`'s return type mentions it with no textual reference the
|
|
369
|
+
// ambient-value seed walk could pick up.
|
|
370
|
+
{
|
|
371
|
+
forDeclaration: (declaration) => declaration === frontend.generatorDeclaration ||
|
|
372
|
+
declaration === frontend.asyncGeneratorDeclaration ||
|
|
373
|
+
declaration === frontend.mapIteratorDeclaration
|
|
374
|
+
},
|
|
375
|
+
// `RegExp`/`RegExpExecArray`/`RegExpMatchArray`, resolved by the frontend
|
|
376
|
+
// the same way `promiseDeclaration` and `keyedCollections` are, and
|
|
377
|
+
// installed here for the same reason: the deriver may not know what the
|
|
378
|
+
// standard library is, and the frontend may not know what a carrier is.
|
|
379
|
+
//
|
|
380
|
+
// This is the one policy that is COMPOSED here rather than forwarded. The
|
|
381
|
+
// frontend answers which declaration it is; `cppRegExpNativeTypes`
|
|
382
|
+
// (targets/cpp/regexp-types.ts) answers what this target spells it, and
|
|
383
|
+
// `src/representation/` may not name a C++ type at all. This function is
|
|
384
|
+
// already the composition root that defaults the conversion registry to
|
|
385
|
+
// the C++ one, so it is the place the two authorities meet.
|
|
386
|
+
{
|
|
387
|
+
forDeclaration: (declaration) => {
|
|
388
|
+
const kind = frontend.regexpDeclarations.get(declaration);
|
|
389
|
+
return kind ? { kind, native: cppRegExpNativeTypes[kind] } : null;
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
// `String`, the wrapper OBJECT interface, resolved by the frontend the
|
|
393
|
+
// same way `Date` is and composed here for the identical reason `RegExp`
|
|
394
|
+
// immediately above is: the frontend answers WHICH declaration it is
|
|
395
|
+
// (`frontend.stringObjectDeclaration`, `stringObjectDeclarationOf`),
|
|
396
|
+
// `cppStringObjectNativeType` (targets/cpp/regexp-types.ts) answers
|
|
397
|
+
// what this target spells it, and `src/representation/` may not name a
|
|
398
|
+
// C++ type at all.
|
|
399
|
+
{
|
|
400
|
+
forDeclaration: (declaration) => (declaration === frontend.stringObjectDeclaration ? cppStringObjectNativeType : null)
|
|
401
|
+
},
|
|
402
|
+
// The bare `Function` interface's own declaration identity, resolved once
|
|
403
|
+
// by the frontend for the identical reason `generatorDeclaration` is: a
|
|
404
|
+
// program reaches the type constantly (`typeof x === 'function'`,
|
|
405
|
+
// `x.constructor`) with no textual reference the ambient-value seed walk
|
|
406
|
+
// could pick up. Forwarded rather than composed -- unlike `Date`/`String`,
|
|
407
|
+
// the carrier names no C++ type for this target to spell.
|
|
408
|
+
{
|
|
409
|
+
forDeclaration: (declaration) => declaration === frontend.functionDeclaration
|
|
410
|
+
},
|
|
411
|
+
// Class heritage, forwarded from the frontend's own checker-answered walk
|
|
412
|
+
// (`classHeritageOf`, semantics/class-heritage.ts). Forwarded rather than
|
|
413
|
+
// composed for the same reason the generator declaration is: the answer
|
|
414
|
+
// names declarations, not C++ types, so this target has nothing to add.
|
|
415
|
+
{
|
|
416
|
+
forDeclaration: (declaration) => frontend.classHeritage.get(declaration) ?? [],
|
|
417
|
+
constructorSlotSubclassesOf: (declaration) => frontend.constructorSlotSubclasses.get(declaration) ?? []
|
|
418
|
+
}, { forType: (id) => valueRecords.has(id) },
|
|
419
|
+
// The classes this program declares as each interface's implementations,
|
|
420
|
+
// forwarded from the frontend for the same reason class heritage is: the
|
|
421
|
+
// answer names declarations, and it is read off `implements` clauses,
|
|
422
|
+
// which only the semantic layer may look at.
|
|
423
|
+
{
|
|
424
|
+
forDeclaration: (declaration) => frontend.interfaceImplementors.get(declaration) ?? []
|
|
425
|
+
}, {
|
|
426
|
+
forDeclaration: (declaration) => (frontend.errorDeclarations.has(declaration) ? cppErrorNativeType : null)
|
|
427
|
+
}, request.dynamicFallback ?? false, frontend.dynamicFallbackTypes, frontend.dynamicFallbackCallables, frontend.dynamicWrittenTypes,
|
|
428
|
+
// The copies of every generic class whose copies can differ in layout,
|
|
429
|
+
// forwarded from the frontend's typing for the deriver to group into
|
|
430
|
+
// physical classes (`physicalClassDeclarationOf`).
|
|
431
|
+
{ copiesOf: (declaration) => frontend.classCopies.get(declaration) ?? [] });
|
|
432
|
+
// The backend's own registry is the default, not `empty`: a compilation that
|
|
433
|
+
// asked for no registry is asking this compiler to use the target it has, and
|
|
434
|
+
// handing it an empty one made every conversion an uninstalled capability
|
|
435
|
+
// regardless of what the target could really do. A caller may still pass its
|
|
436
|
+
// own -- that is what measuring a target with a capability removed looks like.
|
|
437
|
+
// This projection depends only on the sealed graph and representation plan.
|
|
438
|
+
// Build it before conversions so the C++ registry can certify structural
|
|
439
|
+
// class-to-interface views from the same member table emission later uses.
|
|
440
|
+
const declaredClasses = projectClasses({
|
|
441
|
+
graph: frontend.graph,
|
|
442
|
+
plan: representations.plan,
|
|
443
|
+
deriver: representations.deriver,
|
|
444
|
+
uninstantiable: frontend.uninstantiableClasses
|
|
445
|
+
});
|
|
446
|
+
// `createCppTargetManifest` (targets/cpp/manifest.ts) is the permanent home
|
|
447
|
+
// for every backend capability row, this one included, and it should move
|
|
448
|
+
// there outright the next time that file is free to edit. The claim is not
|
|
449
|
+
// provisional in the meantime: `bindingReference` (targets/cpp/emit-context.ts)
|
|
450
|
+
// and the extern declarations `translation-unit.ts` renders both go through
|
|
451
|
+
// one carrier-derived, uniform recipe for every ambient value binding, never
|
|
452
|
+
// a per-declaration one, so this backend genuinely has the capability for
|
|
453
|
+
// any ambient global a program names, not only the one that motivated it.
|
|
454
|
+
// The spellings that render the host protocols, unioned here rather than in
|
|
455
|
+
// the emitter, so a protocol's claim and its template are admitted by one
|
|
456
|
+
// step over one set of plugins. A backend entry wins a collision: a plugin
|
|
457
|
+
// may add a host the backend does not have, and may not redefine one it
|
|
458
|
+
// does, for the same reason it cannot remove a capability row. Built before
|
|
459
|
+
// the manifest because the manifest publishes this table's keys
|
|
460
|
+
// (`hostMembers`) for certification to check host member reads against.
|
|
461
|
+
const hostMembers = new Map([...plugins.flatMap((plugin) => [...plugin.capabilities.hostMembers]), ...coreHostMembers]);
|
|
462
|
+
const backend = createCppTargetManifest(representations.plan, undefined, (function* () {
|
|
463
|
+
for (const operation of frontend.graph.operations.values()) {
|
|
464
|
+
if (operation.family !== 'computation' || operation.form !== 'typeof')
|
|
465
|
+
continue;
|
|
466
|
+
const representation = typeofOperandRepresentationOf(operation, representations.plan, representations.deriver);
|
|
467
|
+
if (representation !== undefined)
|
|
468
|
+
yield representation;
|
|
469
|
+
}
|
|
470
|
+
})(), coreHostMembers, (function* () {
|
|
471
|
+
for (const operation of frontend.graph.operations.values()) {
|
|
472
|
+
if (operation.family !== 'computation' || operation.operator !== 'ObjectTag')
|
|
473
|
+
continue;
|
|
474
|
+
const representation = typeofOperandRepresentationOf(operation, representations.plan, representations.deriver);
|
|
475
|
+
if (representation !== undefined)
|
|
476
|
+
yield representation;
|
|
477
|
+
}
|
|
478
|
+
})(), new Map(plugins.flatMap((plugin) => [...(plugin.capabilities.hostInstanceTests ?? new Map())])));
|
|
479
|
+
// A plugin's capabilities are unioned in, never allowed to remove a row. A
|
|
480
|
+
// plugin installs a runtime of its own -- helpers the backend alone does not
|
|
481
|
+
// carry -- but it cannot make the backend able to do less than it can, and a
|
|
482
|
+
// merge that let it would turn preflight's answer into a negotiation.
|
|
483
|
+
const manifest = {
|
|
484
|
+
...backend,
|
|
485
|
+
supportsExternalBindings: true,
|
|
486
|
+
runtimeHelpers: union(backend.runtimeHelpers, plugins.flatMap((plugin) => [...plugin.capabilities.runtimeHelpers])),
|
|
487
|
+
propertyRecipes: union(backend.propertyRecipes, plugins.flatMap((plugin) => [...plugin.capabilities.propertyRecipes])),
|
|
488
|
+
// Claimed by CARRIER, not by declared name: the runtime type is the thing a
|
|
489
|
+
// target either has or does not, and thirty-nine names resolving to
|
|
490
|
+
// twenty-six carriers means twenty-six claims. A per-name claim set would
|
|
491
|
+
// let two names for one runtime type be admitted separately and then
|
|
492
|
+
// disagree, which is the whole failure the join key exists to prevent.
|
|
493
|
+
nativeProtocols: union(backend.nativeProtocols, [
|
|
494
|
+
...plugins.flatMap((plugin) => [...plugin.capabilities.nativeProtocols]),
|
|
495
|
+
...(request.dynamicFallback ? ['ProxyConstructor@1', 'FunctionConstructor@1'] : []),
|
|
496
|
+
...[...new Set([...nativeTypes.values(), ...[...nativeTypesByDeclaration.values()].map((row) => row.native)])].map((carrier) => `${carrier}@1`)
|
|
497
|
+
]),
|
|
498
|
+
hostInvocations: new Set(plugins.flatMap((plugin) => [...(plugin.capabilities.hostInvocations ?? new Map()).keys()])),
|
|
499
|
+
hostConstructors: new Set(plugins.flatMap((plugin) => [...plugin.capabilities.hostConstructors.keys()])),
|
|
500
|
+
hostMembers: new Set(hostMembers.keys())
|
|
501
|
+
};
|
|
502
|
+
// The reflectable member list per protocol NAME, collected out of this
|
|
503
|
+
// program's own host-protocol census (`frontend.hostProtocols`, keyed by
|
|
504
|
+
// DECLARATION) rather than a table this file states -- see
|
|
505
|
+
// `HostProtocolBinding.members`'s own comment for why the list has to come
|
|
506
|
+
// from there. Two declarations could in principle bind the same protocol
|
|
507
|
+
// name; the later one wins, which is the identical last-write precedence
|
|
508
|
+
// every other table on `hosts` already takes for a collision.
|
|
509
|
+
const intrinsicMembers = new Map([...frontend.hostProtocols.values()].flatMap((binding) => (binding.members ? [[binding.protocol, binding.members]] : [])));
|
|
510
|
+
// The construct half of the same union. There is no core table to merge on
|
|
511
|
+
// top: the protocols this backend constructs itself (`Error`, `String`,
|
|
512
|
+
// `Number`) are rendered by `hostInvocations` in `emit-host-invoke.ts`, whose
|
|
513
|
+
// spellings depend on the call's own static types and so are code rather than
|
|
514
|
+
// a template. A plugin row and a backend renderer for one protocol would be
|
|
515
|
+
// two authorities, which is why the renderer is consulted only when no row
|
|
516
|
+
// claims the protocol.
|
|
517
|
+
const hosts = {
|
|
518
|
+
members: hostMembers,
|
|
519
|
+
intrinsicMembers,
|
|
520
|
+
voidResults: new Set(plugins.flatMap((plugin) => [...plugin.capabilities.hostMemberVoidResults])),
|
|
521
|
+
constructors: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.hostConstructors])),
|
|
522
|
+
invocations: new Map(plugins.flatMap((plugin) => [...(plugin.capabilities.hostInvocations ?? new Map())])),
|
|
523
|
+
instanceTests: new Map(plugins.flatMap((plugin) => [...(plugin.capabilities.hostInstanceTests ?? new Map())])),
|
|
524
|
+
// The language's own global functions (`parseInt`, `isNaN`, ...) unioned on
|
|
525
|
+
// top of the plugins' the same way `hostMembers` is above, and with the same
|
|
526
|
+
// precedence rule: a plugin may add a global the backend does not have, and
|
|
527
|
+
// may not redefine one it does. They are ECMAScript's, present in every
|
|
528
|
+
// conforming environment, so the backend is where they belong.
|
|
529
|
+
arraySnapshotFunctions: new Set(plugins.flatMap((plugin) => [...(plugin.capabilities.hostArraySnapshotFunctions ?? [])])),
|
|
530
|
+
nativeArrayFunctions: new Set(plugins.flatMap((plugin) => [...(plugin.capabilities.hostNativeArrayFunctions ?? [])])),
|
|
531
|
+
functions: new Map([...plugins.flatMap((plugin) => [...plugin.capabilities.hostFunctions]), ...coreHostFunctions]),
|
|
532
|
+
// Unioned the same way, one table per question. Two plugins claiming the
|
|
533
|
+
// same global would be two hosts claiming one name, which is a
|
|
534
|
+
// configuration this compiler cannot resolve and does not pretend to: the
|
|
535
|
+
// later row wins, exactly as it does for every other table here.
|
|
536
|
+
namespaces: {
|
|
537
|
+
roots: new Set(['Reflect', ...plugins.flatMap((plugin) => [...plugin.capabilities.hostNamespaces.roots])]),
|
|
538
|
+
typeofs: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.hostNamespaces.typeofs])),
|
|
539
|
+
methods: new Map([
|
|
540
|
+
['Reflect.get', { kind: 'path', text: 'gea::reflectGet', arguments: 'dynamic', result: 'dynamic' }],
|
|
541
|
+
['Reflect.set', { kind: 'path', text: 'gea::reflectSet', arguments: 'dynamic' }],
|
|
542
|
+
['Reflect.has', { kind: 'path', text: 'gea::reflectHas', arguments: 'dynamic' }],
|
|
543
|
+
['Reflect.deleteProperty', { kind: 'path', text: 'gea::reflectDelete', arguments: 'dynamic' }],
|
|
544
|
+
['Reflect.getOwnPropertyDescriptor', { kind: 'path', text: 'gea::reflectOwnDescriptor', arguments: 'dynamic', result: 'dynamic' }],
|
|
545
|
+
// The key-array carrier belongs to this call's native recipe; there
|
|
546
|
+
// is no single runtime function ABI to materialize for this template.
|
|
547
|
+
['Reflect.ownKeys', { kind: 'template', emit: 'gea::reflectOwnKeys({arg0})' }],
|
|
548
|
+
...plugins.flatMap((plugin) => [...plugin.capabilities.hostNamespaces.methods])
|
|
549
|
+
]),
|
|
550
|
+
properties: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.hostNamespaces.properties])),
|
|
551
|
+
propertySetters: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.hostNamespaces.propertySetters]))
|
|
552
|
+
},
|
|
553
|
+
singletons: new Set(plugins.flatMap((plugin) => [...plugin.capabilities.hostSingletons])),
|
|
554
|
+
preambles: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.hostPreambles])),
|
|
555
|
+
includes: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.nativeIncludes])),
|
|
556
|
+
// One answer, not a union: a fragment is one node, so two hosts that both
|
|
557
|
+
// had one would be two hosts claiming one syntax. The last plugin to state
|
|
558
|
+
// one wins, exactly as the later row wins in every table above, and a
|
|
559
|
+
// configuration with none leaves fragments refused by name.
|
|
560
|
+
fragment: plugins.reduce((claimed, plugin) => plugin.capabilities.elementFragment ?? claimed, null),
|
|
561
|
+
// Unioned like every other table here, and read AFTER `runFrontend` above
|
|
562
|
+
// has finished: a plugin fills this one while normalizing (a class
|
|
563
|
+
// declaration is not known before the program is read), and shares the
|
|
564
|
+
// live map rather than a copy, so flattening it here sees the whole
|
|
565
|
+
// answer. See `PluginCapabilities.reactiveClassFields`.
|
|
566
|
+
reactive: {
|
|
567
|
+
fields: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.reactiveClassFields])),
|
|
568
|
+
// One answer, not a union, for the same reason `fragment` is one: a field
|
|
569
|
+
// is held in one cell type. The last plugin to state one wins, and a
|
|
570
|
+
// configuration with none leaves every field a plain member.
|
|
571
|
+
cell: plugins.reduce((claimed, plugin) => plugin.capabilities.nativeReactiveCell ?? claimed, null),
|
|
572
|
+
// Unioned rather than last-wins, unlike `cell`: two plugins each naming a
|
|
573
|
+
// header is two headers a unit needs, not a disagreement about one.
|
|
574
|
+
cellPreamble: [...new Set(plugins.flatMap((plugin) => [...plugin.capabilities.nativeReactiveCellPreamble]))],
|
|
575
|
+
// Empty here, filled by `translation-unit.ts`: the answer is read off the
|
|
576
|
+
// lowered IR, which does not exist yet at this point in the pipeline.
|
|
577
|
+
dependencies: new Map(),
|
|
578
|
+
nodeDependencies: new Map(),
|
|
579
|
+
revisions: new Map(),
|
|
580
|
+
celled: new Map(),
|
|
581
|
+
boundRecordFields: new Map()
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
stage('representations');
|
|
585
|
+
const preflight = runPreflight({ semanticGraph: frontend.graph, representationPlan: representations.plan, manifest });
|
|
586
|
+
stage('preflight');
|
|
587
|
+
const diagnostics = sweepDiagnostics({
|
|
588
|
+
graph: frontend.graph,
|
|
589
|
+
representations,
|
|
590
|
+
preflight,
|
|
591
|
+
frontend: [...frontend.checkerDiagnostics, ...frontend.intrinsicProtocolDiagnostics],
|
|
592
|
+
locationOfNode: frontend.locationOfNode
|
|
593
|
+
});
|
|
594
|
+
// The ABI projection runs after preflight and before any body lowers:
|
|
595
|
+
// a body reads its own frame, and a frame that is decided per body is a frame
|
|
596
|
+
// two bodies can disagree about.
|
|
597
|
+
const abis = projectAbis({
|
|
598
|
+
graph: frontend.graph,
|
|
599
|
+
plan: representations.plan,
|
|
600
|
+
deriver: representations.deriver,
|
|
601
|
+
locationOfDeclaration: frontend.locationOfDeclaration
|
|
602
|
+
});
|
|
603
|
+
const placements = projectBindingPlacements({
|
|
604
|
+
graph: frontend.graph,
|
|
605
|
+
plan: representations.plan,
|
|
606
|
+
externals: frontend.externalBindings,
|
|
607
|
+
absentBindings: frontend.absentBindings,
|
|
608
|
+
externalFiles: frontend.externalBindingFiles,
|
|
609
|
+
// `NaN`/`Infinity` and `parseInt`/`parseFloat`/`isNaN`/`isFinite`, unioned
|
|
610
|
+
// on top of the plugins' tables by the same rule as `hosts` above. Without
|
|
611
|
+
// them these names fall through to the ordinary external-cell case, and the
|
|
612
|
+
// unit declares an `extern` for a symbol no object file defines.
|
|
613
|
+
hostConstants: new Map([...plugins.flatMap((plugin) => [...plugin.capabilities.nativeConstants]), ...coreHostConstants]),
|
|
614
|
+
// Per-declaration-file, unioned the same way `hostFunctionsByDeclaration`
|
|
615
|
+
// is: each plugin's own table is keyed by ITS declaration files, so a
|
|
616
|
+
// union of the per-plugin maps cannot let one plugin's file collide with
|
|
617
|
+
// another's.
|
|
618
|
+
hostConstantsByDeclaration: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.hostConstantsByDeclaration])),
|
|
619
|
+
hostFunctions: new Map([...plugins.flatMap((plugin) => [...plugin.capabilities.hostFunctions]), ...coreHostFunctions]),
|
|
620
|
+
hostFunctionsByDeclaration: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.hostFunctionsByDeclaration])),
|
|
621
|
+
// The backend's own table, unioned in the same way `coreHostMembers` is
|
|
622
|
+
// above and for the same reason: `btoa`/`encodeURIComponent` are language
|
|
623
|
+
// builtins, so a plugin row for one would make an ECMAScript global
|
|
624
|
+
// conditional on which host is installed. Passed separately rather than
|
|
625
|
+
// merged into `hostFunctions`, because the two are admitted differently --
|
|
626
|
+
// see `BindingPlacementInput.coreGlobalFunctions`.
|
|
627
|
+
coreGlobalFunctions,
|
|
628
|
+
coreGlobalClasses,
|
|
629
|
+
standardLibraryExternals: frontend.standardLibraryBindings,
|
|
630
|
+
hostNamespaces: hosts.namespaces,
|
|
631
|
+
hostNamespaceRootsByDeclaration: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.hostNamespaceRootsByDeclaration])),
|
|
632
|
+
hostNamespaceBindings: frontend.hostNamespaceBindings,
|
|
633
|
+
exactHostNamespaceNames: new Set(hostNamespaceRootDeclarations.map((row) => row.declarationName)),
|
|
634
|
+
hostSingletons: hosts.singletons,
|
|
635
|
+
hostSingletonsByDeclaration: new Map(plugins.flatMap((plugin) => [...plugin.capabilities.hostSingletonsByDeclaration])),
|
|
636
|
+
hostSingletonBindings: frontend.hostSingletonBindings
|
|
637
|
+
});
|
|
638
|
+
stage('diagnostics+abi');
|
|
639
|
+
const slotsForClasses = (classes) => createSlotCensus({
|
|
640
|
+
graph: frontend.graph,
|
|
641
|
+
plan: representations.plan,
|
|
642
|
+
deriver: representations.deriver,
|
|
643
|
+
abis: abis.abis,
|
|
644
|
+
constructs: abis.constructs,
|
|
645
|
+
callableOrigins: abis.callableOrigins,
|
|
646
|
+
classes,
|
|
647
|
+
placements,
|
|
648
|
+
hostMembers,
|
|
649
|
+
hostMethodAliasDeclarations: hostMethodAliasDeclarations(frontend.graph, representations.plan, representations.deriver, hostMembers),
|
|
650
|
+
slotHooks: plugins.flatMap((plugin) => (plugin.slotOf ? [plugin.slotOf] : []))
|
|
651
|
+
});
|
|
652
|
+
const nativeClassStorage = projectNativeClassStorage(declaredClasses, representations.deriver, nativeClassFieldUsesOf(frontend.graph, representations.plan, representations.deriver, declaredClasses, slotsForClasses(declaredClasses)));
|
|
653
|
+
const classes = new Map([...declaredClasses].map(([declaration, layout]) => {
|
|
654
|
+
const nativeStorage = nativeClassStorage.get(declaration);
|
|
655
|
+
return [declaration, nativeStorage === undefined ? layout : { ...layout, nativeStorage }];
|
|
656
|
+
}));
|
|
657
|
+
const conversionRegistry = request.conversionRegistry ??
|
|
658
|
+
// No heritage policy: a `class-ref` carrier now STATES its own ancestors
|
|
659
|
+
// (`representation/model.ts`), so the upcast/downcast admissions read the
|
|
660
|
+
// fact off the carrier instead of asking a second authority for it.
|
|
661
|
+
createCppConversionRegistry(recordLayoutPolicyOf(representations.deriver, classes));
|
|
662
|
+
const conversions = buildConversionGraph(representations.plan, conversionRegistry,
|
|
663
|
+
// Inline constants have no published result in the plan, but lowering
|
|
664
|
+
// still converts them when they enter a merge or another typed slot.
|
|
665
|
+
(function* () {
|
|
666
|
+
for (const operation of frontend.graph.operations.values()) {
|
|
667
|
+
for (const operand of operation.operands) {
|
|
668
|
+
if (operand.source.kind === 'constant')
|
|
669
|
+
yield representations.deriver.derive(operand.type);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
})());
|
|
673
|
+
const conversionCensus = createConversionNodes({ registry: conversionRegistry, nodes: conversions.nodes });
|
|
674
|
+
// Lowering runs on the plan's verdict alone. An uncertified program lowers
|
|
675
|
+
// too, so its refusals are rows beside preflight's rather than a stage that
|
|
676
|
+
// never ran; only emission waits for the certificate (see the header).
|
|
677
|
+
const lowered = diagnostics.planClean
|
|
678
|
+
? lowerToIr({
|
|
679
|
+
graph: frontend.graph,
|
|
680
|
+
plan: representations.plan,
|
|
681
|
+
deriver: representations.deriver,
|
|
682
|
+
abis: abis.abis,
|
|
683
|
+
constructs: abis.constructs,
|
|
684
|
+
callableOrigins: abis.callableOrigins,
|
|
685
|
+
callableOwnPropertyWrites: abis.callableOwnPropertyWrites,
|
|
686
|
+
functionPrototypePropertyWrites: abis.functionPrototypePropertyWrites,
|
|
687
|
+
abiBlockers: new Map(abis.blocked.map((blocker) => [blocker.functionId, blocker.reason])),
|
|
688
|
+
classes,
|
|
689
|
+
slots: slotsForClasses(classes),
|
|
690
|
+
conversions: conversionCensus,
|
|
691
|
+
plugins
|
|
692
|
+
})
|
|
693
|
+
: null;
|
|
694
|
+
stage('lowering');
|
|
695
|
+
// A partially lowered program renders a partially correct file, which is
|
|
696
|
+
// worse than rendering none: the missing half is invisible in the output.
|
|
697
|
+
// So text is produced only when every body lowered, and the blockers travel
|
|
698
|
+
// back either way so the caller can say which ones did not.
|
|
699
|
+
const complete = lowered !== null && lowered.blocked.length === 0;
|
|
700
|
+
// A generator whose formals need real work (a default, or a destructured
|
|
701
|
+
// pattern) was lowered as one body with a marker `ir/lower.ts` left on it
|
|
702
|
+
// (`IrBody.generatorPrologueBoundary`); this carves that one body into the
|
|
703
|
+
// ordinary/coroutine pair ECMA-262's own timing needs -- see
|
|
704
|
+
// `ir/generator-split.ts`. Run once here, after lowering and before both
|
|
705
|
+
// consumers of the body list, so the shaker and the emitter agree on which
|
|
706
|
+
// bodies -- and which placements, since a bridged cell mints its own -- the
|
|
707
|
+
// program actually has.
|
|
708
|
+
const split = complete && lowered ? splitGeneratorBodies(lowered.bodies, placements) : null;
|
|
709
|
+
const splitBodies = split?.bodies ?? lowered?.bodies ?? new Map();
|
|
710
|
+
const splitPlacements = split?.placements ?? placements;
|
|
711
|
+
const pruned = complete
|
|
712
|
+
? pruneProvenBranches(splitBodies, frontend.graph, lowered?.slotDrift ?? [])
|
|
713
|
+
: { bodies: splitBodies, slotDrift: lowered?.slotDrift ?? [] };
|
|
714
|
+
// What the entry can reach, computed once over the whole lowered program.
|
|
715
|
+
//
|
|
716
|
+
// Placed here rather than inside emission because emission is a renderer:
|
|
717
|
+
// which bodies a program HAS is a question about the program, and the answer
|
|
718
|
+
// has to be the same one every artifact of the unit is built from -- the
|
|
719
|
+
// capture index, the reactive dependencies, the forward signatures and the
|
|
720
|
+
// thunks all read the body list, and two of them disagreeing about it is a
|
|
721
|
+
// symbol declared and never defined. See `ir/shake.ts` for the rules and for
|
|
722
|
+
// why the cut is after lowering rather than before it.
|
|
723
|
+
const shaken = complete && lowered
|
|
724
|
+
? shakeProgram({
|
|
725
|
+
bodies: pruned.bodies,
|
|
726
|
+
placements: splitPlacements,
|
|
727
|
+
classes,
|
|
728
|
+
deriver: representations.deriver,
|
|
729
|
+
// A computed class read keeps only methods the C++ callable
|
|
730
|
+
// conversion authority can actually publish at that read's ABI.
|
|
731
|
+
// Passing the question in keeps the generic IR shaker free of C++
|
|
732
|
+
// spellings while making pruning and emission share one answer.
|
|
733
|
+
computedMethodCanFill: (callable, target) => {
|
|
734
|
+
const abi = abis.abis.get(callable);
|
|
735
|
+
// A read the checker typed `any` boxes whatever method the key
|
|
736
|
+
// selects; the boxing conversion is the same authority, asked
|
|
737
|
+
// against the `dynamic` carrier.
|
|
738
|
+
if (abi === undefined || (target.kind !== 'function-value-dispatch' && target.kind !== 'dynamic'))
|
|
739
|
+
return false;
|
|
740
|
+
return conversionCensus.nodeFor({ kind: 'function-value-dispatch', abi }, target).capability.kind !== 'never';
|
|
741
|
+
}
|
|
742
|
+
})
|
|
743
|
+
: null;
|
|
744
|
+
// Which cells a closure captures, and whether a captured cell is boxed
|
|
745
|
+
// (a program fact, so it belongs to the IR), computed once here from the
|
|
746
|
+
// FINAL, shaken body set -- not the pre-shake one `split` produced -- so a
|
|
747
|
+
// relay edge through a callable `shakeProgram` removed as dead cannot
|
|
748
|
+
// widen a surviving owner's environment past what
|
|
749
|
+
// `targets/cpp/captures.ts` used to compute from this same, already-shaken
|
|
750
|
+
// list at render time. `renderTranslationUnit` reads the published fact
|
|
751
|
+
// off each body instead of re-deriving it from a fresh walk.
|
|
752
|
+
const captureFacts = shaken
|
|
753
|
+
? publishCaptureFacts(shaken.bodies, splitPlacements, recordAccessorBodiesOf([...representations.plan.selected.values()], representations.deriver))
|
|
754
|
+
: null;
|
|
755
|
+
// `CallOperation.target` (a fact moved out of the target): which
|
|
756
|
+
// FunctionId a call's callee resolves to statically, so the target reads a
|
|
757
|
+
// fact instead of re-deriving it from a whole-unit capture index at render
|
|
758
|
+
// time. This is the SAME rewrite-after-the-shake step captures itself
|
|
759
|
+
// needed, applied to operations rather than bodies
|
|
760
|
+
// (`ir/generator-split.ts`'s pattern, `ir/call-dispatch.ts`) -- it has to
|
|
761
|
+
// run here because the capture-freedom test every branch of the target
|
|
762
|
+
// bottoms out in (`IrBody.facts`) does not exist until `captureFacts`
|
|
763
|
+
// above has published it, and every `call` operation was already built by
|
|
764
|
+
// `lowerToIr`, long before that.
|
|
765
|
+
//
|
|
766
|
+
// The dispatchability verdict this needs for its `virtual` branch
|
|
767
|
+
// (`projection/dispatch.ts`'s `virtualDispatchVerdictOf`) is computed here
|
|
768
|
+
// from `shaken.classes` -- the SAME, already-pruned layout map
|
|
769
|
+
// `renderTranslationUnit` is handed below -- so this pass and
|
|
770
|
+
// `translation-unit.ts`'s own (separate, render-time) call to the same
|
|
771
|
+
// pure function can never disagree: both read the identical classes,
|
|
772
|
+
// ABIs, capture facts and conversion census.
|
|
773
|
+
const bodyFactsBySourceOwner = new Map(captureFacts ? [...captureFacts.values()].map((body) => [String(body.sourceOwner), body.facts]) : []);
|
|
774
|
+
const capturesNothingOf = (callable) => {
|
|
775
|
+
const facts = bodyFactsBySourceOwner.get(String(callable));
|
|
776
|
+
return facts === undefined || (facts.capturedDeclarations.length === 0 && facts.capturedReceiver === null);
|
|
777
|
+
};
|
|
778
|
+
const dispatchVerdict = shaken
|
|
779
|
+
? virtualDispatchVerdictOf(shaken.classes, (callable) => abis.abis.get(callable) ?? null, capturesNothingOf, conversionCensus)
|
|
780
|
+
: null;
|
|
781
|
+
let dispatchedBodies = captureFacts && shaken && dispatchVerdict
|
|
782
|
+
? fillCallDispatchTargets(captureFacts, splitPlacements, shaken.classes, (callable) => abis.abis.get(callable) ?? null, capturesNothingOf, dispatchVerdict, representations.deriver, conversionCensus)
|
|
783
|
+
: captureFacts;
|
|
784
|
+
// Physical emission dependencies come from the final program. The sealed
|
|
785
|
+
// plan stays intact as carrier authority and as the incomplete-shake fallback.
|
|
786
|
+
const resolveClassRef = physicalClassInstanceResolverOf(shaken?.classes ?? classes, frontend.graph.structuralTypes, representations.deriver);
|
|
787
|
+
let emissionRepresentations = shaken
|
|
788
|
+
? publishEmissionRepresentationsOf({
|
|
789
|
+
bodies: dispatchedBodies ?? shaken.bodies,
|
|
790
|
+
placements: splitPlacements,
|
|
791
|
+
classes: shaken.classes,
|
|
792
|
+
resolveClassRef,
|
|
793
|
+
deriver: representations.deriver,
|
|
794
|
+
conversions: conversionCensus,
|
|
795
|
+
omitGlobals: shaken.unreferencedCells,
|
|
796
|
+
complete: shaken.refused === null,
|
|
797
|
+
fallbackRoots: [...representations.plan.selected.values()]
|
|
798
|
+
})
|
|
799
|
+
: undefined;
|
|
800
|
+
stage('emission-carriers');
|
|
801
|
+
// Candidate native reads become executable only after the one reflection
|
|
802
|
+
// census proves their layouts stay closed across the reachable program.
|
|
803
|
+
let reflection = shaken
|
|
804
|
+
? reflectionExposureOf([...(dispatchedBodies ?? shaken.bodies).values()], shaken.classes, representations.deriver, {
|
|
805
|
+
representations: emissionRepresentations?.representations ?? [...representations.plan.selected.values()],
|
|
806
|
+
wellKnownSymbols: frontend.wellKnownSymbols,
|
|
807
|
+
physicalClasses: physicalClassLayoutsOf(shaken.classes, emissionRepresentations?.representations ?? [...representations.plan.selected.values()]).layouts,
|
|
808
|
+
placements: splitPlacements,
|
|
809
|
+
conversions: conversionCensus,
|
|
810
|
+
trace: request.includeIr === true,
|
|
811
|
+
shakeComplete: shaken.refused === null && emissionRepresentations?.complete === true
|
|
812
|
+
})
|
|
813
|
+
: undefined;
|
|
814
|
+
// Closed containers can transport callable records through their native
|
|
815
|
+
// fields. Newly authenticated calls can close further containers. Grow the
|
|
816
|
+
// same call/reflection censuses to a fixed point before ownership or emission
|
|
817
|
+
// consumes either publication; no printer derives this provenance.
|
|
818
|
+
if (shaken && dispatchedBodies && reflection && dispatchVerdict) {
|
|
819
|
+
const closedFactsOf = (bodies) => {
|
|
820
|
+
let count = 0;
|
|
821
|
+
for (const body of bodies)
|
|
822
|
+
for (const block of body.blocks.values())
|
|
823
|
+
for (const operation of block.operations)
|
|
824
|
+
if (operation.kind === 'get' || operation.kind === 'binding-read'
|
|
825
|
+
? operation.closedCallable !== undefined
|
|
826
|
+
: operation.kind === 'call' && operation.closedCallee !== undefined)
|
|
827
|
+
count++;
|
|
828
|
+
return count;
|
|
829
|
+
};
|
|
830
|
+
let count = closedFactsOf(dispatchedBodies.values());
|
|
831
|
+
for (;;) {
|
|
832
|
+
const next = fillCallDispatchTargets(dispatchedBodies, splitPlacements, shaken.classes, (callable) => abis.abis.get(callable) ?? null, capturesNothingOf, dispatchVerdict, representations.deriver, conversionCensus, reflection);
|
|
833
|
+
const nextCount = closedFactsOf(next.values());
|
|
834
|
+
if (nextCount <= count)
|
|
835
|
+
break;
|
|
836
|
+
count = nextCount;
|
|
837
|
+
dispatchedBodies = next;
|
|
838
|
+
emissionRepresentations = publishEmissionRepresentationsOf({
|
|
839
|
+
bodies: dispatchedBodies,
|
|
840
|
+
placements: splitPlacements,
|
|
841
|
+
classes: shaken.classes,
|
|
842
|
+
resolveClassRef,
|
|
843
|
+
deriver: representations.deriver,
|
|
844
|
+
conversions: conversionCensus,
|
|
845
|
+
omitGlobals: shaken.unreferencedCells,
|
|
846
|
+
complete: shaken.refused === null,
|
|
847
|
+
fallbackRoots: [...representations.plan.selected.values()]
|
|
848
|
+
});
|
|
849
|
+
reflection = reflectionExposureOf([...dispatchedBodies.values()], shaken.classes, representations.deriver, {
|
|
850
|
+
representations: emissionRepresentations.representations,
|
|
851
|
+
wellKnownSymbols: frontend.wellKnownSymbols,
|
|
852
|
+
physicalClasses: physicalClassLayoutsOf(shaken.classes, emissionRepresentations.representations).layouts,
|
|
853
|
+
placements: splitPlacements,
|
|
854
|
+
conversions: conversionCensus,
|
|
855
|
+
trace: request.includeIr === true,
|
|
856
|
+
shakeComplete: shaken.refused === null && emissionRepresentations.complete
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
const finalizedReads = shaken && reflection ? finalizeTypedComputedReads(dispatchedBodies ?? shaken.bodies, reflection) : null;
|
|
861
|
+
const fieldOwnership = shaken && reflection && finalizedReads
|
|
862
|
+
? finalizeNativeFieldOwnership(finalizedReads, shaken.classes, representations.deriver, conversionCensus, reflection, (reads) => nativeClassFieldUsesOf(frontend.graph, representations.plan, representations.deriver, classes, slotsForClasses(classes), reads))
|
|
863
|
+
: null;
|
|
864
|
+
// Presence is the census's to prove, not the checker's to assert: a load out
|
|
865
|
+
// of an `optional` that no program fact proves present tests before it reads
|
|
866
|
+
// (`ir/presence-proof.ts`). Which loads read unchecked is the conversion
|
|
867
|
+
// census's fact -- `targets/cpp/conversions.ts` installs `operator*` as the
|
|
868
|
+
// `present-optional` materializer.
|
|
869
|
+
const readsUnchecked = (operation) => {
|
|
870
|
+
const node = conversionCensus.nodeById(operation.conversionUse);
|
|
871
|
+
return ((node?.capability.kind === 'atom' || node?.capability.kind === 'static') && node.capability.materializer.domain === 'present-optional');
|
|
872
|
+
};
|
|
873
|
+
const finalizedBodies = (() => {
|
|
874
|
+
const bodies = fieldOwnership?.bodies ?? finalizedReads;
|
|
875
|
+
return bodies ? withPresenceChecks(bodies, readsUnchecked) : null;
|
|
876
|
+
})();
|
|
877
|
+
const executableClasses = fieldOwnership?.classes ?? shaken?.classes ?? classes;
|
|
878
|
+
if (shaken && fieldOwnership && fieldOwnership.classes !== shaken.classes) {
|
|
879
|
+
// Relocation preserves every lowered field carrier, but changes which
|
|
880
|
+
// native layouts and dispatch identities the emitted program requires.
|
|
881
|
+
emissionRepresentations = publishEmissionRepresentationsOf({
|
|
882
|
+
bodies: fieldOwnership.bodies,
|
|
883
|
+
placements: splitPlacements,
|
|
884
|
+
classes: executableClasses,
|
|
885
|
+
resolveClassRef: physicalClassInstanceResolverOf(executableClasses, frontend.graph.structuralTypes, representations.deriver),
|
|
886
|
+
deriver: representations.deriver,
|
|
887
|
+
conversions: conversionCensus,
|
|
888
|
+
omitGlobals: shaken.unreferencedCells,
|
|
889
|
+
complete: shaken.refused === null,
|
|
890
|
+
fallbackRoots: [...representations.plan.selected.values()]
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
const physicalClasses = shaken && emissionRepresentations ? physicalClassLayoutsOf(executableClasses, emissionRepresentations.representations) : undefined;
|
|
894
|
+
if (reflection && physicalClasses)
|
|
895
|
+
reflection = closePhysicalClassReflection(reflection, physicalClasses.layouts);
|
|
896
|
+
// A union read's class arm that provably lacks the key reads `undefined`;
|
|
897
|
+
// only the CLOSED exposure can say its class never gained a dynamic protocol.
|
|
898
|
+
const emittedBodies = finalizedBodies && reflection ? finalizeAbsentClassArms(finalizedBodies, reflection, executableClasses) : finalizedBodies;
|
|
899
|
+
stage('reflection');
|
|
900
|
+
// Certification is a walk of the IR lowering actually built
|
|
901
|
+
// (one question, one census): every capability the printer
|
|
902
|
+
// will need is read off the operation that needs it and looked up in the
|
|
903
|
+
// manifest's own sets, so nothing the printer asks for was left unasked.
|
|
904
|
+
//
|
|
905
|
+
// It runs on the SHAKEN bodies, after the generator split and after
|
|
906
|
+
// `publishCaptureFacts`, because the certificate has to describe the
|
|
907
|
+
// program that is printed. Certifying the pre-shake list demanded
|
|
908
|
+
// capabilities for bodies the shaker then deleted -- a refusal in code the
|
|
909
|
+
// unit never emits -- and it ran before `IrBody.facts` existed, which is
|
|
910
|
+
// why captures went uncertified and were refused at print instead. An
|
|
911
|
+
// incomplete program has no shaken list at all, so it certifies the bodies
|
|
912
|
+
// lowering did build: its refusals are the point of running at all, and
|
|
913
|
+
// dropping them would hide why it did not lower.
|
|
914
|
+
const certifiedBodies = emittedBodies ?? lowered?.bodies ?? null;
|
|
915
|
+
const certification = lowered && certifiedBodies
|
|
916
|
+
? certifyIr({
|
|
917
|
+
bodies: certifiedBodies,
|
|
918
|
+
placements: splitPlacements,
|
|
919
|
+
slotDrift: pruned.slotDrift,
|
|
920
|
+
blocked: lowered.blocked,
|
|
921
|
+
manifest,
|
|
922
|
+
conversions: conversionCensus,
|
|
923
|
+
deriver: representations.deriver,
|
|
924
|
+
classes: executableClasses,
|
|
925
|
+
...(reflection ? { reflection } : {}),
|
|
926
|
+
externalBindings: new Set(frontend.externalBindings.keys()),
|
|
927
|
+
deadTypeofGuards: frontend.deadTypeofGuards,
|
|
928
|
+
graph: frontend.graph
|
|
929
|
+
})
|
|
930
|
+
: null;
|
|
931
|
+
stage('certify');
|
|
932
|
+
// Certification requires a clean sweep as well as a clean IR walk, and the
|
|
933
|
+
// difference is not academic. The walk reads the bodies lowering built, so a
|
|
934
|
+
// family whose producer never ran lowers nothing, demands nothing, and leaves
|
|
935
|
+
// the walk vacuously clean -- a green answer for a program that was never
|
|
936
|
+
// normalized at all. The sweep is what sees the census blockers, the plan's
|
|
937
|
+
// guard violations and the checker's own errors, so it is the honest gate.
|
|
938
|
+
//
|
|
939
|
+
// The certificate itself is minted from the actual plan, graph, manifest and
|
|
940
|
+
// demanded-key census rather than from a caller-supplied identity, so a
|
|
941
|
+
// caller cannot hand in a name and acquire authority it did not earn.
|
|
942
|
+
const certificate = diagnostics.clean && certification
|
|
943
|
+
? mintCapabilityCertificate(certification, { plan: representations.plan, semanticSnapshot: frontend.graph, manifest })
|
|
944
|
+
: null;
|
|
945
|
+
const rendered = complete && certificate && shaken
|
|
946
|
+
? renderTranslationUnit({
|
|
947
|
+
plan: representations.plan,
|
|
948
|
+
structuralTypes: frontend.graph.structuralTypes,
|
|
949
|
+
bodies: [...(emittedBodies ?? withPresenceChecks(shaken.bodies, readsUnchecked)).values()],
|
|
950
|
+
omitGlobals: shaken.unreferencedCells,
|
|
951
|
+
placements: splitPlacements,
|
|
952
|
+
// The SHAKEN layouts. Emission renders a class's methods and
|
|
953
|
+
// accessors from its layout, so a member whose body the shake
|
|
954
|
+
// dropped has to be gone from here too -- see `ir/shake.ts`'s
|
|
955
|
+
// `prunedClass`. Identical to `classes` whenever the pass declines.
|
|
956
|
+
classes: executableClasses,
|
|
957
|
+
...(physicalClasses ? { physicalClasses: physicalClasses.layouts } : {}),
|
|
958
|
+
hosts,
|
|
959
|
+
runtimeDefinitions: plugins.flatMap((plugin) => [...plugin.capabilities.runtimeDefinitions]),
|
|
960
|
+
moduleOrder: frontend.moduleOrder,
|
|
961
|
+
entrySymbol: request.entrySymbol === undefined ? defaultEntrySymbol : request.entrySymbol,
|
|
962
|
+
// `'preferred'` rather than `false`: a unit that is the whole program
|
|
963
|
+
// has nothing to collide with, but internal linkage is still what
|
|
964
|
+
// lets the C++ compiler see a function is never called from
|
|
965
|
+
// elsewhere. See `CppSymbolIsolation`.
|
|
966
|
+
isolateSymbols: request.isolateSymbols === true ? 'required' : 'preferred',
|
|
967
|
+
layout: request.translationUnits ?? 'single',
|
|
968
|
+
unitBaseName: request.unitBaseName ?? 'unit',
|
|
969
|
+
sourceFileNames: frontend.sourceFileNames,
|
|
970
|
+
wellKnownSymbols: frontend.wellKnownSymbols,
|
|
971
|
+
// The one deriver this compilation built, so emission asks the same
|
|
972
|
+
// authority the plan did. See `RepresentationPublication.deriver`.
|
|
973
|
+
deriver: representations.deriver,
|
|
974
|
+
conversions: conversionCensus,
|
|
975
|
+
...(emissionRepresentations ? { emissionRepresentations: emissionRepresentations.representations } : {}),
|
|
976
|
+
...(reflection ? { reflection } : {}),
|
|
977
|
+
certificate
|
|
978
|
+
})
|
|
979
|
+
: null;
|
|
980
|
+
stage('emit');
|
|
981
|
+
return {
|
|
982
|
+
dynamicFallback: {
|
|
983
|
+
enabled: request.dynamicFallback ?? false,
|
|
984
|
+
valueCount: [...representations.plan.selected.values()].filter((value) => value.kind === 'dynamic' && value.reason === 'opt-in-fallback').length
|
|
985
|
+
},
|
|
986
|
+
locationOfNode: frontend.locationOfNode,
|
|
987
|
+
locationOfDeclaration: frontend.locationOfDeclaration,
|
|
988
|
+
textOfNode: frontend.textOfNode,
|
|
989
|
+
graph: frontend.graph,
|
|
990
|
+
sourceFileNames: frontend.sourceFileNames,
|
|
991
|
+
sourcePreparations: frontend.sourcePreparations,
|
|
992
|
+
representations,
|
|
993
|
+
manifest,
|
|
994
|
+
preflight,
|
|
995
|
+
certificate,
|
|
996
|
+
diagnostics,
|
|
997
|
+
uninstalledFamilies: frontend.uninstalledFamilies,
|
|
998
|
+
censusAccounting: frontend.censusAccounting,
|
|
999
|
+
cellFacts: frontend.cellFacts,
|
|
1000
|
+
conversionNodes: conversions.nodes,
|
|
1001
|
+
conversionCensus,
|
|
1002
|
+
source: rendered?.source ?? null,
|
|
1003
|
+
units: rendered?.units ?? [],
|
|
1004
|
+
loweringBlockers: lowered?.blocked ?? [],
|
|
1005
|
+
certification,
|
|
1006
|
+
refusals: refusalsOf(frontend.censusRefusals, abis.blocked, lowered?.blocked ?? [], certification?.refusals ?? [], rendered?.refused ?? []),
|
|
1007
|
+
slotDrift: pruned.slotDrift,
|
|
1008
|
+
printerDrift: rendered?.printerDrift ?? [],
|
|
1009
|
+
abiBlockers: abis.blocked,
|
|
1010
|
+
emissionRefusals: rendered?.refused ?? [],
|
|
1011
|
+
artifacts: plugins.flatMap((plugin) => (plugin.writeArtifacts ? [plugin.writeArtifacts] : [])),
|
|
1012
|
+
generatedSupportIncludes: [...new Set(plugins.flatMap((plugin) => plugin.capabilities.generatedSupportIncludes))].sort(),
|
|
1013
|
+
projection: {
|
|
1014
|
+
abis: abis.abis,
|
|
1015
|
+
constructs: abis.constructs,
|
|
1016
|
+
callableOrigins: abis.callableOrigins,
|
|
1017
|
+
classes: new Map([...classes].map(([id, layout]) => {
|
|
1018
|
+
const storage = executableClasses.get(id)?.nativeStorage;
|
|
1019
|
+
return [id, storage === undefined ? layout : { ...layout, nativeStorage: storage }];
|
|
1020
|
+
})),
|
|
1021
|
+
placements: splitPlacements,
|
|
1022
|
+
slotHooks: plugins.flatMap((plugin) => (plugin.slotOf ? [plugin.slotOf] : []))
|
|
1023
|
+
},
|
|
1024
|
+
emissionRepresentations: emissionRepresentations ?? null,
|
|
1025
|
+
reflection: reflection ?? null,
|
|
1026
|
+
irBodies: request.includeIr && certifiedBodies ? [...certifiedBodies.values()] : null,
|
|
1027
|
+
physicalClasses: physicalClasses ?? null
|
|
1028
|
+
};
|
|
1029
|
+
};
|