@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,59 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { StructuralTypeId } from '../../../identity/ids.js';
|
|
3
|
+
import type { ProducerContext } from '../producer-context.js';
|
|
4
|
+
/** Which iteration a caller is following -- `for`-`of` and spread are `sync`, `for await` is `async`. */
|
|
5
|
+
export type IterationProtocol = 'sync' | 'async';
|
|
6
|
+
/**
|
|
7
|
+
* The `[Symbol.iterator]` member a source's own type declares, or `null` when
|
|
8
|
+
* it declares none (on `source` itself, or -- see `iterableConstituentsOf` --
|
|
9
|
+
* on any of its non-nullish union arms) -- the same lookup
|
|
10
|
+
* `iteratorYieldStructuralType` below performs to type what iterating
|
|
11
|
+
* `source` yields, exported so `producers/protocol.ts` can resolve the SAME
|
|
12
|
+
* member's property-key text for the general protocol's `get-method` step.
|
|
13
|
+
* One lookup, cited by both, so the step that types the element and the step
|
|
14
|
+
* that names the member to call can never disagree about which member either
|
|
15
|
+
* one means, OR about whether a member exists at all: both go through
|
|
16
|
+
* `iteratorMethodSymbolsOf`'s same all-or-nothing union rule. A well-known
|
|
17
|
+
* symbol's key text is the same regardless of which constituent declares it
|
|
18
|
+
* (`Symbol.iterator` names one property, not one per class), so the first
|
|
19
|
+
* found is as good a representative as any for that purpose.
|
|
20
|
+
*/
|
|
21
|
+
export declare const iteratorMethodSymbolOf: (source: ts.Type, protocol?: IterationProtocol) => ts.Symbol | null;
|
|
22
|
+
/**
|
|
23
|
+
* The iterator objects `source`'s own `[Symbol.iterator]`(s) return when
|
|
24
|
+
* called -- the RECORD ECMA-262 7.4.2 `GetIterator` hands back, before
|
|
25
|
+
* anything downstream asks what iterating it yields. `null` under the same
|
|
26
|
+
* all-or-nothing rule `iteratorMethodSymbolsOf` states: a source where only
|
|
27
|
+
* some union arms are iterable names no single answer.
|
|
28
|
+
*
|
|
29
|
+
* Exported so `producers/protocol.ts` can ask what real structural type a
|
|
30
|
+
* resolved `[Symbol.iterator]` method actually returns -- the same lookup
|
|
31
|
+
* `iteratorYieldStructuralType` below performs on its way to an ELEMENT type,
|
|
32
|
+
* factored out here rather than left for `protocol.ts` to re-walk
|
|
33
|
+
* independently: the step that types what a `for`-`of` yields and the step
|
|
34
|
+
* that types what calling `[Symbol.iterator]()` itself produces must resolve
|
|
35
|
+
* to the same method, or a generator-returning `[Symbol.iterator]()` and the
|
|
36
|
+
* element type computed for it could name two different generators.
|
|
37
|
+
*/
|
|
38
|
+
export declare const iteratorRecordTypesOf: (context: ProducerContext, source: ts.Type, at: ts.Node, protocol?: IterationProtocol) => readonly ts.Type[] | null;
|
|
39
|
+
/**
|
|
40
|
+
* The structural type an iteration over `source` yields, or `null` when the
|
|
41
|
+
* source declares no iterator protocol this can follow.
|
|
42
|
+
*
|
|
43
|
+
* `at` is the iterated expression itself: `getTypeOfSymbolAtLocation` resolves
|
|
44
|
+
* a member's type in a scope, and the scope that matters is the one the
|
|
45
|
+
* iteration is written in.
|
|
46
|
+
*
|
|
47
|
+
* The union at the end is built by interning each arm and asking the structural
|
|
48
|
+
* table for their union, rather than by asking the checker to union the
|
|
49
|
+
* `ts.Type`s -- there is no public API for the latter, and the table's own
|
|
50
|
+
* union is the same answer every other multi-arm producer in this layer builds.
|
|
51
|
+
*
|
|
52
|
+
* `iteratorYieldTypesOf` is the checker-level walk underneath it, exported
|
|
53
|
+
* for the local census (`local-bindings.ts`), which types a pattern's read
|
|
54
|
+
* of a non-array iterable (`var [a, b] = g()`) with no `ProducerContext` in
|
|
55
|
+
* hand: the same five steps, answered as `ts.Type`s, so the census and the
|
|
56
|
+
* producer can never disagree about what one source yields.
|
|
57
|
+
*/
|
|
58
|
+
export declare const iteratorYieldTypesOf: (checker: ts.TypeChecker, source: ts.Type, at: ts.Node, protocol?: IterationProtocol) => readonly ts.Type[] | null;
|
|
59
|
+
export declare const iteratorYieldStructuralType: (context: ProducerContext, source: ts.Type, at: ts.Node, protocol?: IterationProtocol) => StructuralTypeId | null;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { physicalGeneratorOverloadReturnOf } from '../physical-overload-result.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a member is `[Symbol.iterator]` / `[Symbol.asyncIterator]`.
|
|
5
|
+
*
|
|
6
|
+
* The escaped name of a well-known-symbol member is `"__@" + name` optionally
|
|
7
|
+
* followed by `"@" + the symbol's own declaration id` -- `__@iterator@11` on
|
|
8
|
+
* the TypeScript this compiler builds against, bare `__@iterator` on older
|
|
9
|
+
* ones. Both spellings are accepted rather than one, because the id half is a
|
|
10
|
+
* per-program number with no meaning here and pinning it would silently stop
|
|
11
|
+
* matching on a library upgrade. The two names never collide with each other:
|
|
12
|
+
* the prefix tested includes the separator, so `__@asyncIterator@11` is not a
|
|
13
|
+
* `__@iterator@...`.
|
|
14
|
+
*/
|
|
15
|
+
const isIterationMember = (symbol, wellKnown) => {
|
|
16
|
+
const name = String(symbol.escapedName);
|
|
17
|
+
return name === `__@${wellKnown}` || name.startsWith(`__@${wellKnown}@`);
|
|
18
|
+
};
|
|
19
|
+
/** Every constituent of a union, or the type itself when it is not one. */
|
|
20
|
+
const constituentsOf = (type) => (type.isUnion() ? type.types : [type]);
|
|
21
|
+
/**
|
|
22
|
+
* `source`'s own constituents with `undefined`/`null` dropped, or every
|
|
23
|
+
* constituent when `source` is entirely nullish.
|
|
24
|
+
*
|
|
25
|
+
* `ts.Type#getProperties()` on a UNION answers with the properties held in
|
|
26
|
+
* COMMON across every constituent -- documented `ts.Type` behavior, not a gap
|
|
27
|
+
* this file introduces. `undefined` and `null` carry no properties at all, so
|
|
28
|
+
* that intersection is EMPTY for any `T | undefined`, and `[Symbol.iterator]`
|
|
29
|
+
* disappears even though `T` alone declares one. A `for`-`of` never actually
|
|
30
|
+
* steps the `undefined` arm (stepping it throws before this compiler runs at
|
|
31
|
+
* all -- the same runtime fact this file's own module comment already reasons
|
|
32
|
+
* from for the RETURN arm of `IteratorResult`), so the protocol query below is
|
|
33
|
+
* answered from the arms that can genuinely be iterated.
|
|
34
|
+
*/
|
|
35
|
+
const iterableConstituentsOf = (source) => {
|
|
36
|
+
const nonNullish = constituentsOf(source).filter((constituent) => (constituent.flags & (ts.TypeFlags.Undefined | ts.TypeFlags.Null)) === 0);
|
|
37
|
+
return nonNullish.length > 0 ? nonNullish : constituentsOf(source);
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Every iterable constituent's OWN `[Symbol.iterator]` member, or `null` when
|
|
41
|
+
* any one of them declares none.
|
|
42
|
+
*
|
|
43
|
+
* All-or-nothing, deliberately: a source where only SOME arms are iterable is
|
|
44
|
+
* a real disagreement (this value is not unconditionally iterable), the same
|
|
45
|
+
* refusal a single non-iterable type already produced before unions were
|
|
46
|
+
* considered at all here -- never a guess at which arm the program meant.
|
|
47
|
+
*/
|
|
48
|
+
const iteratorMethodSymbolsOf = (source, protocol) => {
|
|
49
|
+
const methods = [];
|
|
50
|
+
for (const constituent of iterableConstituentsOf(source)) {
|
|
51
|
+
const properties = constituent.getProperties();
|
|
52
|
+
// `async` looks for `[Symbol.asyncIterator]` first and accepts a plain
|
|
53
|
+
// `[Symbol.iterator]` after it -- ECMA-262 14.7.5.7's own order, where a
|
|
54
|
+
// sync iterable reached by `for await` is wrapped rather than rejected.
|
|
55
|
+
// `sync` never accepts the async one: `for`-`of` over an async iterable is
|
|
56
|
+
// a TypeScript error, not something to paper over here.
|
|
57
|
+
const method = protocol === 'async'
|
|
58
|
+
? (properties.find((property) => isIterationMember(property, 'asyncIterator')) ??
|
|
59
|
+
properties.find((property) => isIterationMember(property, 'iterator')))
|
|
60
|
+
: properties.find((property) => isIterationMember(property, 'iterator'));
|
|
61
|
+
if (!method)
|
|
62
|
+
return null;
|
|
63
|
+
methods.push(method);
|
|
64
|
+
}
|
|
65
|
+
return methods;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The `[Symbol.iterator]` member a source's own type declares, or `null` when
|
|
69
|
+
* it declares none (on `source` itself, or -- see `iterableConstituentsOf` --
|
|
70
|
+
* on any of its non-nullish union arms) -- the same lookup
|
|
71
|
+
* `iteratorYieldStructuralType` below performs to type what iterating
|
|
72
|
+
* `source` yields, exported so `producers/protocol.ts` can resolve the SAME
|
|
73
|
+
* member's property-key text for the general protocol's `get-method` step.
|
|
74
|
+
* One lookup, cited by both, so the step that types the element and the step
|
|
75
|
+
* that names the member to call can never disagree about which member either
|
|
76
|
+
* one means, OR about whether a member exists at all: both go through
|
|
77
|
+
* `iteratorMethodSymbolsOf`'s same all-or-nothing union rule. A well-known
|
|
78
|
+
* symbol's key text is the same regardless of which constituent declares it
|
|
79
|
+
* (`Symbol.iterator` names one property, not one per class), so the first
|
|
80
|
+
* found is as good a representative as any for that purpose.
|
|
81
|
+
*/
|
|
82
|
+
export const iteratorMethodSymbolOf = (source, protocol = 'sync') => iteratorMethodSymbolsOf(source, protocol)?.[0] ?? null;
|
|
83
|
+
// STATED, not held: a `ts.Signature`'s own `getReturnType()` on a signature
|
|
84
|
+
// already resolved off a concrete member (`[Symbol.iterator]`/`next`) --
|
|
85
|
+
// there is no node here for a census to have bound evidence to, and no
|
|
86
|
+
// `ts.TypeChecker` call to route through one either.
|
|
87
|
+
/** The return types of every call signature a type carries, across all its constituents. */
|
|
88
|
+
const callResultsOf = (type) => constituentsOf(type).flatMap((constituent) => constituent.getCallSignatures().map((signature) => signature.getReturnType()));
|
|
89
|
+
/**
|
|
90
|
+
* The iterator objects `source`'s own `[Symbol.iterator]`(s) return when
|
|
91
|
+
* called -- the RECORD ECMA-262 7.4.2 `GetIterator` hands back, before
|
|
92
|
+
* anything downstream asks what iterating it yields. `null` under the same
|
|
93
|
+
* all-or-nothing rule `iteratorMethodSymbolsOf` states: a source where only
|
|
94
|
+
* some union arms are iterable names no single answer.
|
|
95
|
+
*
|
|
96
|
+
* Exported so `producers/protocol.ts` can ask what real structural type a
|
|
97
|
+
* resolved `[Symbol.iterator]` method actually returns -- the same lookup
|
|
98
|
+
* `iteratorYieldStructuralType` below performs on its way to an ELEMENT type,
|
|
99
|
+
* factored out here rather than left for `protocol.ts` to re-walk
|
|
100
|
+
* independently: the step that types what a `for`-`of` yields and the step
|
|
101
|
+
* that types what calling `[Symbol.iterator]()` itself produces must resolve
|
|
102
|
+
* to the same method, or a generator-returning `[Symbol.iterator]()` and the
|
|
103
|
+
* element type computed for it could name two different generators.
|
|
104
|
+
*/
|
|
105
|
+
export const iteratorRecordTypesOf = (context, source, at, protocol = 'sync') => {
|
|
106
|
+
const methods = iteratorMethodSymbolsOf(source, protocol);
|
|
107
|
+
if (!methods)
|
|
108
|
+
return null;
|
|
109
|
+
// STATED, not held: `method` is a resolved member symbol on `source`
|
|
110
|
+
// (already the census-corrected receiver -- `producers/protocol.ts`'s own
|
|
111
|
+
// callers of this function read `source` through `context.types.rawTypeAt`),
|
|
112
|
+
// so its own callable type is a structural fact about that receiver's
|
|
113
|
+
// declared shape, not a program binding a census would improve further.
|
|
114
|
+
// Deliberately NOT routed through `context.returns` (the optional return
|
|
115
|
+
// census reachable off `context`): that census answers for a function-like
|
|
116
|
+
// DECLARATION or the call/`new` naming it, and using it here without the
|
|
117
|
+
// same checker-first, census-only-as-fallback reconciliation
|
|
118
|
+
// `producers/invocations.ts` built for its own `returnType` (see that
|
|
119
|
+
// file's `censusReturn`/`siteReturn` comment) risks introducing exactly the
|
|
120
|
+
// "two authorities disagree" class that reconciliation exists to prevent,
|
|
121
|
+
// for a narrow case (a hand-rolled iterator's own return type) with no
|
|
122
|
+
// measured evidence it matters.
|
|
123
|
+
return methods.flatMap((method) => {
|
|
124
|
+
// An OVERLOADED generator member is the one case where the symbol's own
|
|
125
|
+
// callable type cannot answer this: TypeScript shows the bodiless
|
|
126
|
+
// signatures and never the implementation, so
|
|
127
|
+
// `*[Symbol.iterator](): Generator<T>` behind an `(): IterableIterator<T>`
|
|
128
|
+
// overload reads back as the interface -- and `protocol.ts`'s
|
|
129
|
+
// `generatorRecordTypeOf` then publishes the synthetic `{ next() }` record
|
|
130
|
+
// for a method that physically returns the native cursor. See
|
|
131
|
+
// `physicalGeneratorOverloadReturnOf`.
|
|
132
|
+
const physical = physicalGeneratorOverloadReturnOf(context.checker, method.getDeclarations() ?? []);
|
|
133
|
+
return physical ? [physical] : callResultsOf(context.checker.getTypeOfSymbolAtLocation(method, at));
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Whether an `IteratorResult` constituent is the RETURN arm -- the one whose
|
|
138
|
+
* `done` is the literal `true`.
|
|
139
|
+
*
|
|
140
|
+
* Only an exact `true` literal is dropped. A result object that declares `done:
|
|
141
|
+
* boolean` (the hand-written `{ value: T; done: boolean }` shape, which is what
|
|
142
|
+
* a program-defined iterator most often writes) is not discriminated at all, so
|
|
143
|
+
* it is a yield arm as much as a return arm and its `value` is genuinely what
|
|
144
|
+
* the loop sees.
|
|
145
|
+
*
|
|
146
|
+
* `typeToString` decides which of the two boolean literals this is, and that is
|
|
147
|
+
* a legitimate use of it rather than the forbidden one: the ban elsewhere in
|
|
148
|
+
* this layer is on using a display string as type IDENTITY (two unrelated
|
|
149
|
+
* anonymous objects print alike). Here the type is already known to be one of
|
|
150
|
+
* exactly two intrinsics, `true` and `false`, whose renderings are their own
|
|
151
|
+
* intrinsic names -- there is no third value for it to collide with, and no
|
|
152
|
+
* public accessor for that name other than this one.
|
|
153
|
+
*/
|
|
154
|
+
const isIteratorReturnArm = (checker, arm, at) => {
|
|
155
|
+
const done = arm.getProperty('done');
|
|
156
|
+
if (!done)
|
|
157
|
+
return false;
|
|
158
|
+
// STATED: `arm` is one constituent of an already-resolved `IteratorResult`
|
|
159
|
+
// (a call's own return type -- `next()`), and `done`'s own type is a
|
|
160
|
+
// structural fact of that record, not a program binding. No `context` is
|
|
161
|
+
// even threaded to this helper (it takes a bare `checker`), which matches:
|
|
162
|
+
// there is nothing here a producer census answers.
|
|
163
|
+
const doneType = checker.getTypeOfSymbolAtLocation(done, at);
|
|
164
|
+
return (doneType.flags & ts.TypeFlags.BooleanLiteral) !== 0 && checker.typeToString(doneType) === 'true';
|
|
165
|
+
};
|
|
166
|
+
/** The `value` types of every yield arm of one `IteratorResult`. */
|
|
167
|
+
// STATED, same reasoning as `isIteratorReturnArm` just above: `value` is a
|
|
168
|
+
// member of an already-resolved `IteratorResult` arm, not a program binding.
|
|
169
|
+
const yieldValuesOf = (checker, result, at) => constituentsOf(result).flatMap((arm) => {
|
|
170
|
+
if (isIteratorReturnArm(checker, arm, at))
|
|
171
|
+
return [];
|
|
172
|
+
const value = arm.getProperty('value');
|
|
173
|
+
return value ? [checker.getTypeOfSymbolAtLocation(value, at)] : [];
|
|
174
|
+
});
|
|
175
|
+
/**
|
|
176
|
+
* The structural type an iteration over `source` yields, or `null` when the
|
|
177
|
+
* source declares no iterator protocol this can follow.
|
|
178
|
+
*
|
|
179
|
+
* `at` is the iterated expression itself: `getTypeOfSymbolAtLocation` resolves
|
|
180
|
+
* a member's type in a scope, and the scope that matters is the one the
|
|
181
|
+
* iteration is written in.
|
|
182
|
+
*
|
|
183
|
+
* The union at the end is built by interning each arm and asking the structural
|
|
184
|
+
* table for their union, rather than by asking the checker to union the
|
|
185
|
+
* `ts.Type`s -- there is no public API for the latter, and the table's own
|
|
186
|
+
* union is the same answer every other multi-arm producer in this layer builds.
|
|
187
|
+
*
|
|
188
|
+
* `iteratorYieldTypesOf` is the checker-level walk underneath it, exported
|
|
189
|
+
* for the local census (`local-bindings.ts`), which types a pattern's read
|
|
190
|
+
* of a non-array iterable (`var [a, b] = g()`) with no `ProducerContext` in
|
|
191
|
+
* hand: the same five steps, answered as `ts.Type`s, so the census and the
|
|
192
|
+
* producer can never disagree about what one source yields.
|
|
193
|
+
*/
|
|
194
|
+
export const iteratorYieldTypesOf = (checker, source, at, protocol = 'sync') => {
|
|
195
|
+
const methods = iteratorMethodSymbolsOf(source, protocol);
|
|
196
|
+
if (!methods)
|
|
197
|
+
return null;
|
|
198
|
+
const values = [];
|
|
199
|
+
for (const method of methods) {
|
|
200
|
+
for (const iterator of callResultsOf(checker.getTypeOfSymbolAtLocation(method, at))) {
|
|
201
|
+
for (const constituent of constituentsOf(iterator)) {
|
|
202
|
+
const next = constituent.getProperty('next');
|
|
203
|
+
if (!next)
|
|
204
|
+
continue;
|
|
205
|
+
// STATED, same boundary `iteratorRecordTypesOf` above documents: `next`
|
|
206
|
+
// is a resolved member of an already-census-corrected iterator record.
|
|
207
|
+
for (const result of callResultsOf(checker.getTypeOfSymbolAtLocation(next, at))) {
|
|
208
|
+
// An async iterator's `next()` returns `Promise<IteratorResult<T>>`
|
|
209
|
+
// (ECMA-262 27.1.3), so the record to read `value`/`done` off is the
|
|
210
|
+
// AWAITED one. `getAwaitedType` is the checker's own answer to exactly
|
|
211
|
+
// that -- the same one it uses to type an `await` expression -- and it
|
|
212
|
+
// answers the type itself for a non-thenable, which is what makes this
|
|
213
|
+
// safe to apply to the sync fallback arm too.
|
|
214
|
+
const record = protocol === 'async' ? (checker.getAwaitedType(result) ?? result) : result;
|
|
215
|
+
values.push(...yieldValuesOf(checker, record, at));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return values.length === 0 ? null : values;
|
|
221
|
+
};
|
|
222
|
+
export const iteratorYieldStructuralType = (context, source, at, protocol = 'sync') => {
|
|
223
|
+
// Every non-nullish arm's OWN `[Symbol.iterator]` -- not `source`'s
|
|
224
|
+
// (possibly empty, see `iterableConstituentsOf`) -- so a `Set<T> | Map<K,
|
|
225
|
+
// V>`-shaped union still gathers each side's own iterator, exactly as it
|
|
226
|
+
// did before unions with an absent arm were considered here at all.
|
|
227
|
+
const values = iteratorYieldTypesOf(context.checker, source, at, protocol);
|
|
228
|
+
if (!values)
|
|
229
|
+
return null;
|
|
230
|
+
const members = values.map((value) => context.types.typeOf(value));
|
|
231
|
+
const first = members[0];
|
|
232
|
+
if (members.length === 1 && first !== undefined)
|
|
233
|
+
return first;
|
|
234
|
+
return context.table.intern({ kind: 'union', members });
|
|
235
|
+
};
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { normalCompletion } from '../../model/operands.js';
|
|
3
|
+
import { mintOperationId, mintResult, operand } from './mint.js';
|
|
4
|
+
import { resolveExpressionOperand } from './boundary.js';
|
|
5
|
+
import { asBlocked, valueEdgesInto } from './shared.js';
|
|
6
|
+
/**
|
|
7
|
+
* JSX element construction.
|
|
8
|
+
*
|
|
9
|
+
* JSX is a *language* surface -- TSX is checked, and every part of an element
|
|
10
|
+
* is an ordinary expression with an ordinary type -- but what an element
|
|
11
|
+
* evaluates to is decided by the JSX namespace the checked program supplies,
|
|
12
|
+
* not by this compiler. So this producer states only what the language states:
|
|
13
|
+
* which tag, which attributes in which order, which children in which order,
|
|
14
|
+
* and what the checker says the result is. It never assumes a `createElement`,
|
|
15
|
+
* a props object, or a render call, because a program's JSX namespace is free
|
|
16
|
+
* to define none of those.
|
|
17
|
+
*
|
|
18
|
+
* Attributes are operand *pairs* (`prop-key` / `prop-value`) rather than a
|
|
19
|
+
* record allocation. A record would be the right model for a runtime that
|
|
20
|
+
* builds a props object -- `jsx(type, props)` does -- but under `jsx:
|
|
21
|
+
* "preserve"` no such object exists, and minting an allocation for one would
|
|
22
|
+
* publish an object identity the program never creates. The pairing keeps the
|
|
23
|
+
* key next to the value it belongs with, which is the only invariant a
|
|
24
|
+
* consumer needs.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* The props key this program's JSX namespace designates for children.
|
|
28
|
+
*
|
|
29
|
+
* `JSX.ElementChildrenAttribute` exists for exactly this: its single member's
|
|
30
|
+
* *name* is the answer, and its type is ignored by the language and by this.
|
|
31
|
+
* A namespace that declares none, or declares more than one member, designates
|
|
32
|
+
* no key -- and a component element with children then has nowhere to put them,
|
|
33
|
+
* which lowering refuses rather than inventing a name for.
|
|
34
|
+
*/
|
|
35
|
+
const childrenKeyOf = (context, node) => {
|
|
36
|
+
const namespace = context.checker.resolveName('JSX', node, ts.SymbolFlags.Namespace, false);
|
|
37
|
+
const designator = namespace?.exports?.get(ts.escapeLeadingUnderscores('ElementChildrenAttribute'));
|
|
38
|
+
if (!designator)
|
|
39
|
+
return null;
|
|
40
|
+
const members = context.checker.getDeclaredTypeOfSymbol(designator).getProperties();
|
|
41
|
+
const only = members[0];
|
|
42
|
+
return members.length === 1 && only ? only.name : null;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The types the JSX *grammar* states, rather than the ones the checker infers.
|
|
46
|
+
*
|
|
47
|
+
* A tag name, an attribute name, an attribute's string-literal value, and a
|
|
48
|
+
* text child are all strings by the grammar's own definition: `<view id="x">y`
|
|
49
|
+
* indexes `JSX.IntrinsicElements` by the string `"view"`, names the property
|
|
50
|
+
* `"id"`, gives it the string `"x"`, and appends the text `"y"`. None of those
|
|
51
|
+
* four positions is an expression, so `getTypeAtLocation` has no expression to
|
|
52
|
+
* type and answers about something else entirely -- the props type behind a tag
|
|
53
|
+
* name, `any` for a text node. Carrying that answer made a string constant
|
|
54
|
+
* select the boxed carrier and emit as a bare identifier: `v4 = line;` rather
|
|
55
|
+
* than `v4 = "line";`, which reads as a variable nobody declared.
|
|
56
|
+
*
|
|
57
|
+
* Interning the primitive directly is not the compiler overriding the checker.
|
|
58
|
+
* The checker was never asked -- these are grammar productions, not
|
|
59
|
+
* expressions, exactly as a tag's first character (not its spelling) is what
|
|
60
|
+
* the JSX grammar uses to decide intrinsic from component.
|
|
61
|
+
*/
|
|
62
|
+
const grammarStringType = (context) => context.table.intern({ kind: 'primitive', primitive: 'string' });
|
|
63
|
+
/** `<div hidden />` is `hidden={true}`: the grammar supplies the value, and it is a boolean. */
|
|
64
|
+
const grammarBooleanType = (context) => context.table.intern({ kind: 'primitive', primitive: 'boolean' });
|
|
65
|
+
/**
|
|
66
|
+
* A JSX attribute name as a property key.
|
|
67
|
+
*
|
|
68
|
+
* `JsxNamespacedName` (`xlink:href`) keeps its colon: the name *is* the key in
|
|
69
|
+
* the language, and rewriting it here would be this compiler inventing a
|
|
70
|
+
* spelling the program did not use.
|
|
71
|
+
*/
|
|
72
|
+
const attributeKeyOf = (name) => ts.isJsxNamespacedName(name) ? `${name.namespace.text}:${name.name.text}` : name.text;
|
|
73
|
+
/**
|
|
74
|
+
* The tag of an intrinsic element, or `null` when the tag names a value.
|
|
75
|
+
*
|
|
76
|
+
* JSX's own rule decides this and it is a syntactic one the specification
|
|
77
|
+
* states outright: a lowercase-initial identifier with no dots is an intrinsic
|
|
78
|
+
* name, anything else resolves as a value. This is the one place a spelling is
|
|
79
|
+
* authoritative, exactly as it is for a string literal's characters -- the tag
|
|
80
|
+
* is data the language reads, not a name this compiler is matching against a
|
|
81
|
+
* list it knows.
|
|
82
|
+
*/
|
|
83
|
+
const intrinsicTagOf = (tagName) => {
|
|
84
|
+
if (ts.isJsxNamespacedName(tagName))
|
|
85
|
+
return `${tagName.namespace.text}:${tagName.name.text}`;
|
|
86
|
+
if (!ts.isIdentifier(tagName))
|
|
87
|
+
return null;
|
|
88
|
+
const text = tagName.text;
|
|
89
|
+
const first = text.charAt(0);
|
|
90
|
+
return first === first.toLowerCase() && first !== first.toUpperCase() ? text : null;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* The named character references JSX text and attribute values may spell, as
|
|
94
|
+
* `name:codepoint` pairs.
|
|
95
|
+
*
|
|
96
|
+
* `<span>Display & Brightness</span>` is not a span holding the six
|
|
97
|
+
* characters `&`. JSX inherits HTML's character references, and the AST
|
|
98
|
+
* does not resolve them: `ts.JsxText.text` and a JSX attribute's
|
|
99
|
+
* `StringLiteral.text` both hand back the source spelling verbatim, so a
|
|
100
|
+
* producer that reads either one straight out puts the entity itself on screen.
|
|
101
|
+
* Measured, on this exact app: the sidebar rendered `Display & Brightness`
|
|
102
|
+
* and every press that looked for the label it was written to say missed it.
|
|
103
|
+
*
|
|
104
|
+
* This is TypeScript's own table, copied from its JSX transform
|
|
105
|
+
* (`transformers/jsx.ts`'s `entities`) rather than assembled from a spec,
|
|
106
|
+
* because TypeScript's emit is the authority on what a `.tsx` file means: an
|
|
107
|
+
* app compiled by `tsc` and an app compiled here have to render the same
|
|
108
|
+
* characters, and the set of names each accepts is exactly that agreement.
|
|
109
|
+
* It is the XHTML set -- HTML5's several thousand aliases are deliberately not
|
|
110
|
+
* here, for the same reason.
|
|
111
|
+
*/
|
|
112
|
+
const jsxNamedEntityTable = 'quot:34 amp:38 apos:39 lt:60 gt:62 nbsp:160 iexcl:161 cent:162 pound:163 curren:164 yen:165 brvbar:166 sect:167 uml:168 copy:169 ordf:170 laquo:171 not:172 shy:173 reg:174 macr:175 deg:176 plusmn:177 sup2:178 sup3:179 acute:180 micro:181 para:182 ' +
|
|
113
|
+
'middot:183 cedil:184 sup1:185 ordm:186 raquo:187 frac14:188 frac12:189 frac34:190 iquest:191 Agrave:192 Aacute:193 Acirc:194 Atilde:195 Auml:196 Aring:197 AElig:198 Ccedil:199 Egrave:200 Eacute:201 Ecirc:202 Euml:203 Igrave:204 Iacute:205 Icirc:206 ' +
|
|
114
|
+
'Iuml:207 ETH:208 Ntilde:209 Ograve:210 Oacute:211 Ocirc:212 Otilde:213 Ouml:214 times:215 Oslash:216 Ugrave:217 Uacute:218 Ucirc:219 Uuml:220 Yacute:221 THORN:222 szlig:223 agrave:224 aacute:225 acirc:226 atilde:227 auml:228 aring:229 aelig:230 ' +
|
|
115
|
+
'ccedil:231 egrave:232 eacute:233 ecirc:234 euml:235 igrave:236 iacute:237 icirc:238 iuml:239 eth:240 ntilde:241 ograve:242 oacute:243 ocirc:244 otilde:245 ouml:246 divide:247 oslash:248 ugrave:249 uacute:250 ucirc:251 uuml:252 yacute:253 thorn:254 ' +
|
|
116
|
+
'yuml:255 OElig:338 oelig:339 Scaron:352 scaron:353 Yuml:376 fnof:402 circ:710 tilde:732 Alpha:913 Beta:914 Gamma:915 Delta:916 Epsilon:917 Zeta:918 Eta:919 Theta:920 Iota:921 Kappa:922 Lambda:923 Mu:924 Nu:925 Xi:926 Omicron:927 Pi:928 Rho:929 ' +
|
|
117
|
+
'Sigma:931 Tau:932 Upsilon:933 Phi:934 Chi:935 Psi:936 Omega:937 alpha:945 beta:946 gamma:947 delta:948 epsilon:949 zeta:950 eta:951 theta:952 iota:953 kappa:954 lambda:955 mu:956 nu:957 xi:958 omicron:959 pi:960 rho:961 sigmaf:962 sigma:963 tau:964 ' +
|
|
118
|
+
'upsilon:965 phi:966 chi:967 psi:968 omega:969 thetasym:977 upsih:978 piv:982 ensp:8194 emsp:8195 thinsp:8201 zwnj:8204 zwj:8205 lrm:8206 rlm:8207 ndash:8211 mdash:8212 lsquo:8216 rsquo:8217 sbquo:8218 ldquo:8220 rdquo:8221 bdquo:8222 dagger:8224 ' +
|
|
119
|
+
'Dagger:8225 bull:8226 hellip:8230 permil:8240 prime:8242 Prime:8243 lsaquo:8249 rsaquo:8250 oline:8254 frasl:8260 euro:8364 image:8465 weierp:8472 real:8476 trade:8482 alefsym:8501 larr:8592 uarr:8593 rarr:8594 darr:8595 harr:8596 crarr:8629 ' +
|
|
120
|
+
'lArr:8656 uArr:8657 rArr:8658 dArr:8659 hArr:8660 forall:8704 part:8706 exist:8707 empty:8709 nabla:8711 isin:8712 notin:8713 ni:8715 prod:8719 sum:8721 minus:8722 lowast:8727 radic:8730 prop:8733 infin:8734 ang:8736 and:8743 or:8744 cap:8745 ' +
|
|
121
|
+
'cup:8746 int:8747 there4:8756 sim:8764 cong:8773 asymp:8776 ne:8800 equiv:8801 le:8804 ge:8805 sub:8834 sup:8835 nsub:8836 sube:8838 supe:8839 oplus:8853 otimes:8855 perp:8869 sdot:8901 lceil:8968 rceil:8969 lfloor:8970 rfloor:8971 lang:9001 ' +
|
|
122
|
+
'rang:9002 loz:9674 spades:9824 clubs:9827 hearts:9829 diams:9830 ';
|
|
123
|
+
const jsxNamedEntities = new Map(jsxNamedEntityTable
|
|
124
|
+
.split(' ')
|
|
125
|
+
.filter((pair) => pair.length > 0)
|
|
126
|
+
.map((pair) => [pair.slice(0, pair.indexOf(':')), Number(pair.slice(pair.indexOf(':') + 1))]));
|
|
127
|
+
/**
|
|
128
|
+
* One text run with its character references resolved.
|
|
129
|
+
*
|
|
130
|
+
* TypeScript's `decodeEntities`, rule for rule: a decimal reference, a
|
|
131
|
+
* hexadecimal one, or a name from the table above, and anything else is left
|
|
132
|
+
* standing as the literal text the author wrote. Leaving an unknown name alone
|
|
133
|
+
* is what makes this safe to run over every text run in every program -- an
|
|
134
|
+
* `&` that begins no reference, or a name outside the set, comes back
|
|
135
|
+
* unchanged rather than being swallowed.
|
|
136
|
+
*
|
|
137
|
+
* A reference naming a code point outside Unicode's range is left standing too.
|
|
138
|
+
* `String.fromCodePoint` THROWS for one, and a malformed source file must
|
|
139
|
+
* produce a diagnostic or a verbatim copy, never a crash in the producer.
|
|
140
|
+
*/
|
|
141
|
+
const decodeJsxEntities = (text) => text.replace(/&(?:#(\d+)|#[xX]([\da-fA-F]+)|(\w+));/gu, (match, decimal, hex, name) => {
|
|
142
|
+
const code = decimal !== undefined
|
|
143
|
+
? Number.parseInt(decimal, 10)
|
|
144
|
+
: hex !== undefined
|
|
145
|
+
? Number.parseInt(hex, 16)
|
|
146
|
+
: name === undefined
|
|
147
|
+
? undefined
|
|
148
|
+
: jsxNamedEntities.get(name);
|
|
149
|
+
if (code === undefined || !Number.isInteger(code) || code < 0 || code > 0x10ffff)
|
|
150
|
+
return match;
|
|
151
|
+
return String.fromCodePoint(code);
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* The text a `JsxText` child contributes, or `null` when it contributes none.
|
|
155
|
+
*
|
|
156
|
+
* These are the JSX whitespace rules, and they are semantics rather than
|
|
157
|
+
* formatting: a line break plus indentation between two elements is layout and
|
|
158
|
+
* produces no child, while `{a} b {c}`'s interior spaces are real text. Getting
|
|
159
|
+
* this wrong does not fail to compile -- it renders different output.
|
|
160
|
+
*/
|
|
161
|
+
const jsxTextOf = (node) => {
|
|
162
|
+
if (node.containsOnlyTriviaWhiteSpaces)
|
|
163
|
+
return null;
|
|
164
|
+
const lines = node.text.split(/\r\n|\n|\r/u);
|
|
165
|
+
const kept = [];
|
|
166
|
+
for (const [index, line] of lines.entries()) {
|
|
167
|
+
const isFirst = index === 0;
|
|
168
|
+
const isLast = index === lines.length - 1;
|
|
169
|
+
// Only a line break licenses trimming; a space that is not adjacent to one
|
|
170
|
+
// is content, which is why the first and last lines are trimmed on one side
|
|
171
|
+
// each rather than both.
|
|
172
|
+
const trimmed = isFirst ? line.replace(/\s+$/u, '') : isLast ? line.replace(/^\s+/u, '') : line.trim();
|
|
173
|
+
if (lines.length === 1)
|
|
174
|
+
kept.push(line);
|
|
175
|
+
else if (trimmed.length > 0)
|
|
176
|
+
kept.push(trimmed);
|
|
177
|
+
}
|
|
178
|
+
const text = decodeJsxEntities(kept.join(' '));
|
|
179
|
+
return text.length > 0 ? text : null;
|
|
180
|
+
};
|
|
181
|
+
/** Every attribute of an opening element, or a reason the set cannot be stated. */
|
|
182
|
+
const attributesOf = (context, attributes) => {
|
|
183
|
+
const entries = [];
|
|
184
|
+
for (const property of attributes.properties) {
|
|
185
|
+
if (ts.isJsxSpreadAttribute(property)) {
|
|
186
|
+
return {
|
|
187
|
+
kind: 'blocked',
|
|
188
|
+
reason: 'a spread attribute copies an unknown key set into the element, which needs CopyDataProperties over a props object this element has none of'
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const key = attributeKeyOf(property.name);
|
|
192
|
+
const initializer = property.initializer;
|
|
193
|
+
// `<div hidden />` is `hidden={true}`: the language supplies the value, so
|
|
194
|
+
// it is stated as the constant it is rather than left absent, which would
|
|
195
|
+
// read as an attribute with no value at all.
|
|
196
|
+
if (initializer === undefined) {
|
|
197
|
+
entries.push({
|
|
198
|
+
key,
|
|
199
|
+
value: { source: { kind: 'constant', text: 'true', literal: 'boolean' }, type: grammarBooleanType(context) },
|
|
200
|
+
node: property
|
|
201
|
+
});
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (ts.isStringLiteral(initializer)) {
|
|
205
|
+
entries.push({
|
|
206
|
+
key,
|
|
207
|
+
value: {
|
|
208
|
+
source: { kind: 'constant', text: decodeJsxEntities(initializer.text), literal: 'string' },
|
|
209
|
+
type: grammarStringType(context)
|
|
210
|
+
},
|
|
211
|
+
node: property
|
|
212
|
+
});
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
// An attribute value is either a string literal, a braced expression, or --
|
|
216
|
+
// since JSX allows it -- an element written directly. The last two both
|
|
217
|
+
// resolve as expressions; only the braced form can be empty.
|
|
218
|
+
const inner = ts.isJsxExpression(initializer) ? initializer.expression : initializer;
|
|
219
|
+
if (inner === undefined)
|
|
220
|
+
return { kind: 'blocked', reason: `attribute "${key}" has an empty expression container and names no value` };
|
|
221
|
+
const resolved = resolveExpressionOperand(context, inner);
|
|
222
|
+
if (!resolved)
|
|
223
|
+
return { kind: 'blocked', reason: `no normalized operation identifies the value of attribute "${key}"` };
|
|
224
|
+
entries.push({ key, value: resolved, node: property });
|
|
225
|
+
}
|
|
226
|
+
return { kind: 'ok', entries };
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Every child of an element, in evaluation order, or a reason one cannot be
|
|
230
|
+
* stated.
|
|
231
|
+
*
|
|
232
|
+
* `{...kids}` gets NO static fast path, unlike the array-literal and
|
|
233
|
+
* call-argument spreads (`allocations.ts`, `spread-arguments.ts`), and the
|
|
234
|
+
* reason is the checker's own rule rather than a gap here: TypeScript requires
|
|
235
|
+
* a JSX spread child to be an ARRAY type outright (TS2609, "JSX spread child
|
|
236
|
+
* must be an array type" -- measured: a `[string, string]` operand is a type
|
|
237
|
+
* error, not a narrower array). So the one source shape whose iteration IS
|
|
238
|
+
* settled at compile time -- a closed tuple, which the other two sites expand
|
|
239
|
+
* positionally -- cannot legally appear here at all, and the only source that
|
|
240
|
+
* can is the one with a runtime length. An element's children are a fixed
|
|
241
|
+
* operand run (`child` at ordinal 0..n) with no container for a
|
|
242
|
+
* runtime-length range copy to land in, so admitting an array would need the
|
|
243
|
+
* general protocol wired into element children, exactly as the refusal says.
|
|
244
|
+
*/
|
|
245
|
+
const childrenOf = (context, children) => {
|
|
246
|
+
const entries = [];
|
|
247
|
+
for (const child of children) {
|
|
248
|
+
if (ts.isJsxText(child)) {
|
|
249
|
+
const text = jsxTextOf(child);
|
|
250
|
+
if (text !== null)
|
|
251
|
+
entries.push({ source: { kind: 'constant', text, literal: 'string' }, type: grammarStringType(context) });
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (ts.isJsxExpression(child)) {
|
|
255
|
+
// `{}` and `{/* comment */}` are containers the language evaluates
|
|
256
|
+
// nothing for; they are not children, and skipping them is the rule
|
|
257
|
+
// rather than a convenience.
|
|
258
|
+
if (child.expression === undefined)
|
|
259
|
+
continue;
|
|
260
|
+
if (child.dotDotDotToken !== undefined) {
|
|
261
|
+
return {
|
|
262
|
+
kind: 'blocked',
|
|
263
|
+
reason: 'a spread child iterates its operand, which needs the iterator protocol wired into element children'
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
const resolved = resolveExpressionOperand(context, child.expression);
|
|
267
|
+
if (!resolved)
|
|
268
|
+
return { kind: 'blocked', reason: 'no normalized operation identifies the value of an expression child' };
|
|
269
|
+
entries.push(resolved);
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const resolved = resolveExpressionOperand(context, child);
|
|
273
|
+
if (!resolved)
|
|
274
|
+
return { kind: 'blocked', reason: `no normalized operation identifies the value of a ${ts.SyntaxKind[child.kind]} child` };
|
|
275
|
+
entries.push(resolved);
|
|
276
|
+
}
|
|
277
|
+
return { kind: 'ok', entries };
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Constructing an element runs whatever the framework installed for the tag,
|
|
281
|
+
* which this compiler cannot see into. Claiming purity would let a consumer
|
|
282
|
+
* reorder two sibling elements, and sibling order is the whole content of a
|
|
283
|
+
* child list.
|
|
284
|
+
*/
|
|
285
|
+
const elementEffects = { readsMutableState: true, writesMutableState: true, allocates: true, callsUserCode: true };
|
|
286
|
+
export const createElementProducer = (context) => {
|
|
287
|
+
const contribute = (candidate) => {
|
|
288
|
+
const node = candidate.node;
|
|
289
|
+
const isElement = ts.isJsxElement(node);
|
|
290
|
+
const isSelfClosing = ts.isJsxSelfClosingElement(node);
|
|
291
|
+
const isFragment = ts.isJsxFragment(node);
|
|
292
|
+
if (!isElement && !isSelfClosing && !isFragment) {
|
|
293
|
+
return asBlocked(candidate.id, 'element', 'element census produced a syntax kind this producer does not model', null);
|
|
294
|
+
}
|
|
295
|
+
const opening = isElement ? node.openingElement : isSelfClosing ? node : null;
|
|
296
|
+
const attributes = opening ? attributesOf(context, opening.attributes) : { kind: 'ok', entries: [] };
|
|
297
|
+
if (attributes.kind === 'blocked')
|
|
298
|
+
return asBlocked(candidate.id, 'element', attributes.reason, null);
|
|
299
|
+
const childNodes = isElement ? node.children : isFragment ? node.children : [];
|
|
300
|
+
const children = childrenOf(context, childNodes);
|
|
301
|
+
if (children.kind === 'blocked')
|
|
302
|
+
return asBlocked(candidate.id, 'element', children.reason, null);
|
|
303
|
+
const intrinsic = opening ? intrinsicTagOf(opening.tagName) : null;
|
|
304
|
+
const form = isFragment ? 'fragment' : intrinsic !== null ? 'intrinsic' : 'value';
|
|
305
|
+
// An element whose checked type is `any` is not an element this compiler
|
|
306
|
+
// knows anything about: the program's JSX namespace did not resolve, so
|
|
307
|
+
// every attribute went unchecked and the result has no shape to carry.
|
|
308
|
+
// Publishing it anyway would select the boxed carrier for what is really a
|
|
309
|
+
// configuration fault, and a whole application would compile as `any`
|
|
310
|
+
// without one line saying why. Under `jsx: "preserve"` the usual cause is a
|
|
311
|
+
// `jsxImportSource` naming a package whose `jsx-runtime` declares no `JSX`
|
|
312
|
+
// namespace, which suppresses the global one the framework declares.
|
|
313
|
+
const resultType = context.types.typeAt(node);
|
|
314
|
+
const resultShape = context.table.get(resultType).shape;
|
|
315
|
+
if (resultShape.kind === 'primitive' && resultShape.primitive === 'any') {
|
|
316
|
+
return asBlocked(candidate.id, 'element', 'the checker types this element `any`, so no JSX namespace defined it -- with `jsx: "preserve"` that is usually a ' +
|
|
317
|
+
'`jsxImportSource` naming a package that declares no `JSX` namespace, which hides the one the framework declares', null);
|
|
318
|
+
}
|
|
319
|
+
const id = mintOperationId(context.ordinals, candidate.id, 'element');
|
|
320
|
+
const operands = [];
|
|
321
|
+
if (opening) {
|
|
322
|
+
if (intrinsic !== null) {
|
|
323
|
+
operands.push(operand('tag', 0, { kind: 'constant', text: intrinsic, literal: 'string' }, grammarStringType(context)));
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
const tag = resolveExpressionOperand(context, opening.tagName);
|
|
327
|
+
if (!tag)
|
|
328
|
+
return asBlocked(candidate.id, 'element', 'no normalized operation identifies the component this element names', null);
|
|
329
|
+
operands.push(operand('tag', 0, tag.source, tag.type));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
attributes.entries.forEach((attribute, index) => {
|
|
333
|
+
operands.push(operand('prop-key', index, { kind: 'constant', text: attribute.key, literal: 'string' }, grammarStringType(context)));
|
|
334
|
+
const value = attribute.value;
|
|
335
|
+
if (value)
|
|
336
|
+
operands.push(operand('prop-value', index, value.source, value.type));
|
|
337
|
+
else
|
|
338
|
+
operands.push(operand('prop-value', index, { kind: 'absent' }, context.types.typeAt(attribute.node)));
|
|
339
|
+
});
|
|
340
|
+
children.entries.forEach((child, index) => operands.push(operand('child', index, child.source, child.type)));
|
|
341
|
+
const operation = {
|
|
342
|
+
family: 'element',
|
|
343
|
+
id,
|
|
344
|
+
form,
|
|
345
|
+
childrenKey: childrenKeyOf(context, node),
|
|
346
|
+
caller: candidate.caller,
|
|
347
|
+
operands,
|
|
348
|
+
results: [mintResult(id, 'value', resultType)],
|
|
349
|
+
// A component's own body can throw, and an intrinsic's construction can
|
|
350
|
+
// fail on a tag the framework does not install, so neither completes
|
|
351
|
+
// normally by construction.
|
|
352
|
+
completion: normalCompletion,
|
|
353
|
+
effects: elementEffects,
|
|
354
|
+
evaluationOrdinal: candidate.evaluationOrdinal
|
|
355
|
+
};
|
|
356
|
+
const edges = valueEdgesInto(id, operands);
|
|
357
|
+
return { kind: 'operations', operations: [operation], edges };
|
|
358
|
+
};
|
|
359
|
+
return { family: 'element', contribute };
|
|
360
|
+
};
|