@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
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* `this.field = expr`, written through a captured lexical alias rather than
|
|
4
|
+
* `this` itself: `const scope = this; ... function later() { scope.field =
|
|
5
|
+
* expr; } ...` -- a plain, generic JS idiom for reaching the enclosing
|
|
6
|
+
* instance from inside a nested (non-arrow) helper, where a bare `this`
|
|
7
|
+
* would rebind to something else. `WebGLRenderer`'s own constructor is built
|
|
8
|
+
* out of it (`const _this = this;`, then a dozen nested `function
|
|
9
|
+
* initGLContext() { ... _this.info = info; ... }`-shaped helpers).
|
|
10
|
+
*
|
|
11
|
+
* TypeScript's own JS-class member inference (the mechanism
|
|
12
|
+
* `field-bindings.ts`'s header describes at length) reads a class's implicit
|
|
13
|
+
* members from `this.field = expr` assignments, but only ones it can trace
|
|
14
|
+
* to the constructor's own `this` binding directly -- it does not follow a
|
|
15
|
+
* variable that merely happens to alias `this`, even though the alias is a
|
|
16
|
+
* perfectly ordinary closure capture and refers to the exact same object at
|
|
17
|
+
* every one of its uses, arbitrarily nested. The result: `checker.
|
|
18
|
+
* getSymbolAtLocation` returns nothing at ALL for `scope.field`, and nothing
|
|
19
|
+
* for `this.field` at any of the class's own read sites either -- there is
|
|
20
|
+
* no symbol for `field-bindings.ts` (or anything else) to hang a type on, so
|
|
21
|
+
* every read boxes.
|
|
22
|
+
*
|
|
23
|
+
* ## The fix, and why it is a source transform
|
|
24
|
+
*
|
|
25
|
+
* Once a field is given an ordinary bare declaration (`field;`, no
|
|
26
|
+
* annotation -- `field-bindings.ts`'s own "second shape"), TypeScript's
|
|
27
|
+
* property lookup resolves `scope.field`, `this.field`, and every alias in
|
|
28
|
+
* between to that ONE declaration's symbol, regardless of nesting -- lookup
|
|
29
|
+
* through a value of a known type has none of implicit-member-inference's
|
|
30
|
+
* traversal limits. So this transform's only job is to make the declaration
|
|
31
|
+
* exist: find every `alias.field = expr` this idiom produces, for an alias
|
|
32
|
+
* that provably names nothing but `this`, and inject a bare field for each
|
|
33
|
+
* name the class does not already declare some other way. `field-bindings.ts`
|
|
34
|
+
* then types it exactly as it types any other bare field -- from the JOIN of
|
|
35
|
+
* every write reaching that symbol, direct or aliased alike, since once the
|
|
36
|
+
* declaration exists the checker treats them identically.
|
|
37
|
+
*
|
|
38
|
+
* This has to happen before the checker ever sees the class, which is what
|
|
39
|
+
* makes it a source transform rather than a census rule: a census can only
|
|
40
|
+
* ask the checker questions, and the checker has already thrown the fact
|
|
41
|
+
* away (no symbol at all) by the time any census would run.
|
|
42
|
+
*
|
|
43
|
+
* ## What counts as an alias
|
|
44
|
+
*
|
|
45
|
+
* A `const alias = this;` (not `let`/`var`: this module trusts nothing it
|
|
46
|
+
* cannot prove never gets reassigned to something else mid-scope) whose
|
|
47
|
+
* declaration sits inside one of the class's own members -- constructor or
|
|
48
|
+
* method. Its scope is exactly what JavaScript gives it: the block it is
|
|
49
|
+
* declared in, plus everything nested inside, EXCEPT a nested scope that
|
|
50
|
+
* shadows the same name with its own binding (a parameter, another
|
|
51
|
+
* `const`/`let`/`var`, a nested function of that name) -- reads/writes past
|
|
52
|
+
* that point name a different value, and this module does not attempt to
|
|
53
|
+
* follow which.
|
|
54
|
+
*
|
|
55
|
+
* ## What is deliberately left alone
|
|
56
|
+
*
|
|
57
|
+
* - A field also written as a DIRECT `this.field = expr` ANYWHERE in the
|
|
58
|
+
* class is skipped for alias purposes entirely, even where the alias write
|
|
59
|
+
* is a different field -- not because the direct write is wrong, but
|
|
60
|
+
* because it may already be a working candidate (top-level in the
|
|
61
|
+
* constructor, the one shape TypeScript's own inference already handles),
|
|
62
|
+
* and this module has no way to tell "already inferred" from "not" without
|
|
63
|
+
* asking the checker, which does not exist yet. Adding a redundant bare
|
|
64
|
+
* declaration alongside a real inferred one would mix two declaration
|
|
65
|
+
* SHAPES on one symbol and make `field-bindings.ts`'s own candidate test
|
|
66
|
+
* refuse it -- a regression this module must never risk. Refusing to act
|
|
67
|
+
* on a name is always safe; guessing which of two declarations is the real
|
|
68
|
+
* one is not.
|
|
69
|
+
* - A name already declared some other way (a real property, an accessor, a
|
|
70
|
+
* method) is left untouched -- the checker already has an answer, or the
|
|
71
|
+
* name is not a data member at all.
|
|
72
|
+
* - `this` used directly inside a nested PLAIN (non-arrow) function is not
|
|
73
|
+
* an alias of anything; that `this` is a different binding by the language
|
|
74
|
+
* itself, and this module does not treat it as one. An arrow function needs
|
|
75
|
+
* no alias to begin with -- it
|
|
76
|
+
* inherits `this` lexically, and TypeScript's own inference already
|
|
77
|
+
* follows it there.
|
|
78
|
+
*/
|
|
79
|
+
/** The static string a key names, for `alias.field` or `alias['field']` -- never a computed key. */
|
|
80
|
+
const staticKeyOf = (node) => {
|
|
81
|
+
if (ts.isPropertyAccessExpression(node))
|
|
82
|
+
return node.name.text;
|
|
83
|
+
if (ts.isStringLiteralLike(node.argumentExpression))
|
|
84
|
+
return node.argumentExpression.text;
|
|
85
|
+
return null;
|
|
86
|
+
};
|
|
87
|
+
/** Whether `node` is `name.field` / `name['field']` over exactly the identifier `name`, with a static key. */
|
|
88
|
+
const staticAliasFieldNameOf = (node, aliasName) => {
|
|
89
|
+
if (!ts.isPropertyAccessExpression(node) && !ts.isElementAccessExpression(node))
|
|
90
|
+
return null;
|
|
91
|
+
if (!ts.isIdentifier(node.expression) || node.expression.text !== aliasName)
|
|
92
|
+
return null;
|
|
93
|
+
return staticKeyOf(node);
|
|
94
|
+
};
|
|
95
|
+
/** Whether `node` binds a name that would shadow `aliasName` inside its own subtree. */
|
|
96
|
+
const shadowsAlias = (node, aliasName) => {
|
|
97
|
+
if (ts.isParameter(node) || ts.isVariableDeclaration(node) || ts.isBindingElement(node)) {
|
|
98
|
+
return ts.isIdentifier(node.name) && node.name.text === aliasName;
|
|
99
|
+
}
|
|
100
|
+
if (ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)) {
|
|
101
|
+
return node.name !== undefined && node.name.text === aliasName;
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
};
|
|
105
|
+
/** Every field name written as `aliasName.field = expr` anywhere under `root`, stopping at a shadowing re-binding. */
|
|
106
|
+
const aliasFieldWritesUnder = (root, aliasName) => {
|
|
107
|
+
const names = new Set();
|
|
108
|
+
const walk = (node) => {
|
|
109
|
+
if (shadowsAlias(node, aliasName))
|
|
110
|
+
return;
|
|
111
|
+
// A nested class could rebind `this` for its own members; nothing under it is this alias's scope.
|
|
112
|
+
if (ts.isClassLike(node) && node !== root)
|
|
113
|
+
return;
|
|
114
|
+
if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken) {
|
|
115
|
+
const name = staticAliasFieldNameOf(node.left, aliasName);
|
|
116
|
+
if (name !== null)
|
|
117
|
+
names.add(name);
|
|
118
|
+
}
|
|
119
|
+
ts.forEachChild(node, walk);
|
|
120
|
+
};
|
|
121
|
+
ts.forEachChild(root, walk);
|
|
122
|
+
return names;
|
|
123
|
+
};
|
|
124
|
+
/** Every field name written as a DIRECT `this.field = expr` / `this['field'] = expr` anywhere in `klass`, any depth. */
|
|
125
|
+
const directThisFieldWritesIn = (klass) => {
|
|
126
|
+
const names = new Set();
|
|
127
|
+
const walk = (node) => {
|
|
128
|
+
if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken) {
|
|
129
|
+
const left = node.left;
|
|
130
|
+
if ((ts.isPropertyAccessExpression(left) || ts.isElementAccessExpression(left)) &&
|
|
131
|
+
left.expression.kind === ts.SyntaxKind.ThisKeyword) {
|
|
132
|
+
const name = staticKeyOf(left);
|
|
133
|
+
if (name !== null)
|
|
134
|
+
names.add(name);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
ts.forEachChild(node, walk);
|
|
138
|
+
};
|
|
139
|
+
for (const member of klass.members)
|
|
140
|
+
walk(member);
|
|
141
|
+
return names;
|
|
142
|
+
};
|
|
143
|
+
/** Every member name `klass` already declares some other way -- a real field, an accessor, a method. */
|
|
144
|
+
const alreadyDeclaredIn = (klass) => {
|
|
145
|
+
const names = new Set();
|
|
146
|
+
for (const member of klass.members) {
|
|
147
|
+
if ((ts.isPropertyDeclaration(member) || ts.isMethodDeclaration(member) || ts.isGetAccessor(member) || ts.isSetAccessor(member)) &&
|
|
148
|
+
ts.isIdentifier(member.name)) {
|
|
149
|
+
names.add(member.name.text);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return names;
|
|
153
|
+
};
|
|
154
|
+
/** Every `const alias = this;` declared inside one of `klass`'s own members, with the alias's own scope root. */
|
|
155
|
+
const thisAliasesIn = (klass) => {
|
|
156
|
+
const aliases = [];
|
|
157
|
+
const walk = (node) => {
|
|
158
|
+
if (ts.isClassLike(node) && node !== klass)
|
|
159
|
+
return;
|
|
160
|
+
if (ts.isVariableStatement(node) && (node.declarationList.flags & ts.NodeFlags.Const) !== 0) {
|
|
161
|
+
for (const declaration of node.declarationList.declarations) {
|
|
162
|
+
if (ts.isIdentifier(declaration.name) && declaration.initializer?.kind === ts.SyntaxKind.ThisKeyword) {
|
|
163
|
+
// Scope = the statement's own containing block/source list, so
|
|
164
|
+
// sibling statements after it (and everything nested under them)
|
|
165
|
+
// are in scope, exactly as JavaScript's own block scoping gives it.
|
|
166
|
+
const scope = node.parent;
|
|
167
|
+
aliases.push({ name: declaration.name.text, scope });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
ts.forEachChild(node, walk);
|
|
172
|
+
};
|
|
173
|
+
for (const member of klass.members)
|
|
174
|
+
walk(member);
|
|
175
|
+
return aliases;
|
|
176
|
+
};
|
|
177
|
+
export const aliasThisFieldDeclarationTransform = (input) => {
|
|
178
|
+
const file = ts.createSourceFile(input.fileName, input.text, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
|
|
179
|
+
const edits = [];
|
|
180
|
+
const visitTopLevel = (node) => {
|
|
181
|
+
if (ts.isClassDeclaration(node) && node.name) {
|
|
182
|
+
const already = alreadyDeclaredIn(node);
|
|
183
|
+
const direct = directThisFieldWritesIn(node);
|
|
184
|
+
const candidates = new Set();
|
|
185
|
+
for (const alias of thisAliasesIn(node)) {
|
|
186
|
+
for (const name of aliasFieldWritesUnder(alias.scope, alias.name)) {
|
|
187
|
+
if (already.has(name) || direct.has(name))
|
|
188
|
+
continue;
|
|
189
|
+
candidates.add(name);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (candidates.size > 0) {
|
|
193
|
+
const fieldTexts = [...candidates].sort().map((name) => `\t${name};\n`);
|
|
194
|
+
edits.push({ at: node.members.pos, text: fieldTexts.join('') });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
ts.forEachChild(node, visitTopLevel);
|
|
198
|
+
};
|
|
199
|
+
visitTopLevel(file);
|
|
200
|
+
if (edits.length === 0)
|
|
201
|
+
return null;
|
|
202
|
+
edits.sort((a, b) => b.at - a.at);
|
|
203
|
+
let text = input.text;
|
|
204
|
+
for (const edit of edits)
|
|
205
|
+
text = text.slice(0, edit.at) + edit.text + text.slice(edit.at);
|
|
206
|
+
return text;
|
|
207
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A declared type a feature package's own runtime REPLACES with a concrete
|
|
3
|
+
* type it ships as ordinary source.
|
|
4
|
+
*
|
|
5
|
+
* `WebGLRenderer`'s `_gl` parameter is documented, by `@types/three` and by
|
|
6
|
+
* three's own JSDoc, as an AMBIENT browser interface -- `WebGLRenderingContext`
|
|
7
|
+
* in one place, the correct `WebGL2RenderingContext` in another -- because
|
|
8
|
+
* that is the type a browser host would hand it. This build's host is not a
|
|
9
|
+
* browser: `@geastack/native-webgl-angle` ships `NativeWebGL2RenderingContext`,
|
|
10
|
+
* an ordinary TypeScript class this compiler already compiles from source, and
|
|
11
|
+
* every `_gl` this program ever actually holds is one of ITS instances
|
|
12
|
+
* (`createNativeWebGLCanvas(...).getContext('webgl2')`).
|
|
13
|
+
*
|
|
14
|
+
* The ambient interface and the concrete class are structurally unrelated --
|
|
15
|
+
* `WebGLRenderingContext` is the WebGL 1 surface and lacks
|
|
16
|
+
* `renderbufferStorageMultisample`/`blitFramebuffer`/`invalidateFramebuffer`
|
|
17
|
+
* and the WebGL 2 framebuffer constants three's own renderer calls -- so a
|
|
18
|
+
* member read through the STATED type either does not exist (the checker
|
|
19
|
+
* answers `any`, and every read of it boxes) or answers a DIFFERENT host's
|
|
20
|
+
* member than the one that will ever run.
|
|
21
|
+
*
|
|
22
|
+
* `type`/`importedFrom` name the concrete replacement and where a value
|
|
23
|
+
* consumer imports it from, exactly as three's own source already does
|
|
24
|
+
* (`import { createNativeWebGLCanvas } from '@geastack/native-webgl-angle/nativeWebGL'`)
|
|
25
|
+
* -- so respelling a stated ambient name to this one is not inventing a fact,
|
|
26
|
+
* it is stating in the type layer what the program's own value layer already
|
|
27
|
+
* says.
|
|
28
|
+
*/
|
|
29
|
+
export interface AmbientTypeRealization {
|
|
30
|
+
/** The concrete type's own name, as its package exports it. */
|
|
31
|
+
readonly type: string;
|
|
32
|
+
/** The module specifier a consumer imports `type` from, UNQUOTED. */
|
|
33
|
+
readonly importedFrom: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Respell JSDoc and TypeScript type references to a host's concrete type.
|
|
37
|
+
* Value references remain untouched: an interface realization does not imply
|
|
38
|
+
* that a browser constructor exists on the native host.
|
|
39
|
+
*
|
|
40
|
+
* Built from `realizations` -- the union of every installed plugin's own
|
|
41
|
+
* `PluginCapabilities.ambientTypeRealizations` -- rather than reading any
|
|
42
|
+
* name here: an empty map (no plugin states one) costs one size check and
|
|
43
|
+
* changes nothing, exactly as `jsdocNamepathTransform` costs one substring
|
|
44
|
+
* test on a file with no `~`.
|
|
45
|
+
*
|
|
46
|
+
* Runs after `declarationOverlayTransform` in `compiler.ts`'s own pipeline so
|
|
47
|
+
* it sees what THAT transform injects -- `@types/three`'s own `_gl:
|
|
48
|
+
* WebGLRenderingContext` -- and not only what the program's own source
|
|
49
|
+
* already wrote.
|
|
50
|
+
*
|
|
51
|
+
* Whole-comment, word-boundary text replacement, the same shape
|
|
52
|
+
* `jsdocNamepathTransform` uses for the identical reason: this compiler does
|
|
53
|
+
* not parse a JSDoc type expression into a tree before rewriting it, so
|
|
54
|
+
* scoping the replacement to "inside a `/**\/` range" is what keeps it out of
|
|
55
|
+
* ordinary code and prose comments, and a plain `\b` match is exact for a
|
|
56
|
+
* name that is a single, unqualified identifier -- which every ambient
|
|
57
|
+
* protocol name in `lib.dom.d.ts` is.
|
|
58
|
+
*/
|
|
59
|
+
export declare const createAmbientTypeRealizationTransform: (realizations: ReadonlyMap<string, AmbientTypeRealization>) => ((input: {
|
|
60
|
+
readonly fileName: string;
|
|
61
|
+
readonly text: string;
|
|
62
|
+
}) => string | null);
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { documentationRangesIn } from './documentation-ranges.js';
|
|
3
|
+
const scriptKindOf = (fileName) => fileName.endsWith('.tsx')
|
|
4
|
+
? ts.ScriptKind.TSX
|
|
5
|
+
: fileName.endsWith('.jsx')
|
|
6
|
+
? ts.ScriptKind.JSX
|
|
7
|
+
: fileName.endsWith('.js') || fileName.endsWith('.mjs') || fileName.endsWith('.cjs')
|
|
8
|
+
? ts.ScriptKind.JS
|
|
9
|
+
: ts.ScriptKind.TS;
|
|
10
|
+
/**
|
|
11
|
+
* Locally declared names cannot be assumed to denote a host ambient type.
|
|
12
|
+
* Without a checker in this source transform, conservatively exclude a name
|
|
13
|
+
* shadowed in any scope. Include type declarations and destructured bindings.
|
|
14
|
+
*/
|
|
15
|
+
const boundNamesIn = (file) => {
|
|
16
|
+
const bound = new Set();
|
|
17
|
+
const binding = (name) => {
|
|
18
|
+
if (ts.isIdentifier(name))
|
|
19
|
+
bound.add(name.text);
|
|
20
|
+
else
|
|
21
|
+
for (const element of name.elements)
|
|
22
|
+
if (ts.isBindingElement(element))
|
|
23
|
+
binding(element.name);
|
|
24
|
+
};
|
|
25
|
+
const visit = (node) => {
|
|
26
|
+
if (ts.isVariableDeclaration(node) || ts.isParameter(node))
|
|
27
|
+
binding(node.name);
|
|
28
|
+
else if (ts.isClassDeclaration(node) ||
|
|
29
|
+
ts.isClassExpression(node) ||
|
|
30
|
+
ts.isFunctionDeclaration(node) ||
|
|
31
|
+
ts.isFunctionExpression(node) ||
|
|
32
|
+
ts.isInterfaceDeclaration(node) ||
|
|
33
|
+
ts.isTypeAliasDeclaration(node) ||
|
|
34
|
+
ts.isTypeParameterDeclaration(node) ||
|
|
35
|
+
ts.isImportSpecifier(node) ||
|
|
36
|
+
ts.isImportClause(node) ||
|
|
37
|
+
ts.isNamespaceImport(node) ||
|
|
38
|
+
ts.isImportEqualsDeclaration(node) ||
|
|
39
|
+
ts.isEnumDeclaration(node) ||
|
|
40
|
+
ts.isModuleDeclaration(node)) {
|
|
41
|
+
if (node.name && ts.isIdentifier(node.name))
|
|
42
|
+
bound.add(node.name.text);
|
|
43
|
+
}
|
|
44
|
+
ts.forEachChild(node, visit);
|
|
45
|
+
};
|
|
46
|
+
visit(file);
|
|
47
|
+
return bound;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Respell JSDoc and TypeScript type references to a host's concrete type.
|
|
51
|
+
* Value references remain untouched: an interface realization does not imply
|
|
52
|
+
* that a browser constructor exists on the native host.
|
|
53
|
+
*
|
|
54
|
+
* Built from `realizations` -- the union of every installed plugin's own
|
|
55
|
+
* `PluginCapabilities.ambientTypeRealizations` -- rather than reading any
|
|
56
|
+
* name here: an empty map (no plugin states one) costs one size check and
|
|
57
|
+
* changes nothing, exactly as `jsdocNamepathTransform` costs one substring
|
|
58
|
+
* test on a file with no `~`.
|
|
59
|
+
*
|
|
60
|
+
* Runs after `declarationOverlayTransform` in `compiler.ts`'s own pipeline so
|
|
61
|
+
* it sees what THAT transform injects -- `@types/three`'s own `_gl:
|
|
62
|
+
* WebGLRenderingContext` -- and not only what the program's own source
|
|
63
|
+
* already wrote.
|
|
64
|
+
*
|
|
65
|
+
* Whole-comment, word-boundary text replacement, the same shape
|
|
66
|
+
* `jsdocNamepathTransform` uses for the identical reason: this compiler does
|
|
67
|
+
* not parse a JSDoc type expression into a tree before rewriting it, so
|
|
68
|
+
* scoping the replacement to "inside a `/**\/` range" is what keeps it out of
|
|
69
|
+
* ordinary code and prose comments, and a plain `\b` match is exact for a
|
|
70
|
+
* name that is a single, unqualified identifier -- which every ambient
|
|
71
|
+
* protocol name in `lib.dom.d.ts` is.
|
|
72
|
+
*/
|
|
73
|
+
export const createAmbientTypeRealizationTransform = (realizations) => {
|
|
74
|
+
if (realizations.size === 0)
|
|
75
|
+
return () => null;
|
|
76
|
+
const patterns = [...realizations].map(([name, realization]) => ({
|
|
77
|
+
name,
|
|
78
|
+
realization,
|
|
79
|
+
pattern: new RegExp(`\\b${name}\\b`, 'g')
|
|
80
|
+
}));
|
|
81
|
+
return (input) => {
|
|
82
|
+
if (input.fileName.endsWith('.d.ts'))
|
|
83
|
+
return null;
|
|
84
|
+
let mentioned = false;
|
|
85
|
+
for (const { name } of patterns) {
|
|
86
|
+
if (input.text.includes(name)) {
|
|
87
|
+
mentioned = true;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (!mentioned)
|
|
92
|
+
return null;
|
|
93
|
+
const file = ts.createSourceFile(input.fileName, input.text, ts.ScriptTarget.Latest, true, scriptKindOf(input.fileName));
|
|
94
|
+
const ranges = documentationRangesIn(file, input.text);
|
|
95
|
+
const bound = boundNamesIn(file);
|
|
96
|
+
const usable = patterns
|
|
97
|
+
.filter(({ name }) => !bound.has(name))
|
|
98
|
+
.map((entry) => {
|
|
99
|
+
// Reuse an existing import of the same exported native type. Otherwise
|
|
100
|
+
// alias a collision instead of silently leaving a browser layout behind.
|
|
101
|
+
for (const statement of file.statements) {
|
|
102
|
+
if (!ts.isImportDeclaration(statement) ||
|
|
103
|
+
!ts.isStringLiteral(statement.moduleSpecifier) ||
|
|
104
|
+
statement.moduleSpecifier.text !== entry.realization.importedFrom)
|
|
105
|
+
continue;
|
|
106
|
+
const bindings = statement.importClause?.namedBindings;
|
|
107
|
+
if (!bindings || !ts.isNamedImports(bindings))
|
|
108
|
+
continue;
|
|
109
|
+
const existing = bindings.elements.find((element) => (element.propertyName ?? element.name).text === entry.realization.type);
|
|
110
|
+
if (existing)
|
|
111
|
+
return { ...entry, local: existing.name.text, imported: true };
|
|
112
|
+
}
|
|
113
|
+
let local = entry.realization.type;
|
|
114
|
+
for (let suffix = 0; bound.has(local); suffix++)
|
|
115
|
+
local = `__gea_ambient_${entry.name}_${suffix}`;
|
|
116
|
+
return { ...entry, local, imported: false };
|
|
117
|
+
});
|
|
118
|
+
if (usable.length === 0)
|
|
119
|
+
return null;
|
|
120
|
+
const needed = new Map();
|
|
121
|
+
const use = (entry) => {
|
|
122
|
+
if (!entry.imported)
|
|
123
|
+
needed.set(entry.local, { exported: entry.realization.type, specifier: entry.realization.importedFrom });
|
|
124
|
+
return entry.local;
|
|
125
|
+
};
|
|
126
|
+
const edits = [];
|
|
127
|
+
for (const range of ranges) {
|
|
128
|
+
const comment = input.text.slice(range.pos, range.end);
|
|
129
|
+
let respelled = comment;
|
|
130
|
+
for (const entry of usable) {
|
|
131
|
+
const { pattern } = entry;
|
|
132
|
+
pattern.lastIndex = 0;
|
|
133
|
+
if (!pattern.test(respelled))
|
|
134
|
+
continue;
|
|
135
|
+
pattern.lastIndex = 0;
|
|
136
|
+
respelled = respelled.replace(pattern, use(entry));
|
|
137
|
+
}
|
|
138
|
+
if (respelled === comment)
|
|
139
|
+
continue;
|
|
140
|
+
edits.push({ pos: range.pos, end: range.end, text: respelled });
|
|
141
|
+
}
|
|
142
|
+
const visit = (node) => {
|
|
143
|
+
if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName)) {
|
|
144
|
+
const entry = usable.find((candidate) => candidate.name === node.typeName.getText(file));
|
|
145
|
+
if (entry)
|
|
146
|
+
edits.push({ pos: node.typeName.getStart(file), end: node.typeName.end, text: use(entry) });
|
|
147
|
+
}
|
|
148
|
+
ts.forEachChild(node, visit);
|
|
149
|
+
};
|
|
150
|
+
visit(file);
|
|
151
|
+
if (edits.length === 0)
|
|
152
|
+
return null;
|
|
153
|
+
let rewritten = input.text;
|
|
154
|
+
for (const edit of edits.sort((left, right) => right.pos - left.pos)) {
|
|
155
|
+
rewritten = rewritten.slice(0, edit.pos) + edit.text + rewritten.slice(edit.end);
|
|
156
|
+
}
|
|
157
|
+
const javascript = scriptKindOf(input.fileName) === ts.ScriptKind.JS || scriptKindOf(input.fileName) === ts.ScriptKind.JSX;
|
|
158
|
+
const header = [...needed]
|
|
159
|
+
.map(([local, { exported, specifier }]) => {
|
|
160
|
+
const binding = local === exported ? exported : `${exported} as ${local}`;
|
|
161
|
+
return javascript
|
|
162
|
+
? `/** @import { ${binding} } from ${JSON.stringify(specifier)} */`
|
|
163
|
+
: `import type { ${binding} } from ${JSON.stringify(specifier)};`;
|
|
164
|
+
})
|
|
165
|
+
.join('\n');
|
|
166
|
+
return header ? `${header}\n${rewritten}` : rewritten;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* The one-declaration half of the same fact.
|
|
4
|
+
*
|
|
5
|
+
* `isAmbientSymbol` asks it of every declaration a symbol has; a caller
|
|
6
|
+
* holding a single `ts.Declaration` -- resolving which copy of a generic a
|
|
7
|
+
* name means, say -- asks it of that one. Both go through this so the three
|
|
8
|
+
* spellings of "ambient" below are stated once: a fourth caller deriving its
|
|
9
|
+
* own is the drift this file exists to prevent.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isAmbientDeclaration: (declaration: ts.Declaration) => boolean;
|
|
12
|
+
export declare const isAmbientSymbol: (symbol: ts.Symbol) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Every declared base of a class or interface type, nearest first.
|
|
15
|
+
*
|
|
16
|
+
* A class can be recognized by what it derives from, and the base that
|
|
17
|
+
* identifies it may be reached through an intermediate the program wrote
|
|
18
|
+
* (`class View extends Base`, then `class Home extends View`). Stopping at the
|
|
19
|
+
* immediate base would admit the first spelling and refuse the second for no
|
|
20
|
+
* reason the program could act on, so the whole chain is walked -- and a type
|
|
21
|
+
* visited twice is not revisited, because a declaration file is free to
|
|
22
|
+
* declare a cycle this walk must still terminate on.
|
|
23
|
+
*/
|
|
24
|
+
export declare const declaredBaseTypesOf: (checker: ts.TypeChecker, type: ts.Type) => readonly ts.Type[];
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* Declared, never defined: what a host owns.
|
|
4
|
+
*
|
|
5
|
+
* A declaration file states that something exists; it never brings it into
|
|
6
|
+
* being. That is the language's own notion, the same one `declare` spells
|
|
7
|
+
* inside an ordinary file, and it is what separates a value the program owns
|
|
8
|
+
* from one a host supplies. A symbol with even one non-ambient declaration is
|
|
9
|
+
* defined by this program somewhere and is not a host's.
|
|
10
|
+
*
|
|
11
|
+
* This lives on its own rather than beside its callers because what they
|
|
12
|
+
* decide with it is something a program cannot recover from being wrong about
|
|
13
|
+
* -- placing a binding as an external cell, admitting a class into a library's
|
|
14
|
+
* protocol -- and two spellings of "ambient" that drifted apart would disagree
|
|
15
|
+
* silently on exactly the declarations that matter.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Whether an enclosing block put this declaration in an ambient context.
|
|
19
|
+
*
|
|
20
|
+
* `getCombinedModifierFlags` answers only for the declaration itself (and, for
|
|
21
|
+
* a variable, its own statement). It walks out of neither `declare global { }`
|
|
22
|
+
* nor `declare module 'x' { }`, whose `declare` sits on the block -- so a
|
|
23
|
+
* function declared inside one carries no ambient modifier of its own and
|
|
24
|
+
* reads as a definition this program owns.
|
|
25
|
+
*
|
|
26
|
+
* The parser does record it, as an internal `NodeFlags.Ambient` bit the public
|
|
27
|
+
* typings do not expose; deriving the same fact from the ancestor chain asks
|
|
28
|
+
* the same question through the API that is actually documented.
|
|
29
|
+
*/
|
|
30
|
+
const isInsideAmbientBlock = (declaration) => {
|
|
31
|
+
for (let node = declaration.parent; node !== undefined; node = node.parent) {
|
|
32
|
+
if ((ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Ambient) !== 0)
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The one-declaration half of the same fact.
|
|
39
|
+
*
|
|
40
|
+
* `isAmbientSymbol` asks it of every declaration a symbol has; a caller
|
|
41
|
+
* holding a single `ts.Declaration` -- resolving which copy of a generic a
|
|
42
|
+
* name means, say -- asks it of that one. Both go through this so the three
|
|
43
|
+
* spellings of "ambient" below are stated once: a fourth caller deriving its
|
|
44
|
+
* own is the drift this file exists to prevent.
|
|
45
|
+
*/
|
|
46
|
+
export const isAmbientDeclaration = (declaration) => declaration.getSourceFile().isDeclarationFile ||
|
|
47
|
+
(ts.getCombinedModifierFlags(declaration) & ts.ModifierFlags.Ambient) !== 0 ||
|
|
48
|
+
// The third spelling, and the one the other two miss.
|
|
49
|
+
//
|
|
50
|
+
// `declare global { function requestAnimationFrame(...): number }` in an
|
|
51
|
+
// ordinary `.ts` file puts no `declare` modifier on the *function*: the
|
|
52
|
+
// modifier is on the block, and `getCombinedModifierFlags` walks up only
|
|
53
|
+
// from a variable declaration to its statement, not out of an ambient
|
|
54
|
+
// module body. What the parser does instead is mark every node inside a
|
|
55
|
+
// `declare` context with `NodeFlags.Ambient`, which is the language's own
|
|
56
|
+
// answer to this exact question and is what the checker itself consults.
|
|
57
|
+
//
|
|
58
|
+
// Missing it made a host function look like one this program defines:
|
|
59
|
+
// `canvas-3d` declares `requestAnimationFrame` that way, and the symbol
|
|
60
|
+
// -- ambient in `lib`'s own `.d.ts` and ambient again here -- was judged
|
|
61
|
+
// non-ambient on the strength of the second declaration. It then
|
|
62
|
+
// allocated a function object with no body behind it, whose ABI declared
|
|
63
|
+
// one parameter nothing could bind, and the whole program was refused.
|
|
64
|
+
isInsideAmbientBlock(declaration);
|
|
65
|
+
export const isAmbientSymbol = (symbol) => {
|
|
66
|
+
const declarations = symbol.declarations;
|
|
67
|
+
if (!declarations || declarations.length === 0)
|
|
68
|
+
return false;
|
|
69
|
+
return declarations.every(isAmbientDeclaration);
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Every declared base of a class or interface type, nearest first.
|
|
73
|
+
*
|
|
74
|
+
* A class can be recognized by what it derives from, and the base that
|
|
75
|
+
* identifies it may be reached through an intermediate the program wrote
|
|
76
|
+
* (`class View extends Base`, then `class Home extends View`). Stopping at the
|
|
77
|
+
* immediate base would admit the first spelling and refuse the second for no
|
|
78
|
+
* reason the program could act on, so the whole chain is walked -- and a type
|
|
79
|
+
* visited twice is not revisited, because a declaration file is free to
|
|
80
|
+
* declare a cycle this walk must still terminate on.
|
|
81
|
+
*/
|
|
82
|
+
export const declaredBaseTypesOf = (checker, type) => {
|
|
83
|
+
const found = [];
|
|
84
|
+
const seen = new Set();
|
|
85
|
+
/**
|
|
86
|
+
* The declaration-shaped type whose bases the checker will answer for.
|
|
87
|
+
*
|
|
88
|
+
* `getBaseTypes` answers only for the `ClassOrInterface` a declaration
|
|
89
|
+
* produced. A *generic* class reached through an instantiation is not that:
|
|
90
|
+
* `ReactiveComponent<unknown>` is a `Reference`, and its `target` is the
|
|
91
|
+
* declaration-shaped type that actually states `extends Component<...>`.
|
|
92
|
+
* Without this step the walk asked a reference for its bases, got none, and
|
|
93
|
+
* stopped -- reporting a class that plainly extends something as having no
|
|
94
|
+
* bases at all, at the first generic link in the chain.
|
|
95
|
+
*/
|
|
96
|
+
const declarationShapeOf = (current) => {
|
|
97
|
+
if (current.isClassOrInterface())
|
|
98
|
+
return current;
|
|
99
|
+
if ((current.flags & ts.TypeFlags.Object) === 0)
|
|
100
|
+
return null;
|
|
101
|
+
if ((current.objectFlags & ts.ObjectFlags.Reference) === 0)
|
|
102
|
+
return null;
|
|
103
|
+
const target = current.target;
|
|
104
|
+
return target !== current && target.isClassOrInterface() ? target : null;
|
|
105
|
+
};
|
|
106
|
+
const visit = (current) => {
|
|
107
|
+
if (seen.has(current))
|
|
108
|
+
return;
|
|
109
|
+
seen.add(current);
|
|
110
|
+
const declared = declarationShapeOf(current);
|
|
111
|
+
const bases = declared ? checker.getBaseTypes(declared) : [];
|
|
112
|
+
for (const base of bases) {
|
|
113
|
+
found.push(base);
|
|
114
|
+
visit(base);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
visit(type);
|
|
118
|
+
return found;
|
|
119
|
+
};
|