@geastack/compiler 1.0.20 → 1.0.22
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/dist/cli-emit.js +11 -1
- package/dist/cli-package-source.d.ts +0 -4
- package/dist/cli-package-source.js +8 -112
- package/dist/cli-refusal-location.d.ts +6 -0
- package/dist/cli-refusal-location.js +5 -0
- package/dist/cli.js +2 -1
- package/dist/compiler.d.ts +4 -0
- package/dist/compiler.js +120 -29
- package/dist/conversion/algebra.d.ts +16 -1
- package/dist/conversion/algebra.js +2 -0
- package/dist/conversion/build.d.ts +12 -0
- package/dist/conversion/build.js +31 -6
- package/dist/conversion/constructor-identity-family.d.ts +49 -0
- package/dist/conversion/constructor-identity-family.js +67 -0
- package/dist/conversion/derive.js +39 -6
- package/dist/conversion/iterable-object-view.d.ts +44 -0
- package/dist/conversion/iterable-object-view.js +55 -0
- package/dist/conversion/iterator-object-view.d.ts +77 -0
- package/dist/conversion/iterator-object-view.js +112 -0
- package/dist/conversion/nodes.d.ts +93 -0
- package/dist/conversion/nodes.js +262 -5
- package/dist/conversion/operand-view.js +41 -0
- package/dist/conversion/protocol-iterator.d.ts +84 -0
- package/dist/conversion/protocol-iterator.js +88 -0
- package/dist/conversion/record-view.d.ts +152 -8
- package/dist/conversion/record-view.js +518 -37
- package/dist/conversion/registry.d.ts +32 -0
- package/dist/ir/borrowed-call-arguments.d.ts +22 -1
- package/dist/ir/borrowed-call-arguments.js +102 -1
- package/dist/ir/borrowed-callable-uses.d.ts +62 -0
- package/dist/ir/borrowed-callable-uses.js +135 -0
- package/dist/ir/boxed-bind-assumptions.d.ts +24 -0
- package/dist/ir/boxed-bind-assumptions.js +93 -0
- package/dist/ir/build.d.ts +18 -7
- package/dist/ir/build.js +71 -13
- package/dist/ir/call-dispatch.js +474 -10
- package/dist/ir/call-entry.d.ts +24 -1
- package/dist/ir/call-entry.js +106 -1
- package/dist/ir/callable-class-flow.d.ts +3 -1
- package/dist/ir/callable-class-flow.js +42 -6
- package/dist/ir/callable-identity-demand.d.ts +20 -1
- package/dist/ir/callable-identity-demand.js +157 -18
- package/dist/ir/callable-member-candidates.d.ts +11 -1
- package/dist/ir/callable-member-candidates.js +82 -3
- package/dist/ir/callable-records.js +2 -2
- package/dist/ir/callable-site-escape.d.ts +4 -0
- package/dist/ir/callable-site-escape.js +228 -0
- package/dist/ir/captures.d.ts +10 -1
- package/dist/ir/captures.js +219 -4
- package/dist/ir/certificate.js +87 -16
- package/dist/ir/certify/carrier-keys.d.ts +58 -1
- package/dist/ir/certify/carrier-keys.js +160 -6
- package/dist/ir/certify/property-access-keys.d.ts +17 -0
- package/dist/ir/certify/property-access-keys.js +36 -0
- package/dist/ir/certify/property-access.js +49 -4
- package/dist/ir/certify/runtime-helper.d.ts +4 -0
- package/dist/ir/certify/runtime-helper.js +17 -5
- package/dist/ir/certify.js +132 -79
- package/dist/ir/class-static-fields.d.ts +11 -0
- package/dist/ir/class-static-fields.js +28 -0
- package/dist/ir/construct-entry.d.ts +2 -1
- package/dist/ir/construct-entry.js +3 -2
- package/dist/ir/construction-only-fields.d.ts +73 -0
- package/dist/ir/construction-only-fields.js +211 -0
- package/dist/ir/dominance.d.ts +14 -0
- package/dist/ir/dominance.js +18 -4
- package/dist/ir/emission-representations.js +4 -1
- package/dist/ir/exception-edges.d.ts +17 -0
- package/dist/ir/exception-edges.js +75 -0
- package/dist/ir/facts.d.ts +54 -3
- package/dist/ir/facts.js +182 -5
- package/dist/ir/generator-split.js +2 -2
- package/dist/ir/instance-reparenting.d.ts +83 -0
- package/dist/ir/instance-reparenting.js +167 -0
- package/dist/ir/integer-storage.d.ts +29 -0
- package/dist/ir/integer-storage.js +188 -79
- package/dist/ir/integers.d.ts +16 -0
- package/dist/ir/integers.js +327 -8
- package/dist/ir/integrity-restrictions.d.ts +42 -9
- package/dist/ir/integrity-restrictions.js +335 -42
- package/dist/ir/key-order-observation.d.ts +38 -0
- package/dist/ir/key-order-observation.js +173 -0
- package/dist/ir/literal-set-membership.d.ts +30 -0
- package/dist/ir/literal-set-membership.js +277 -0
- package/dist/ir/lower-allocation.js +68 -8
- package/dist/ir/lower-completion.d.ts +0 -9
- package/dist/ir/lower-completion.js +14 -5
- package/dist/ir/lower-destructuring.js +24 -2
- package/dist/ir/lower-exceptions.js +4 -4
- package/dist/ir/lower-flow.d.ts +21 -0
- package/dist/ir/lower-flow.js +37 -3
- package/dist/ir/lower-graph.d.ts +19 -1
- package/dist/ir/lower-graph.js +91 -67
- package/dist/ir/lower-invocation.d.ts +16 -0
- package/dist/ir/lower-invocation.js +189 -29
- package/dist/ir/lower-narrow.d.ts +0 -46
- package/dist/ir/lower-narrow.js +63 -1
- package/dist/ir/lower-operands.d.ts +52 -2
- package/dist/ir/lower-operands.js +491 -8
- package/dist/ir/lower-property.d.ts +2 -1
- package/dist/ir/lower-property.js +140 -31
- package/dist/ir/lower-protocol.js +16 -4
- package/dist/ir/lower-proxy.d.ts +65 -0
- package/dist/ir/lower-proxy.js +181 -0
- package/dist/ir/lower.js +112 -17
- package/dist/ir/model.d.ts +228 -18
- package/dist/ir/native-class-accessor.d.ts +9 -2
- package/dist/ir/native-class-accessor.js +12 -3
- package/dist/ir/native-class-construction.d.ts +1 -1
- package/dist/ir/native-class-construction.js +2 -1
- package/dist/ir/native-class-initialization.js +2 -2
- package/dist/ir/object-value-conversions.js +20 -5
- package/dist/ir/operation-index.d.ts +16 -0
- package/dist/ir/operation-index.js +17 -0
- package/dist/ir/pcm-loops.d.ts +11 -0
- package/dist/ir/pcm-loops.js +284 -0
- package/dist/ir/presence-proof.js +5 -0
- package/dist/ir/program-facts.d.ts +10 -20
- package/dist/ir/program-facts.js +80 -6
- package/dist/ir/proven-branches.d.ts +2 -2
- package/dist/ir/proven-branches.js +198 -3
- package/dist/ir/queries.js +35 -1
- package/dist/ir/reflection-demand.d.ts +9 -4
- package/dist/ir/reflection-demand.js +410 -28
- package/dist/ir/refusal.d.ts +1 -0
- package/dist/ir/refusal.js +2 -1
- package/dist/ir/shake.d.ts +94 -1
- package/dist/ir/shake.js +209 -12
- package/dist/ir/shared-empty-records.d.ts +12 -0
- package/dist/ir/shared-empty-records.js +301 -0
- package/dist/ir/spread-copy-elision.d.ts +59 -0
- package/dist/ir/spread-copy-elision.js +431 -0
- package/dist/ir/stable-cell-reads.d.ts +40 -0
- package/dist/ir/stable-cell-reads.js +123 -0
- package/dist/ir/static-callables.js +50 -0
- package/dist/ir/string-layout-reuse.d.ts +16 -1
- package/dist/ir/string-layout-reuse.js +66 -0
- package/dist/ir/transfer.d.ts +72 -3
- package/dist/ir/transfer.js +511 -19
- package/dist/ir/typed-property-access.d.ts +18 -2
- package/dist/ir/typed-property-access.js +109 -12
- package/dist/ir/verify.js +2 -1
- package/dist/plugins/apple/plugin.js +3 -2
- package/dist/plugins/gea/host.d.ts +7 -0
- package/dist/plugins/gea/host.js +30 -1
- package/dist/plugins/gea/lower.js +6 -1
- package/dist/plugins/gea/plugin.js +7 -4
- package/dist/plugins/gea/render-bridge.d.ts +4 -2
- package/dist/plugins/gea/render-bridge.js +23 -7
- package/dist/plugins/model.d.ts +2 -0
- package/dist/project-preparation.d.ts +5 -1
- package/dist/project-preparation.js +184 -7
- package/dist/projection/bindings.d.ts +5 -2
- package/dist/projection/bindings.js +40 -1
- package/dist/projection/callee.d.ts +16 -0
- package/dist/projection/callee.js +35 -6
- package/dist/projection/class-prototype.js +5 -1
- package/dist/projection/classes.d.ts +65 -2
- package/dist/projection/classes.js +159 -2
- package/dist/projection/dispatch.d.ts +69 -18
- package/dist/projection/dispatch.js +391 -19
- package/dist/projection/fields.d.ts +4 -3
- package/dist/projection/fields.js +89 -21
- package/dist/projection/instance-test.d.ts +12 -0
- package/dist/projection/instance-test.js +40 -10
- package/dist/projection/method-value-escapes.d.ts +43 -0
- package/dist/projection/method-value-escapes.js +113 -0
- package/dist/projection/slots.d.ts +34 -1
- package/dist/projection/slots.js +82 -5
- package/dist/representation/any-null-record-members.d.ts +41 -0
- package/dist/representation/any-null-record-members.js +115 -0
- package/dist/representation/collections.d.ts +3 -1
- package/dist/representation/collections.js +5 -2
- package/dist/representation/derive.d.ts +9 -1
- package/dist/representation/derive.js +366 -25
- package/dist/representation/difference.js +14 -0
- package/dist/representation/embedded-carriers.js +1 -0
- package/dist/representation/host-abi.d.ts +15 -0
- package/dist/representation/host-abi.js +28 -0
- package/dist/representation/host-templates.d.ts +1 -1
- package/dist/representation/host-templates.js +7 -3
- package/dist/representation/intersection.js +22 -0
- package/dist/representation/json-nullable.d.ts +18 -0
- package/dist/representation/json-nullable.js +22 -0
- package/dist/representation/model.d.ts +141 -0
- package/dist/representation/model.js +47 -3
- package/dist/representation/object-shape.d.ts +5 -1
- package/dist/representation/object-shape.js +5 -2
- package/dist/representation/policies.d.ts +66 -1
- package/dist/representation/proxy-carriers.d.ts +71 -0
- package/dist/representation/proxy-carriers.js +330 -0
- package/dist/representation/publish.d.ts +9 -1
- package/dist/representation/publish.js +186 -18
- package/dist/representation/record-fields.d.ts +5 -0
- package/dist/representation/record-fields.js +7 -1
- package/dist/representation/static-field-cells.d.ts +61 -0
- package/dist/representation/static-field-cells.js +80 -0
- package/dist/representation/unassigned-binding-cells.d.ts +32 -0
- package/dist/representation/unassigned-binding-cells.js +44 -0
- package/dist/representation/union.js +17 -1
- package/dist/representation/unwritten-record-members.d.ts +54 -0
- package/dist/representation/unwritten-record-members.js +167 -0
- package/dist/representation/value-records.js +153 -11
- package/dist/semantics/ambient.d.ts +102 -0
- package/dist/semantics/ambient.js +183 -0
- package/dist/semantics/any-null-member-declarations.d.ts +32 -0
- package/dist/semantics/any-null-member-declarations.js +90 -0
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +14 -0
- package/dist/semantics/borrowed-method-receiver-copy-source-transform.d.ts +51 -0
- package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +367 -0
- package/dist/semantics/call-invalidated-narrowing.d.ts +3 -0
- package/dist/semantics/call-invalidated-narrowing.js +715 -0
- package/dist/semantics/callable-origins.d.ts +39 -0
- package/dist/semantics/callable-origins.js +73 -2
- package/dist/semantics/class-alias.d.ts +36 -0
- package/dist/semantics/class-alias.js +64 -14
- package/dist/semantics/class-heritage.d.ts +64 -0
- package/dist/semantics/class-heritage.js +278 -2
- package/dist/semantics/commonjs-wrapper.d.ts +1 -1
- package/dist/semantics/commonjs-wrapper.js +24 -7
- package/dist/semantics/constructor-function-class-source-transform.d.ts +4 -0
- package/dist/semantics/constructor-function-class-source-transform.js +327 -0
- package/dist/semantics/constructor-slot-subclasses.js +163 -4
- package/dist/semantics/declaration-overlay-transform.js +197 -3
- package/dist/semantics/frontend.d.ts +31 -0
- package/dist/semantics/frontend.js +212 -26
- package/dist/semantics/host-methods.d.ts +27 -2
- package/dist/semantics/host-methods.js +57 -4
- package/dist/semantics/host-protocols.d.ts +19 -8
- package/dist/semantics/host-protocols.js +145 -31
- package/dist/semantics/interface-families.d.ts +51 -2
- package/dist/semantics/interface-families.js +609 -23
- package/dist/semantics/interface-implementors.d.ts +20 -0
- package/dist/semantics/interface-implementors.js +130 -6
- package/dist/semantics/known-caller-predicate-parameters.d.ts +2 -0
- package/dist/semantics/known-caller-predicate-parameters.js +161 -0
- package/dist/semantics/model/intrinsic-accessor-getters.d.ts +10 -0
- package/dist/semantics/model/intrinsic-accessor-getters.js +4 -0
- package/dist/semantics/model/operands.d.ts +10 -0
- package/dist/semantics/model/operations.d.ts +107 -0
- package/dist/semantics/model/selected-signature.d.ts +33 -0
- package/dist/semantics/model/structural-type-table.d.ts +15 -0
- package/dist/semantics/model/structural-type-table.js +19 -1
- package/dist/semantics/model/structural-types.d.ts +99 -0
- package/dist/semantics/model/structural-types.js +31 -2
- package/dist/semantics/normalize/absent-globals.d.ts +1 -1
- package/dist/semantics/normalize/absent-globals.js +3 -3
- package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +46 -0
- package/dist/semantics/normalize/bivariant-slot-parameter.js +372 -0
- package/dist/semantics/normalize/callback-parameter-contracts.d.ts +2 -0
- package/dist/semantics/normalize/callback-parameter-contracts.js +21 -0
- package/dist/semantics/normalize/census.d.ts +2 -1
- package/dist/semantics/normalize/census.js +25 -2
- package/dist/semantics/normalize/class-instance-record-statement.d.ts +37 -0
- package/dist/semantics/normalize/class-instance-record-statement.js +74 -0
- package/dist/semantics/normalize/collection-bindings.js +242 -5
- package/dist/semantics/normalize/commonjs-require.d.ts +35 -5
- package/dist/semantics/normalize/commonjs-require.js +464 -147
- package/dist/semantics/normalize/dead-event-emissions.d.ts +6 -0
- package/dist/semantics/normalize/dead-event-emissions.js +866 -0
- package/dist/semantics/normalize/dead-method-copies.d.ts +56 -0
- package/dist/semantics/normalize/dead-method-copies.js +239 -0
- package/dist/semantics/normalize/derived-expression-type.d.ts +149 -2
- package/dist/semantics/normalize/derived-expression-type.js +418 -14
- package/dist/semantics/normalize/field-bindings.js +139 -4
- package/dist/semantics/normalize/flow/callable-reach.js +162 -9
- package/dist/semantics/normalize/flow/member-call-forwarding.js +6 -0
- package/dist/semantics/normalize/flow/owned-class-receivers.js +40 -2
- package/dist/semantics/normalize/flow/source-class-data.d.ts +7 -1
- package/dist/semantics/normalize/flow/source-class-data.js +28 -9
- package/dist/semantics/normalize/flow/source-value-session.js +32 -13
- package/dist/semantics/normalize/flow/targets.d.ts +32 -0
- package/dist/semantics/normalize/flow/targets.js +65 -6
- package/dist/semantics/normalize/flow/value-flow.d.ts +7 -0
- package/dist/semantics/normalize/flow/value-flow.js +30 -2
- package/dist/semantics/normalize/fresh-array-result.d.ts +32 -0
- package/dist/semantics/normalize/fresh-array-result.js +125 -0
- package/dist/semantics/normalize/gating.js +2 -0
- package/dist/semantics/normalize/global-host-mutations.d.ts +11 -1
- package/dist/semantics/normalize/global-host-mutations.js +691 -27
- package/dist/semantics/normalize/host-effect-contracts.d.ts +43 -1
- package/dist/semantics/normalize/host-effect-contracts.js +60 -3
- package/dist/semantics/normalize/host-mutation-key-reader.js +35 -10
- package/dist/semantics/normalize/identities.js +64 -3
- package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +59 -0
- package/dist/semantics/normalize/intrinsic-accessor-getter.js +129 -0
- package/dist/semantics/normalize/local-bindings.js +117 -21
- package/dist/semantics/normalize/merged-declaration.d.ts +41 -0
- package/dist/semantics/normalize/merged-declaration.js +81 -0
- package/dist/semantics/normalize/never-override-result.d.ts +21 -0
- package/dist/semantics/normalize/never-override-result.js +64 -0
- package/dist/semantics/normalize/null-blind-parameter.d.ts +21 -0
- package/dist/semantics/normalize/null-blind-parameter.js +77 -0
- package/dist/semantics/normalize/object-bag-bindings.js +26 -2
- package/dist/semantics/normalize/omitted-stated-parameter.d.ts +1 -1
- package/dist/semantics/normalize/omitted-stated-parameter.js +34 -4
- package/dist/semantics/normalize/override-field-arms.d.ts +33 -0
- package/dist/semantics/normalize/override-field-arms.js +362 -0
- package/dist/semantics/normalize/parameter-bindings.d.ts +64 -1
- package/dist/semantics/normalize/parameter-bindings.js +827 -81
- package/dist/semantics/normalize/parameter-slot.d.ts +1 -0
- package/dist/semantics/normalize/parameter-slot.js +69 -0
- package/dist/semantics/normalize/physical-overload-result.d.ts +45 -0
- package/dist/semantics/normalize/physical-overload-result.js +132 -0
- package/dist/semantics/normalize/producer-context.d.ts +23 -0
- package/dist/semantics/normalize/producers/allocations.d.ts +13 -0
- package/dist/semantics/normalize/producers/allocations.js +8 -15
- package/dist/semantics/normalize/producers/binding-kind.d.ts +11 -0
- package/dist/semantics/normalize/producers/binding-kind.js +31 -0
- package/dist/semantics/normalize/producers/bindings.js +16 -1
- package/dist/semantics/normalize/producers/boundary.js +21 -1
- package/dist/semantics/normalize/producers/class-lifecycle.js +23 -14
- package/dist/semantics/normalize/producers/computations.js +8 -67
- package/dist/semantics/normalize/producers/control-loops.d.ts +1 -1
- package/dist/semantics/normalize/producers/control-loops.js +25 -1
- package/dist/semantics/normalize/producers/control.js +87 -60
- package/dist/semantics/normalize/producers/declaration-lifecycle.js +5 -0
- package/dist/semantics/normalize/producers/enums.d.ts +10 -0
- package/dist/semantics/normalize/producers/enums.js +169 -0
- package/dist/semantics/normalize/producers/erasure.d.ts +10 -0
- package/dist/semantics/normalize/producers/erasure.js +23 -0
- package/dist/semantics/normalize/producers/intrinsic-accessor-getter.d.ts +15 -0
- package/dist/semantics/normalize/producers/intrinsic-accessor-getter.js +33 -0
- package/dist/semantics/normalize/producers/invocations.js +255 -18
- package/dist/semantics/normalize/producers/iteration-yield.js +6 -1
- package/dist/semantics/normalize/producers/logical-merge-type.d.ts +36 -0
- package/dist/semantics/normalize/producers/logical-merge-type.js +163 -0
- package/dist/semantics/normalize/producers/properties.js +207 -18
- package/dist/semantics/normalize/producers/protocol.d.ts +4 -0
- package/dist/semantics/normalize/producers/protocol.js +147 -12
- package/dist/semantics/normalize/producers/references.js +50 -9
- package/dist/semantics/normalize/producers/shared.d.ts +120 -0
- package/dist/semantics/normalize/producers/shared.js +359 -10
- package/dist/semantics/normalize/producers/spread-arguments.js +85 -4
- package/dist/semantics/normalize/producers/tuple-spread.d.ts +1 -0
- package/dist/semantics/normalize/producers/tuple-spread.js +1 -1
- package/dist/semantics/normalize/property-key-domain.js +6 -0
- package/dist/semantics/normalize/reachability.d.ts +7 -0
- package/dist/semantics/normalize/reachability.js +166 -9
- package/dist/semantics/normalize/record-home-arms.d.ts +25 -0
- package/dist/semantics/normalize/record-home-arms.js +87 -0
- package/dist/semantics/normalize/record-link-families.d.ts +74 -0
- package/dist/semantics/normalize/record-link-families.js +327 -0
- package/dist/semantics/normalize/record-stand-in-arms.d.ts +56 -0
- package/dist/semantics/normalize/record-stand-in-arms.js +484 -0
- package/dist/semantics/normalize/return-bindings.d.ts +6 -2
- package/dist/semantics/normalize/return-bindings.js +60 -7
- package/dist/semantics/normalize/script-global-redefinition.js +5 -0
- package/dist/semantics/normalize/shared-array-storage.d.ts +42 -0
- package/dist/semantics/normalize/shared-array-storage.js +373 -0
- package/dist/semantics/normalize/sloppy-absence.d.ts +41 -0
- package/dist/semantics/normalize/sloppy-absence.js +199 -0
- package/dist/semantics/normalize/specialization.d.ts +40 -0
- package/dist/semantics/normalize/specialization.js +770 -36
- package/dist/semantics/normalize/structural-array-element.js +196 -6
- package/dist/semantics/normalize/structural-array-read.js +12 -0
- package/dist/semantics/normalize/structural-creation-order.d.ts +15 -0
- package/dist/semantics/normalize/structural-creation-order.js +51 -48
- package/dist/semantics/normalize/structural-declarations.d.ts +16 -0
- package/dist/semantics/normalize/structural-declarations.js +43 -0
- package/dist/semantics/normalize/structural-generics.d.ts +13 -0
- package/dist/semantics/normalize/structural-generics.js +22 -0
- package/dist/semantics/normalize/structural-indexed-access.js +16 -0
- package/dist/semantics/normalize/structural-instantiated-member.js +68 -2
- package/dist/semantics/normalize/structural-joins.js +2 -0
- package/dist/semantics/normalize/structural-layout-relevance.d.ts +30 -0
- package/dist/semantics/normalize/structural-layout-relevance.js +164 -0
- package/dist/semantics/normalize/structural-layout-type.js +270 -14
- package/dist/semantics/normalize/structural-leaves.d.ts +1 -1
- package/dist/semantics/normalize/structural-leaves.js +17 -3
- package/dist/semantics/normalize/structural-mutable-method.js +5 -1
- package/dist/semantics/normalize/structural-parts.d.ts +18 -5
- package/dist/semantics/normalize/structural-parts.js +68 -19
- package/dist/semantics/normalize/structural-receiver.d.ts +1 -1
- package/dist/semantics/normalize/structural-receiver.js +23 -1
- package/dist/semantics/normalize/structural-self-reference.d.ts +1 -1
- package/dist/semantics/normalize/structural-self-reference.js +23 -2
- package/dist/semantics/normalize/structural.d.ts +12 -1
- package/dist/semantics/normalize/structural.js +1437 -53
- package/dist/semantics/normalize/suppressed-write-arms.d.ts +47 -0
- package/dist/semantics/normalize/suppressed-write-arms.js +393 -0
- package/dist/semantics/normalize/unresolvable-names.d.ts +15 -2
- package/dist/semantics/normalize/unresolvable-names.js +30 -6
- package/dist/semantics/normalize/unshared-array-result.d.ts +32 -0
- package/dist/semantics/normalize/unshared-array-result.js +125 -0
- package/dist/semantics/package-sources.d.ts +1 -1
- package/dist/semantics/package-sources.js +120 -8
- package/dist/semantics/program.d.ts +20 -0
- package/dist/semantics/program.js +179 -26
- package/dist/semantics/shared-declaration-files.d.ts +44 -0
- package/dist/semantics/shared-declaration-files.js +42 -0
- package/dist/semantics/stable-checker.d.ts +1 -1
- package/dist/semantics/stable-checker.js +7 -2
- package/dist/semantics/subclass-member-overlay-transform.js +95 -53
- package/dist/semantics/unchecked-guard-argument-copies.d.ts +67 -0
- package/dist/semantics/unchecked-guard-argument-copies.js +163 -0
- package/dist/semantics/unchecked-write-member-declarations.d.ts +46 -0
- package/dist/semantics/unchecked-write-member-declarations.js +331 -0
- package/dist/targets/cpp/balanced-units.d.ts +31 -0
- package/dist/targets/cpp/balanced-units.js +57 -0
- package/dist/targets/cpp/borrowed-arm-projections.d.ts +31 -0
- package/dist/targets/cpp/borrowed-arm-projections.js +106 -0
- package/dist/targets/cpp/borrowed-call-entry.d.ts +1 -1
- package/dist/targets/cpp/borrowed-call-entry.js +24 -20
- package/dist/targets/cpp/captures.js +314 -8
- package/dist/targets/cpp/char-code-buffers.d.ts +36 -0
- package/dist/targets/cpp/char-code-buffers.js +214 -0
- package/dist/targets/cpp/class-layout.d.ts +7 -1
- package/dist/targets/cpp/class-layout.js +42 -17
- package/dist/targets/cpp/class-properties/computed-method-value.d.ts +17 -2
- package/dist/targets/cpp/class-properties/computed-method-value.js +50 -4
- package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +31 -1
- package/dist/targets/cpp/class-properties/emit-class-properties.js +174 -17
- package/dist/targets/cpp/class-ref-transport.d.ts +32 -0
- package/dist/targets/cpp/class-ref-transport.js +56 -1
- package/dist/targets/cpp/conversions.js +1827 -1502
- package/dist/targets/cpp/coroutine-bodies.d.ts +97 -0
- package/dist/targets/cpp/coroutine-bodies.js +187 -0
- package/dist/targets/cpp/document.js +11 -1
- package/dist/targets/cpp/emit-allocation.js +568 -21
- package/dist/targets/cpp/emit-arrays.d.ts +10 -0
- package/dist/targets/cpp/emit-arrays.js +147 -16
- package/dist/targets/cpp/emit-binding-reference.d.ts +26 -2
- package/dist/targets/cpp/emit-binding-reference.js +97 -5
- package/dist/targets/cpp/emit-bindings.d.ts +9 -1
- package/dist/targets/cpp/emit-bindings.js +108 -8
- package/dist/targets/cpp/emit-buffers.d.ts +2 -16
- package/dist/targets/cpp/emit-buffers.js +124 -25
- package/dist/targets/cpp/emit-callable.d.ts +35 -72
- package/dist/targets/cpp/emit-callable.js +647 -82
- package/dist/targets/cpp/emit-carrier-members.d.ts +13 -2
- package/dist/targets/cpp/emit-carrier-members.js +50 -9
- package/dist/targets/cpp/emit-constructor-identity-family.d.ts +20 -0
- package/dist/targets/cpp/emit-constructor-identity-family.js +45 -0
- package/dist/targets/cpp/emit-context.d.ts +329 -15
- package/dist/targets/cpp/emit-context.js +104 -13
- package/dist/targets/cpp/emit-dynamic-properties.d.ts +44 -0
- package/dist/targets/cpp/emit-dynamic-properties.js +256 -37
- package/dist/targets/cpp/emit-equality.js +117 -2
- package/dist/targets/cpp/emit-error-constructor.d.ts +19 -0
- package/dist/targets/cpp/emit-error-constructor.js +73 -0
- package/dist/targets/cpp/emit-exceptions.d.ts +25 -3
- package/dist/targets/cpp/emit-exceptions.js +215 -26
- package/dist/targets/cpp/emit-in.js +52 -5
- package/dist/targets/cpp/emit-instanceof.js +59 -11
- package/dist/targets/cpp/emit-integers.d.ts +6 -0
- package/dist/targets/cpp/emit-integers.js +10 -0
- package/dist/targets/cpp/emit-iterable-object-view.d.ts +15 -0
- package/dist/targets/cpp/emit-iterable-object-view.js +51 -0
- package/dist/targets/cpp/emit-iterator-object-view.d.ts +15 -0
- package/dist/targets/cpp/emit-iterator-object-view.js +125 -0
- package/dist/targets/cpp/emit-iterator.d.ts +7 -10
- package/dist/targets/cpp/emit-iterator.js +361 -24
- package/dist/targets/cpp/emit-json.d.ts +7 -1
- package/dist/targets/cpp/emit-json.js +595 -55
- package/dist/targets/cpp/emit-jsx.d.ts +0 -37
- package/dist/targets/cpp/emit-jsx.js +70 -8
- package/dist/targets/cpp/emit-narrowing.d.ts +192 -28
- package/dist/targets/cpp/emit-narrowing.js +1595 -120
- package/dist/targets/cpp/emit-native-selection.js +8 -2
- package/dist/targets/cpp/emit-presence.js +13 -0
- package/dist/targets/cpp/emit-properties.d.ts +3 -1
- package/dist/targets/cpp/emit-properties.js +303 -54
- package/dist/targets/cpp/emit-protocol-iterator.d.ts +14 -0
- package/dist/targets/cpp/emit-protocol-iterator.js +203 -0
- package/dist/targets/cpp/emit-proxy.d.ts +17 -0
- package/dist/targets/cpp/emit-proxy.js +35 -0
- package/dist/targets/cpp/emit-record-view.d.ts +12 -1
- package/dist/targets/cpp/emit-record-view.js +429 -18
- package/dist/targets/cpp/emit-return.d.ts +38 -0
- package/dist/targets/cpp/emit-return.js +143 -21
- package/dist/targets/cpp/emit-scopes.d.ts +78 -0
- package/dist/targets/cpp/emit-scopes.js +196 -0
- package/dist/targets/cpp/emit-sum-widening.js +6 -3
- package/dist/targets/cpp/emit-tonumber.d.ts +40 -1
- package/dist/targets/cpp/emit-tonumber.js +75 -4
- package/dist/targets/cpp/emit-tostring.d.ts +28 -2
- package/dist/targets/cpp/emit-tostring.js +115 -12
- package/dist/targets/cpp/emit-typeof.js +2 -2
- package/dist/targets/cpp/emit-union-properties.d.ts +9 -0
- package/dist/targets/cpp/emit-union-properties.js +391 -49
- package/dist/targets/cpp/emit.d.ts +3 -1
- package/dist/targets/cpp/emit.js +725 -90
- package/dist/targets/cpp/evaluated-once.d.ts +51 -0
- package/dist/targets/cpp/evaluated-once.js +140 -0
- package/dist/targets/cpp/host/core-globals.d.ts +0 -21
- package/dist/targets/cpp/host/core-globals.js +10 -2
- package/dist/targets/cpp/host/emit-host-invoke.d.ts +0 -10
- package/dist/targets/cpp/host/emit-host-invoke.js +454 -36
- package/dist/targets/cpp/host/emit-host-object.js +733 -88
- package/dist/targets/cpp/host/emit-host-properties.js +26 -2
- package/dist/targets/cpp/host/emit-host-reflect.d.ts +1 -0
- package/dist/targets/cpp/host/emit-host-reflect.js +26 -7
- package/dist/targets/cpp/host/emit-host-value.d.ts +13 -0
- package/dist/targets/cpp/host/emit-host-value.js +47 -3
- package/dist/targets/cpp/host/host-members.d.ts +11 -0
- package/dist/targets/cpp/host/host-members.js +50 -4
- package/dist/targets/cpp/host/native-protocols.js +3 -0
- package/dist/targets/cpp/host/object-protocol.d.ts +8 -0
- package/dist/targets/cpp/host/object-protocol.js +55 -13
- package/dist/targets/cpp/key-order-tracking.d.ts +11 -0
- package/dist/targets/cpp/key-order-tracking.js +18 -0
- package/dist/targets/cpp/manifest/capabilities.js +117 -9
- package/dist/targets/cpp/manifest.js +14 -0
- package/dist/targets/cpp/native-collection-base.d.ts +27 -0
- package/dist/targets/cpp/native-collection-base.js +202 -0
- package/dist/targets/cpp/native-error-base.d.ts +14 -0
- package/dist/targets/cpp/native-error-base.js +19 -4
- package/dist/targets/cpp/native-promise-base.d.ts +23 -0
- package/dist/targets/cpp/native-promise-base.js +30 -0
- package/dist/targets/cpp/native-symbol-keys.js +1 -1
- package/dist/targets/cpp/prototype/emit-prototype-array.js +258 -20
- package/dist/targets/cpp/prototype/emit-prototype-date.js +5 -4
- package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +9 -1
- package/dist/targets/cpp/prototype/emit-prototype-invoke.js +232 -26
- package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +1 -1
- package/dist/targets/cpp/prototype/emit-prototype-iterator.js +111 -13
- package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +33 -4
- package/dist/targets/cpp/prototype/emit-prototype-promise.js +218 -10
- package/dist/targets/cpp/prototype/emit-prototype-regexp.js +8 -5
- package/dist/targets/cpp/prototype/emit-prototype-string.js +24 -7
- package/dist/targets/cpp/prototype/prototype-method-reads.js +18 -3
- package/dist/targets/cpp/reactive-dependencies.d.ts +2 -0
- package/dist/targets/cpp/reactive-dependencies.js +94 -3
- package/dist/targets/cpp/realm-storage.d.ts +5 -0
- package/dist/targets/cpp/realm-storage.js +12 -0
- package/dist/targets/cpp/records.d.ts +151 -1
- package/dist/targets/cpp/records.js +1328 -122
- package/dist/targets/cpp/recursive-containers.d.ts +4 -1
- package/dist/targets/cpp/recursive-containers.js +28 -9
- package/dist/targets/cpp/translation-unit.d.ts +10 -0
- package/dist/targets/cpp/translation-unit.js +686 -140
- package/dist/targets/cpp/types.d.ts +56 -6
- package/dist/targets/cpp/types.js +218 -12
- package/dist/targets/cpp/virtual-methods.d.ts +3 -3
- package/dist/targets/cpp/virtual-methods.js +174 -17
- package/package.json +14 -13
- package/src/targets/cpp/runtime/gea_dynamic_proxy.h +155 -25
- package/src/targets/cpp/runtime/gea_eval.h +3 -0
- package/src/targets/cpp/runtime/gea_pcm.h +116 -0
- package/src/targets/cpp/runtime/gea_runtime.h +18159 -4887
- package/src/targets/cpp/runtime/gea_runtime_builtins.cpp +7 -45
- package/src/targets/cpp/runtime/gea_runtime_rtc.h +247 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { DeclarationId } from '../../identity/ids.js';
|
|
3
|
+
import type { ClassCopyAncestor } from '../class-heritage.js';
|
|
4
|
+
import type { IdentityTable, SpecializationPath } from './identities.js';
|
|
5
|
+
import type { SpecializationCensus } from './specialization.js';
|
|
6
|
+
/**
|
|
7
|
+
* Which copies of an abstract generic class's method body no instance can run.
|
|
8
|
+
*
|
|
9
|
+
* `reachability.ts` opens an instance method by KEY, for every copy at once:
|
|
10
|
+
* a live spelling of `handleOk` anywhere keeps `AbstractOperation.handleOk` in
|
|
11
|
+
* the program. That is the right cut for a method with one body, and too
|
|
12
|
+
* coarse for a generic class's method, which has one body PER COPY with a
|
|
13
|
+
* different type in it. mongodb's
|
|
14
|
+
*
|
|
15
|
+
* abstract class AbstractOperation<TResult> {
|
|
16
|
+
* handleOk(response: MongoDBResponse): TResult {
|
|
17
|
+
* return response.toObject(this.bsonOptions) as TResult
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* is inherited (or reached through `super.handleOk`) only by the operations
|
|
22
|
+
* whose `TResult` is a document; every operation at `number`, `boolean`,
|
|
23
|
+
* `string[]` or a cursor response overrides it and never calls up. The copies
|
|
24
|
+
* at those fillings are therefore bodies no dispatch lands on -- and they are
|
|
25
|
+
* exactly the ones where `as TResult` has no native meaning (a dictionary is
|
|
26
|
+
* not a number), so censusing them refused the program over code that never
|
|
27
|
+
* runs.
|
|
28
|
+
*
|
|
29
|
+
* A copy of `C.m` is dead when EVERY way the language reaches it is shut:
|
|
30
|
+
*
|
|
31
|
+
* - `C` is `abstract`, so no instance is a bare `C`. Every instance is some
|
|
32
|
+
* concrete descendant `X`, and a lookup of `m` on it stops at the first
|
|
33
|
+
* class from `X` up that gives `m` a runtime definition (a method or
|
|
34
|
+
* accessor with a body, a field with an initializer). Only a descendant
|
|
35
|
+
* whose lookup gets past every class below `C` reaches `C.m` -- and it
|
|
36
|
+
* reaches the copy of `C` its heritage chain names
|
|
37
|
+
* (`classCopyHeritageOf`, the same chain its struct is built from).
|
|
38
|
+
* - `super.m` in a class whose nearest definition of `m` above it is `C`'s
|
|
39
|
+
* reaches `C.m` in the copy that class's chain names.
|
|
40
|
+
* - Nothing reads the prototype of `C` or of a descendant (`X.prototype`,
|
|
41
|
+
* `Object.getPrototypeOf(x)`), which could hand `C.prototype.m` out
|
|
42
|
+
* without an instance lookup; a dynamic read cannot reach a class method at
|
|
43
|
+
* all (`emit-properties.ts` refuses a dynamic method key by name).
|
|
44
|
+
*
|
|
45
|
+
* Wherever an answer is not available -- a descendant whose chain names no
|
|
46
|
+
* copy of `C`, a heritage that is not a straight chain, a class nested inside
|
|
47
|
+
* another generic, a decorator -- every copy is live. The dead copy keeps its
|
|
48
|
+
* DECLARATION: it is censused exactly as an `abstract` member is, so the key
|
|
49
|
+
* still roots its dispatch family (`projection/dispatch.ts`) and every
|
|
50
|
+
* override still lands in it.
|
|
51
|
+
*/
|
|
52
|
+
export interface DeadMethodCopies {
|
|
53
|
+
readonly bodyIsDeadIn: (method: ts.MethodDeclaration, path: SpecializationPath) => boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare const noDeadMethodCopies: DeadMethodCopies;
|
|
56
|
+
export declare const deadMethodCopiesOf: (checker: ts.TypeChecker, identities: IdentityTable, specializations: SpecializationCensus, files: readonly ts.SourceFile[], heritage: ReadonlyMap<DeclarationId, readonly DeclarationId[]>, copyHeritage: ReadonlyMap<DeclarationId, ReadonlyMap<number | null, readonly ClassCopyAncestor[]>>) => DeadMethodCopies;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
export const noDeadMethodCopies = { bodyIsDeadIn: () => false };
|
|
3
|
+
const hasModifier = (node, kind) => ts.canHaveModifiers(node) && (ts.getModifiers(node)?.some((modifier) => modifier.kind === kind) ?? false);
|
|
4
|
+
const hasDecorators = (node) => ts.canHaveDecorators(node) && (ts.getDecorators(node)?.length ?? 0) > 0;
|
|
5
|
+
const memberNameText = (name) => {
|
|
6
|
+
if (!name)
|
|
7
|
+
return null;
|
|
8
|
+
if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNumericLiteral(name))
|
|
9
|
+
return name.text;
|
|
10
|
+
return null;
|
|
11
|
+
};
|
|
12
|
+
export const deadMethodCopiesOf = (checker, identities, specializations, files, heritage, copyHeritage) => {
|
|
13
|
+
const classes = new Map();
|
|
14
|
+
const superReads = [];
|
|
15
|
+
const prototypeReads = [];
|
|
16
|
+
// A class whose `extends` names no class declaration (`extends Ctor`, a
|
|
17
|
+
// parameter typed `typeof URLSearchParams`) inherits from whatever value
|
|
18
|
+
// arrives there: its chain is unknown, so it may descend from any class
|
|
19
|
+
// whose instances its base type admits. Kept as that base instance type.
|
|
20
|
+
const opaqueBases = [];
|
|
21
|
+
const insideGeneric = (node) => {
|
|
22
|
+
for (let parent = node.parent; parent; parent = parent.parent)
|
|
23
|
+
if (specializations.isGeneric(parent))
|
|
24
|
+
return true;
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
27
|
+
for (const file of files) {
|
|
28
|
+
if (file.isDeclarationFile)
|
|
29
|
+
continue;
|
|
30
|
+
const visit = (node) => {
|
|
31
|
+
if (ts.isClassLike(node)) {
|
|
32
|
+
classes.set(identities.declarationIdOf(node), node);
|
|
33
|
+
const base = node.heritageClauses?.find((clause) => clause.token === ts.SyntaxKind.ExtendsKeyword)?.types[0]?.expression;
|
|
34
|
+
if (base) {
|
|
35
|
+
let symbol = checker.getSymbolAtLocation(base);
|
|
36
|
+
if (symbol && symbol.flags & ts.SymbolFlags.Alias)
|
|
37
|
+
symbol = checker.getAliasedSymbol(symbol);
|
|
38
|
+
const declared = symbol?.declarations?.some((declaration) => ts.isClassLike(declaration) || ts.isInterfaceDeclaration(declaration));
|
|
39
|
+
if (!declared) {
|
|
40
|
+
const constructed = checker.getTypeAtLocation(base).getConstructSignatures()[0]?.getReturnType();
|
|
41
|
+
opaqueBases.push(constructed ?? checker.getAnyType());
|
|
42
|
+
if (process.env['GEA_DEAD_METHOD_COPIES_DEBUG']) {
|
|
43
|
+
process.stderr.write(`[DEAD-COPY-OPAQUE] ${file.fileName}:${file.getLineAndCharacterOfPosition(base.getStart()).line + 1} ${base.getText()}\n`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if ((ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
|
|
49
|
+
node.expression.kind === ts.SyntaxKind.SuperKeyword) {
|
|
50
|
+
superReads.push(node);
|
|
51
|
+
}
|
|
52
|
+
if (ts.isPropertyAccessExpression(node) && node.name.text === 'prototype')
|
|
53
|
+
prototypeReads.push(node.expression);
|
|
54
|
+
if (ts.isCallExpression(node) &&
|
|
55
|
+
ts.isPropertyAccessExpression(node.expression) &&
|
|
56
|
+
node.expression.name.text === 'getPrototypeOf' &&
|
|
57
|
+
node.arguments[0] !== undefined) {
|
|
58
|
+
prototypeReads.push(node.arguments[0]);
|
|
59
|
+
}
|
|
60
|
+
ts.forEachChild(node, visit);
|
|
61
|
+
};
|
|
62
|
+
visit(file);
|
|
63
|
+
}
|
|
64
|
+
const idOfType = (type) => {
|
|
65
|
+
const node = type.getSymbol()?.declarations?.find((declaration) => ts.isClassLike(declaration));
|
|
66
|
+
return node && ts.isClassLike(node) ? identities.declarationIdOf(node) : null;
|
|
67
|
+
};
|
|
68
|
+
// The class `node` is inside, as far as `super` is concerned: arrows and
|
|
69
|
+
// their bodies inherit it, any other function does not.
|
|
70
|
+
const homeClassOf = (node) => {
|
|
71
|
+
for (let parent = node.parent; parent; parent = parent.parent) {
|
|
72
|
+
if (ts.isClassLike(parent))
|
|
73
|
+
return parent;
|
|
74
|
+
if (ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(parent) || ts.isObjectLiteralExpression(parent))
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
};
|
|
79
|
+
const definesAtRuntime = (node, key) => node.members.some((member) => {
|
|
80
|
+
if (hasModifier(member, ts.SyntaxKind.StaticKeyword) || memberNameText(member.name) !== key)
|
|
81
|
+
return false;
|
|
82
|
+
if (ts.isMethodDeclaration(member) || ts.isGetAccessorDeclaration(member) || ts.isSetAccessorDeclaration(member)) {
|
|
83
|
+
return member.body !== undefined;
|
|
84
|
+
}
|
|
85
|
+
if (ts.isPropertyDeclaration(member))
|
|
86
|
+
return !hasModifier(member, ts.SyntaxKind.DeclareKeyword) && member.initializer !== undefined;
|
|
87
|
+
return false;
|
|
88
|
+
});
|
|
89
|
+
// `heritage` lists every ancestor, nearest first; a straight chain is one
|
|
90
|
+
// where each ancestor's own list is the rest of it. Anything else (a
|
|
91
|
+
// re-parented prototype, an interface merged beside a class) has no single
|
|
92
|
+
// lookup order to reason about.
|
|
93
|
+
const straightChainOf = (id) => {
|
|
94
|
+
const chain = heritage.get(id) ?? [];
|
|
95
|
+
for (const [index, ancestor] of chain.entries()) {
|
|
96
|
+
const rest = heritage.get(ancestor) ?? [];
|
|
97
|
+
if (rest.length !== chain.length - index - 1 || rest.some((one, at) => one !== chain[index + 1 + at]))
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return chain;
|
|
101
|
+
};
|
|
102
|
+
// The copies of `owner` that `from`'s copies reach, or `null` when some copy
|
|
103
|
+
// of `from` names no copy of it.
|
|
104
|
+
const copiesReachedFrom = (from, owner) => {
|
|
105
|
+
const published = copyHeritage.get(from);
|
|
106
|
+
if (!published || published.size === 0)
|
|
107
|
+
return null;
|
|
108
|
+
const reached = [];
|
|
109
|
+
for (const chain of published.values()) {
|
|
110
|
+
const step = chain.find((ancestor) => ancestor.declaration === owner);
|
|
111
|
+
if (!step || step.ordinal === null)
|
|
112
|
+
return null;
|
|
113
|
+
reached.push(step.ordinal);
|
|
114
|
+
}
|
|
115
|
+
return reached;
|
|
116
|
+
};
|
|
117
|
+
// The key a `super` read names: its text, `null` for a symbol (which is
|
|
118
|
+
// never a method's string key), `'unknown'` for a key only known at run time.
|
|
119
|
+
const superKeyOf = (read) => {
|
|
120
|
+
if (ts.isPropertyAccessExpression(read))
|
|
121
|
+
return read.name.text;
|
|
122
|
+
if (!ts.isElementAccessExpression(read))
|
|
123
|
+
return 'unknown';
|
|
124
|
+
const type = checker.getTypeAtLocation(read.argumentExpression);
|
|
125
|
+
if (type.isStringLiteral())
|
|
126
|
+
return type.value;
|
|
127
|
+
if (type.flags & ts.TypeFlags.ESSymbolLike)
|
|
128
|
+
return null;
|
|
129
|
+
return 'unknown';
|
|
130
|
+
};
|
|
131
|
+
const liveCopies = new Map();
|
|
132
|
+
const liveCopiesOf = (method) => {
|
|
133
|
+
const known = liveCopies.get(method);
|
|
134
|
+
if (known !== undefined)
|
|
135
|
+
return known;
|
|
136
|
+
const every = (site) => {
|
|
137
|
+
if (process.env['GEA_DEAD_METHOD_COPIES_DEBUG'])
|
|
138
|
+
process.stderr.write(`[DEAD-COPY-WHY] ${memberNameText(method.name)} ${site}\n`);
|
|
139
|
+
return 'every';
|
|
140
|
+
};
|
|
141
|
+
const compute = () => {
|
|
142
|
+
const owner = method.parent;
|
|
143
|
+
const key = memberNameText(method.name);
|
|
144
|
+
if (key === null || !ts.isClassDeclaration(owner) || owner.name === undefined)
|
|
145
|
+
return every('unnamed member');
|
|
146
|
+
const ownerSymbol = checker.getSymbolAtLocation(owner.name);
|
|
147
|
+
const ownerInstance = ownerSymbol ? checker.getDeclaredTypeOfSymbol(ownerSymbol) : null;
|
|
148
|
+
if (ownerInstance === null)
|
|
149
|
+
return every('owner type');
|
|
150
|
+
for (const base of opaqueBases) {
|
|
151
|
+
if (base.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown) || checker.isTypeAssignableTo(ownerInstance, base))
|
|
152
|
+
return every('opaque heritage admits the owner');
|
|
153
|
+
}
|
|
154
|
+
if (!hasModifier(owner, ts.SyntaxKind.AbstractKeyword) || hasDecorators(owner) || hasDecorators(method))
|
|
155
|
+
return every('owner not abstract or decorated');
|
|
156
|
+
if (hasModifier(method, ts.SyntaxKind.StaticKeyword) || method.body === undefined || insideGeneric(owner))
|
|
157
|
+
return every('static, bodiless or nested');
|
|
158
|
+
if (!specializations.isGeneric(owner) || specializations.isGeneric(method))
|
|
159
|
+
return every('not a copy');
|
|
160
|
+
const ownerId = identities.declarationIdOf(owner);
|
|
161
|
+
const descends = (id) => id === ownerId || (heritage.get(id) ?? []).includes(ownerId);
|
|
162
|
+
for (const read of prototypeReads) {
|
|
163
|
+
const type = checker.getTypeAtLocation(read);
|
|
164
|
+
const direct = idOfType(type);
|
|
165
|
+
const constructed = type.getConstructSignatures()[0]?.getReturnType();
|
|
166
|
+
const instance = constructed ? idOfType(constructed) : null;
|
|
167
|
+
if ((direct !== null && descends(direct)) || (instance !== null && descends(instance)))
|
|
168
|
+
return every('prototype read');
|
|
169
|
+
}
|
|
170
|
+
const live = new Set();
|
|
171
|
+
const reach = (from) => {
|
|
172
|
+
const reached = copiesReachedFrom(from, ownerId);
|
|
173
|
+
if (reached === null)
|
|
174
|
+
return false;
|
|
175
|
+
for (const ordinal of reached)
|
|
176
|
+
live.add(ordinal);
|
|
177
|
+
return true;
|
|
178
|
+
};
|
|
179
|
+
for (const [id, node] of classes) {
|
|
180
|
+
if (id === ownerId || !(heritage.get(id) ?? []).includes(ownerId))
|
|
181
|
+
continue;
|
|
182
|
+
const chain = straightChainOf(id);
|
|
183
|
+
if (chain === null)
|
|
184
|
+
return every('descendant chain not straight');
|
|
185
|
+
const below = [id, ...chain.slice(0, chain.indexOf(ownerId))];
|
|
186
|
+
const shadowed = below.some((one) => {
|
|
187
|
+
const declaration = classes.get(one);
|
|
188
|
+
return declaration !== undefined && definesAtRuntime(declaration, key);
|
|
189
|
+
});
|
|
190
|
+
if (below.some((one) => !classes.has(one)))
|
|
191
|
+
return every('descendant chain leaves the program');
|
|
192
|
+
if (!shadowed && !hasModifier(node, ts.SyntaxKind.AbstractKeyword) && !reach(id))
|
|
193
|
+
return every('descendant chain names no copy');
|
|
194
|
+
}
|
|
195
|
+
for (const read of superReads) {
|
|
196
|
+
const name = superKeyOf(read);
|
|
197
|
+
if (name === 'unknown')
|
|
198
|
+
return every('computed super key');
|
|
199
|
+
if (name !== key)
|
|
200
|
+
continue;
|
|
201
|
+
const home = homeClassOf(read);
|
|
202
|
+
if (home === null)
|
|
203
|
+
return every('super outside a class');
|
|
204
|
+
const homeId = identities.declarationIdOf(home);
|
|
205
|
+
const chain = straightChainOf(homeId);
|
|
206
|
+
if (chain === null)
|
|
207
|
+
return every('super home chain not straight');
|
|
208
|
+
const target = chain.find((one) => {
|
|
209
|
+
const declaration = classes.get(one);
|
|
210
|
+
return declaration !== undefined && definesAtRuntime(declaration, key);
|
|
211
|
+
});
|
|
212
|
+
if (target === ownerId && !reach(homeId))
|
|
213
|
+
return every('super home chain names no copy');
|
|
214
|
+
}
|
|
215
|
+
return live;
|
|
216
|
+
};
|
|
217
|
+
const answer = compute();
|
|
218
|
+
liveCopies.set(method, answer);
|
|
219
|
+
return answer;
|
|
220
|
+
};
|
|
221
|
+
return {
|
|
222
|
+
bodyIsDeadIn: (method, path) => {
|
|
223
|
+
const owner = method.parent;
|
|
224
|
+
if (!ts.isClassDeclaration(owner))
|
|
225
|
+
return false;
|
|
226
|
+
const subject = identities.genericSubjectOf(owner);
|
|
227
|
+
const step = [...path].reverse().find((one) => one.owner === subject);
|
|
228
|
+
if (step === undefined)
|
|
229
|
+
return false;
|
|
230
|
+
const live = liveCopiesOf(method);
|
|
231
|
+
const dead = live !== 'every' && !live.has(step.ordinal);
|
|
232
|
+
if (process.env['GEA_DEAD_METHOD_COPIES_DEBUG']) {
|
|
233
|
+
process.stderr.write(`[DEAD-COPY] ${owner.name?.text ?? '<anonymous>'}.${memberNameText(method.name)}@${step.ordinal} ` +
|
|
234
|
+
`live=${live === 'every' ? 'every' : [...live].join(',')} dead=${dead}\n`);
|
|
235
|
+
}
|
|
236
|
+
return dead;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
};
|
|
@@ -245,7 +245,7 @@ export declare const numericIndexAbsenceProven: (checker: ts.TypeChecker, flow:
|
|
|
245
245
|
* directly rather than re-deriving "was it the absence arm" from
|
|
246
246
|
* `memberTypeOf`'s result.
|
|
247
247
|
*/
|
|
248
|
-
export declare const closedLiteralMemberAbsenceProven: (checker: ts.TypeChecker, flow: ValueFlowIndex, receiver: ts.Type, name: string, at: ts.Node) => boolean;
|
|
248
|
+
export declare const closedLiteralMemberAbsenceProven: (checker: ts.TypeChecker, flow: ValueFlowIndex, receiver: ts.Type, name: string, at: ts.Node, census?: SettledReceiverCensus | null) => boolean;
|
|
249
249
|
/**
|
|
250
250
|
* The literal member NAME an element access spells, or `null` when its key is
|
|
251
251
|
* not a literal. `x[ 'name' ]` and `x[ 0 ]` are named reads written with
|
|
@@ -280,7 +280,48 @@ export declare const explicitThisCallReturnType: (fallback: ts.Signature, underl
|
|
|
280
280
|
* Generic signatures remain the checker's instantiation question.
|
|
281
281
|
*/
|
|
282
282
|
export declare const overloadInvariantReturnTypeAt: (checker: ts.TypeChecker, call: ts.CallExpression | ts.NewExpression, read: (node: ts.Expression) => ts.Type | null) => ts.Type | null;
|
|
283
|
-
|
|
283
|
+
/**
|
|
284
|
+
* `Array.from(source)` over a source the census typed where the checker saw
|
|
285
|
+
* `any`: an array of the source's own elements.
|
|
286
|
+
*
|
|
287
|
+
* `function bytes (buf) { var list = Array.from(buf) }` is handed a
|
|
288
|
+
* `Uint8Array` by every caller, so the census binds `buf` -- but the checker
|
|
289
|
+
* instantiated `from<T>(arrayLike: ArrayLike<T>): T[]` against `any` and
|
|
290
|
+
* answered `any[]`, and nothing re-asked. The call then published a boxed
|
|
291
|
+
* `any[]` result while its renderer, which reads the SOURCE's carrier, built
|
|
292
|
+
* the `number[]` a typed array's copy is: a `Ref<ArrayObject<double>>` written
|
|
293
|
+
* into a `Ref<ArrayObject<gea::Value>>` local, which clang rejects. The
|
|
294
|
+
* renderer is right about what the call builds (23.1.2.1 reads the source's
|
|
295
|
+
* elements one by one), so the census states it.
|
|
296
|
+
*
|
|
297
|
+
* Only where the checker's own answer is an array of `any` (a typed source is
|
|
298
|
+
* the checker's answer already), for one argument (a mapper's result is the
|
|
299
|
+
* mapper's question), and for a source whose elements the standard library
|
|
300
|
+
* states by a numeric index: an array, a tuple, or a typed array. A `Set` or
|
|
301
|
+
* `Map` is iterated through a protocol this does not read, and keeps the
|
|
302
|
+
* checker's answer.
|
|
303
|
+
*/
|
|
304
|
+
export declare const arrayFromCopyTypeAt: (checker: ts.TypeChecker, call: ts.CallExpression | ts.NewExpression, read: (node: ts.Expression) => ts.Type | null) => ts.Type | null;
|
|
305
|
+
export declare const memberTypeOf: (checker: ts.TypeChecker, receiver: ts.Type, name: string, at: ts.Node, flow?: ValueFlowIndex,
|
|
306
|
+
/** A settled census the absence proof may ask where the checker types a write's receiver `any`. */
|
|
307
|
+
census?: SettledReceiverCensus | null) => ts.Type | null;
|
|
308
|
+
/**
|
|
309
|
+
* Whether `node` is a feature test of a method a HOST declares on `receiver`
|
|
310
|
+
* -- memory-pager's `buf.equals && buf.equals(x)` over Node's `Buffer` -- whose
|
|
311
|
+
* value only a truthiness test reads. Such a method is always there, so the
|
|
312
|
+
* read is `true` (typed `boolean`, which is what every census, the layout
|
|
313
|
+
* resolver and the property producer answer for it alike), and no function
|
|
314
|
+
* value is ever taken off a host object that has no callable to hand out.
|
|
315
|
+
*
|
|
316
|
+
* Only a non-optional method signature outside the default library, declared
|
|
317
|
+
* ambiently or read off an ambient value: `Buffer.alloc` is a member of
|
|
318
|
+
* node-compat's plain `interface BufferConstructor`, and what makes it a host
|
|
319
|
+
* method is the `declare const Buffer` it is read through. A program's own
|
|
320
|
+
* methods and `lib.*.d.ts` members keep their function type. Whether the program may have replaced the key on some host
|
|
321
|
+
* surface is the producer's question, asked against the sealed mutation census
|
|
322
|
+
* before it folds the read.
|
|
323
|
+
*/
|
|
324
|
+
export declare const isHostMethodPresenceTest: (checker: ts.TypeChecker, node: ts.Node, receiver: ts.Type) => boolean;
|
|
284
325
|
/**
|
|
285
326
|
* Whether a JSDoc tag resolved to nothing AT ALL -- `any` or `unknown`.
|
|
286
327
|
*
|
|
@@ -438,6 +479,41 @@ export declare const isStandardGlobalValue: (checker: ts.TypeChecker, expression
|
|
|
438
479
|
* this backend does not implement wrapper-object carriers.
|
|
439
480
|
*/
|
|
440
481
|
export declare const objectAssignTargetType: (checker: ts.TypeChecker, node: ts.Node) => ts.Type | null;
|
|
482
|
+
/**
|
|
483
|
+
* `objectAssignTargetType`, asked of a CELL: an unannotated `const` whose
|
|
484
|
+
* initializer is an authenticated `Object.assign` holds that call's target
|
|
485
|
+
* for its whole life, since no later write can replace it. `declaration` is
|
|
486
|
+
* the cell, or `null` when it is not one.
|
|
487
|
+
*
|
|
488
|
+
* The one authority for "this binding IS the assigned object", shared by the
|
|
489
|
+
* local census (which lays the cell out as it) and the return census (which
|
|
490
|
+
* publishes it as the carrier of a function returning the cell), so the cell
|
|
491
|
+
* and the value handed back out of it cannot become two carriers of one
|
|
492
|
+
* object. An annotated cell keeps its annotation: that is a stated conversion.
|
|
493
|
+
*/
|
|
494
|
+
export declare const objectAssignCellTargetType: (checker: ts.TypeChecker, declaration: ts.Node | undefined) => ts.Type | null;
|
|
495
|
+
/**
|
|
496
|
+
* The object an authenticated `Object.assign` returns, read at the call or at
|
|
497
|
+
* the `const` cell holding its result (`objectAssignCellTargetType`).
|
|
498
|
+
*/
|
|
499
|
+
export declare const objectAssignedValueTypeOf: (checker: ts.TypeChecker, node: ts.Node) => ts.Type | null;
|
|
500
|
+
/**
|
|
501
|
+
* A function with a STATED return whose every `return` hands back the object
|
|
502
|
+
* an `Object.assign` mutated.
|
|
503
|
+
*
|
|
504
|
+
* ECMA-262 returns the target itself, so the value is that object's carrier --
|
|
505
|
+
* its extra keys in the dynamic-property sidecar -- and the annotation
|
|
506
|
+
* (typically the call's own `T & U`, or a wider interface of it, which the
|
|
507
|
+
* checker has already proved the value satisfies) is a view of it, not a
|
|
508
|
+
* second layout. Holding the return to the annotation asked for a conversion
|
|
509
|
+
* of one object into another carrier at the `return` (bson's
|
|
510
|
+
* `DBRef.toJSON(): DBRefLike & Document`), which is a copy: it would sever the
|
|
511
|
+
* caller's object from the one assigned into and re-order its keys, since the
|
|
512
|
+
* annotation names `$db` while the object gained it after the spread-in
|
|
513
|
+
* fields. The return census publishes the target as the function's return,
|
|
514
|
+
* and a `const` cell initialized by a call to it holds the same object.
|
|
515
|
+
*/
|
|
516
|
+
export declare const returnsOnlyAssignedObjects: (checker: ts.TypeChecker, declaration: ts.Node) => boolean;
|
|
441
517
|
/**
|
|
442
518
|
* The object `Object.assign( {}, ...sources )` builds, when `literal` is that
|
|
443
519
|
* bare `{}`.
|
|
@@ -551,8 +627,59 @@ export declare const narrowsOnlyUnstatedPositions: (checker: ts.TypeChecker, anc
|
|
|
551
627
|
* the `null`.
|
|
552
628
|
*/
|
|
553
629
|
export declare const withoutUndefinedMember: (checker: ts.TypeChecker, type: ts.Type) => ts.Type;
|
|
630
|
+
/** The class a constructor-object type (`typeof C`) belongs to, or `null` for any other type. */
|
|
631
|
+
export declare const classOfConstructorType: (type: ts.Type) => ts.Symbol | null;
|
|
554
632
|
/** Whether `a` and `b` are the constructor objects of two different classes -- nominally distinct, whatever their shapes. */
|
|
555
633
|
export declare const isDistinctClassConstructorPair: (a: ts.Type, b: ts.Type) => boolean;
|
|
634
|
+
/**
|
|
635
|
+
* A constructor type with no class anchor -- `{ new (bytes: Uint8Array):
|
|
636
|
+
* Reply; make(bytes: Uint8Array): Reply }`, `new () => Component`.
|
|
637
|
+
*
|
|
638
|
+
* It states a construction CONVENTION (and whatever statics it lists), never
|
|
639
|
+
* WHICH class runs: that position is as unstated as the implementing object
|
|
640
|
+
* behind `Iterable<T>`. Only construct-only object types qualify -- a value
|
|
641
|
+
* that is also callable keeps both conventions (`function-and-constructor`),
|
|
642
|
+
* and an intersection may already name a class.
|
|
643
|
+
*/
|
|
644
|
+
export declare const isStructuralConstructorType: (type: ts.Type) => boolean;
|
|
645
|
+
/**
|
|
646
|
+
* Whether `actual` refines a stated structural constructor type only at the
|
|
647
|
+
* class identity it leaves open: every present member of `actual` is a class
|
|
648
|
+
* constructor (`typeof C`) assignable to the one structural constructor the
|
|
649
|
+
* statement names, and every absence `actual` carries the statement admits.
|
|
650
|
+
*
|
|
651
|
+
* mongodb's `command(..., responseType?: MongoDBResponseConstructor)` is fed
|
|
652
|
+
* `operation.SERVER_COMMAND_RESPONSE_TYPE`, a closed family of response
|
|
653
|
+
* classes. Reading the statement as the last word re-carries that family as a
|
|
654
|
+
* `constructor-value-dispatch` -- a slot no class constructor converts into
|
|
655
|
+
* and whose statics (`make`) are not the family's own -- so the census may hold
|
|
656
|
+
* the parameter to the callers' family instead, exactly as it holds hono's
|
|
657
|
+
* `Result<[unknown, Route]>` to its concrete handler.
|
|
658
|
+
*/
|
|
659
|
+
export declare const narrowsStructuralConstructorToClasses: (checker: ts.TypeChecker, declared: ts.Type, actual: ts.Type) => boolean;
|
|
660
|
+
/**
|
|
661
|
+
* lib's `ArrayBufferView` interface: a window onto an `ArrayBuffer` that says
|
|
662
|
+
* nothing about WHICH view -- `Uint8Array`, `DataView`, ... -- sits behind
|
|
663
|
+
* it. Like the class behind a structural constructor type, that identity is
|
|
664
|
+
* the one position the statement leaves open, and no view converts into the
|
|
665
|
+
* interface's generated record without losing it.
|
|
666
|
+
*/
|
|
667
|
+
export declare const isLibArrayBufferViewType: (type: ts.Type) => boolean;
|
|
668
|
+
/** A statement with an `ArrayBufferView` arm -- `ArrayBufferView` itself, or `BufferSource`. */
|
|
669
|
+
export declare const statesAnArrayBufferView: (declared: ts.Type) => boolean;
|
|
670
|
+
/**
|
|
671
|
+
* Whether `actual` refines a statement naming `ArrayBufferView` only at the
|
|
672
|
+
* view identity it leaves open: every present member is a lib-declared buffer
|
|
673
|
+
* type other than the interface itself (`Uint8Array`, `DataView`,
|
|
674
|
+
* `ArrayBuffer`, ...) assignable to the statement, and every absence it
|
|
675
|
+
* carries the statement admits.
|
|
676
|
+
*
|
|
677
|
+
* mongodb's aws4 signing hands a `Uint8Array` to Web Crypto's
|
|
678
|
+
* `digest(algorithm, data: BufferSource)`. Held to the statement, the slot is
|
|
679
|
+
* `ArrayBuffer | ArrayBufferView` with the view arm a generated record no
|
|
680
|
+
* typed array reaches; held to its callers, it is the array itself.
|
|
681
|
+
*/
|
|
682
|
+
export declare const narrowsArrayBufferViewToViews: (checker: ts.TypeChecker, declared: ts.Type, actual: ts.Type) => boolean;
|
|
556
683
|
/** Shape subtyping cannot discard the identity of a class constructor selected at runtime. */
|
|
557
684
|
export declare const nominalConstructorChoiceTypeAt: (checker: ts.TypeChecker, node: ts.Node, read: (operand: ts.Expression) => ts.Type) => ts.Type | null;
|
|
558
685
|
export declare const widestOf: (checker: ts.TypeChecker, types: readonly ts.Type[]) => ts.Type | null;
|
|
@@ -617,6 +744,26 @@ export declare const normalizedArrayConditionalType: (checker: ts.TypeChecker, n
|
|
|
617
744
|
* would need a join this is not the place to take.
|
|
618
745
|
*/
|
|
619
746
|
export declare const arrayPredicateNarrowedTypeOf: (checker: ts.TypeChecker, type: ts.Type) => ts.Type | null;
|
|
747
|
+
/**
|
|
748
|
+
* A member the `typeof x === 'function'` narrowing buried under `Function`'s
|
|
749
|
+
* own `any`.
|
|
750
|
+
*
|
|
751
|
+
* TypeScript narrows a value whose declared type has a call or construct
|
|
752
|
+
* signature to `X & Function`, and `lib.es5.d.ts` declares
|
|
753
|
+
* `Function.prototype: any`. The intersection's `prototype` is therefore `any`
|
|
754
|
+
* although `X` states it exactly: bson's `byte_utils.ts` declares `Buffer: {
|
|
755
|
+
* new (): unknown; prototype?: { _isBuffer?: boolean } } | undefined` and
|
|
756
|
+
* reads `typeof Buffer === 'function' && Buffer.prototype?._isBuffer !==
|
|
757
|
+
* true`, and both links of that chain were typed `any` -- a boxed `gea::Value`
|
|
758
|
+
* cell receiving the host's typed `Optional<bool>` absence. The `any` is the
|
|
759
|
+
* narrowing's artifact, not a boundary the program declared (the same kind of
|
|
760
|
+
* artifact `arrayPredicateNarrowedElementTypeOf` below repairs), so the member
|
|
761
|
+
* is read off the part that declared it, and a link further along a repaired
|
|
762
|
+
* receiver is read off that repaired type. Only a checker answer of `any`, and
|
|
763
|
+
* only a `Function` member itself typed `any`, is ever replaced; exactly one
|
|
764
|
+
* other part must state the member, or the checker's answer stands.
|
|
765
|
+
*/
|
|
766
|
+
export declare const functionIntersectionMemberTypeOf: (checker: ts.TypeChecker, node: ts.Node) => ts.Type | null;
|
|
620
767
|
/**
|
|
621
768
|
* The element an `x[k]` read produces when the checker typed it `any` only
|
|
622
769
|
* because `x` is standing in an `arg is any[]` narrowing's intersection.
|