@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,917 @@
|
|
|
1
|
+
import { nativePrototypeObjectText } from './native-prototype.js';
|
|
2
|
+
import { abiKey, representationKey } from '../../../representation/model.js';
|
|
3
|
+
import { abiOfCallee } from '../../../projection/callee.js';
|
|
4
|
+
import { runtimeClassLayoutsOf } from '../../../projection/classes.js';
|
|
5
|
+
import { classMethodOverrideOf, classPrototypeMethodMutableOf } from '../../../projection/fields.js';
|
|
6
|
+
import { bindingReference, captureFieldText, cppEnvironmentStructName, cppThunkName, createCppEmitBlockedError, operandText } from '../emit-context.js';
|
|
7
|
+
import { classFamilyOverridesOf, classMemberOf, dispatchesStatically, reachableClassMethodsOf, classStaticFieldStorageOf, classStaticMemberOf } from '../class-layout.js';
|
|
8
|
+
import { cppVirtualMemberName, virtualDispatchKey } from '../virtual-methods.js';
|
|
9
|
+
import { cppAbiParameterType, cppBodyName, cppCallableDeclarationTagName, cppClassName, cppConstructName, cppRecordFieldName, cppRecordFieldPresenceName, cppResultTypeOf, cppStringLiteral, cppTypeOf, cppUndefinedIn } from '../types.js';
|
|
10
|
+
import { alignedValueText, receiverBoundFieldText } from '../emit-narrowing.js';
|
|
11
|
+
import { computedOverriddenMethodValueText } from './computed-method-value.js';
|
|
12
|
+
import { nativePrototypeMethodFallbackText } from './native-prototype.js';
|
|
13
|
+
import { classMethodValueArmsOf, classPrototypeMethodKeysOf, classPrototypeMethodValueArmsOf } from '../../../projection/dispatch.js';
|
|
14
|
+
/**
|
|
15
|
+
* Reading a class's own members as VALUES: an instance's methods and
|
|
16
|
+
* accessors (`classMemberText`), and a class value's own static methods and
|
|
17
|
+
* accessors (`classConstructorStaticMemberText`) -- `emit-properties.ts`'s
|
|
18
|
+
* twin pair for the one receiver kind whose `[[Get]]` needs a class layout to
|
|
19
|
+
* answer at all.
|
|
20
|
+
*
|
|
21
|
+
* Split out of `emit-properties.ts` (2026-09-03) to keep that file under the
|
|
22
|
+
* architecture gate's per-file line cap -- a directory split, not a design
|
|
23
|
+
* change: `emitGet` still dispatches here for a `class-ref`/`constructor-
|
|
24
|
+
* family` receiver exactly as it dispatched to these same two functions when
|
|
25
|
+
* they lived inline.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* The `environment` half of the `CallableObject{invoke, environment}` a method
|
|
29
|
+
* READ produces.
|
|
30
|
+
*
|
|
31
|
+
* `emitAllocateCallable` builds this for a closure literal; a method reached
|
|
32
|
+
* through `[[Get]]` needs the identical thing and used to hard-code `nullptr`
|
|
33
|
+
* for it. That is only correct when the method's body captures nothing. When
|
|
34
|
+
* it does capture -- a class declared inside a function, whose method reads
|
|
35
|
+
* that function's local -- the thunk casts the `void*` it is handed to the
|
|
36
|
+
* body's environment struct and dereferences it unconditionally
|
|
37
|
+
* (`translation-unit.ts` writes that cast), so a `nullptr` there is a null
|
|
38
|
+
* dereference at the first captured read. It was reached, certified clean and
|
|
39
|
+
* segfaulted: `.scratch/probe/capture` compiles, clang accepts it, and
|
|
40
|
+
* `make(41)` dies on `gea_e->c0`. The environment is not optional information
|
|
41
|
+
* this can default; it is the frame the body will read.
|
|
42
|
+
*
|
|
43
|
+
* The fields are read with `bindingReference` in the frame performing the
|
|
44
|
+
* READ, which is the same rule `emitAllocateCallable` uses in the frame
|
|
45
|
+
* performing the allocation -- and it is what makes this fail closed rather
|
|
46
|
+
* than guess: a read from a frame that cannot name the captured cell raises
|
|
47
|
+
* `bindingReference`'s own "a cell owned by another callable frame" refusal
|
|
48
|
+
* instead of producing a pointer to nothing.
|
|
49
|
+
*
|
|
50
|
+
* Two shapes are refused outright rather than rendered, because this returns
|
|
51
|
+
* an EXPRESSION and neither can be expressed without emitting a statement
|
|
52
|
+
* first:
|
|
53
|
+
*
|
|
54
|
+
* - a BOXED slot, whose box `emitAllocateCallable` declares with
|
|
55
|
+
* `ensureBoxedSlotDeclared` ahead of the environment build;
|
|
56
|
+
* - a captured RECEIVER, whose field is this frame's own `gea_this` -- which
|
|
57
|
+
* exists only if the reading frame has a receiver at all, a fact this
|
|
58
|
+
* expression-level path has no way to establish.
|
|
59
|
+
*/
|
|
60
|
+
const methodEnvironmentText = (ctx, callable, what) => {
|
|
61
|
+
const admission = ctx.captures.of(callable);
|
|
62
|
+
if (admission.kind === 'none')
|
|
63
|
+
return 'nullptr';
|
|
64
|
+
if (admission.kind === 'refused') {
|
|
65
|
+
throw createCppEmitBlockedError('capture:refused', `${what} reads a method whose environment cannot be built: ${admission.reason}`);
|
|
66
|
+
}
|
|
67
|
+
if (admission.layout.slots.some((slot) => slot.boxed)) {
|
|
68
|
+
throw createCppEmitBlockedError('capture:boxed', `${what} reads a method that captures a cell shared by aliasing; its box is declared by a statement, and a method read renders as an expression`);
|
|
69
|
+
}
|
|
70
|
+
if (admission.layout.receiver !== null) {
|
|
71
|
+
throw createCppEmitBlockedError('capture:receiver', `${what} reads a method that captures an enclosing frame's receiver; the environment would name this frame's own "this", which a method read cannot prove it has`);
|
|
72
|
+
}
|
|
73
|
+
const fields = admission.layout.slots.map((slot) => {
|
|
74
|
+
const text = bindingReference(ctx, slot.declaration, `a capture of ${callable}`).name;
|
|
75
|
+
return slot.boxed ? text : captureFieldText(ctx, slot.declaration, slot.representation, text);
|
|
76
|
+
});
|
|
77
|
+
// Packed by the same authority the allocation path uses, so a method read
|
|
78
|
+
// and a closure allocation of the same function agree on where the captured
|
|
79
|
+
// state lives; `emitAllocateCallable` states the reasoning.
|
|
80
|
+
return `gea::packEnvironment(${cppEnvironmentStructName(callable)}{${fields.join(', ')}})`;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The representation a materialized instance-method VALUE actually needs --
|
|
84
|
+
* as opposed to `operation.result.representation`, which is what
|
|
85
|
+
* `representation/derive.ts`'s `deriveSignature` publishes for it.
|
|
86
|
+
*
|
|
87
|
+
* `deriveSignature` derives a method's value representation purely from its
|
|
88
|
+
* TS call signature, correctly: a method's declared TYPE never states an
|
|
89
|
+
* implicit receiver parameter, so the `CallableAbi` it builds always has
|
|
90
|
+
* `receiver: null`. But the C++ thunk this value actually points at
|
|
91
|
+
* (`cppThunkName(site.method.callable)`, built by `translation-unit.ts`'s
|
|
92
|
+
* `thunkOf`/`formalsOf`) gives every receiver-bearing body an EXPLICIT
|
|
93
|
+
* leading receiver formal whenever `abi.receiver !== null` -- `cppAbiType`
|
|
94
|
+
* (`types.ts`) documents the identical rule for spelling the type: "the
|
|
95
|
+
* receiver (if any) as the first formal". A materialized value that keeps
|
|
96
|
+
* the TS-derived, receiver-less type disagrees with the thunk it is built
|
|
97
|
+
* from: the declared arity is missing the one argument the thunk requires,
|
|
98
|
+
* and the one argument every caller that reaches it through `.call(receiver)`
|
|
99
|
+
* -- `emit-iterator.ts`'s `emitDynamicGetIterator` is the caller that surfaced
|
|
100
|
+
* this, calling exactly `${method}.call(${receiverText})` on the documented
|
|
101
|
+
* assumption that `classMemberText` built the callable to expect it -- already
|
|
102
|
+
* supplies.
|
|
103
|
+
*
|
|
104
|
+
* This has no effect on the common `obj.method()` case: that never
|
|
105
|
+
* materializes this operation's value as a standalone `CallableObject` at
|
|
106
|
+
* all (`emit-callable.ts`'s direct-call path calls the body by name once it
|
|
107
|
+
* sees `ctx.directCallees`, without ever reading this text). It matters only
|
|
108
|
+
* when a method is read as a first-class value and called separately from
|
|
109
|
+
* where it was read -- rare in application code, but exactly the shape the
|
|
110
|
+
* general iterator protocol mints (`get-method` and `get-iterator` are two
|
|
111
|
+
* separate operations; `producers/protocol.ts`'s `mintIteratorSteps`) and,
|
|
112
|
+
* per the `constructor-family`/`function-value-dispatch` split `cppTypeOf`
|
|
113
|
+
* already documents, exactly as sound for a plain callback reference.
|
|
114
|
+
*
|
|
115
|
+
* A static member (`classConstructorStaticMemberText`, this file's twin) has
|
|
116
|
+
* no receiver and needs no correction -- this helper is only ever called from
|
|
117
|
+
* the instance-member path below.
|
|
118
|
+
*/
|
|
119
|
+
const boundMethodValueRepresentation = (operation) => {
|
|
120
|
+
const representation = operation.result.representation;
|
|
121
|
+
if (representation.kind !== 'function-value-dispatch') {
|
|
122
|
+
throw createCppEmitBlockedError(`physical-cpp-type:${representationKey(representation)}`, `reads a method as a value carried as "${representationKey(representation)}", not "function-value-dispatch"; ` +
|
|
123
|
+
'this backend only knows how to bind a receiver onto that one carrier');
|
|
124
|
+
}
|
|
125
|
+
// Some method-value representations already carry a receiver -- measured on
|
|
126
|
+
// the real app corpus, which regressed (3 programs, `c++` 0/clang `-`)
|
|
127
|
+
// under an earlier version of this fix that threw here instead. Whatever
|
|
128
|
+
// published that receiver already agrees with the real thunk (those
|
|
129
|
+
// programs were clang-clean before this function existed), so this only
|
|
130
|
+
// fills the gap `deriveSignature`'s receiver-less TS-signature derivation
|
|
131
|
+
// leaves; a value that already names one is left exactly as published.
|
|
132
|
+
if (representation.abi.receiver !== null)
|
|
133
|
+
return representation;
|
|
134
|
+
return { ...representation, abi: { ...representation.abi, receiver: operation.receiver.representation } };
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* One prototype method materialised at the callable convention a particular
|
|
138
|
+
* property read publishes.
|
|
139
|
+
*
|
|
140
|
+
* Kept beside `classMemberText` because a constant `object.method` read and a
|
|
141
|
+
* computed `object[key]` read must build the identical function object. The
|
|
142
|
+
* latter merely chooses between several such objects at run time; it does not
|
|
143
|
+
* get a second opinion about thunk ABIs, receiver binding or captured state.
|
|
144
|
+
*/
|
|
145
|
+
export const classMethodValueText = (ctx, operation, key, method,
|
|
146
|
+
// The carrier the read publishes: a bound-method convention for a typed
|
|
147
|
+
// read, or the read's own `dynamic` carrier for a computed key the census
|
|
148
|
+
// could not type (`d[String(k)]()`), which boxes the method with
|
|
149
|
+
// `receivesThis` so the call's `callWithReceiver` hands the instance back.
|
|
150
|
+
valueRepresentation = boundMethodValueRepresentation(operation), receiverText = operandText(ctx, operation.receiver), receiverRepresentation = operation.receiver.representation) => {
|
|
151
|
+
if (!method.callable) {
|
|
152
|
+
throw createCppEmitBlockedError(`property-access:${representationKey(operation.receiver.representation)}:get:false`, `method "${key}" names no body to take a function object of`);
|
|
153
|
+
}
|
|
154
|
+
const environment = methodEnvironmentText(ctx, method.callable, `a "get" of "${key}"`);
|
|
155
|
+
const valueType = cppTypeOf(valueRepresentation);
|
|
156
|
+
const bodyAbi = ctx.abiOfCallable(method.callable);
|
|
157
|
+
if (bodyAbi === null)
|
|
158
|
+
throw createCppEmitBlockedError('call-abi:class-method', `method "${key}" body has no callable convention`);
|
|
159
|
+
const bodyRepresentation = { kind: 'function-value-dispatch', abi: bodyAbi };
|
|
160
|
+
const owner = [...ctx.classes.values()].find((layout) => layout.methods.some((entry) => entry.callable === method.callable && entry.key === key));
|
|
161
|
+
if (owner === undefined)
|
|
162
|
+
throw createCppEmitBlockedError('call-abi:class-method-owner', `method "${key}" has no declaring prototype`);
|
|
163
|
+
const payload = `${cppTypeOf(bodyRepresentation)}{&${cppThunkName(method.callable)}, ${environment}}`;
|
|
164
|
+
const override = receiverRepresentation.kind === 'class-ref' && !dispatchesStatically(ctx, operation.receiver)
|
|
165
|
+
? classMethodOverrideOf(ctx.classes, receiverRepresentation.declaration, key)
|
|
166
|
+
: null;
|
|
167
|
+
const heldReceiver = override === null ? receiverText : 'gea_method_receiver';
|
|
168
|
+
const state = `${heldReceiver}->gea_method_state`;
|
|
169
|
+
const bodyValue = `gea::nativeClassMethodValue<${cppClassName(owner.declaration)}, &${cppCallableDeclarationTagName(method.callable)}>(${state}, ${payload})`;
|
|
170
|
+
const materialized = alignedValueText(ctx, 'class-properties/emit-class-properties.ts:212', bodyRepresentation, valueRepresentation, bodyValue) ??
|
|
171
|
+
// The published value declares no receiver while the body's convention
|
|
172
|
+
// leads with one, so the receiver has to travel WITH the value
|
|
173
|
+
// (`gea_runtime.h`'s `CallableObject::bindReceiver`). This is the arm half
|
|
174
|
+
// of hono's `Router<T>.match`: the interface declares `match` a method and
|
|
175
|
+
// `RegExpRouter` stores a `this`-typed FUNCTION under that name, so the
|
|
176
|
+
// union's read publishes a receiver-less callable that every arm -- the
|
|
177
|
+
// field one and the two genuine methods -- has to be able to produce. A
|
|
178
|
+
// method arm cannot produce it any other way.
|
|
179
|
+
//
|
|
180
|
+
// Reached only where emission refused outright a line below, so nothing
|
|
181
|
+
// that compiles today moves. It is not the detached-method case
|
|
182
|
+
// `receiverBoundCallableText` guards with `readsReceiver`: that one is a
|
|
183
|
+
// value handed on to a slot, where the language would supply no receiver
|
|
184
|
+
// at all. What is NOT proven here is that this value is only ever called
|
|
185
|
+
// as a method -- a program that detaches it (`const f = r.match; f(a, b)`,
|
|
186
|
+
// which TypeScript admits through a method-declared member) would see the
|
|
187
|
+
// read's receiver where the language gives `undefined`. hono writes the
|
|
188
|
+
// two shapes that are exact: the call, and `router.match.bind(router)`.
|
|
189
|
+
receiverBoundFieldText(ctx, bodyRepresentation, valueRepresentation, bodyValue, receiverRepresentation, heldReceiver);
|
|
190
|
+
if (materialized === null) {
|
|
191
|
+
throw createCppEmitBlockedError(`conversion:${representationKey(bodyRepresentation)}->${representationKey(valueRepresentation)}`, `method "${key}" body convention cannot fill its published bound-method convention`);
|
|
192
|
+
}
|
|
193
|
+
const publicAbi = abiOfCallee(valueRepresentation);
|
|
194
|
+
const originalValue = publicAbi !== null && abiKey(publicAbi) !== abiKey(bodyAbi)
|
|
195
|
+
? `gea::nativeClassAdaptedMethodValue<${cppClassName(owner.declaration)}, &${cppCallableDeclarationTagName(method.callable)}, ${valueType}>(${state}, [&]() { return ${materialized}; })`
|
|
196
|
+
: materialized;
|
|
197
|
+
const fallback = nativePrototypeMethodFallbackText(ctx, receiverRepresentation, key, owner, valueRepresentation, heldReceiver, originalValue, dispatchesStatically(ctx, operation.receiver));
|
|
198
|
+
if (override === null)
|
|
199
|
+
return { text: fallback, type: valueType, environment };
|
|
200
|
+
const ownedStorage = `${heldReceiver}->${cppRecordFieldName(key)}`;
|
|
201
|
+
const owned = alignedValueText(ctx, 'class-properties/emit-class-properties.ts:own-method', override.value, valueRepresentation, ownedStorage) ??
|
|
202
|
+
// The own slot carries the METHOD's storage convention -- receiver first,
|
|
203
|
+
// because that is the convention every writer into it was adapted to --
|
|
204
|
+
// while this read publishes a receiver-less callable. Same conversion the
|
|
205
|
+
// prototype half above needs, and for the same reason.
|
|
206
|
+
receiverBoundFieldText(ctx, override.value, valueRepresentation, ownedStorage, receiverRepresentation, heldReceiver);
|
|
207
|
+
if (owned === null) {
|
|
208
|
+
throw createCppEmitBlockedError(`conversion:${representationKey(override.value)}->${representationKey(valueRepresentation)}`, `own method "${key}" storage cannot fill its published method-read convention`);
|
|
209
|
+
}
|
|
210
|
+
// Own function properties shadow the prototype without changing the
|
|
211
|
+
// prototype's identity. Snapshot the receiver once, including detached reads.
|
|
212
|
+
const text = `([&]() -> ${valueType} { const auto& ${heldReceiver} = ${receiverText}; ` +
|
|
213
|
+
`if (${heldReceiver}->${cppRecordFieldPresenceName(key)}) return ${owned}; return ${fallback}; })()`;
|
|
214
|
+
return { text, type: valueType, environment };
|
|
215
|
+
};
|
|
216
|
+
const classDescendsFrom = (classes, declaration, base) => {
|
|
217
|
+
const seen = new Set();
|
|
218
|
+
for (let current = declaration; current !== null && !seen.has(current);) {
|
|
219
|
+
if (current === base)
|
|
220
|
+
return true;
|
|
221
|
+
seen.add(current);
|
|
222
|
+
current = classes.get(current)?.base ?? null;
|
|
223
|
+
}
|
|
224
|
+
return false;
|
|
225
|
+
};
|
|
226
|
+
const dynamicConstructorActualText = (ctx, target, actual, position) => {
|
|
227
|
+
const parameter = actual.parameters[position];
|
|
228
|
+
if (parameter === undefined) {
|
|
229
|
+
throw createCppEmitBlockedError('call-abi:dynamic-constructor', `a dynamic constructor candidate has no parameter at position ${position}`);
|
|
230
|
+
}
|
|
231
|
+
const targetRest = target.restFrom;
|
|
232
|
+
if (targetRest !== null && position >= targetRest) {
|
|
233
|
+
const packed = target.parameters[targetRest];
|
|
234
|
+
if (packed === undefined || packed.value.kind !== 'array-object') {
|
|
235
|
+
throw createCppEmitBlockedError('call-abi:dynamic-constructor', `a dynamic constructor read publishes rest slot ${targetRest} without an array-object carrier`);
|
|
236
|
+
}
|
|
237
|
+
const packedName = `gea_constructor_arg_${targetRest}`;
|
|
238
|
+
const packedIndex = position - targetRest;
|
|
239
|
+
const absent = cppUndefinedIn(packed.value.element);
|
|
240
|
+
if (absent === null) {
|
|
241
|
+
throw createCppEmitBlockedError(`conversion:undefined->${representationKey(packed.value.element)}`, `a dynamic constructor rest array carries "${representationKey(packed.value.element)}", which cannot state an omitted argument`);
|
|
242
|
+
}
|
|
243
|
+
const source = `(${packedName} && ${packedName}->hasElementAtIndex(${packedIndex}) ? ${packedName}->elementAtIndex(${packedIndex}) : ${absent})`;
|
|
244
|
+
const converted = alignedValueText(ctx, 'class-properties/emit-class-properties.ts:259', packed.value.element, parameter.value, source);
|
|
245
|
+
if (converted !== null)
|
|
246
|
+
return converted;
|
|
247
|
+
throw createCppEmitBlockedError(`conversion:${representationKey(packed.value.element)}->${representationKey(parameter.value)}`, `a dynamic constructor rest element carried as "${representationKey(packed.value.element)}" cannot fill candidate parameter ${position} carried as "${representationKey(parameter.value)}"`);
|
|
248
|
+
}
|
|
249
|
+
const source = target.parameters[position];
|
|
250
|
+
if (source !== undefined) {
|
|
251
|
+
const converted = alignedValueText(ctx, 'class-properties/emit-class-properties.ts:268', source.value, parameter.value, `gea_constructor_arg_${position}`);
|
|
252
|
+
if (converted !== null)
|
|
253
|
+
return converted;
|
|
254
|
+
throw createCppEmitBlockedError(`conversion:${representationKey(source.value)}->${representationKey(parameter.value)}`, `dynamic constructor parameter ${position} is carried as "${representationKey(source.value)}", while the selected class expects "${representationKey(parameter.value)}"`);
|
|
255
|
+
}
|
|
256
|
+
const omitted = cppUndefinedIn(parameter.value);
|
|
257
|
+
if (omitted !== null)
|
|
258
|
+
return omitted;
|
|
259
|
+
throw createCppEmitBlockedError(`conversion:undefined->${representationKey(parameter.value)}`, `a dynamic constructor can omit candidate parameter ${position}, whose "${representationKey(parameter.value)}" carrier cannot hold undefined`);
|
|
260
|
+
};
|
|
261
|
+
const dynamicConstructorCandidateText = (ctx, target, declaration, state) => {
|
|
262
|
+
const layout = ctx.classes.get(declaration);
|
|
263
|
+
const actual = layout?.construct;
|
|
264
|
+
const instance = layout?.instance;
|
|
265
|
+
if (actual == null || instance == null || instance.kind !== 'class-ref') {
|
|
266
|
+
throw createCppEmitBlockedError('call-abi:dynamic-constructor', `runtime class ${declaration} can inhabit this receiver but publishes no class construction convention`);
|
|
267
|
+
}
|
|
268
|
+
if (actual.receiver !== null) {
|
|
269
|
+
throw createCppEmitBlockedError('call-abi:dynamic-constructor', `runtime class ${declaration}'s construct convention unexpectedly declares a receiver`);
|
|
270
|
+
}
|
|
271
|
+
if (actual.restFrom !== null && actual.restFrom !== target.restFrom) {
|
|
272
|
+
throw createCppEmitBlockedError('call-abi:dynamic-constructor', `runtime class ${declaration}'s rest slot ${actual.restFrom} cannot be adapted from dynamic constructor rest slot ${String(target.restFrom)}`);
|
|
273
|
+
}
|
|
274
|
+
const actuals = actual.parameters.map((parameter, position) => {
|
|
275
|
+
if (actual.restFrom !== position)
|
|
276
|
+
return dynamicConstructorActualText(ctx, target, actual, position);
|
|
277
|
+
const source = target.parameters[position];
|
|
278
|
+
if (source === undefined) {
|
|
279
|
+
if (parameter.value.kind !== 'array-object') {
|
|
280
|
+
throw createCppEmitBlockedError('call-abi:dynamic-constructor', `runtime class ${declaration}'s rest slot is not an array-object`);
|
|
281
|
+
}
|
|
282
|
+
return `gea::makeRef<gea::ArrayObject<${cppTypeOf(parameter.value.element)}>>()`;
|
|
283
|
+
}
|
|
284
|
+
const converted = alignedValueText(ctx, 'class-properties/emit-class-properties.ts:308', source.value, parameter.value, `gea_constructor_arg_${position}`);
|
|
285
|
+
if (converted !== null)
|
|
286
|
+
return converted;
|
|
287
|
+
throw createCppEmitBlockedError(`conversion:${representationKey(source.value)}->${representationKey(parameter.value)}`, `runtime class ${declaration}'s rest carrier "${representationKey(parameter.value)}" cannot be filled from "${representationKey(source.value)}"`);
|
|
288
|
+
});
|
|
289
|
+
const invocation = `${cppConstructName(declaration)}(${['static_cast<gea::NativeClassMethodState*>(gea_environment)', ...actuals].join(', ')})`;
|
|
290
|
+
const result = alignedValueText(ctx, 'class-properties/emit-class-properties.ts:316', instance, target.result, invocation);
|
|
291
|
+
if (result === null) {
|
|
292
|
+
throw createCppEmitBlockedError(`conversion:${representationKey(instance)}->${representationKey(target.result)}`, `runtime class ${declaration}'s instance carrier "${representationKey(instance)}" cannot satisfy dynamic constructor result "${representationKey(target.result)}"`);
|
|
293
|
+
}
|
|
294
|
+
const formals = target.parameters.map((parameter, position) => `${cppAbiParameterType(parameter)} gea_constructor_arg_${position}`);
|
|
295
|
+
const thunk = `+[](void* gea_environment${formals.length === 0 ? '' : `, ${formals.join(', ')}`}) -> ${cppResultTypeOf(target.result)} { return ${result}; }`;
|
|
296
|
+
return `${cppTypeOf({ kind: 'constructor-value-dispatch', abi: target })}{${thunk}, gea::nativeClassMethodEnvironment(${state})}`;
|
|
297
|
+
};
|
|
298
|
+
const dynamicClassConstructorText = (ctx, operation) => {
|
|
299
|
+
const receiver = operation.receiver.representation;
|
|
300
|
+
const result = operation.result.representation;
|
|
301
|
+
if (receiver.kind !== 'class-ref') {
|
|
302
|
+
throw createCppEmitBlockedError('call-abi:dynamic-constructor', 'a dynamic class constructor read has no class-ref receiver');
|
|
303
|
+
}
|
|
304
|
+
if (result.kind !== 'constructor-value-dispatch') {
|
|
305
|
+
throw createCppEmitBlockedError(`physical-cpp-type:${representationKey(result)}`, `"constructor" of class ${receiver.declaration} is carried as "${representationKey(result)}", not a dispatching constructor`);
|
|
306
|
+
}
|
|
307
|
+
if (result.abi.receiver !== null) {
|
|
308
|
+
throw createCppEmitBlockedError('call-abi:dynamic-constructor', `"constructor" of class ${receiver.declaration} publishes a construct receiver`);
|
|
309
|
+
}
|
|
310
|
+
if (result.abi.result.kind === 'dynamic') {
|
|
311
|
+
throw createCppEmitBlockedError('call-abi:dynamic-constructor', `"constructor" of typed class ${receiver.declaration} publishes a dynamic constructed result, which would box the native instance`);
|
|
312
|
+
}
|
|
313
|
+
const candidates = runtimeClassLayoutsOf(ctx.classes)
|
|
314
|
+
.map((layout) => layout.declaration)
|
|
315
|
+
.filter((declaration) => classDescendsFrom(ctx.classes, declaration, receiver.declaration))
|
|
316
|
+
.sort((left, right) => String(left).localeCompare(String(right)));
|
|
317
|
+
if (candidates.length === 0) {
|
|
318
|
+
throw createCppEmitBlockedError(`property-access:${representationKey(receiver)}:get:false`, `"constructor" of class ${receiver.declaration} has no runtime class candidates`);
|
|
319
|
+
}
|
|
320
|
+
const receiverText = operandText(ctx, operation.receiver);
|
|
321
|
+
const carrier = cppTypeOf(result);
|
|
322
|
+
const branches = candidates.map((declaration) => `if (gea::host::hasNativeClassLayoutRef<${cppClassName(declaration)}>(${receiverText})) return ${dynamicConstructorCandidateText(ctx, result.abi, declaration, `${receiverText}->gea_method_state`)};`);
|
|
323
|
+
const failure = `std::fprintf(stderr, "gea: constructor read found an unregistered runtime class for ${String(receiver.declaration)}\\n"); ` +
|
|
324
|
+
'std::abort();';
|
|
325
|
+
return { text: `[&]() -> ${carrier} { ${branches.join(' ')} ${failure} }()`, spelling: carrier };
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* The body an instance-method read can invoke directly, or `null` when the
|
|
329
|
+
* callable carrier is part of the semantics of the read.
|
|
330
|
+
*
|
|
331
|
+
* This is deliberately asked before rendering by dead-value analysis as well
|
|
332
|
+
* as by `classMemberText`: once a call names the body, its callee operand is
|
|
333
|
+
* not a read of the materialized `CallableObject`. Keeping the two decisions
|
|
334
|
+
* on this one query prevents a devirtualized call from leaving a dead carrier
|
|
335
|
+
* construction in every hot invocation.
|
|
336
|
+
*/
|
|
337
|
+
export const directClassMethodBody = (ctx, operation, key) => {
|
|
338
|
+
const receiver = operation.receiver.representation;
|
|
339
|
+
if (receiver.kind !== 'class-ref' || key === null)
|
|
340
|
+
return null;
|
|
341
|
+
const site = classMemberOf(ctx.classes, receiver.declaration, key);
|
|
342
|
+
if (site === null || site.kind !== 'method' || site.method.callable === null)
|
|
343
|
+
return null;
|
|
344
|
+
const isSuperAccess = dispatchesStatically(ctx, operation.receiver);
|
|
345
|
+
if (classPrototypeMethodMutableOf(ctx.classes, receiver.declaration, key))
|
|
346
|
+
return null;
|
|
347
|
+
if (!isSuperAccess && classMethodOverrideOf(ctx.classes, receiver.declaration, key) !== null)
|
|
348
|
+
return null;
|
|
349
|
+
if (classFamilyOverridesOf(ctx.classes, receiver.declaration, key).length > 0 && !isSuperAccess)
|
|
350
|
+
return null;
|
|
351
|
+
return ctx.captures.of(site.method.callable).kind === 'none' ? site.method.callable : null;
|
|
352
|
+
};
|
|
353
|
+
export const reactiveClassFieldClaim = (ctx, operation) => {
|
|
354
|
+
if (operation.reactive !== true)
|
|
355
|
+
return null;
|
|
356
|
+
const receiver = operation.receiver.representation;
|
|
357
|
+
if (receiver.kind !== 'class-ref')
|
|
358
|
+
return null;
|
|
359
|
+
const key = ctx.staticKeyTexts.get(operation.key.value);
|
|
360
|
+
if (key === undefined)
|
|
361
|
+
return null;
|
|
362
|
+
const site = classMemberOf(ctx.classes, receiver.declaration, key);
|
|
363
|
+
if (!site || site.kind !== 'field')
|
|
364
|
+
return null;
|
|
365
|
+
const struct = cppClassName(site.owner);
|
|
366
|
+
return {
|
|
367
|
+
kind: ctx.hosts.reactive.revisions.get(struct)?.has(key) === true ? 'revision' : 'cell',
|
|
368
|
+
origin: { struct, key, receiver: operation.receiver }
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
export const classMemberText = (ctx, operation) => {
|
|
372
|
+
const receiver = operation.receiver.representation;
|
|
373
|
+
if (receiver.kind !== 'class-ref')
|
|
374
|
+
return null;
|
|
375
|
+
// A key only known at runtime names no member of the layout -- the layout is
|
|
376
|
+
// keyed by source spelling -- so this path declines rather than refusing,
|
|
377
|
+
// and the walk reaches the dynamic-property sidecar. Declining is the whole
|
|
378
|
+
// difference between "this compiler cannot compile `(this as any)[key]`" and
|
|
379
|
+
// "that access is answered by the object's own sidecar": the class layout is
|
|
380
|
+
// simply not the authority for a key it cannot see.
|
|
381
|
+
const key = ctx.staticKeyTexts.get(operation.key.value);
|
|
382
|
+
if (key === undefined)
|
|
383
|
+
return null;
|
|
384
|
+
const site = classMemberOf(ctx.classes, receiver.declaration, key);
|
|
385
|
+
if (!site) {
|
|
386
|
+
// A base-typed handle can carry a descendant whose generated field
|
|
387
|
+
// dispatcher does answer this key, and a statically typed intersection can
|
|
388
|
+
// add an own property that lives in the native expando table. Both are the
|
|
389
|
+
// dynamic-property sidecar case, not a reason to box the receiver. Decline
|
|
390
|
+
// here so `nativeSidecarGetText` performs the actual runtime field/expando
|
|
391
|
+
// lookup and tag-checks the result against this read's published carrier.
|
|
392
|
+
// `constructor` is the one prototype intrinsic that is not an own field or
|
|
393
|
+
// expando. Its value is selected from the receiver's allocation identity,
|
|
394
|
+
// because a base-typed handle may hold a subclass and polymorphic clone
|
|
395
|
+
// methods must allocate that subclass again.
|
|
396
|
+
if (key !== 'constructor')
|
|
397
|
+
return null;
|
|
398
|
+
return dynamicClassConstructorText(ctx, operation);
|
|
399
|
+
}
|
|
400
|
+
if (site.kind === 'unknown-class') {
|
|
401
|
+
throw createCppEmitBlockedError(`property-access:${representationKey(receiver)}:get:false`, `a "get" of "${key}" reaches class ${site.owner}, whose members no class evaluation published`);
|
|
402
|
+
}
|
|
403
|
+
if (site.kind === 'field') {
|
|
404
|
+
// A celled field renders its read exactly as any other field does -- the
|
|
405
|
+
// cell converts to `const T&` -- so this declines and lets the ordinary
|
|
406
|
+
// member access below produce the line. The note a JSX consumer needs to
|
|
407
|
+
// subscribe rather than sample is not decided here: it is a question about
|
|
408
|
+
// the projected class layout, settled for the whole body before a line is
|
|
409
|
+
// printed (`reactiveClassFieldClaim`, walked by `reactive-dependencies.ts`).
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
// The class's family has to be CLOSED at this key for a direct bind to be
|
|
413
|
+
// right. Both branches below name one body -- the accessor's getter, or the
|
|
414
|
+
// method's callable -- and a receiver annotated as a base can hold anything
|
|
415
|
+
// derived from it, so a key some subclass redeclares reaches the wrong body
|
|
416
|
+
// for every instance of that subclass. Nothing about that shows up later: it
|
|
417
|
+
// compiles, it links, and it runs the base's implementation. gea3d-cube's
|
|
418
|
+
// scene walk is the worked case -- `Object3D.collectSelf` is empty and
|
|
419
|
+
// `Mesh`/`Light` override it, so a bound base body collected zero meshes and
|
|
420
|
+
// drew an empty frame with no diagnostic anywhere.
|
|
421
|
+
//
|
|
422
|
+
// `virtual-methods.ts` puts a dispatch member on such a family's root struct,
|
|
423
|
+
// and `ctx.virtualDispatch` names every one it really emitted. A key it did
|
|
424
|
+
// not -- an accessor, or a family whose implementations disagree on their
|
|
425
|
+
// convention -- is refused rather than bound: a named refusal is a report
|
|
426
|
+
// somebody can act on, and the direct bind is not.
|
|
427
|
+
const overriding = classFamilyOverridesOf(ctx.classes, receiver.declaration, key);
|
|
428
|
+
// `super.m()` is the one member access the language binds STATICALLY: 13.3.7
|
|
429
|
+
// resolves it against the home object's prototype, not against the object,
|
|
430
|
+
// and dispatching it would re-enter the override that wrote it -- `Camera`'s
|
|
431
|
+
// `updateMatrixWorld` calling `super.updateMatrixWorld(force)` recursed until
|
|
432
|
+
// the stack ran out. The receiver tells them apart on its own: `ir/lower.ts`
|
|
433
|
+
// mints a `receiver` operation for `this` at the frame's own class and for
|
|
434
|
+
// `super` at the BASE's, so a receiver-defined value carrying any other class
|
|
435
|
+
// than this frame's receiver is a super access and nothing else.
|
|
436
|
+
const isSuperAccess = dispatchesStatically(ctx, operation.receiver);
|
|
437
|
+
const role = site.kind === 'accessor' ? 'get' : 'call';
|
|
438
|
+
const dispatchAbi = ctx.virtualDispatch.get(virtualDispatchKey(receiver.declaration, key, role));
|
|
439
|
+
const dispatchable = dispatchAbi !== undefined;
|
|
440
|
+
if (overriding.length > 0 && !isSuperAccess && !dispatchable) {
|
|
441
|
+
throw createCppEmitBlockedError(`property-access:${representationKey(receiver)}:get:false`, `"${key}" of class ${site.owner} is redeclared by ${overriding.join(', ')}, so a receiver typed as ${receiver.declaration} needs dynamic dispatch, which this unit emitted no member for; binding one body would run ${site.owner}'s for every instance of a subclass`);
|
|
442
|
+
}
|
|
443
|
+
// An accessor-backed member is read by *calling* its getter, not by taking a
|
|
444
|
+
// function object of it: `box.value` is the number the getter returns. The
|
|
445
|
+
// call is direct rather than through a callable carrier because the class's
|
|
446
|
+
// family is closed here -- the layout names exactly one body -- and going
|
|
447
|
+
// through a carrier would allocate a pointer pair only to invoke it at once.
|
|
448
|
+
if (site.kind === 'accessor') {
|
|
449
|
+
// An overridden getter is dispatched through the object, exactly as an
|
|
450
|
+
// overridden method is: `escalation.label` on a receiver typed `Rule` must
|
|
451
|
+
// reach `EscalationRule`'s getter. The member is declared on the family's
|
|
452
|
+
// root, so any `Ref` to the root or below names it without a cast.
|
|
453
|
+
if (overriding.length > 0 && !isSuperAccess && dispatchable) {
|
|
454
|
+
return { text: `${operandText(ctx, operation.receiver)}->${cppVirtualMemberName(key, 'get')}()`, spelling: null };
|
|
455
|
+
}
|
|
456
|
+
if (!site.accessor.getter) {
|
|
457
|
+
throw createCppEmitBlockedError(`property-access:${representationKey(receiver)}:get:false`, `accessor "${key}" of class ${site.owner} declares only a setter, so reading it has no body to call`);
|
|
458
|
+
}
|
|
459
|
+
return { text: `${cppBodyName(site.accessor.getter)}(${operandText(ctx, operation.receiver)})`, spelling: null };
|
|
460
|
+
}
|
|
461
|
+
if (overriding.length > 0 && !isSuperAccess && !ctx.virtualCallees.has(operation.result.id)) {
|
|
462
|
+
const selected = computedOverriddenMethodValueText(ctx, operation, key, (method) => classMethodValueText(ctx, operation, key, method));
|
|
463
|
+
return { text: selected.text, spelling: selected.type };
|
|
464
|
+
}
|
|
465
|
+
// An ABSTRACT declaration roots the family and owns no body, so there is no
|
|
466
|
+
// function object to materialise: the only thing this read can publish is
|
|
467
|
+
// the dispatch itself. `emit.ts` already refuses any virtual callee that is
|
|
468
|
+
// not consumed as a callee, so a program that took this value rather than
|
|
469
|
+
// calling it is named there rather than handed a base body it has none of.
|
|
470
|
+
if (overriding.length > 0 && !isSuperAccess && site.method.callable === null) {
|
|
471
|
+
// Asked, not re-derived: `virtualCalleeClaim` settled which reads dispatch
|
|
472
|
+
// before this body rendered, and a read this branch reached that it did not
|
|
473
|
+
// claim is one whose dispatch member this unit never emitted.
|
|
474
|
+
if (!ctx.virtualCallees.has(operation.result.id)) {
|
|
475
|
+
throw createCppEmitBlockedError('call-abi:virtual-dispatch', `virtual dispatch ABI for "${key}" was not retained`);
|
|
476
|
+
}
|
|
477
|
+
// The receiver is recorded by `emit.ts`'s prepass, which asked
|
|
478
|
+
// `classMethodValueReceiverClaim` -- the same layout question this branch
|
|
479
|
+
// reached by resolving the member.
|
|
480
|
+
return { text: '', spelling: null };
|
|
481
|
+
}
|
|
482
|
+
// An ABSTRACT declaration NOTHING in this program implements: no body of its
|
|
483
|
+
// own (the branch above already took every family that has one to dispatch
|
|
484
|
+
// to), so there is neither a function object to materialise nor a dispatch
|
|
485
|
+
// to publish. hono's `FetchEventLike` (`types.ts`) is the shape -- an
|
|
486
|
+
// abstract class declaring only abstract members, extended by nothing,
|
|
487
|
+
// constructed nowhere, written purely to TYPE the service-worker event
|
|
488
|
+
// `hono-base.ts`'s `fire` reads `respondWith` off.
|
|
489
|
+
//
|
|
490
|
+
// That read cannot execute. A `class-ref` to a class with no concrete
|
|
491
|
+
// descendant names a struct this unit never constructs, so no value of it
|
|
492
|
+
// exists to read a member from -- which is why a trap is the honest
|
|
493
|
+
// lowering and not a shortcut: it states the fact rather than inventing a
|
|
494
|
+
// body, keeps the read at its published callable carrier (nothing is
|
|
495
|
+
// boxed), and fails loudly in the impossible case instead of running some
|
|
496
|
+
// other class's implementation. It is the same answer, spelled the same
|
|
497
|
+
// way, that `dynamicClassConstructorText` above gives a `constructor` read
|
|
498
|
+
// whose receiver matches no runtime class.
|
|
499
|
+
//
|
|
500
|
+
// `super.m()` is excluded: that spelling binds statically (13.3.7) and an
|
|
501
|
+
// abstract base really has nothing for it, which stays a refusal.
|
|
502
|
+
if (site.method.callable === null && !isSuperAccess) {
|
|
503
|
+
const carrier = cppTypeOf(boundMethodValueRepresentation(operation));
|
|
504
|
+
const failure = `std::fprintf(stderr, "gea: \\"${key}\\" of class ${String(site.owner)} is abstract and no class in this program implements it\\n"); ` +
|
|
505
|
+
'std::abort();';
|
|
506
|
+
return { text: `[]() -> ${carrier} { ${failure} }()`, spelling: carrier };
|
|
507
|
+
}
|
|
508
|
+
const materialized = classMethodValueText(ctx, operation, key, site.method);
|
|
509
|
+
// Keep the receiver beside the exact method value this property read
|
|
510
|
+
// publishes. An immediate `object.method()` call can need it even when the
|
|
511
|
+
// method is not eligible for the body-by-name optimization below: the
|
|
512
|
+
// materialized callable's physical convention includes its leading class
|
|
513
|
+
// receiver, while the semantic method signature does not. A detached read
|
|
514
|
+
// (`const method = object.method; method()`) reaches the call through a
|
|
515
|
+
// different SSA value, so this does not bind `this` where the language does
|
|
516
|
+
// not. `emit-callable.ts` consults it only for the identical callee value.
|
|
517
|
+
// It is recorded by `emit.ts`'s prepass -- see `classMethodValueReceiverClaim`.
|
|
518
|
+
// An overridden method goes through the object instead: the callee is
|
|
519
|
+
// recorded for `emit-callable.ts` to render as `receiver->member(args)`, and
|
|
520
|
+
// deliberately NOT as a direct callee -- a second, name-bound path to the
|
|
521
|
+
// same value is exactly the drift that would reinstate the base's body.
|
|
522
|
+
// `virtualCalleesUsed` is what proves every one of them was really called.
|
|
523
|
+
if (overriding.length > 0 && !isSuperAccess) {
|
|
524
|
+
// Asked, not re-derived: `virtualCalleeClaim` settled which reads dispatch
|
|
525
|
+
// before this body rendered, and a read this branch reached that it did not
|
|
526
|
+
// claim is one whose dispatch member this unit never emitted.
|
|
527
|
+
if (!ctx.virtualCallees.has(operation.result.id)) {
|
|
528
|
+
throw createCppEmitBlockedError('call-abi:virtual-dispatch', `virtual dispatch ABI for "${key}" was not retained`);
|
|
529
|
+
}
|
|
530
|
+
return { text: materialized.text, spelling: materialized.type };
|
|
531
|
+
}
|
|
532
|
+
// A method that captures nothing IS its own body: a call through this
|
|
533
|
+
// value can name it rather than reach it through the carrier. That NAME is
|
|
534
|
+
// registered up front now, by `emitBody`'s walk of `CallOperation.target`
|
|
535
|
+
// (`ir/call-dispatch.ts`, which asks the identical `directClassMethodBody`
|
|
536
|
+
// question) -- nothing is left for this read to register itself.
|
|
537
|
+
return { text: materialized.text, spelling: materialized.type };
|
|
538
|
+
};
|
|
539
|
+
/**
|
|
540
|
+
* The member and convention an overridden method read has to be DISPATCHED
|
|
541
|
+
* through, or `null` for every read that is not one.
|
|
542
|
+
*
|
|
543
|
+
* A direct bind is only right while nothing below the receiver's class
|
|
544
|
+
* redeclares the key; where something does, the call has to go through the
|
|
545
|
+
* object. That is the same family-closure question `classMemberText` resolves
|
|
546
|
+
* to choose its own spelling, and it is decided entirely from the projected
|
|
547
|
+
* layouts and the dispatch table this unit emitted -- so it is stated here and
|
|
548
|
+
* recorded by `emit.ts`'s prepass, rather than as a side effect of the two
|
|
549
|
+
* branches that happen to spell such a read.
|
|
550
|
+
*
|
|
551
|
+
* `super.m()` is excluded for the reason 13.3.7 gives: the language binds it
|
|
552
|
+
* statically, and dispatching it re-enters the override that wrote it.
|
|
553
|
+
*/
|
|
554
|
+
export const virtualCalleeClaim = (ctx, operation) => {
|
|
555
|
+
const receiver = operation.receiver.representation;
|
|
556
|
+
if (receiver.kind !== 'class-ref')
|
|
557
|
+
return null;
|
|
558
|
+
const key = ctx.staticKeyTexts.get(operation.key.value);
|
|
559
|
+
if (key === undefined)
|
|
560
|
+
return null;
|
|
561
|
+
if (classMemberOf(ctx.classes, receiver.declaration, key)?.kind !== 'method')
|
|
562
|
+
return null;
|
|
563
|
+
if (classFamilyOverridesOf(ctx.classes, receiver.declaration, key).length === 0)
|
|
564
|
+
return null;
|
|
565
|
+
if (dispatchesStatically(ctx, operation.receiver))
|
|
566
|
+
return null;
|
|
567
|
+
if (classPrototypeMethodMutableOf(ctx.classes, receiver.declaration, key))
|
|
568
|
+
return null;
|
|
569
|
+
if (classMethodOverrideOf(ctx.classes, receiver.declaration, key) !== null)
|
|
570
|
+
return null;
|
|
571
|
+
const abi = ctx.virtualDispatch.get(virtualDispatchKey(receiver.declaration, key, 'call'));
|
|
572
|
+
return abi === undefined ? null : { member: cppVirtualMemberName(key), abi };
|
|
573
|
+
};
|
|
574
|
+
/**
|
|
575
|
+
* Whether a `[[Get]]` on a class receiver publishes a METHOD VALUE, and the
|
|
576
|
+
* receiver it went through -- `null` for every other read.
|
|
577
|
+
*
|
|
578
|
+
* A method value carries its body's own physical convention, receiver first,
|
|
579
|
+
* while the language's view of the value declares no receiver; the call that
|
|
580
|
+
* consumes it therefore has to be handed the object the read went through
|
|
581
|
+
* (`EmitContext.directCallReceivers`, and `emit-callable.ts`'s use of it).
|
|
582
|
+
* That is a property of the READ, decided from the projected class layout, so
|
|
583
|
+
* it is stated here once and recorded by `emit.ts`'s prepass -- the resolvers
|
|
584
|
+
* below simply spell the value the layout already committed them to.
|
|
585
|
+
*
|
|
586
|
+
* Both shapes the class path publishes a method value through are here,
|
|
587
|
+
* because both hand the same receiver to the same consumer: the ordinary
|
|
588
|
+
* `object.method` read, and `computedClassPrototypeMethodText`'s finite
|
|
589
|
+
* `object[key]` dispatch.
|
|
590
|
+
*/
|
|
591
|
+
export const classMethodValueReceiverClaim = (ctx, operation) => {
|
|
592
|
+
const receiver = operation.receiver.representation;
|
|
593
|
+
if (receiver.kind !== 'class-ref')
|
|
594
|
+
return null;
|
|
595
|
+
const key = ctx.staticKeyTexts.get(operation.key.value);
|
|
596
|
+
if (key === undefined) {
|
|
597
|
+
const result = operation.result.representation;
|
|
598
|
+
if (result.kind !== 'function-value-dispatch' && result.kind !== 'dynamic')
|
|
599
|
+
return null;
|
|
600
|
+
if (operation.key.representation.kind !== 'string')
|
|
601
|
+
return null;
|
|
602
|
+
for (const { method } of reachableClassMethodsOf(ctx.classes, receiver.declaration)) {
|
|
603
|
+
if (method !== null && ctx.abiOfCallable(method.callable) !== null)
|
|
604
|
+
return operation.receiver;
|
|
605
|
+
}
|
|
606
|
+
return null;
|
|
607
|
+
}
|
|
608
|
+
return classMemberOf(ctx.classes, receiver.declaration, key)?.kind === 'method' ? operation.receiver : null;
|
|
609
|
+
};
|
|
610
|
+
/**
|
|
611
|
+
* A computed class-method read such as Hono's `raw[key]()` where `key` is a
|
|
612
|
+
* finite `keyof` set whose literal arms share one callable convention.
|
|
613
|
+
*
|
|
614
|
+
* String-literal unions intentionally collapse to the native `std::string`
|
|
615
|
+
* carrier, so the C++ emitter cannot branch on the key's representation. It
|
|
616
|
+
* can, however, ask the already-projected class layout for every prototype
|
|
617
|
+
* method whose body converts to the read's one published callable type. Each
|
|
618
|
+
* arm is built by `classMethodValueText`, the same authority used by a static
|
|
619
|
+
* `.method` read. A key absent from that finite set falls through to the
|
|
620
|
+
* ordinary missing-property failure at the caller.
|
|
621
|
+
*
|
|
622
|
+
* Overridden families select the exact prototype implementation from the
|
|
623
|
+
* receiver allocation at READ time. A later call keeps that implementation.
|
|
624
|
+
* Own fields and expando shadowing are handled by
|
|
625
|
+
* `nativeSidecarGetText` before it chooses this prototype result.
|
|
626
|
+
*/
|
|
627
|
+
export const computedClassPrototypeMethodText = (ctx, operation) => {
|
|
628
|
+
const receiver = operation.receiver.representation;
|
|
629
|
+
if (receiver.kind !== 'class-ref')
|
|
630
|
+
return null;
|
|
631
|
+
const staticKey = ctx.staticKeyTexts.get(operation.key.value);
|
|
632
|
+
const result = operation.result.representation;
|
|
633
|
+
if (result.kind === 'dynamic') {
|
|
634
|
+
if (staticKey === undefined && operation.key.representation.kind !== 'string')
|
|
635
|
+
return null;
|
|
636
|
+
const keys = staticKey === undefined ? classPrototypeMethodKeysOf(ctx.classes, receiver.declaration) : [staticKey];
|
|
637
|
+
const type = cppTypeOf(result);
|
|
638
|
+
const object = operandText(ctx, operation.receiver);
|
|
639
|
+
const branches = [];
|
|
640
|
+
for (const key of keys) {
|
|
641
|
+
const arms = classPrototypeMethodValueArmsOf(ctx.classes, receiver.declaration, key);
|
|
642
|
+
if (arms === null || !arms.some((arm) => arm.method !== null))
|
|
643
|
+
continue;
|
|
644
|
+
// A base-typed native reference can have a method only on some exact
|
|
645
|
+
// allocations. Preserve undefined for the others and choose the method
|
|
646
|
+
// at READ time, before a later call supplies a possibly new receiver.
|
|
647
|
+
const selections = arms.map(({ allocation, method }) => {
|
|
648
|
+
const value = method === null ? 'gea::Value()' : classMethodValueText(ctx, operation, key, method, result).text;
|
|
649
|
+
return `if (gea::host::hasNativeClassLayoutRef<${cppClassName(allocation)}>(${object})) return ${value};`;
|
|
650
|
+
});
|
|
651
|
+
const selection = `${selections.join(' ')} return gea::Value();`;
|
|
652
|
+
branches.push(staticKey === undefined ? `if (gea_method_key == ${cppStringLiteral(key)}) { ${selection} }` : selection);
|
|
653
|
+
}
|
|
654
|
+
if (branches.length === 0)
|
|
655
|
+
return null;
|
|
656
|
+
const keyBinding = staticKey === undefined ? `const std::string& gea_method_key = ${operandText(ctx, operation.key)}; ` : '';
|
|
657
|
+
return { text: `([&]() -> ${type} { ${keyBinding}${branches.join(' ')} return gea::Value(); })()`, spelling: type, carrier: result };
|
|
658
|
+
}
|
|
659
|
+
if (staticKey !== undefined)
|
|
660
|
+
return null;
|
|
661
|
+
if (result.kind !== 'function-value-dispatch')
|
|
662
|
+
return null;
|
|
663
|
+
// The arms compare the key as a `std::string`; a numeric runtime key would
|
|
664
|
+
// need the canonical-string comparison `gea::PropertyKey` does, and no
|
|
665
|
+
// caller has asked for one yet.
|
|
666
|
+
if (operation.key.representation.kind !== 'string')
|
|
667
|
+
return null;
|
|
668
|
+
const target = boundMethodValueRepresentation(operation);
|
|
669
|
+
// Which of the class's methods this read can actually YIELD: the ones whose
|
|
670
|
+
// body convention fills the carrier the read publishes. That carrier is the
|
|
671
|
+
// census's answer for the key -- `readBodyWithFastPath`'s `request[method]()`
|
|
672
|
+
// (@hono/node-server's `request.ts`) publishes the join of `text`,
|
|
673
|
+
// `arrayBuffer` and `blob` because `DirectBodyReadMethod` is exactly those
|
|
674
|
+
// three literals -- so a method outside it is a key this read cannot take,
|
|
675
|
+
// and skipping it is how this walk narrows to the proven domain.
|
|
676
|
+
const fillsTarget = (callable) => {
|
|
677
|
+
const bodyAbi = ctx.abiOfCallable(callable);
|
|
678
|
+
if (bodyAbi === null)
|
|
679
|
+
return false;
|
|
680
|
+
const bodyRepresentation = { kind: 'function-value-dispatch', abi: bodyAbi };
|
|
681
|
+
return (alignedValueText(ctx, 'class-properties/emit-class-properties.ts:611', bodyRepresentation, target, `${cppTypeOf(bodyRepresentation)}{}`) !== null);
|
|
682
|
+
};
|
|
683
|
+
const methods = [];
|
|
684
|
+
const overriddenKeys = [];
|
|
685
|
+
for (const { key: methodKey, method } of reachableClassMethodsOf(ctx.classes, receiver.declaration)) {
|
|
686
|
+
if (method === null) {
|
|
687
|
+
overriddenKeys.push(methodKey);
|
|
688
|
+
continue;
|
|
689
|
+
}
|
|
690
|
+
if (fillsTarget(method.callable))
|
|
691
|
+
methods.push({ key: methodKey, method });
|
|
692
|
+
}
|
|
693
|
+
const materialized = methods.map(({ key, method }) => ({ key, ...classMethodValueText(ctx, operation, key, method, target) }));
|
|
694
|
+
for (const key of overriddenKeys) {
|
|
695
|
+
// The SAME question, asked of an overridden key's every arm. Left
|
|
696
|
+
// unasked, a key outside the read's domain reached
|
|
697
|
+
// `classMethodValueText` anyway and refused the whole program on a
|
|
698
|
+
// conversion it was never going to need: the node-server shim's
|
|
699
|
+
// `LightRequest extends Request` overrides `json`, whose
|
|
700
|
+
// `() -> promise(dynamic)` cannot fill a read that publishes
|
|
701
|
+
// `text|arrayBuffer|blob` -- and `json` is not one of the three keys the
|
|
702
|
+
// read can take. Every arm must fill it, because the arm is chosen at run
|
|
703
|
+
// time from the receiver's allocation and any one of them can be the
|
|
704
|
+
// value this read yields.
|
|
705
|
+
const arms = classMethodValueArmsOf(ctx.classes, receiver.declaration, key);
|
|
706
|
+
if (arms === null || !arms.every((arm) => fillsTarget(arm.method.callable)))
|
|
707
|
+
continue;
|
|
708
|
+
materialized.push({
|
|
709
|
+
key,
|
|
710
|
+
environment: 'nullptr',
|
|
711
|
+
...computedOverriddenMethodValueText(ctx, operation, key, (method) => classMethodValueText(ctx, operation, key, method, target))
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
const valueType = materialized[0]?.type;
|
|
715
|
+
if (valueType === undefined || materialized.some((candidate) => candidate.type !== valueType))
|
|
716
|
+
return null;
|
|
717
|
+
const keyText = operandText(ctx, operation.key);
|
|
718
|
+
const branches = materialized.map((candidate) => `if (gea_method_key == ${cppStringLiteral(candidate.key)}) return ${candidate.text};`);
|
|
719
|
+
// What a key matching NO arm evaluates to. Over a proven-finite domain that
|
|
720
|
+
// is unreachable and saying so lets the optimizer drop the tail; over an open
|
|
721
|
+
// one it is the ordinary "this object has no such member", whose answer is
|
|
722
|
+
// `undefined` and whose error belongs to the CALL, not to the read.
|
|
723
|
+
const missText = `gea::host::unreachableValue<${valueType}>()`;
|
|
724
|
+
return {
|
|
725
|
+
text: `([&]() -> ${valueType} { const std::string& gea_method_key = ${keyText}; ${branches.join(' ')} ` + `return ${missText}; })()`,
|
|
726
|
+
spelling: valueType,
|
|
727
|
+
carrier: target
|
|
728
|
+
};
|
|
729
|
+
};
|
|
730
|
+
/**
|
|
731
|
+
* The emitted global one `ClassName.KEY` names, or `null` when the
|
|
732
|
+
* whole-program census claimed no storage for it.
|
|
733
|
+
*
|
|
734
|
+
* The census (`class-layout.ts`'s `censusClassStaticFieldStorage`, published
|
|
735
|
+
* by `translation-unit.ts` before any body renders) is the ONLY authority
|
|
736
|
+
* here -- this re-derives nothing. It records only the assignment-only idiom
|
|
737
|
+
* (a key no `static` member declares) and refuses a key two writes carried
|
|
738
|
+
* differently, so a name it answers for is a location whose carrier every
|
|
739
|
+
* write in the program already agreed on, and a name it declines falls
|
|
740
|
+
* through to whatever refusal the caller already had.
|
|
741
|
+
*
|
|
742
|
+
* Shared by both directions: a read (`classConstructorStaticMemberText`) and
|
|
743
|
+
* a store (`emit-properties.ts`'s `emitFieldStoreLines`) must resolve the
|
|
744
|
+
* same key to the same global, and two lookups written separately are how
|
|
745
|
+
* they would eventually stop doing so.
|
|
746
|
+
*/
|
|
747
|
+
export const classConstructorStaticFieldStorage = (ctx, receiver, key) => {
|
|
748
|
+
if (receiver.kind !== 'constructor-family')
|
|
749
|
+
return null;
|
|
750
|
+
// Along the base chain, as `classStaticMemberOf` walks it: `Derived.x`
|
|
751
|
+
// after `class Base { static x = 1 }` resolves through `Derived`'s
|
|
752
|
+
// `[[Prototype]]`, the base constructor, and the storage the census gave
|
|
753
|
+
// `Base.x` is the one cell both spellings name. Stopping at the receiver's
|
|
754
|
+
// own class found no storage, fell through to the member scan, and refused
|
|
755
|
+
// the inherited field as "no emitted storage yet".
|
|
756
|
+
const walked = new Set();
|
|
757
|
+
for (const member of receiver.members) {
|
|
758
|
+
let declaration = member;
|
|
759
|
+
while (declaration !== null && !walked.has(declaration)) {
|
|
760
|
+
walked.add(declaration);
|
|
761
|
+
const stored = classStaticFieldStorageOf(ctx.classes, declaration, key);
|
|
762
|
+
if (stored)
|
|
763
|
+
return stored;
|
|
764
|
+
declaration = ctx.classes.get(declaration)?.base ?? null;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
return null;
|
|
768
|
+
};
|
|
769
|
+
export const classConstructorStaticFieldName = (ctx, receiver, key) => classConstructorStaticFieldStorage(ctx, receiver, key)?.name ?? null;
|
|
770
|
+
/**
|
|
771
|
+
* `classMemberText`'s twin for the constructor side: `Quaternion.fromEuler`,
|
|
772
|
+
* a static method or get-only accessor read off the class value itself
|
|
773
|
+
* rather than off an instance.
|
|
774
|
+
*
|
|
775
|
+
* `constructor-family.members` is a list in the model (`representation/
|
|
776
|
+
* model.ts`) but `deriveClassConstructor` (`representation/derive.ts`) never
|
|
777
|
+
* produces more than one entry, so every member is tried and the first site
|
|
778
|
+
* found wins -- the same tolerance `projectClasses` already gives a heritage
|
|
779
|
+
* value naming several classes, just applied to the read instead of the base
|
|
780
|
+
* link.
|
|
781
|
+
*
|
|
782
|
+
* A key the whole-program static-field census claimed
|
|
783
|
+
* (`class-layout.ts`'s `censusClassStaticFieldStorage`, published by
|
|
784
|
+
* `translation-unit.ts` before any body renders) reads its own emitted
|
|
785
|
+
* global. That census records only the assignment-only idiom -- a key no
|
|
786
|
+
* `static` member of the class declares -- so it can never disagree with the
|
|
787
|
+
* `classStaticMemberOf` site below about which storage a key names, and it
|
|
788
|
+
* is asked FIRST for exactly that reason: the site scan has no answer for a
|
|
789
|
+
* key nothing declares, and would otherwise fall through to this function's
|
|
790
|
+
* closing refusal.
|
|
791
|
+
*
|
|
792
|
+
* A DECLARED static field (`site.kind === 'field'`) is still refused by
|
|
793
|
+
* name: the census skips those, so no storage was emitted for one, and
|
|
794
|
+
* reading it would be a lookup path answering before its storage exists.
|
|
795
|
+
*/
|
|
796
|
+
export const classConstructorStaticMemberTextFor = (ctx, receiver, key, result,
|
|
797
|
+
// Asked for only by the members that need an object: `prototype` and an
|
|
798
|
+
// accessor whose getter takes a receiver. A static FIELD is a global and a
|
|
799
|
+
// static METHOD is a direct call, so neither needs one -- and a generic
|
|
800
|
+
// class instantiated at several layouts HAS no single class object to
|
|
801
|
+
// render (`emit-bindings.ts`'s `classObjectReadsOf`), so computing this
|
|
802
|
+
// eagerly refused `Box.count` for a class whose static cell was sitting
|
|
803
|
+
// right there.
|
|
804
|
+
receiverText) => {
|
|
805
|
+
if (receiver.kind !== 'constructor-family')
|
|
806
|
+
return null;
|
|
807
|
+
if (key === 'prototype') {
|
|
808
|
+
return nativePrototypeObjectText(ctx, receiver, result, receiverText(), (owner, method, state) => {
|
|
809
|
+
if (method.callable === null)
|
|
810
|
+
throw createCppEmitBlockedError('property-access:class-prototype:abstract-method', 'abstract method has no function object');
|
|
811
|
+
const abi = ctx.abiOfCallable(method.callable);
|
|
812
|
+
if (abi === null)
|
|
813
|
+
throw createCppEmitBlockedError('property-access:class-prototype:method-abi', 'prototype method has no native convention');
|
|
814
|
+
const representation = { kind: 'function-value-dispatch', abi };
|
|
815
|
+
const environment = methodEnvironmentText(ctx, method.callable, `prototype method ${method.key}`);
|
|
816
|
+
const payload = `${cppTypeOf(representation)}{&${cppThunkName(method.callable)}, ${environment}}`;
|
|
817
|
+
return {
|
|
818
|
+
representation,
|
|
819
|
+
text: `gea::nativeClassMethodValue<${cppClassName(owner.declaration)}, &${cppCallableDeclarationTagName(method.callable)}>(${state}, ${payload})`
|
|
820
|
+
};
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
const censused = classConstructorStaticFieldStorage(ctx, receiver, key);
|
|
824
|
+
if (censused !== null) {
|
|
825
|
+
const converted = alignedValueText(ctx, 'class-properties/emit-class-properties.ts:713', censused.representation, result, censused.name);
|
|
826
|
+
if (converted !== null)
|
|
827
|
+
return converted;
|
|
828
|
+
throw createCppEmitBlockedError(`conversion:${representationKey(censused.representation)}->${representationKey(result)}`, `static field "${key}" is stored as "${representationKey(censused.representation)}" and this read publishes ` +
|
|
829
|
+
`"${representationKey(result)}"; no conversion is installed between them`);
|
|
830
|
+
}
|
|
831
|
+
for (const declaration of receiver.members) {
|
|
832
|
+
const site = classStaticMemberOf(ctx.classes, declaration, key);
|
|
833
|
+
if (!site)
|
|
834
|
+
continue;
|
|
835
|
+
if (site.kind === 'unknown-class') {
|
|
836
|
+
throw createCppEmitBlockedError(`property-access:${representationKey(receiver)}:get:false`, `a "get" of static "${key}" reaches class ${site.owner}, whose static members no class evaluation published -- ` +
|
|
837
|
+
'likely an ambient "declare class" this compiler does not census');
|
|
838
|
+
}
|
|
839
|
+
if (site.kind === 'field') {
|
|
840
|
+
throw createCppEmitBlockedError(`property-access:${representationKey(receiver)}:get:false`, `static field "${key}" of class ${declaration} has no emitted storage yet; only static methods and get-only accessors are rendered`);
|
|
841
|
+
}
|
|
842
|
+
if (site.kind === 'accessor') {
|
|
843
|
+
if (!site.accessor.getter) {
|
|
844
|
+
throw createCppEmitBlockedError(`property-access:${representationKey(receiver)}:get:false`, `static accessor "${key}" of class ${site.owner} declares only a setter, so reading it has no body to call`);
|
|
845
|
+
}
|
|
846
|
+
// A static getter's body reads `this` as the class constructor object,
|
|
847
|
+
// and its convention declares that receiver exactly when it does (see
|
|
848
|
+
// `structural-receiver.ts`'s static branch); `C.method` is the call
|
|
849
|
+
// `getter(C)`, the same shape the instance read above renders.
|
|
850
|
+
const getterAbi = ctx.abiOfCallable(site.accessor.getter);
|
|
851
|
+
const called = `${cppBodyName(site.accessor.getter)}(${getterAbi?.receiver ? receiverText() : ''})`;
|
|
852
|
+
// The call yields the getter's OWN result carrier; a site publishing a
|
|
853
|
+
// different one (a computed read boxes to `dynamic`) converts from it
|
|
854
|
+
// rather than pretending the call already produced the published type.
|
|
855
|
+
const converted = getterAbi === null
|
|
856
|
+
? called
|
|
857
|
+
: alignedValueText(ctx, 'class-properties/emit-class-properties.ts:753', getterAbi.result, result, called);
|
|
858
|
+
if (converted !== null)
|
|
859
|
+
return converted;
|
|
860
|
+
throw createCppEmitBlockedError(`conversion:${representationKey(getterAbi?.result ?? result)}->${representationKey(result)}`, `static accessor "${key}" yields "${representationKey(getterAbi?.result ?? result)}" and this read publishes ` +
|
|
861
|
+
`"${representationKey(result)}"; no conversion is installed between them`);
|
|
862
|
+
}
|
|
863
|
+
if (!site.method.callable) {
|
|
864
|
+
throw createCppEmitBlockedError(`property-access:${representationKey(receiver)}:get:false`, `static method "${key}" of class ${site.owner} names no body to take a function object of`);
|
|
865
|
+
}
|
|
866
|
+
// The function object is spelled in the method's own dispatch carrier and
|
|
867
|
+
// converted to what the site publishes, as `classMethodValueText` does for
|
|
868
|
+
// an instance method: spelling it directly in the published type wrote
|
|
869
|
+
// `gea::Value{&thunk, env}` for a computed read, which is not a boxed
|
|
870
|
+
// callable at all.
|
|
871
|
+
const methodAbi = ctx.abiOfCallable(site.method.callable);
|
|
872
|
+
const object = `{&${cppThunkName(site.method.callable)}, ${methodEnvironmentText(ctx, site.method.callable, `a "get" of static "${key}"`)}}`;
|
|
873
|
+
if (methodAbi === null)
|
|
874
|
+
return `${cppTypeOf(result)}${object}`;
|
|
875
|
+
const methodRepresentation = { kind: 'function-value-dispatch', abi: methodAbi };
|
|
876
|
+
const converted = alignedValueText(ctx, 'class-properties/emit-class-properties.ts:776', methodRepresentation, result, `${cppTypeOf(methodRepresentation)}${object}`);
|
|
877
|
+
if (converted !== null)
|
|
878
|
+
return converted;
|
|
879
|
+
throw createCppEmitBlockedError(`conversion:${representationKey(methodRepresentation)}->${representationKey(result)}`, `static method "${key}" is a "${representationKey(methodRepresentation)}" and this read publishes "${representationKey(result)}"; ` +
|
|
880
|
+
'no conversion is installed between them');
|
|
881
|
+
}
|
|
882
|
+
// `C.name` with no static member shadowing it is the class's `[[Name]]`, a
|
|
883
|
+
// fact the constructor-object allocation stated and the layout carries
|
|
884
|
+
// (`projection/classes.ts`'s `name`) -- asked last, after every declared
|
|
885
|
+
// static member, because a `static name()` is the language's own shadow.
|
|
886
|
+
if (key === 'name') {
|
|
887
|
+
const named = receiver.members.map((declaration) => ctx.classes.get(declaration)?.name ?? null).find((name) => name !== null);
|
|
888
|
+
if (named !== undefined && named !== null) {
|
|
889
|
+
const converted = alignedValueText(ctx, 'class-properties/emit-class-properties.ts:791', { kind: 'string' }, result, `std::string(${cppStringLiteral(named)})`);
|
|
890
|
+
if (converted !== null)
|
|
891
|
+
return converted;
|
|
892
|
+
throw createCppEmitBlockedError(`conversion:string->${representationKey(result)}`, `"name" reads as "string" and this receiver's result is stored as "${representationKey(result)}"; no conversion is installed between them`);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
if (key === 'length') {
|
|
896
|
+
const length = receiver.members.map((declaration) => ctx.classes.get(declaration)?.length ?? null).find((value) => value !== null);
|
|
897
|
+
if (length !== undefined && length !== null) {
|
|
898
|
+
const converted = alignedValueText(ctx, 'class-properties/emit-class-properties.ts:802', { kind: 'scalar', domain: 'number' }, result, `static_cast<double>(${length})`);
|
|
899
|
+
if (converted !== null)
|
|
900
|
+
return converted;
|
|
901
|
+
throw createCppEmitBlockedError(`conversion:${representationKey({ kind: 'scalar', domain: 'number' })}->${representationKey(result)}`, `"length" reads as "number" and this receiver's result is stored as "${representationKey(result)}"; no conversion is installed between them`);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
throw createCppEmitBlockedError(`property-access:${representationKey(receiver)}:get:false`, `"${key}" is not a static field, accessor or method of class ${receiver.members.join('|')} or of any class it extends`);
|
|
905
|
+
};
|
|
906
|
+
export const classConstructorStaticMemberText = (ctx, operation) => {
|
|
907
|
+
const receiver = operation.receiver.representation;
|
|
908
|
+
if (receiver.kind !== 'constructor-family')
|
|
909
|
+
return null;
|
|
910
|
+
const key = ctx.staticKeyTexts.get(operation.key.value);
|
|
911
|
+
// A key only known at runtime is a dispatch over every static member the
|
|
912
|
+
// class declares, rendered by `emit-dynamic-properties.ts`'s
|
|
913
|
+
// `constructorFamilyComputedGetText` from this file's per-key renderer.
|
|
914
|
+
if (key === undefined)
|
|
915
|
+
return null;
|
|
916
|
+
return classConstructorStaticMemberTextFor(ctx, receiver, key, operation.result.representation, () => operandText(ctx, operation.receiver));
|
|
917
|
+
};
|