@geastack/compiler 1.0.26 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-coverage.js +2 -2
- package/dist/cli-emit.js +36 -12
- package/dist/compiler.d.ts +11 -9
- package/dist/compiler.js +264 -43
- package/dist/conversion/algebra.d.ts +84 -4
- package/dist/conversion/algebra.js +39 -0
- package/dist/conversion/array-view.d.ts +63 -0
- package/dist/conversion/array-view.js +186 -0
- package/dist/conversion/build.d.ts +8 -8
- package/dist/conversion/build.js +56 -50
- package/dist/conversion/certified-iterator-object-view.d.ts +13 -0
- package/dist/conversion/certified-iterator-object-view.js +31 -0
- package/dist/conversion/certified-iterator-protocols.d.ts +23 -0
- package/dist/conversion/certified-iterator-protocols.js +50 -0
- package/dist/conversion/checked-native-field-read.d.ts +7 -0
- package/dist/conversion/checked-native-field-read.js +36 -0
- package/dist/conversion/constructor-identity-family.d.ts +6 -6
- package/dist/conversion/constructor-identity-family.js +3 -3
- package/dist/conversion/derive.js +11 -8
- package/dist/conversion/dictionary-view.d.ts +114 -0
- package/dist/conversion/dictionary-view.js +275 -0
- package/dist/conversion/document-record-view.d.ts +89 -0
- package/dist/conversion/document-record-view.js +269 -0
- package/dist/conversion/dynamic-result-carriers.d.ts +6 -0
- package/dist/conversion/dynamic-result-carriers.js +43 -0
- package/dist/conversion/dynamic-wrapper.d.ts +52 -0
- package/dist/conversion/dynamic-wrapper.js +82 -0
- package/dist/conversion/impossible-field-read.d.ts +9 -0
- package/dist/conversion/impossible-field-read.js +28 -0
- package/dist/conversion/iterable-object-view.d.ts +1 -1
- package/dist/conversion/iterator-object-view.d.ts +2 -2
- package/dist/conversion/native-absence.d.ts +4 -0
- package/dist/conversion/native-absence.js +4 -0
- package/dist/conversion/native-buffer-method.d.ts +16 -0
- package/dist/conversion/native-buffer-method.js +37 -0
- package/dist/conversion/native-callable-adapter.d.ts +13 -0
- package/dist/conversion/native-callable-adapter.js +73 -0
- package/dist/conversion/native-descriptor-snapshot.d.ts +30 -0
- package/dist/conversion/native-descriptor-snapshot.js +75 -0
- package/dist/conversion/native-entry-writer.d.ts +21 -0
- package/dist/conversion/native-entry-writer.js +32 -0
- package/dist/conversion/native-field-view.d.ts +42 -0
- package/dist/conversion/native-field-view.js +145 -0
- package/dist/conversion/native-logical-receiver.d.ts +11 -0
- package/dist/conversion/native-logical-receiver.js +19 -0
- package/dist/conversion/native-method.d.ts +43 -0
- package/dist/conversion/native-method.js +56 -0
- package/dist/conversion/native-object-sample.d.ts +30 -0
- package/dist/conversion/native-object-sample.js +37 -0
- package/dist/conversion/native-payload-transport.d.ts +1 -1
- package/dist/conversion/native-payload-transport.js +1 -1
- package/dist/conversion/native-record-products.d.ts +15 -0
- package/dist/conversion/native-record-products.js +73 -0
- package/dist/conversion/native-selection.d.ts +18 -1
- package/dist/conversion/native-selection.js +117 -4
- package/dist/conversion/native-sum.d.ts +27 -0
- package/dist/conversion/native-sum.js +74 -9
- package/dist/conversion/native-view-origins.d.ts +12 -0
- package/dist/conversion/native-view-origins.js +97 -0
- package/dist/conversion/nodes.d.ts +75 -7
- package/dist/conversion/nodes.js +694 -19
- package/dist/conversion/number-storage.d.ts +8 -0
- package/dist/conversion/number-storage.js +8 -0
- package/dist/conversion/operand-view.js +10 -1
- package/dist/conversion/promise-adoption.d.ts +15 -0
- package/dist/conversion/promise-adoption.js +29 -0
- package/dist/conversion/protocol-iterator.d.ts +3 -3
- package/dist/conversion/recipe-closure.d.ts +14 -0
- package/dist/conversion/recipe-closure.js +135 -0
- package/dist/conversion/record-view.d.ts +51 -26
- package/dist/conversion/record-view.js +160 -97
- package/dist/conversion/registry.d.ts +18 -2
- package/dist/conversion/sibling-class.d.ts +4 -0
- package/dist/conversion/sibling-class.js +7 -0
- package/dist/conversion/structural-plan.d.ts +87 -0
- package/dist/conversion/structural-plan.js +480 -0
- package/dist/ir/absent-class-arm.d.ts +1 -1
- package/dist/ir/absent-class-arm.js +1 -1
- package/dist/ir/async-result-conventions.d.ts +15 -0
- package/dist/ir/async-result-conventions.js +140 -0
- package/dist/ir/borrowed-call-arguments.d.ts +3 -3
- package/dist/ir/borrowed-call-arguments.js +9 -9
- package/dist/ir/build.d.ts +20 -29
- package/dist/ir/build.js +116 -19
- package/dist/ir/call-dispatch.js +153 -40
- package/dist/ir/call-entry.d.ts +14 -3
- package/dist/ir/call-entry.js +63 -5
- package/dist/ir/callable-class-flow.d.ts +48 -3
- package/dist/ir/callable-class-flow.js +1509 -81
- package/dist/ir/callable-flow-candidates.d.ts +25 -0
- package/dist/ir/callable-flow-candidates.js +135 -0
- package/dist/ir/callable-identity-demand.d.ts +2 -2
- package/dist/ir/callable-identity-demand.js +33 -1
- package/dist/ir/callable-member-candidates.d.ts +1 -1
- package/dist/ir/callable-member-candidates.js +2 -2
- package/dist/ir/callable-records.js +1 -0
- package/dist/ir/callable-site-escape.js +3 -4
- package/dist/ir/captures.js +1 -1
- package/dist/ir/certificate.d.ts +1 -0
- package/dist/ir/certificate.js +2 -1
- package/dist/ir/certify/carrier-keys.d.ts +2 -2
- package/dist/ir/certify/carrier-keys.js +4 -4
- package/dist/ir/certify/has-property-key.d.ts +3 -3
- package/dist/ir/certify/has-property-key.js +3 -3
- package/dist/ir/certify/parallel-region.d.ts +26 -0
- package/dist/ir/certify/parallel-region.js +1331 -0
- package/dist/ir/certify/property-access-keys.d.ts +11 -11
- package/dist/ir/certify/property-access-keys.js +11 -11
- package/dist/ir/certify/property-access.js +7 -9
- package/dist/ir/certify.d.ts +66 -3
- package/dist/ir/certify.js +1197 -36
- package/dist/ir/class-allocation-domain.d.ts +9 -0
- package/dist/ir/class-allocation-domain.js +111 -0
- package/dist/ir/class-evaluation.d.ts +2 -3
- package/dist/ir/class-evaluation.js +2 -3
- package/dist/ir/class-static-fields.d.ts +12 -1
- package/dist/ir/class-static-fields.js +25 -0
- package/dist/ir/closed-normal-results.d.ts +18 -0
- package/dist/ir/closed-normal-results.js +208 -0
- package/dist/ir/construct-entry.js +1 -0
- package/dist/ir/construction-only-fields.d.ts +20 -1
- package/dist/ir/construction-only-fields.js +95 -9
- package/dist/ir/convert-carriers.d.ts +7 -0
- package/dist/ir/convert-carriers.js +12 -0
- package/dist/ir/coroutine-bodies.d.ts +74 -0
- package/dist/ir/coroutine-bodies.js +93 -0
- package/dist/ir/dead-logical-merge.d.ts +7 -0
- package/dist/ir/dead-logical-merge.js +84 -0
- package/dist/ir/dead-values.d.ts +7 -5
- package/dist/ir/dead-values.js +34 -5
- package/dist/ir/deferral.d.ts +3 -1
- package/dist/ir/deferral.js +19 -6
- package/dist/ir/dense-loops.d.ts +96 -7
- package/dist/ir/dense-loops.js +333 -17
- package/dist/ir/descriptor-own-protocol.d.ts +12 -0
- package/dist/ir/descriptor-own-protocol.js +35 -0
- package/dist/ir/dynamic-constructor-conversions.d.ts +17 -0
- package/dist/ir/dynamic-constructor-conversions.js +52 -0
- package/dist/ir/emission-representations.js +44 -2
- package/dist/ir/facts.d.ts +14 -2
- package/dist/ir/facts.js +23 -9
- package/dist/ir/fixed-data-definition-attributes.d.ts +10 -0
- package/dist/ir/fixed-data-definition-attributes.js +200 -0
- package/dist/ir/fixed-data-definition.d.ts +23 -5
- package/dist/ir/fixed-data-definition.js +80 -2
- package/dist/ir/function-reflection-demand.d.ts +11 -0
- package/dist/ir/function-reflection-demand.js +71 -0
- package/dist/ir/generic-call-entry.d.ts +18 -0
- package/dist/ir/generic-call-entry.js +94 -0
- package/dist/ir/hoist.d.ts +16 -3
- package/dist/ir/hoist.js +121 -8
- package/dist/ir/host-method-aliases.d.ts +15 -0
- package/dist/ir/host-method-aliases.js +61 -0
- package/dist/ir/host-namespace-reads.d.ts +24 -0
- package/dist/ir/host-namespace-reads.js +151 -0
- package/dist/ir/host-promise-conversions.d.ts +5 -0
- package/dist/ir/host-promise-conversions.js +61 -0
- package/dist/ir/host-template-conversions.d.ts +34 -0
- package/dist/ir/host-template-conversions.js +357 -0
- package/dist/ir/instance-reparenting.d.ts +3 -4
- package/dist/ir/instantiation.d.ts +1 -1
- package/dist/ir/instantiation.js +1 -1
- package/dist/ir/integer-storage.d.ts +19 -9
- package/dist/ir/integer-storage.js +158 -44
- package/dist/ir/integers.d.ts +34 -7
- package/dist/ir/integers.js +240 -7
- package/dist/ir/integrity-restrictions.d.ts +4 -4
- package/dist/ir/integrity-restrictions.js +7 -4
- package/dist/ir/internal-operation-conversions.d.ts +7 -0
- package/dist/ir/internal-operation-conversions.js +195 -0
- package/dist/ir/intrinsic-call-facts.d.ts +40 -0
- package/dist/ir/intrinsic-call-facts.js +176 -0
- package/dist/ir/key-order-observation.d.ts +1 -1
- package/dist/ir/lazy-splits.d.ts +20 -0
- package/dist/ir/lazy-splits.js +58 -0
- package/dist/ir/literal-set-membership.d.ts +2 -2
- package/dist/ir/literal-set-membership.js +2 -2
- package/dist/ir/logical-receivers.d.ts +15 -0
- package/dist/ir/logical-receivers.js +98 -0
- package/dist/ir/lower-allocation.js +16 -13
- package/dist/ir/lower-destructuring.js +7 -6
- package/dist/ir/lower-graph.d.ts +4 -4
- package/dist/ir/lower-graph.js +2 -2
- package/dist/ir/lower-invocation.d.ts +2 -2
- package/dist/ir/lower-invocation.js +99 -57
- package/dist/ir/lower-narrow.js +35 -13
- package/dist/ir/lower-operands.d.ts +40 -11
- package/dist/ir/lower-operands.js +206 -87
- package/dist/ir/lower-property.js +31 -8
- package/dist/ir/lower.js +9 -9
- package/dist/ir/merge-conversions.d.ts +18 -0
- package/dist/ir/merge-conversions.js +106 -0
- package/dist/ir/model.d.ts +138 -28
- package/dist/ir/native-accessor-definition.d.ts +104 -0
- package/dist/ir/native-accessor-definition.js +735 -0
- package/dist/ir/native-array-descriptor-snapshot.d.ts +45 -0
- package/dist/ir/native-array-descriptor-snapshot.js +380 -0
- package/dist/ir/native-array-insertion.d.ts +16 -0
- package/dist/ir/native-array-insertion.js +42 -0
- package/dist/ir/native-callable-argument.d.ts +38 -0
- package/dist/ir/native-callable-argument.js +128 -0
- package/dist/ir/native-callable-data-flow.d.ts +9 -0
- package/dist/ir/native-callable-data-flow.js +59 -0
- package/dist/ir/native-callable-data-owner.d.ts +45 -0
- package/dist/ir/native-callable-data-owner.js +755 -0
- package/dist/ir/native-callable-data-reads.d.ts +45 -0
- package/dist/ir/native-callable-data-reads.js +282 -0
- package/dist/ir/native-callable-data-slots.d.ts +78 -0
- package/dist/ir/native-callable-data-slots.js +403 -0
- package/dist/ir/native-callable-data-write.d.ts +58 -0
- package/dist/ir/native-callable-data-write.js +254 -0
- package/dist/ir/native-callable-integrity.d.ts +23 -0
- package/dist/ir/native-callable-integrity.js +77 -0
- package/dist/ir/native-callable-own-property.d.ts +42 -0
- package/dist/ir/native-callable-own-property.js +505 -0
- package/dist/ir/native-callable-prototype.d.ts +38 -0
- package/dist/ir/native-callable-prototype.js +307 -0
- package/dist/ir/native-callable-readonly-set.d.ts +25 -0
- package/dist/ir/native-callable-readonly-set.js +238 -0
- package/dist/ir/native-class-accessor.d.ts +3 -3
- package/dist/ir/native-class-accessor.js +3 -3
- package/dist/ir/native-class-construction.js +2 -2
- package/dist/ir/native-constructor-reads.d.ts +15 -0
- package/dist/ir/native-constructor-reads.js +156 -0
- package/dist/ir/native-constructor-static.d.ts +18 -0
- package/dist/ir/native-constructor-static.js +61 -0
- package/dist/ir/native-data-definition.d.ts +43 -0
- package/dist/ir/native-data-definition.js +222 -0
- package/dist/ir/native-document-array-entries.d.ts +15 -0
- package/dist/ir/native-document-array-entries.js +37 -0
- package/dist/ir/native-document-entries.d.ts +21 -0
- package/dist/ir/native-document-entries.js +74 -0
- package/dist/ir/native-entry-field-views.d.ts +18 -0
- package/dist/ir/native-entry-field-views.js +62 -0
- package/dist/ir/native-field-view-domains.d.ts +43 -0
- package/dist/ir/native-field-view-domains.js +300 -0
- package/dist/ir/native-field-view-facts.d.ts +97 -0
- package/dist/ir/native-field-view-facts.js +341 -0
- package/dist/ir/native-fixed-layout.js +1 -1
- package/dist/ir/native-host-construction.d.ts +4 -6
- package/dist/ir/native-host-construction.js +4 -6
- package/dist/ir/native-host-method-reads.d.ts +13 -0
- package/dist/ir/native-host-method-reads.js +53 -0
- package/dist/ir/native-iterator-field-views.d.ts +15 -0
- package/dist/ir/native-iterator-field-views.js +39 -0
- package/dist/ir/native-iterator-receivers.d.ts +8 -0
- package/dist/ir/native-iterator-receivers.js +59 -0
- package/dist/ir/native-logical-receiver-body.d.ts +8 -0
- package/dist/ir/native-logical-receiver-body.js +23 -0
- package/dist/ir/native-method-frames.d.ts +18 -0
- package/dist/ir/native-method-frames.js +127 -0
- package/dist/ir/native-method-read-source.d.ts +16 -0
- package/dist/ir/native-method-read-source.js +61 -0
- package/dist/ir/native-object-data-slots.d.ts +60 -0
- package/dist/ir/native-object-data-slots.js +493 -0
- package/dist/ir/native-object-sample.d.ts +32 -0
- package/dist/ir/native-object-sample.js +113 -0
- package/dist/ir/native-own-assignment.d.ts +123 -0
- package/dist/ir/native-own-assignment.js +529 -0
- package/dist/ir/native-property-coercibility.d.ts +3 -0
- package/dist/ir/native-property-coercibility.js +10 -0
- package/dist/ir/native-property-key-texts.d.ts +11 -0
- package/dist/ir/native-property-key-texts.js +41 -0
- package/dist/ir/native-property-presence-effects.d.ts +11 -0
- package/dist/ir/native-property-presence-effects.js +19 -0
- package/dist/ir/native-property-presence.d.ts +27 -0
- package/dist/ir/native-property-presence.js +275 -0
- package/dist/ir/native-prototype-calls.d.ts +19 -0
- package/dist/ir/native-prototype-calls.js +53 -0
- package/dist/ir/native-prototype-conversions.d.ts +5 -0
- package/dist/ir/native-prototype-conversions.js +46 -0
- package/dist/ir/native-prototype-presence-demand.d.ts +9 -0
- package/dist/ir/native-prototype-presence-demand.js +58 -0
- package/dist/ir/native-record-index.d.ts +1 -1
- package/dist/ir/native-union-method-targets.d.ts +8 -0
- package/dist/ir/native-union-method-targets.js +69 -0
- package/dist/ir/no-normal-call-completion.d.ts +15 -0
- package/dist/ir/no-normal-call-completion.js +184 -0
- package/dist/ir/non-normal-receiver.d.ts +39 -0
- package/dist/ir/non-normal-receiver.js +253 -0
- package/dist/ir/operation-conversions.d.ts +29 -0
- package/dist/ir/operation-conversions.js +484 -0
- package/dist/ir/operation-index.d.ts +1 -1
- package/dist/ir/presence-proof.d.ts +1 -1
- package/dist/ir/presence-proof.js +1 -0
- package/dist/ir/program-conversions.d.ts +48 -0
- package/dist/ir/program-conversions.js +221 -0
- package/dist/ir/program-facts.d.ts +4 -1
- package/dist/ir/program-facts.js +9 -7
- package/dist/ir/promise-reaction-conversions.d.ts +6 -0
- package/dist/ir/promise-reaction-conversions.js +92 -0
- package/dist/ir/property-read-conversions.d.ts +10 -0
- package/dist/ir/property-read-conversions.js +124 -0
- package/dist/ir/proven-branches.d.ts +2 -1
- package/dist/ir/proven-branches.js +97 -10
- package/dist/ir/publish-conversion-recipes.d.ts +27 -0
- package/dist/ir/publish-conversion-recipes.js +246 -0
- package/dist/ir/publish-native-field-view-facts.d.ts +17 -0
- package/dist/ir/publish-native-field-view-facts.js +119 -0
- package/dist/ir/queries.js +42 -4
- package/dist/ir/read-only-dictionary.d.ts +38 -0
- package/dist/ir/read-only-dictionary.js +281 -0
- package/dist/ir/reflection-demand.d.ts +2 -0
- package/dist/ir/reflection-demand.js +600 -44
- package/dist/ir/shake.d.ts +3 -0
- package/dist/ir/shake.js +24 -14
- package/dist/ir/shared-empty-records.js +1 -1
- package/dist/ir/short-circuit-threading.d.ts +23 -0
- package/dist/ir/short-circuit-threading.js +133 -0
- package/dist/ir/spread-conversions.d.ts +27 -0
- package/dist/ir/spread-conversions.js +134 -0
- package/dist/ir/spread-copy-elision.d.ts +2 -2
- package/dist/ir/spread-copy-elision.js +7 -4
- package/dist/ir/string-layout-reuse.d.ts +9 -8
- package/dist/ir/string-layout-reuse.js +8 -16
- package/dist/ir/string-length-reuse.d.ts +20 -4
- package/dist/ir/string-length-reuse.js +57 -13
- package/dist/ir/transfer.d.ts +5 -5
- package/dist/ir/transfer.js +53 -31
- package/dist/ir/typed-property-access.d.ts +2 -0
- package/dist/ir/typed-property-access.js +21 -8
- package/dist/ir/virtual-call-frames.d.ts +7 -0
- package/dist/ir/virtual-call-frames.js +8 -0
- package/dist/native-signatures.d.ts +45 -0
- package/dist/native-signatures.js +368 -0
- package/dist/plugins/gea/host.d.ts +6 -1
- package/dist/plugins/gea/host.js +30 -1
- package/dist/plugins/gea/lower.js +9 -3
- package/dist/plugins/gea/members.js +1 -1
- package/dist/plugins/gea/plugin.js +2 -1
- package/dist/plugins/gea/prelude.d.ts +1 -1
- package/dist/plugins/gea/prelude.js +1 -1
- package/dist/plugins/gea/reactive-slots.js +6 -6
- package/dist/plugins/gea/render-bridge.js +5 -6
- package/dist/plugins/gea/user-agent-styles.js +1 -1
- package/dist/plugins/installed.d.ts +2 -2
- package/dist/plugins/installed.js +2 -2
- package/dist/plugins/load.js +1 -1
- package/dist/plugins/model.d.ts +21 -36
- package/dist/plugins/webgl/host.d.ts +23 -23
- package/dist/plugins/webgl/host.js +25 -26
- package/dist/plugins/webgl/plugin.d.ts +16 -19
- package/dist/plugins/webgl/plugin.js +16 -23
- package/dist/project-preparation.js +12 -14
- package/dist/projection/abi.js +13 -10
- package/dist/projection/bindings.d.ts +8 -0
- package/dist/projection/bindings.js +36 -5
- package/dist/projection/callee.d.ts +17 -15
- package/dist/projection/callee.js +108 -81
- package/dist/projection/class-property-presence.d.ts +1 -1
- package/dist/projection/class-property-presence.js +1 -1
- package/dist/projection/classes.d.ts +2 -0
- package/dist/projection/classes.js +4 -1
- package/dist/projection/dispatch.d.ts +19 -3
- package/dist/projection/dispatch.js +39 -16
- package/dist/projection/fields.d.ts +14 -2
- package/dist/projection/fields.js +100 -38
- package/dist/projection/function-source.d.ts +5 -0
- package/dist/projection/function-source.js +15 -0
- package/dist/projection/immediate-callees.d.ts +12 -0
- package/dist/projection/immediate-callees.js +36 -0
- package/dist/projection/index-protocols.d.ts +12 -0
- package/dist/projection/index-protocols.js +39 -0
- package/dist/projection/instance-test.d.ts +8 -0
- package/dist/projection/instance-test.js +3 -1
- package/dist/projection/method-values.d.ts +7 -0
- package/dist/projection/method-values.js +29 -0
- package/dist/projection/native-accessor-access.d.ts +26 -0
- package/dist/projection/native-accessor-access.js +18 -0
- package/dist/projection/native-callable-data.d.ts +24 -0
- package/dist/projection/native-callable-data.js +101 -0
- package/dist/projection/native-expando.d.ts +3 -0
- package/dist/projection/native-expando.js +13 -0
- package/dist/projection/native-object-data.d.ts +47 -0
- package/dist/projection/native-object-data.js +203 -0
- package/dist/projection/native-prototype-methods.d.ts +22 -0
- package/dist/projection/native-prototype-methods.js +161 -0
- package/dist/projection/regexp-fields.d.ts +35 -0
- package/dist/projection/regexp-fields.js +80 -0
- package/dist/projection/slots.d.ts +5 -1
- package/dist/projection/slots.js +89 -10
- package/dist/representation/derive.d.ts +5 -7
- package/dist/representation/derive.js +78 -78
- package/dist/representation/difference.js +1 -1
- package/dist/representation/host-abi.d.ts +2 -2
- package/dist/representation/host-abi.js +4 -5
- package/dist/representation/host-templates.d.ts +6 -2
- package/dist/representation/host-templates.js +8 -2
- package/dist/representation/intersection.d.ts +3 -3
- package/dist/representation/intersection.js +3 -3
- package/dist/representation/merge.js +1 -1
- package/dist/representation/model.d.ts +27 -22
- package/dist/representation/model.js +35 -22
- package/dist/representation/native-callable-data-storage.d.ts +85 -0
- package/dist/representation/native-callable-data-storage.js +398 -0
- package/dist/representation/native-data-properties.d.ts +14 -0
- package/dist/representation/native-data-properties.js +52 -0
- package/dist/representation/native-logical-receiver.d.ts +36 -0
- package/dist/representation/native-logical-receiver.js +92 -0
- package/dist/representation/object-shape.d.ts +1 -1
- package/dist/representation/object-shape.js +1 -1
- package/dist/representation/optional.js +2 -2
- package/dist/representation/physical-carrier.d.ts +25 -0
- package/dist/representation/physical-carrier.js +153 -0
- package/dist/representation/policies.d.ts +16 -10
- package/dist/representation/policies.js +5 -1
- package/dist/representation/primitives.js +3 -0
- package/dist/representation/promise-resolution.d.ts +19 -0
- package/dist/representation/promise-resolution.js +50 -0
- package/dist/representation/prototype-domains.d.ts +43 -0
- package/dist/representation/prototype-domains.js +226 -0
- package/dist/representation/proxy-carriers.d.ts +3 -3
- package/dist/representation/proxy-carriers.js +2 -3
- package/dist/representation/publish.d.ts +4 -0
- package/dist/representation/publish.js +73 -42
- package/dist/representation/record-fields.d.ts +2 -2
- package/dist/representation/record-fields.js +2 -2
- package/dist/representation/static-field-cells.d.ts +1 -1
- package/dist/representation/structural-method-abi.d.ts +6 -0
- package/dist/representation/structural-method-abi.js +13 -0
- package/dist/representation/unassigned-binding-cells.d.ts +3 -3
- package/dist/representation/union.js +19 -4
- package/dist/representation/unwritten-record-members.d.ts +6 -6
- package/dist/representation/unwritten-record-members.js +1 -1
- package/dist/representation/value-records.js +77 -5
- package/dist/representation/verify.js +1 -1
- package/dist/representation/well-known-symbols.d.ts +3 -0
- package/dist/representation/well-known-symbols.js +11 -0
- package/dist/semantics/alias-this-field-declaration-transform.js +3 -3
- package/dist/semantics/ambient-type-realization-transform.d.ts +19 -20
- package/dist/semantics/ambient-type-realization-transform.js +20 -12
- package/dist/semantics/ambient.d.ts +13 -13
- package/dist/semantics/ambient.js +12 -12
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.d.ts +5 -0
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +110 -52
- package/dist/semantics/borrowed-method-receiver-copy-source-transform.d.ts +4 -4
- package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +4 -4
- package/dist/semantics/call-invalidated-narrowing.js +2 -2
- package/dist/semantics/callable-origins.d.ts +49 -1
- package/dist/semantics/callable-origins.js +148 -32
- package/dist/semantics/callable-own-data-slots.d.ts +122 -0
- package/dist/semantics/callable-own-data-slots.js +421 -0
- package/dist/semantics/class-alias.d.ts +4 -4
- package/dist/semantics/class-alias.js +4 -4
- package/dist/semantics/class-heritage.d.ts +8 -7
- package/dist/semantics/class-heritage.js +8 -7
- package/dist/semantics/commonjs-wrapper.js +5 -2
- package/dist/semantics/constructor-function-class-source-transform.js +2 -3
- package/dist/semantics/constructor-slot-subclasses.d.ts +1 -1
- package/dist/semantics/constructor-slot-subclasses.js +5 -5
- package/dist/semantics/declaration-overlay-transform.d.ts +9 -12
- package/dist/semantics/declaration-overlay-transform.js +138 -141
- package/dist/semantics/declared-integers.d.ts +24 -0
- package/dist/semantics/declared-integers.js +34 -0
- package/dist/semantics/define-property-source-transform.js +21 -8
- package/dist/semantics/dynamic-fallback.d.ts +1 -1
- package/dist/semantics/dynamic-fallback.js +1 -1
- package/dist/semantics/frontend.d.ts +12 -16
- package/dist/semantics/frontend.js +187 -75
- package/dist/semantics/host-methods.d.ts +3 -3
- package/dist/semantics/host-methods.js +1 -1
- package/dist/semantics/host-protocols.d.ts +3 -3
- package/dist/semantics/host-protocols.js +26 -26
- package/dist/semantics/interface-families.d.ts +2 -2
- package/dist/semantics/interface-families.js +46 -47
- package/dist/semantics/interface-implementors.d.ts +12 -15
- package/dist/semantics/interface-implementors.js +12 -15
- package/dist/semantics/jsdoc-namepath-transform.js +7 -7
- package/dist/semantics/model/operands.d.ts +18 -3
- package/dist/semantics/model/operands.js +41 -0
- package/dist/semantics/model/operations.d.ts +82 -1
- package/dist/semantics/model/selected-signature.d.ts +24 -3
- package/dist/semantics/model/structural-type-table.js +24 -6
- package/dist/semantics/model/structural-types.d.ts +10 -8
- package/dist/semantics/model/structural-types.js +7 -5
- package/dist/semantics/module-resolution.js +3 -2
- package/dist/semantics/native-callable-readonly-set.d.ts +17 -0
- package/dist/semantics/native-callable-readonly-set.js +1 -0
- package/dist/semantics/native-function-signatures.d.ts +14 -0
- package/dist/semantics/native-function-signatures.js +96 -0
- package/dist/semantics/native-object-data-slots.d.ts +72 -0
- package/dist/semantics/native-object-data-slots.js +679 -0
- package/dist/semantics/native-own-assignment.d.ts +62 -0
- package/dist/semantics/native-own-assignment.js +1 -0
- package/dist/semantics/normalize/absent-globals.d.ts +8 -8
- package/dist/semantics/normalize/absent-globals.js +5 -5
- package/dist/semantics/normalize/arguments-objects.d.ts +3 -1
- package/dist/semantics/normalize/arguments-objects.js +1 -1
- package/dist/semantics/normalize/asserted-argument-arms.d.ts +7 -7
- package/dist/semantics/normalize/asserted-arm-absence.d.ts +1 -2
- package/dist/semantics/normalize/asserted-arm-absence.js +1 -2
- package/dist/semantics/normalize/binding-fixpoint.js +3 -3
- package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +2 -2
- package/dist/semantics/normalize/bivariant-slot-parameter.js +6 -6
- package/dist/semantics/normalize/callable-data-write.d.ts +46 -0
- package/dist/semantics/normalize/callable-data-write.js +182 -0
- package/dist/semantics/normalize/census.js +5 -5
- package/dist/semantics/normalize/class-instance-record-statement.d.ts +1 -1
- package/dist/semantics/normalize/class-instance-record-statement.js +1 -1
- package/dist/semantics/normalize/collection-bindings.d.ts +11 -13
- package/dist/semantics/normalize/collection-bindings.js +60 -33
- package/dist/semantics/normalize/commonjs-module-record.d.ts +7 -4
- package/dist/semantics/normalize/commonjs-module-record.js +93 -4
- package/dist/semantics/normalize/contribution.js +4 -4
- package/dist/semantics/normalize/dead-method-copies.d.ts +5 -5
- package/dist/semantics/normalize/dead-typeof-guards.d.ts +2 -2
- package/dist/semantics/normalize/dead-typeof-guards.js +6 -6
- package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +22 -13
- package/dist/semantics/normalize/deferred-intrinsic-protocols.js +85 -13
- package/dist/semantics/normalize/derived-expression-type.d.ts +129 -91
- package/dist/semantics/normalize/derived-expression-type.js +419 -192
- package/dist/semantics/normalize/field-bindings.d.ts +4 -4
- package/dist/semantics/normalize/field-bindings.js +334 -67
- package/dist/semantics/normalize/flow/array-element-continuation.d.ts +2 -2
- package/dist/semantics/normalize/flow/array-element-continuation.js +35 -18
- package/dist/semantics/normalize/flow/callable-array-origins.d.ts +1 -1
- package/dist/semantics/normalize/flow/callable-array-origins.js +3 -3
- package/dist/semantics/normalize/flow/callable-completions.d.ts +2 -2
- package/dist/semantics/normalize/flow/callable-completions.js +2 -2
- package/dist/semantics/normalize/flow/callable-reach.d.ts +19 -6
- package/dist/semantics/normalize/flow/callable-reach.js +722 -289
- package/dist/semantics/normalize/flow/class-family-member-read.js +24 -29
- package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +2 -2
- package/dist/semantics/normalize/flow/collection-value-continuation.js +2 -2
- package/dist/semantics/normalize/flow/component-solver.d.ts +19 -16
- package/dist/semantics/normalize/flow/component-solver.js +138 -69
- package/dist/semantics/normalize/flow/computed-key-set.d.ts +6 -7
- package/dist/semantics/normalize/flow/computed-key-set.js +20 -1
- package/dist/semantics/normalize/flow/export-importers.js +4 -4
- package/dist/semantics/normalize/flow/host-text-sink.d.ts +3 -2
- package/dist/semantics/normalize/flow/host-text-sink.js +4 -3
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +3 -2
- package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +2 -2
- package/dist/semantics/normalize/flow/intrinsic-data-definition.js +3 -3
- package/dist/semantics/normalize/flow/invocation-facts.d.ts +3 -2
- package/dist/semantics/normalize/flow/invocation-facts.js +3 -3
- package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +12 -6
- package/dist/semantics/normalize/flow/member-call-forwarding.js +94 -21
- package/dist/semantics/normalize/flow/model.d.ts +5 -5
- package/dist/semantics/normalize/flow/model.js +11 -11
- package/dist/semantics/normalize/flow/node-path-token.js +3 -3
- package/dist/semantics/normalize/flow/origin-authority.d.ts +3 -3
- package/dist/semantics/normalize/flow/owned-class-receivers.js +8 -7
- package/dist/semantics/normalize/flow/parameter-values.js +6 -6
- package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +30 -4
- package/dist/semantics/normalize/flow/proof-hypotheses.js +56 -5
- package/dist/semantics/normalize/flow/proof-memo-settlement.d.ts +21 -0
- package/dist/semantics/normalize/flow/proof-memo-settlement.js +32 -0
- package/dist/semantics/normalize/flow/record-alias-closure.d.ts +1 -1
- package/dist/semantics/normalize/flow/record-alias-closure.js +1 -1
- package/dist/semantics/normalize/flow/seeded-origins.d.ts +4 -4
- package/dist/semantics/normalize/flow/seeded-origins.js +4 -4
- package/dist/semantics/normalize/flow/source-accessor-descriptor.d.ts +22 -0
- package/dist/semantics/normalize/flow/source-accessor-descriptor.js +210 -0
- package/dist/semantics/normalize/flow/source-callable-own-data.d.ts +33 -0
- package/dist/semantics/normalize/flow/source-callable-own-data.js +238 -0
- package/dist/semantics/normalize/flow/source-callable-readonly-set.d.ts +26 -0
- package/dist/semantics/normalize/flow/source-callable-readonly-set.js +337 -0
- package/dist/semantics/normalize/flow/source-class-data.d.ts +7 -7
- package/dist/semantics/normalize/flow/source-class-data.js +25 -26
- package/dist/semantics/normalize/flow/source-class-static-data.d.ts +2 -2
- package/dist/semantics/normalize/flow/source-class-static-data.js +2 -2
- package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +15 -0
- package/dist/semantics/normalize/flow/source-commonjs-exports.js +7 -0
- package/dist/semantics/normalize/flow/source-descriptor-protocol.d.ts +20 -0
- package/dist/semantics/normalize/flow/source-descriptor-protocol.js +75 -0
- package/dist/semantics/normalize/flow/source-executing-parameter-values.d.ts +8 -0
- package/dist/semantics/normalize/flow/source-executing-parameter-values.js +93 -0
- package/dist/semantics/normalize/flow/source-global-binding.d.ts +13 -0
- package/dist/semantics/normalize/flow/source-global-binding.js +42 -0
- package/dist/semantics/normalize/flow/source-intrinsic-member-data.d.ts +27 -0
- package/dist/semantics/normalize/flow/source-intrinsic-member-data.js +178 -0
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +31 -11
- package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +7 -3
- package/dist/semantics/normalize/flow/source-invocation-receiver.js +30 -2
- package/dist/semantics/normalize/flow/source-native-class-alias.d.ts +7 -0
- package/dist/semantics/normalize/flow/source-native-class-alias.js +91 -0
- package/dist/semantics/normalize/flow/source-normal-predecessor.d.ts +10 -0
- package/dist/semantics/normalize/flow/source-normal-predecessor.js +90 -0
- package/dist/semantics/normalize/flow/source-property-key.d.ts +3 -0
- package/dist/semantics/normalize/flow/source-property-key.js +7 -0
- package/dist/semantics/normalize/flow/source-read-protocol.d.ts +20 -0
- package/dist/semantics/normalize/flow/source-read-protocol.js +108 -0
- package/dist/semantics/normalize/flow/source-record-data.js +31 -30
- package/dist/semantics/normalize/flow/source-value-session.d.ts +106 -3
- package/dist/semantics/normalize/flow/source-value-session.js +1172 -218
- package/dist/semantics/normalize/flow/standard-prototype-method-source.d.ts +16 -0
- package/dist/semantics/normalize/flow/standard-prototype-method-source.js +64 -0
- package/dist/semantics/normalize/flow/targets.d.ts +13 -14
- package/dist/semantics/normalize/flow/targets.js +20 -23
- package/dist/semantics/normalize/flow/value-flow.d.ts +2 -4
- package/dist/semantics/normalize/flow/value-flow.js +4 -13
- package/dist/semantics/normalize/flow/value-provenance.d.ts +23 -3
- package/dist/semantics/normalize/flow/value-provenance.js +44 -4
- package/dist/semantics/normalize/fresh-dictionary-storage.d.ts +32 -0
- package/dist/semantics/normalize/fresh-dictionary-storage.js +530 -0
- package/dist/semantics/normalize/fresh-indexed-storage.d.ts +43 -0
- package/dist/semantics/normalize/fresh-indexed-storage.js +88 -0
- package/dist/semantics/normalize/fresh-ordinary-object.d.ts +8 -0
- package/dist/semantics/normalize/fresh-ordinary-object.js +27 -0
- package/dist/semantics/normalize/gating.js +2 -2
- package/dist/semantics/normalize/global-host-mutations.js +770 -261
- package/dist/semantics/normalize/host-effect-contracts.d.ts +1 -1
- package/dist/semantics/normalize/host-effect-contracts.js +1 -1
- package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +2 -2
- package/dist/semantics/normalize/host-mutation-computed-keys.js +8 -0
- package/dist/semantics/normalize/host-mutation-key-reader.d.ts +6 -11
- package/dist/semantics/normalize/host-mutation-key-reader.js +11 -28
- package/dist/semantics/normalize/host-mutation-keys.d.ts +11 -7
- package/dist/semantics/normalize/host-mutation-keys.js +26 -15
- package/dist/semantics/normalize/identities.js +20 -17
- package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +8 -3
- package/dist/semantics/normalize/implicit-arguments-tuple.js +21 -4
- package/dist/semantics/normalize/installed-global-properties.d.ts +17 -0
- package/dist/semantics/normalize/installed-global-properties.js +214 -0
- package/dist/semantics/normalize/instantiation.js +6 -6
- package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +1 -1
- package/dist/semantics/normalize/intrinsic-property-call.d.ts +6 -1
- package/dist/semantics/normalize/intrinsic-property-call.js +19 -0
- package/dist/semantics/normalize/intrinsic-prototype.d.ts +7 -0
- package/dist/semantics/normalize/intrinsic-prototype.js +10 -0
- package/dist/semantics/normalize/intrinsic-return-identity.d.ts +5 -0
- package/dist/semantics/normalize/intrinsic-return-identity.js +29 -0
- package/dist/semantics/normalize/jsdoc-type-names.js +59 -63
- package/dist/semantics/normalize/keyof.js +3 -3
- package/dist/semantics/normalize/local-bindings.d.ts +4 -4
- package/dist/semantics/normalize/local-bindings.js +60 -61
- package/dist/semantics/normalize/logical-object-truthiness.d.ts +8 -0
- package/dist/semantics/normalize/logical-object-truthiness.js +20 -0
- package/dist/semantics/normalize/merged-declaration.d.ts +3 -3
- package/dist/semantics/normalize/merged-declaration.js +3 -3
- package/dist/semantics/normalize/never-override-result.d.ts +2 -3
- package/dist/semantics/normalize/never-override-result.js +2 -3
- package/dist/semantics/normalize/null-blind-parameter.d.ts +2 -2
- package/dist/semantics/normalize/null-blind-parameter.js +2 -2
- package/dist/semantics/normalize/object-bag-bindings.d.ts +19 -19
- package/dist/semantics/normalize/object-bag-bindings.js +334 -141
- package/dist/semantics/normalize/omitted-stated-parameter.d.ts +8 -8
- package/dist/semantics/normalize/omitted-stated-parameter.js +8 -9
- package/dist/semantics/normalize/override-field-arms.d.ts +3 -3
- package/dist/semantics/normalize/override-field-arms.js +15 -16
- package/dist/semantics/normalize/parameter-bindings.d.ts +13 -12
- package/dist/semantics/normalize/parameter-bindings.js +173 -139
- package/dist/semantics/normalize/parameter-slot.d.ts +9 -10
- package/dist/semantics/normalize/parameter-slot.js +16 -17
- package/dist/semantics/normalize/physical-overload-result.d.ts +8 -8
- package/dist/semantics/normalize/physical-overload-result.js +10 -10
- package/dist/semantics/normalize/producer-context.d.ts +27 -12
- package/dist/semantics/normalize/producers/allocations.js +5 -1
- package/dist/semantics/normalize/producers/bindings.js +8 -7
- package/dist/semantics/normalize/producers/class-lifecycle.js +52 -7
- package/dist/semantics/normalize/producers/computations.js +27 -3
- package/dist/semantics/normalize/producers/control.js +5 -5
- package/dist/semantics/normalize/producers/declaration-lifecycle.js +4 -4
- package/dist/semantics/normalize/producers/destructuring.js +10 -5
- package/dist/semantics/normalize/producers/erasure.d.ts +9 -0
- package/dist/semantics/normalize/producers/erasure.js +22 -0
- package/dist/semantics/normalize/producers/invocations.d.ts +1 -1
- package/dist/semantics/normalize/producers/invocations.js +200 -55
- package/dist/semantics/normalize/producers/logical-merge-type.d.ts +2 -2
- package/dist/semantics/normalize/producers/logical-merge-type.js +12 -12
- package/dist/semantics/normalize/producers/native-callable-readonly-set.d.ts +6 -0
- package/dist/semantics/normalize/producers/native-callable-readonly-set.js +24 -0
- package/dist/semantics/normalize/producers/native-own-assignment.d.ts +14 -0
- package/dist/semantics/normalize/producers/native-own-assignment.js +153 -0
- package/dist/semantics/normalize/producers/properties.js +153 -20
- package/dist/semantics/normalize/producers/protocol.js +4 -4
- package/dist/semantics/normalize/producers/references.js +21 -19
- package/dist/semantics/normalize/producers/shared.d.ts +1 -1
- package/dist/semantics/normalize/producers/shared.js +59 -58
- package/dist/semantics/normalize/producers/spread-arguments.js +7 -3
- package/dist/semantics/normalize/producers/tuple-spread.d.ts +2 -2
- package/dist/semantics/normalize/producers/tuple-spread.js +5 -5
- package/dist/semantics/normalize/property-key-domain.d.ts +6 -6
- package/dist/semantics/normalize/property-key-domain.js +7 -7
- package/dist/semantics/normalize/reachability.d.ts +6 -7
- package/dist/semantics/normalize/reachability.js +60 -62
- package/dist/semantics/normalize/record-home-arms.js +2 -3
- package/dist/semantics/normalize/record-link-families.d.ts +1 -1
- package/dist/semantics/normalize/record-link-families.js +1 -1
- package/dist/semantics/normalize/record-stand-in-arms.d.ts +4 -5
- package/dist/semantics/normalize/return-bindings.d.ts +19 -9
- package/dist/semantics/normalize/return-bindings.js +49 -41
- package/dist/semantics/normalize/script-global-redefinition.d.ts +1 -1
- package/dist/semantics/normalize/script-global-redefinition.js +1 -1
- package/dist/semantics/normalize/shared-array-storage.d.ts +4 -5
- package/dist/semantics/normalize/shared-array-storage.js +7 -8
- package/dist/semantics/normalize/sloppy-absence.d.ts +6 -3
- package/dist/semantics/normalize/sloppy-absence.js +7 -3
- package/dist/semantics/normalize/source-object-prototype-absence.d.ts +7 -0
- package/dist/semantics/normalize/source-object-prototype-absence.js +19 -0
- package/dist/semantics/normalize/specialization.d.ts +10 -10
- package/dist/semantics/normalize/specialization.js +107 -112
- package/dist/semantics/normalize/specialized-source-frames.d.ts +11 -0
- package/dist/semantics/normalize/specialized-source-frames.js +41 -0
- package/dist/semantics/normalize/structural-array-element.d.ts +5 -5
- package/dist/semantics/normalize/structural-array-element.js +40 -39
- package/dist/semantics/normalize/structural-array-read.js +3 -3
- package/dist/semantics/normalize/structural-callable.d.ts +15 -1
- package/dist/semantics/normalize/structural-callable.js +35 -3
- package/dist/semantics/normalize/structural-creation-order.d.ts +2 -2
- package/dist/semantics/normalize/structural-declarations.d.ts +22 -21
- package/dist/semantics/normalize/structural-declarations.js +42 -42
- package/dist/semantics/normalize/structural-declared-body.js +10 -11
- package/dist/semantics/normalize/structural-indexed-access.js +2 -2
- package/dist/semantics/normalize/structural-instantiated-member.d.ts +9 -10
- package/dist/semantics/normalize/structural-instantiated-member.js +43 -30
- package/dist/semantics/normalize/structural-joins.d.ts +4 -16
- package/dist/semantics/normalize/structural-joins.js +5 -65
- package/dist/semantics/normalize/structural-layout-relevance.d.ts +5 -5
- package/dist/semantics/normalize/structural-layout-relevance.js +22 -23
- package/dist/semantics/normalize/structural-layout-type.d.ts +1 -1
- package/dist/semantics/normalize/structural-layout-type.js +140 -107
- package/dist/semantics/normalize/structural-local-union.d.ts +1 -1
- package/dist/semantics/normalize/structural-local-union.js +38 -12
- package/dist/semantics/normalize/structural-mutable-field.d.ts +9 -0
- package/dist/semantics/normalize/structural-mutable-field.js +152 -0
- package/dist/semantics/normalize/structural-parts.d.ts +6 -0
- package/dist/semantics/normalize/structural-parts.js +35 -32
- package/dist/semantics/normalize/structural-receiver.d.ts +3 -3
- package/dist/semantics/normalize/structural-receiver.js +12 -13
- package/dist/semantics/normalize/structural-self-reference.d.ts +12 -11
- package/dist/semantics/normalize/structural-self-reference.js +24 -25
- package/dist/semantics/normalize/structural.d.ts +13 -3
- package/dist/semantics/normalize/structural.js +400 -201
- package/dist/semantics/normalize/suppressed-write-arms.d.ts +10 -11
- package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +6 -6
- package/dist/semantics/normalize/symbol-keyed-this-slots.js +4 -4
- package/dist/semantics/normalize/unresolvable-names.d.ts +2 -3
- package/dist/semantics/normalize/unresolvable-names.js +2 -2
- package/dist/semantics/normalize/unshared-array-result.d.ts +4 -4
- package/dist/semantics/normalize/unshared-array-result.js +4 -4
- package/dist/semantics/package-sources.js +2 -3
- package/dist/semantics/program.d.ts +10 -13
- package/dist/semantics/program.js +80 -26
- package/dist/semantics/property-key.d.ts +9 -0
- package/dist/semantics/property-key.js +25 -0
- package/dist/semantics/prototype-object-class-source-transform.js +2 -2
- package/dist/semantics/prototype-reparenting.d.ts +1 -1
- package/dist/semantics/prototype-reparenting.js +1 -1
- package/dist/semantics/shared-declaration-files.d.ts +6 -1
- package/dist/semantics/shared-declaration-files.js +2 -2
- package/dist/semantics/source-transform-protocol.d.ts +26 -0
- package/dist/semantics/source-transform-protocol.js +1 -0
- package/dist/semantics/stable-checker.js +9 -13
- package/dist/semantics/subclass-member-overlay-transform.d.ts +2 -2
- package/dist/semantics/subclass-member-overlay-transform.js +89 -88
- package/dist/semantics/this-constructor-source-transform.js +2 -2
- package/dist/semantics/unchecked-guard-argument-copies.d.ts +3 -3
- package/dist/semantics/unchecked-write-member-declarations.d.ts +9 -11
- package/dist/semantics/unchecked-write-member-declarations.js +11 -13
- package/dist/semantics/uninstantiable-classes.d.ts +1 -1
- package/dist/semantics/uninstantiable-classes.js +1 -1
- package/dist/targets/cpp/balanced-units.d.ts +1 -1
- package/dist/targets/cpp/balanced-units.js +1 -1
- package/dist/targets/cpp/borrowed-arm-projections.d.ts +2 -3
- package/dist/targets/cpp/borrowed-arm-projections.js +2 -3
- package/dist/targets/cpp/borrowed-call-entry.js +3 -3
- package/dist/targets/cpp/captures.d.ts +2 -2
- package/dist/targets/cpp/captures.js +4 -4
- package/dist/targets/cpp/char-code-buffers.d.ts +1 -1
- package/dist/targets/cpp/char-code-buffers.js +4 -1
- package/dist/targets/cpp/class-layout.d.ts +7 -17
- package/dist/targets/cpp/class-layout.js +6 -13
- package/dist/targets/cpp/class-properties/computed-method-value.d.ts +1 -1
- package/dist/targets/cpp/class-properties/computed-method-value.js +5 -27
- package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +49 -59
- package/dist/targets/cpp/class-properties/emit-class-properties.js +68 -232
- package/dist/targets/cpp/class-properties/native-method-read.d.ts +5 -0
- package/dist/targets/cpp/class-properties/native-method-read.js +60 -0
- package/dist/targets/cpp/class-properties/native-prototype.d.ts +3 -1
- package/dist/targets/cpp/class-properties/native-prototype.js +5 -6
- package/dist/targets/cpp/class-ref-transport.d.ts +1 -11
- package/dist/targets/cpp/class-ref-transport.js +1 -9
- package/dist/targets/cpp/conversions.js +613 -252
- package/dist/targets/cpp/coroutine-bodies.d.ts +1 -97
- package/dist/targets/cpp/coroutine-bodies.js +1 -187
- package/dist/targets/cpp/document.js +1 -1
- package/dist/targets/cpp/emit-allocation.d.ts +0 -38
- package/dist/targets/cpp/emit-allocation.js +63 -88
- package/dist/targets/cpp/emit-array-view.d.ts +7 -0
- package/dist/targets/cpp/emit-array-view.js +47 -0
- package/dist/targets/cpp/emit-arrays.d.ts +9 -52
- package/dist/targets/cpp/emit-arrays.js +177 -113
- package/dist/targets/cpp/emit-binding-reference.d.ts +10 -0
- package/dist/targets/cpp/emit-binding-reference.js +19 -1
- package/dist/targets/cpp/emit-bindings.js +19 -24
- package/dist/targets/cpp/emit-buffers.d.ts +8 -4
- package/dist/targets/cpp/emit-buffers.js +88 -47
- package/dist/targets/cpp/emit-callable-view.d.ts +6 -0
- package/dist/targets/cpp/emit-callable-view.js +133 -0
- package/dist/targets/cpp/emit-callable.d.ts +11 -1
- package/dist/targets/cpp/emit-callable.js +225 -266
- package/dist/targets/cpp/emit-carrier-members.d.ts +2 -2
- package/dist/targets/cpp/emit-carrier-members.js +42 -35
- package/dist/targets/cpp/emit-certified-conversion.d.ts +7 -0
- package/dist/targets/cpp/emit-certified-conversion.js +27 -0
- package/dist/targets/cpp/emit-context.d.ts +123 -64
- package/dist/targets/cpp/emit-context.js +147 -44
- package/dist/targets/cpp/emit-descriptor-snapshot.d.ts +10 -0
- package/dist/targets/cpp/emit-descriptor-snapshot.js +60 -0
- package/dist/targets/cpp/emit-dictionary-view.d.ts +6 -0
- package/dist/targets/cpp/emit-dictionary-view.js +102 -0
- package/dist/targets/cpp/emit-document-record-view.d.ts +3 -0
- package/dist/targets/cpp/emit-document-record-view.js +104 -0
- package/dist/targets/cpp/emit-dynamic-properties.d.ts +42 -17
- package/dist/targets/cpp/emit-dynamic-properties.js +118 -72
- package/dist/targets/cpp/emit-equality.d.ts +2 -1
- package/dist/targets/cpp/emit-equality.js +65 -45
- package/dist/targets/cpp/emit-exceptions.js +1 -1
- package/dist/targets/cpp/emit-in.js +22 -11
- package/dist/targets/cpp/emit-instanceof.js +15 -14
- package/dist/targets/cpp/emit-integers.d.ts +40 -3
- package/dist/targets/cpp/emit-integers.js +76 -5
- package/dist/targets/cpp/emit-iterable-object-view.d.ts +2 -0
- package/dist/targets/cpp/emit-iterable-object-view.js +15 -11
- package/dist/targets/cpp/emit-iterator-object-view.d.ts +2 -0
- package/dist/targets/cpp/emit-iterator-object-view.js +24 -16
- package/dist/targets/cpp/emit-iterator.d.ts +2 -0
- package/dist/targets/cpp/emit-iterator.js +115 -43
- package/dist/targets/cpp/emit-json.js +6 -6
- package/dist/targets/cpp/emit-jsx.js +2 -2
- package/dist/targets/cpp/emit-live-field-view.d.ts +26 -0
- package/dist/targets/cpp/emit-live-field-view.js +50 -0
- package/dist/targets/cpp/emit-narrowing.d.ts +60 -139
- package/dist/targets/cpp/emit-narrowing.js +694 -624
- package/dist/targets/cpp/emit-native-accessor-definition.d.ts +10 -0
- package/dist/targets/cpp/emit-native-accessor-definition.js +94 -0
- package/dist/targets/cpp/emit-native-callable-data.d.ts +23 -0
- package/dist/targets/cpp/emit-native-callable-data.js +117 -0
- package/dist/targets/cpp/emit-native-document-entry.d.ts +4 -0
- package/dist/targets/cpp/emit-native-document-entry.js +52 -0
- package/dist/targets/cpp/emit-native-field-view.d.ts +26 -0
- package/dist/targets/cpp/emit-native-field-view.js +217 -0
- package/dist/targets/cpp/emit-native-method.d.ts +16 -0
- package/dist/targets/cpp/emit-native-method.js +90 -0
- package/dist/targets/cpp/emit-native-object-data.d.ts +7 -0
- package/dist/targets/cpp/emit-native-object-data.js +66 -0
- package/dist/targets/cpp/emit-native-object-sample.d.ts +8 -0
- package/dist/targets/cpp/emit-native-object-sample.js +34 -0
- package/dist/targets/cpp/emit-native-own-assignment.d.ts +7 -0
- package/dist/targets/cpp/emit-native-own-assignment.js +119 -0
- package/dist/targets/cpp/emit-native-selection.d.ts +2 -2
- package/dist/targets/cpp/emit-native-selection.js +14 -5
- package/dist/targets/cpp/emit-number-storage.d.ts +2 -0
- package/dist/targets/cpp/emit-number-storage.js +1 -0
- package/dist/targets/cpp/emit-presence.d.ts +3 -4
- package/dist/targets/cpp/emit-presence.js +43 -21
- package/dist/targets/cpp/emit-properties.js +224 -111
- package/dist/targets/cpp/emit-protocol-iterator.d.ts +2 -0
- package/dist/targets/cpp/emit-protocol-iterator.js +45 -23
- package/dist/targets/cpp/emit-record-view.d.ts +5 -10
- package/dist/targets/cpp/emit-record-view.js +223 -269
- package/dist/targets/cpp/emit-return.js +33 -8
- package/dist/targets/cpp/emit-scopes.d.ts +2 -2
- package/dist/targets/cpp/emit-sum-widening.js +13 -5
- package/dist/targets/cpp/emit-tonumber.d.ts +1 -1
- package/dist/targets/cpp/emit-tonumber.js +3 -3
- package/dist/targets/cpp/emit-tostring.d.ts +20 -2
- package/dist/targets/cpp/emit-tostring.js +131 -28
- package/dist/targets/cpp/emit-typeof.d.ts +4 -0
- package/dist/targets/cpp/emit-typeof.js +29 -1
- package/dist/targets/cpp/emit-union-properties.d.ts +6 -23
- package/dist/targets/cpp/emit-union-properties.js +127 -235
- package/dist/targets/cpp/emit.d.ts +4 -1
- package/dist/targets/cpp/emit.js +336 -119
- package/dist/targets/cpp/error-types.d.ts +1 -3
- package/dist/targets/cpp/error-types.js +1 -2
- package/dist/targets/cpp/evaluated-once.d.ts +4 -4
- package/dist/targets/cpp/evaluated-once.js +5 -5
- package/dist/targets/cpp/function-source-reads.d.ts +2 -15
- package/dist/targets/cpp/function-source-reads.js +3 -38
- package/dist/targets/cpp/host/core-globals.d.ts +5 -0
- package/dist/targets/cpp/host/core-globals.js +10 -0
- package/dist/targets/cpp/host/emit-host-arity.js +1 -1
- package/dist/targets/cpp/host/emit-host-invoke.js +73 -23
- package/dist/targets/cpp/host/emit-host-object.d.ts +2 -1
- package/dist/targets/cpp/host/emit-host-object.js +328 -145
- package/dist/targets/cpp/host/emit-host-properties.js +4 -6
- package/dist/targets/cpp/host/emit-host-reflect.js +29 -5
- package/dist/targets/cpp/host/emit-host-value.d.ts +1 -1
- package/dist/targets/cpp/host/emit-host-value.js +2 -2
- package/dist/targets/cpp/host/host-members.d.ts +11 -0
- package/dist/targets/cpp/host/host-members.js +27 -5
- package/dist/targets/cpp/host/host-method-aliases.d.ts +1 -30
- package/dist/targets/cpp/host/host-method-aliases.js +1 -76
- package/dist/targets/cpp/host/native-protocols.js +1 -1
- package/dist/targets/cpp/host/object-protocol.d.ts +1 -1
- package/dist/targets/cpp/host/object-protocol.js +24 -24
- package/dist/targets/cpp/host-namespace-reads.d.ts +1 -83
- package/dist/targets/cpp/host-namespace-reads.js +1 -113
- package/dist/targets/cpp/manifest/capabilities.js +33 -33
- package/dist/targets/cpp/manifest.d.ts +5 -0
- package/dist/targets/cpp/manifest.js +38 -14
- package/dist/targets/cpp/native-collection-base.js +7 -6
- package/dist/targets/cpp/native-debug-source.d.ts +15 -0
- package/dist/targets/cpp/native-debug-source.js +21 -0
- package/dist/targets/cpp/native-error-base.d.ts +1 -1
- package/dist/targets/cpp/native-error-base.js +1 -1
- package/dist/targets/cpp/native-narrowing-transport.d.ts +2 -0
- package/dist/targets/cpp/native-narrowing-transport.js +25 -5
- package/dist/targets/cpp/native-view-targets.d.ts +3 -0
- package/dist/targets/cpp/native-view-targets.js +5 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +3 -33
- package/dist/targets/cpp/prototype/emit-prototype-array.js +40 -22
- package/dist/targets/cpp/prototype/emit-prototype-date.d.ts +1 -58
- package/dist/targets/cpp/prototype/emit-prototype-date.js +14 -97
- package/dist/targets/cpp/prototype/emit-prototype-error.d.ts +20 -0
- package/dist/targets/cpp/prototype/emit-prototype-error.js +2 -2
- package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +3 -27
- package/dist/targets/cpp/prototype/emit-prototype-invoke.js +60 -52
- package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +1 -41
- package/dist/targets/cpp/prototype/emit-prototype-iterator.js +4 -43
- package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +2 -13
- package/dist/targets/cpp/prototype/emit-prototype-promise.js +10 -58
- package/dist/targets/cpp/prototype/emit-prototype-regexp.d.ts +4 -25
- package/dist/targets/cpp/prototype/emit-prototype-regexp.js +16 -81
- package/dist/targets/cpp/prototype/emit-prototype-string.d.ts +1 -1
- package/dist/targets/cpp/prototype/emit-prototype-string.js +17 -28
- package/dist/targets/cpp/prototype/prototype-method-reads.js +4 -80
- package/dist/targets/cpp/reactive-dependencies.d.ts +12 -6
- package/dist/targets/cpp/reactive-dependencies.js +62 -42
- package/dist/targets/cpp/reactive-origins.js +12 -0
- package/dist/targets/cpp/records.d.ts +133 -14
- package/dist/targets/cpp/records.js +345 -153
- package/dist/targets/cpp/regexp-types.d.ts +1 -26
- package/dist/targets/cpp/regexp-types.js +4 -29
- package/dist/targets/cpp/segment-scopes.d.ts +30 -0
- package/dist/targets/cpp/segment-scopes.js +294 -0
- package/dist/targets/cpp/translation-unit.d.ts +21 -2
- package/dist/targets/cpp/translation-unit.js +121 -276
- package/dist/targets/cpp/types.d.ts +8 -3
- package/dist/targets/cpp/types.js +30 -6
- package/dist/targets/cpp/virtual-callees.d.ts +18 -0
- package/dist/targets/cpp/virtual-callees.js +27 -0
- package/dist/targets/cpp/virtual-methods.d.ts +7 -7
- package/dist/targets/cpp/virtual-methods.js +213 -58
- package/package.json +8 -3
- package/src/targets/cpp/runtime/gea_dictionary_view.h +204 -0
- package/src/targets/cpp/runtime/gea_document_view.h +845 -0
- package/src/targets/cpp/runtime/gea_dynamic_proxy.h +66 -23
- package/src/targets/cpp/runtime/gea_eval.h +6 -6
- package/src/targets/cpp/runtime/gea_runtime.h +7550 -1166
- package/dist/targets/cpp/direct-call-receivers.d.ts +0 -37
- package/dist/targets/cpp/direct-call-receivers.js +0 -79
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { declaredFieldRepresentationOf, declaredRecordFieldOf, nativeBaseFieldOf, recordAccessorBodiesOf, recordAccessorsOfShape, recordFieldsOfShape } from '../../projection/fields.js';
|
|
2
2
|
export { declaredFieldRepresentationOf, declaredRecordFieldOf, nativeBaseFieldOf, recordAccessorBodiesOf, recordAccessorsOfShape, recordFieldsOfShape };
|
|
3
|
+
import { isNativeError } from './error-types.js';
|
|
3
4
|
import { lazyArrowFieldPlansForClass } from './class-layout.js';
|
|
4
5
|
import { representationKey, walkRepresentation, ownershipOf } from '../../representation/model.js';
|
|
5
6
|
import { isPrivateNameKey } from '../../semantics/model/structural-types.js';
|
|
@@ -7,15 +8,18 @@ import { dynamicFieldAbsencePolicy } from '../../representation/field-descriptor
|
|
|
7
8
|
import { integerStorageSlot } from '../../ir/integer-storage.js';
|
|
8
9
|
import { recordIndexDomainContainsKey } from '../../ir/native-record-index.js';
|
|
9
10
|
import { cppBodyName, cppClassName, cppNarrowedIntegerType, cppRecordFieldKeyIsSymbol, cppRecordFieldAttributesName, cppRecordFieldName, cppRecordAccessorEnvironmentName, cppRecordFieldPresenceName, cppArrayExtensionStructName, cppRecordStructName, positionalArityText, cppStringLiteral, cppTypeOf, withoutUnitFunctions } from './types.js';
|
|
10
|
-
import { storedEnvironmentText } from './emit-context.js';
|
|
11
|
-
import { boxedText, dynamicCarrierBoxText, dynamicTagFor, dynamicValueLoadText } from './emit-narrowing.js';
|
|
12
|
-
import {
|
|
11
|
+
import { createCppEmitBlockedError, storedEnvironmentText } from './emit-context.js';
|
|
12
|
+
import { boxedText, dynamicCarrierBoxText, dynamicTagFor, dynamicValueLoadText, programConversionText } from './emit-narrowing.js';
|
|
13
|
+
import { dynamicFieldConversionOwnerOf, programConversionKey, prototypeSetterValue } from '../../ir/program-conversions.js';
|
|
14
|
+
import { recordLayoutPolicyOf, recordLayoutOfShapeId } from '../../projection/fields.js';
|
|
15
|
+
import { classIndexProtocolsOf } from '../../projection/index-protocols.js';
|
|
16
|
+
import { nativeAccessorAccessOf } from '../../projection/native-accessor-access.js';
|
|
13
17
|
/**
|
|
14
18
|
* The physical Optional carrier does not remember whether its empty state is
|
|
15
19
|
* JavaScript null or undefined. NativeFieldWrite therefore carries the
|
|
16
20
|
* representation's absence policy at every optional and union node.
|
|
17
21
|
*/
|
|
18
|
-
const nativeFieldPolicyType = (representation) => {
|
|
22
|
+
export const nativeFieldPolicyType = (representation) => {
|
|
19
23
|
switch (representation.kind) {
|
|
20
24
|
case 'optional':
|
|
21
25
|
return `gea::NativeFieldOptionalPolicy<${representation.absence === 'null' ? 'true' : 'false'}, ${nativeFieldPolicyType(representation.payload)}>`;
|
|
@@ -39,7 +43,7 @@ const nativeFieldPolicyTemplate = (representation) => representation.kind === 'o
|
|
|
39
43
|
* reason is recorded rather than dropped, so the struct refuses by name instead
|
|
40
44
|
* of silently emitting flat and colliding with a base body later.
|
|
41
45
|
*/
|
|
42
|
-
const classBaseLinks = (classes) => {
|
|
46
|
+
export const classBaseLinks = (classes) => {
|
|
43
47
|
const links = new Map();
|
|
44
48
|
const unlinkable = new Map();
|
|
45
49
|
for (const layout of classes.values()) {
|
|
@@ -76,7 +80,8 @@ const classBaseLinks = (classes) => {
|
|
|
76
80
|
links.set(structName, {
|
|
77
81
|
structName: nativeRecord.native,
|
|
78
82
|
shapeId: nativeRecord.shapeId,
|
|
79
|
-
native: true
|
|
83
|
+
native: true,
|
|
84
|
+
...(isNativeError(nativeRecord) ? { nativeError: true } : {})
|
|
80
85
|
});
|
|
81
86
|
continue;
|
|
82
87
|
}
|
|
@@ -104,8 +109,8 @@ const classBaseLinks = (classes) => {
|
|
|
104
109
|
*
|
|
105
110
|
* `collectRequiredStructs`'s cycle guard then rendered the struct from
|
|
106
111
|
* whichever of them the plan happened to walk first, and every operation typed
|
|
107
|
-
* against the other one compiled against members that were not there:
|
|
108
|
-
*
|
|
112
|
+
* against the other one compiled against members that were not there: a
|
|
113
|
+
* generic class's field was declared `gea::Value` from the unbound root while its own
|
|
109
114
|
* constructor stored an `Optional<Ref<...>>` into it, and clang rejected the
|
|
110
115
|
* assignment. Silently, from the compiler's side -- both halves certified.
|
|
111
116
|
*
|
|
@@ -384,12 +389,12 @@ const collectRequiredStructs = (representations, deriver, bases, unlinkable, cla
|
|
|
384
389
|
*
|
|
385
390
|
* This used to refuse when the two carriers DIFFERED, on the theory that a
|
|
386
391
|
* difference meant a real override. It does not. The common cause is one
|
|
387
|
-
* INHERITED member interned twice: `class
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
392
|
+
* INHERITED member interned twice: `class Derived<E> extends Base<E>` gives the
|
|
393
|
+
* two classes distinct type-parameter symbols, so `Base`'s own
|
|
394
|
+
* `readonly field: Shape<E>` derives one record for `E`-as-declared-in-`Base`
|
|
395
|
+
* and another for `E`-as-declared-in-`Derived`, and the structural view of the
|
|
396
|
+
* derived class lists the inherited member under the second. Neither class
|
|
397
|
+
* declared anything twice -- `Derived` may declare no fields at all -- so
|
|
393
398
|
* refusing here reported a conflict that does not exist in the program.
|
|
394
399
|
*
|
|
395
400
|
* A genuine TypeScript override that narrows a field's declared type is not a
|
|
@@ -530,7 +535,7 @@ const structValueDependencies = (layout) => {
|
|
|
530
535
|
* never a traced edge of any type, so dynamic-property capability does not
|
|
531
536
|
* decide leafness.
|
|
532
537
|
*/
|
|
533
|
-
const traceLeafStructsOf = (layouts, excluded, celled, classAncestors) => {
|
|
538
|
+
export const traceLeafStructsOf = (layouts, excluded, celled, classAncestors, holdsOlder = () => false) => {
|
|
534
539
|
const verdicts = new Map();
|
|
535
540
|
const walking = new Set();
|
|
536
541
|
const structIsLeaf = (structName) => {
|
|
@@ -588,7 +593,9 @@ const traceLeafStructsOf = (layouts, excluded, celled, classAncestors) => {
|
|
|
588
593
|
case 'array-object':
|
|
589
594
|
return value.ownership !== 'borrowed' && value.recursive === undefined && value.extension === null && carrierIsLeaf(value.element);
|
|
590
595
|
case 'dictionary':
|
|
591
|
-
|
|
596
|
+
// A shared entry view may retain a traced source table even when its
|
|
597
|
+
// own entry carrier is primitive. Owned tables have no admitted view.
|
|
598
|
+
return value.ownership === 'owned' && value.recursive === undefined && value.key !== 'symbol' && carrierIsLeaf(value.value);
|
|
592
599
|
case 'promise':
|
|
593
600
|
// The state's value is traced only when the payload is; its reactions are
|
|
594
601
|
// opaque closures the collector never follows, whatever holds the promise.
|
|
@@ -610,7 +617,60 @@ const traceLeafStructsOf = (layouts, excluded, celled, classAncestors) => {
|
|
|
610
617
|
for (const structName of layouts.keys())
|
|
611
618
|
if (structIsLeaf(structName))
|
|
612
619
|
leaves.add(structName);
|
|
613
|
-
|
|
620
|
+
// A recursive class is no leaf by the walk above -- its field names itself
|
|
621
|
+
// -- but it can still never sit on a cycle. `class TreeNode { constructor(
|
|
622
|
+
// readonly left: TreeNode | null, ...) }`: a field written only by
|
|
623
|
+
// construction, only with the constructor's own argument, can only point at
|
|
624
|
+
// an object that existed before this one, so every edge through such
|
|
625
|
+
// fields runs from younger to older and none can close a loop. That holds
|
|
626
|
+
// as long as each such field holds the object ITSELF -- a class reference
|
|
627
|
+
// of a type with the same property, or null -- and not a container, which
|
|
628
|
+
// stays mutable whoever holds it. The set is a greatest fixed point: assume
|
|
629
|
+
// every eligible class, drop any with a field that is neither a leaf nor
|
|
630
|
+
// such a reference, until nothing changes.
|
|
631
|
+
const olderOnly = new Set();
|
|
632
|
+
for (const [structName, ancestors] of classAncestors) {
|
|
633
|
+
if (leaves.has(structName) || ancestors.length > 0 || excluded.has(structName))
|
|
634
|
+
continue;
|
|
635
|
+
const layout = layouts.get(structName);
|
|
636
|
+
if (layout === undefined || layout.accessors.length > 0 || layout.indexes.length > 0 || (celled.get(structName)?.size ?? 0) > 0)
|
|
637
|
+
continue;
|
|
638
|
+
olderOnly.add(structName);
|
|
639
|
+
}
|
|
640
|
+
const olderReference = (value) => {
|
|
641
|
+
switch (value.kind) {
|
|
642
|
+
case 'null':
|
|
643
|
+
case 'undefined':
|
|
644
|
+
return true;
|
|
645
|
+
case 'optional':
|
|
646
|
+
return olderReference(value.payload);
|
|
647
|
+
case 'tagged-union':
|
|
648
|
+
return value.arms.every((arm) => olderReference(arm.value));
|
|
649
|
+
case 'class-ref': {
|
|
650
|
+
if (value.ownership === 'borrowed' || value.nativeBase !== undefined)
|
|
651
|
+
return false;
|
|
652
|
+
const target = cppClassName(value.declaration);
|
|
653
|
+
return leaves.has(target) || olderOnly.has(target);
|
|
654
|
+
}
|
|
655
|
+
default:
|
|
656
|
+
return false;
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
for (let changed = true; changed;) {
|
|
660
|
+
changed = false;
|
|
661
|
+
for (const structName of olderOnly) {
|
|
662
|
+
const layout = layouts.get(structName);
|
|
663
|
+
const holds = layout !== undefined &&
|
|
664
|
+
layout.fields.every((field) => carrierIsLeaf(field.value) || (holdsOlder(structName, field.key) && olderReference(field.value)));
|
|
665
|
+
if (holds)
|
|
666
|
+
continue;
|
|
667
|
+
olderOnly.delete(structName);
|
|
668
|
+
changed = true;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
for (const structName of olderOnly)
|
|
672
|
+
leaves.add(structName);
|
|
673
|
+
return { leaves, olderOnly };
|
|
614
674
|
};
|
|
615
675
|
/**
|
|
616
676
|
* The classes `traceLeafStructsOf` may judge, each with its ancestors: those
|
|
@@ -706,8 +766,8 @@ const immortalMethodStateRoots = (classStructNames, baseStructNames, links, eval
|
|
|
706
766
|
* `A`'s. The second one used to be left to a sort by NAME, which is not an
|
|
707
767
|
* order at all: `gea_record_type_1173` sorts before `gea_record_type_695`
|
|
708
768
|
* because `'1' < '6'`, so an app whose struct numbering fell that way emitted a
|
|
709
|
-
* struct with an incomplete member and failed to compile (
|
|
710
|
-
*
|
|
769
|
+
* struct with an incomplete member and failed to compile (two builds of one
|
|
770
|
+
* game) while every other app happened to be numbered the lucky way.
|
|
711
771
|
*
|
|
712
772
|
* The walk is depth-first and emits each name once. A name reached twice within
|
|
713
773
|
* one chain is a cycle -- a class extending itself, or two structs embedding
|
|
@@ -905,7 +965,7 @@ const accessorUnboxText = (accessor, structName, text) => {
|
|
|
905
965
|
return null;
|
|
906
966
|
return `gea::detail::unboxField<${type}>(${text}, gea::Value::Tag::${tag}, ${cppStringLiteral(structName)}, ${cppStringLiteral(accessor.key)})`;
|
|
907
967
|
};
|
|
908
|
-
const dynamicFieldAccessOf = (field, storageType, isTailField = false) => {
|
|
968
|
+
const dynamicFieldAccessOf = (field, storageType, isTailField = false, cellPayloadType) => {
|
|
909
969
|
// A tail field's WRITE is spelled through the lazily-allocating
|
|
910
970
|
// `RecordTail::ensure()` -- sound because `renderFieldDispatcher` reaches
|
|
911
971
|
// `member` only from a `[[Set]]`/`[[DefineOwnProperty]]` body that is about
|
|
@@ -927,7 +987,7 @@ const dynamicFieldAccessOf = (field, storageType, isTailField = false) => {
|
|
|
927
987
|
const readMember = (key) => isTailField
|
|
928
988
|
? `([&]() { const auto* gea_tail_ptr = ${cppRecordTailMemberName}.peek(); ` +
|
|
929
989
|
`return gea_tail_ptr != nullptr ? gea_tail_ptr->${cppRecordFieldName(key)} : decltype(gea_tail_ptr->${cppRecordFieldName(key)})(); })()`
|
|
930
|
-
: cppRecordFieldName(key);
|
|
990
|
+
: cppRecordFieldName(key) + (cellPayloadType === undefined ? '' : '.get()');
|
|
931
991
|
// Whether this field can be reached dynamically is a question about its
|
|
932
992
|
// VALUE's carrier, not about whether the key that names it is a string or a
|
|
933
993
|
// symbol -- a `[Symbol.iterator]() {}` method boxes exactly the way a
|
|
@@ -944,9 +1004,9 @@ const dynamicFieldAccessOf = (field, storageType, isTailField = false) => {
|
|
|
944
1004
|
// all: `dynamicTagFor` answers `null` for `dynamic` because no STATIC tag
|
|
945
1005
|
// describes it, and reading that as "unaddressable" refused a member the
|
|
946
1006
|
// dynamic path can reach more directly than any other -- by copying the
|
|
947
|
-
// `gea::Value` it already is.
|
|
948
|
-
//
|
|
949
|
-
//
|
|
1007
|
+
// `gea::Value` it already is. `this[name] = handler` in a loop over a list
|
|
1008
|
+
// of method names writes such fields, and every one of them aborted the
|
|
1009
|
+
// program on its first write.
|
|
950
1010
|
if (field.value.kind === 'dynamic' && storageType === 'gea::Value') {
|
|
951
1011
|
return {
|
|
952
1012
|
key: field.key,
|
|
@@ -1007,35 +1067,16 @@ const dynamicFieldAccessOf = (field, storageType, isTailField = false) => {
|
|
|
1007
1067
|
type,
|
|
1008
1068
|
readable,
|
|
1009
1069
|
writable: readable && canonical !== undefined,
|
|
1010
|
-
boxed: false
|
|
1070
|
+
boxed: false,
|
|
1071
|
+
...(cellPayloadType === undefined ? {} : { cellPayloadType })
|
|
1011
1072
|
};
|
|
1012
1073
|
};
|
|
1013
|
-
|
|
1014
|
-
* How a boxed write lands in a field whose carrier boxes under `Object` -- a
|
|
1015
|
-
* record, a class, an array, a promise -- or `null` when no checked conversion
|
|
1016
|
-
* reaches it.
|
|
1017
|
-
*
|
|
1018
|
-
* That tag is boxed WITH its payload type, so the reverse is the same
|
|
1019
|
-
* `any -> T` conversion every other dynamic read into that carrier takes
|
|
1020
|
-
* (`unboxedLoadText`): a class reference is a checked projection of the
|
|
1021
|
-
* allocation the box retained, a record is its exact payload or a checked
|
|
1022
|
-
* product rebuilt from the object's fields, an array of records rebuilds each
|
|
1023
|
-
* element the same way. The value is stored in the native member, never as a
|
|
1024
|
-
* box. This arm used to refuse every such write at run time, which is what
|
|
1025
|
-
* aborted mongodb's `setOption(mongoOptions: any, ...)` on
|
|
1026
|
-
* `driverInfo: DriverInfo` (`default: {}`) in the MongoClient constructor.
|
|
1027
|
-
*
|
|
1028
|
-
* The three canonical primitive tags keep their exact `unboxField` arm, and a
|
|
1029
|
-
* member whose declared C++ type is not the representation's own spelling has
|
|
1030
|
-
* no conversion to name, so it stays refused. So does a `Function` field: its
|
|
1031
|
-
* load adapts a box to the field's frame through `DynamicCarrier`, which only
|
|
1032
|
-
* exists for frames whose every position has an exact carrier (a `BigInt`
|
|
1033
|
-
* result, an iterator parameter or a recursive alias has none), and that is a
|
|
1034
|
-
* C++ `static_assert`, not a fact this renderer can ask.
|
|
1035
|
-
*/
|
|
1036
|
-
const objectFieldWriteLoadText = (layouts, value, access) => {
|
|
1074
|
+
const objectFieldWriteLoadText = (layouts, value, access, selected) => {
|
|
1037
1075
|
if (layouts === undefined || access.tag !== 'Object' || cppTypeOf(value) !== access.type)
|
|
1038
1076
|
return null;
|
|
1077
|
+
const planned = selected?.(access.key, value) ?? null;
|
|
1078
|
+
if (planned !== null)
|
|
1079
|
+
return planned;
|
|
1039
1080
|
if (withoutUnitFunctions(() => dynamicValueLoadText(layouts, value, 'gea_value')) === null)
|
|
1040
1081
|
return null;
|
|
1041
1082
|
return (text) => dynamicValueLoadText(layouts, value, text);
|
|
@@ -1045,21 +1086,30 @@ const objectFieldWriteLoadText = (layouts, value, access) => {
|
|
|
1045
1086
|
* `objectFieldWriteLoadText` builds for a required one, under the optional's
|
|
1046
1087
|
* absence. The optional carrier's generic runtime adapter only accepts the
|
|
1047
1088
|
* exact payload type, so a plain object written into an optional record field
|
|
1048
|
-
* (
|
|
1049
|
-
*
|
|
1089
|
+
* (`options[name] = values[0]` for a member laid out optional because
|
|
1090
|
+
* `Object.create(null)` creates it absent) found no
|
|
1050
1091
|
* conversion and the write reported a read-only property.
|
|
1051
1092
|
*/
|
|
1052
|
-
const optionalObjectFieldLoadText = (layouts, value) => {
|
|
1093
|
+
const optionalObjectFieldLoadText = (layouts, value, selected, key = '') => {
|
|
1053
1094
|
if (value.kind !== 'optional')
|
|
1054
1095
|
return null;
|
|
1055
1096
|
const payload = value.payload;
|
|
1056
1097
|
const access = dynamicFieldAccessOf({ key: '', value: payload, required: true }, cppTypeOf(payload));
|
|
1057
1098
|
if (access === null || !access.readable || access.writable || access.boxed || access.dynamicCarrier === true)
|
|
1058
1099
|
return null;
|
|
1100
|
+
const absentTag = value.absence === 'null' ? 'Null' : 'Undefined';
|
|
1101
|
+
const type = cppTypeOf(value);
|
|
1102
|
+
const planned = selected?.(key, value) ?? null;
|
|
1103
|
+
if (planned !== null)
|
|
1104
|
+
return { load: planned, absentTag, type };
|
|
1059
1105
|
const load = objectFieldWriteLoadText(layouts, payload, access);
|
|
1060
1106
|
if (load === null)
|
|
1061
1107
|
return null;
|
|
1062
|
-
return {
|
|
1108
|
+
return {
|
|
1109
|
+
load: (text) => `(${text}).tag() == gea::Value::Tag::${absentTag} ? ${type}{} : ${type}{${load(text)}}`,
|
|
1110
|
+
absentTag,
|
|
1111
|
+
type
|
|
1112
|
+
};
|
|
1063
1113
|
};
|
|
1064
1114
|
/**
|
|
1065
1115
|
* Whether a boxed write into one of this struct's fields converts into a
|
|
@@ -1070,15 +1120,28 @@ const optionalObjectFieldLoadText = (layouts, value) => {
|
|
|
1070
1120
|
* accessor's does, rather than reordering: two records naming each other have
|
|
1071
1121
|
* no order that completes both.
|
|
1072
1122
|
*/
|
|
1073
|
-
|
|
1123
|
+
/**
|
|
1124
|
+
* The planned load into a typed string table field (`program-conversions.ts`'s
|
|
1125
|
+
* `dynamicTableLoadNeedsPlan`): the stored object viewed through the table's
|
|
1126
|
+
* entry carrier. The carrier's generic adapter admits only the exact table
|
|
1127
|
+
* payload, so a plain object stored by a computed key was refused.
|
|
1128
|
+
*/
|
|
1129
|
+
const plannedTableLoadText = (key, value, selected) => {
|
|
1130
|
+
const table = value.kind === 'optional' ? value.payload : value;
|
|
1131
|
+
if (selected === undefined || table.kind !== 'dictionary')
|
|
1132
|
+
return null;
|
|
1133
|
+
return selected(key, value);
|
|
1134
|
+
};
|
|
1135
|
+
const writesConvertIntoLaterStruct = (layouts, layout, position, orderOf, selected) => layout.fields.some((field) => {
|
|
1074
1136
|
const access = dynamicFieldAccessOf(field, cppTypeOf(field.value));
|
|
1075
1137
|
if (access === null || !access.readable || access.boxed)
|
|
1076
1138
|
return false;
|
|
1077
1139
|
const load = access.dynamicCarrier === true
|
|
1078
|
-
? (optionalObjectFieldLoadText(layouts, field.value)?.load ??
|
|
1140
|
+
? (optionalObjectFieldLoadText(layouts, field.value, selected, field.key)?.load ??
|
|
1141
|
+
plannedTableLoadText(field.key, field.value, selected))
|
|
1079
1142
|
: access.writable
|
|
1080
1143
|
? null
|
|
1081
|
-
: objectFieldWriteLoadText(layouts, field.value, access);
|
|
1144
|
+
: objectFieldWriteLoadText(layouts, field.value, access, selected);
|
|
1082
1145
|
if (load === null)
|
|
1083
1146
|
return false;
|
|
1084
1147
|
return withoutUnitFunctions(() => identifiersIn(load('gea_value')).some((name) => (orderOf.get(name) ?? -1) > position));
|
|
@@ -1320,10 +1383,10 @@ const keyByteLengthOfBranch = (line) => {
|
|
|
1320
1383
|
* key and returning or falling through to the next, dispatched by the name's
|
|
1321
1384
|
* length first.
|
|
1322
1385
|
*
|
|
1323
|
-
* Every field dispatcher is such a chain, and a chain over
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1386
|
+
* Every field dispatcher is such a chain, and a chain over a 100+-field
|
|
1387
|
+
* options family compared the name against every literal on every dynamic
|
|
1388
|
+
* read that reached it -- `string_view` folds the length test, but a miss
|
|
1389
|
+
* still walked every branch and a hit walked to its own. Grouped
|
|
1327
1390
|
* under `switch (gea_name.size())` a lookup compares only against the keys of
|
|
1328
1391
|
* its own length. The branches keep their relative order inside a case, and
|
|
1329
1392
|
* no two keys of different lengths can both match, so the chain's answer is
|
|
@@ -1401,7 +1464,7 @@ virtualDeclarations = new Map(),
|
|
|
1401
1464
|
/** The program's record layouts, which name the checked conversion a boxed write into an object-carrying field takes (`objectFieldWriteLoadText`). */
|
|
1402
1465
|
layouts = undefined,
|
|
1403
1466
|
/** Filled with every field operation a sealed demand names whose arm can only refuse -- see `record` below. */
|
|
1404
|
-
unaddressableDemands = undefined) => {
|
|
1467
|
+
unaddressableDemands = undefined, indexProtocol = true, dynamicFieldLoad, cellPayloadTypeOf = () => undefined) => {
|
|
1405
1468
|
// A write through the property protocol that creates a declared field of a
|
|
1406
1469
|
// record creates its key now, after every key already present, the same
|
|
1407
1470
|
// fact a static store states (`declaredFieldCreationText`). A class's
|
|
@@ -1411,7 +1474,7 @@ unaddressableDemands = undefined) => {
|
|
|
1411
1474
|
: `if (!${presence}) { gea::detail::noteNativeDeclaredKeyCreated(this, ${cppStringLiteral(key)}); ${attributes} = gea::NativeIndexAttributes{}; }`;
|
|
1412
1475
|
const accesses = layout.fields.map((field) => ({
|
|
1413
1476
|
field,
|
|
1414
|
-
access: dynamicFieldAccessOf(field, storageTypeOf(field), tailFields.has(field.key))
|
|
1477
|
+
access: dynamicFieldAccessOf(field, storageTypeOf(field), tailFields.has(field.key), cellPayloadTypeOf(field))
|
|
1415
1478
|
}));
|
|
1416
1479
|
const symbolKeys = layout.fields.filter((field) => cppRecordFieldKeyIsSymbol(field.key));
|
|
1417
1480
|
const baseRead = base ? [` if (this->${base.structName}::gea_readOwnField(gea_key, gea_out)) return true;`] : [];
|
|
@@ -1723,8 +1786,8 @@ unaddressableDemands = undefined) => {
|
|
|
1723
1786
|
// distinct from the ordinary boxed `gea_readOwnField` below) reads
|
|
1724
1787
|
// `access.member` just as directly, so it gets the same guard.
|
|
1725
1788
|
const nativeRead = lazyPlan !== undefined
|
|
1726
|
-
? ` if (gea_name == ${literal}) { if (!${presence}) return false; ${materializeText(lazyPlan, access.member)}; return gea_out.assign(${access.readMember}); }`
|
|
1727
|
-
: ` if (gea_name == ${literal}) return ${presence} && gea_out.assign(${access.readMember});`;
|
|
1789
|
+
? ` if (gea_name == ${literal}) { if (!${presence}) return false; ${materializeText(lazyPlan, access.member)}; return gea_out.assign${nativeFieldPolicyTemplate(field.value)}(${access.readMember}); }`
|
|
1790
|
+
: ` if (gea_name == ${literal}) return ${presence} && gea_out.assign${nativeFieldPolicyTemplate(field.value)}(${access.readMember});`;
|
|
1728
1791
|
if (fieldOperations === undefined ||
|
|
1729
1792
|
fieldOperations.get(field.key)?.has('read') ||
|
|
1730
1793
|
fieldOperations.get(field.key)?.has('native-read')) {
|
|
@@ -1736,7 +1799,10 @@ unaddressableDemands = undefined) => {
|
|
|
1736
1799
|
fieldOperations.get(field.key)?.has('write') ||
|
|
1737
1800
|
fieldOperations.get(field.key)?.has('native-write')) {
|
|
1738
1801
|
const nativeWrite = ` if (gea_name == ${literal}) { if (${presence} ? !${attributes}.writable : !gea_extensible) return false; ` +
|
|
1739
|
-
|
|
1802
|
+
(access.cellPayloadType === undefined
|
|
1803
|
+
? `if (!gea_value.assign${nativeFieldPolicyTemplate(field.value)}(${access.member})) return false; `
|
|
1804
|
+
: `${access.cellPayloadType} gea_cell_value = ${access.readMember}; if (!gea_value.assign${nativeFieldPolicyTemplate(field.value)}(gea_cell_value)) return false; ${access.member} = std::move(gea_cell_value); `) +
|
|
1805
|
+
`${firstFieldStore(presence, attributes, field.key)} ${presence} = true; return true; }`;
|
|
1740
1806
|
nativeFieldWrites.push(nativeWrite);
|
|
1741
1807
|
nativeFieldWritesByKey.set(field.key, nativeWrite);
|
|
1742
1808
|
}
|
|
@@ -1808,12 +1874,34 @@ unaddressableDemands = undefined) => {
|
|
|
1808
1874
|
record(descriptors, descriptorsByKey, descriptorText(boxed));
|
|
1809
1875
|
if (fieldOperations !== undefined && !fieldOperations.get(field.key)?.has('write') && !fieldOperations.get(field.key)?.has('define'))
|
|
1810
1876
|
continue;
|
|
1811
|
-
const optionalLoad = optionalObjectFieldLoadText(layouts, field.value);
|
|
1877
|
+
const optionalLoad = optionalObjectFieldLoadText(layouts, field.value, dynamicFieldLoad, field.key);
|
|
1812
1878
|
if (optionalLoad !== null) {
|
|
1813
|
-
const
|
|
1879
|
+
const loaded = optionalLoad.load;
|
|
1880
|
+
const store = (text) => `${access.member} = ${loaded(text)}`;
|
|
1814
1881
|
record(writes, writesByKey, ` if (gea_name == ${literal}) { if (${presence} ? !${attributes}.writable : !gea_extensible) return false; ` +
|
|
1815
1882
|
`${store('gea_value')}; ${firstFieldStore(presence, attributes, field.key)} ${presence} = true; return true; }`);
|
|
1816
|
-
|
|
1883
|
+
const defaults = optionalLoad.absentTag === 'Undefined'
|
|
1884
|
+
? `if (!gea_descriptor.hasValue && !${presence}) { ` +
|
|
1885
|
+
`if (gea_descriptor.isAccessor() || !gea_extensible) return false; ` +
|
|
1886
|
+
`const ${optionalLoad.type} gea_undefined{}; if (!gea::applyNativeFixedDataDescriptor(` +
|
|
1887
|
+
`${access.member}, ${attributes}, gea_undefined, false, gea_descriptor.hasWritable, gea_descriptor.writable, ` +
|
|
1888
|
+
`gea_descriptor.hasEnumerable, gea_descriptor.enumerable, gea_descriptor.hasConfigurable, gea_descriptor.configurable)) return false; ` +
|
|
1889
|
+
`${presence} = true; return true; } `
|
|
1890
|
+
: '';
|
|
1891
|
+
record(defines, definesByKey, ` if (gea_name == ${literal}) { ${defaults}return gea::applyNativeFieldDescriptorLoaded<${cppTypeOf(field.value)}, ${nativeFieldPolicyType(field.value)}>(` +
|
|
1892
|
+
`${access.member}, ${attributes}, ${presence}, gea_descriptor, gea_extensible, ` +
|
|
1893
|
+
`[&](const gea::Value& gea_written) { return ${loaded('gea_written')}; }); }`);
|
|
1894
|
+
continue;
|
|
1895
|
+
}
|
|
1896
|
+
// A planned load (a typed table viewing the stored object) replaces the
|
|
1897
|
+
// carrier's generic adapter, which admits only the exact payload.
|
|
1898
|
+
const plannedLoad = plannedTableLoadText(field.key, field.value, dynamicFieldLoad);
|
|
1899
|
+
if (plannedLoad !== null) {
|
|
1900
|
+
record(writes, writesByKey, ` if (gea_name == ${literal}) { if (${presence} ? !${attributes}.writable : !gea_extensible) return false; ` +
|
|
1901
|
+
`${access.member} = ${plannedLoad('gea_value')}; ${firstFieldStore(presence, attributes, field.key)} ${presence} = true; return true; }`);
|
|
1902
|
+
record(defines, definesByKey, ` if (gea_name == ${literal}) return gea::applyNativeFieldDescriptorLoaded<${cppTypeOf(field.value)}, ${nativeFieldPolicyType(field.value)}>(` +
|
|
1903
|
+
`${access.member}, ${attributes}, ${presence}, gea_descriptor, gea_extensible, ` +
|
|
1904
|
+
`[&](const gea::Value& gea_written) { return ${plannedLoad('gea_written')}; });`);
|
|
1817
1905
|
continue;
|
|
1818
1906
|
}
|
|
1819
1907
|
record(writes, writesByKey, ` if (gea_name == ${literal}) { if (${presence} ? !${attributes}.writable : !gea_extensible) return false; ` +
|
|
@@ -1884,13 +1972,13 @@ unaddressableDemands = undefined) => {
|
|
|
1884
1972
|
// materializes first, unconditionally, the same as every other reader
|
|
1885
1973
|
// in this file that observes rather than replaces the current value.
|
|
1886
1974
|
record(defines, definesByKey, lazyPlan !== undefined
|
|
1887
|
-
? ` if (gea_name == ${literal}) { ${materializeText(lazyPlan, access.member)}; return gea::applyNativeFieldDescriptor(` +
|
|
1975
|
+
? ` if (gea_name == ${literal}) { ${materializeText(lazyPlan, access.member)}; return gea::applyNativeFieldDescriptor<${cppTypeOf(field.value)}, ${nativeFieldPolicyType(field.value)}>(` +
|
|
1888
1976
|
`${access.member}, ${attributes}, ${presence}, gea_descriptor, gea_extensible, gea::Value::Tag::${access.tag}); }`
|
|
1889
|
-
: ` if (gea_name == ${literal}) return gea::applyNativeFieldDescriptor(` +
|
|
1977
|
+
: ` if (gea_name == ${literal}) return gea::applyNativeFieldDescriptor<${cppTypeOf(field.value)}, ${nativeFieldPolicyType(field.value)}>(` +
|
|
1890
1978
|
`${access.member}, ${attributes}, ${presence}, gea_descriptor, gea_extensible, gea::Value::Tag::${access.tag});`);
|
|
1891
1979
|
}
|
|
1892
1980
|
else {
|
|
1893
|
-
const load = objectFieldWriteLoadText(layouts, field.value, access);
|
|
1981
|
+
const load = objectFieldWriteLoadText(layouts, field.value, access, dynamicFieldLoad);
|
|
1894
1982
|
if (load === null) {
|
|
1895
1983
|
record(writes, writesByKey, ` if (gea_name == ${literal}) ${refuseFieldText(structName, access.key)}`);
|
|
1896
1984
|
record(defines, definesByKey, ` if (gea_name == ${literal}) ${refuseFieldText(structName, access.key)}`);
|
|
@@ -1898,7 +1986,7 @@ unaddressableDemands = undefined) => {
|
|
|
1898
1986
|
else {
|
|
1899
1987
|
record(writes, writesByKey, ` if (gea_name == ${literal}) { if (${presence} ? !${attributes}.writable : !gea_extensible) return false; ` +
|
|
1900
1988
|
`${access.member} = ${load('gea_value')}; ${firstFieldStore(presence, attributes, field.key)} ${presence} = true; return true; }`);
|
|
1901
|
-
record(defines, definesByKey, ` if (gea_name == ${literal}) return gea::applyNativeFieldDescriptorLoaded(` +
|
|
1989
|
+
record(defines, definesByKey, ` if (gea_name == ${literal}) return gea::applyNativeFieldDescriptorLoaded<${cppTypeOf(field.value)}, ${nativeFieldPolicyType(field.value)}>(` +
|
|
1902
1990
|
`${access.member}, ${attributes}, ${presence}, gea_descriptor, gea_extensible, [&](const gea::Value& gea_value) { return ${load('gea_value')}; });`);
|
|
1903
1991
|
}
|
|
1904
1992
|
}
|
|
@@ -1952,6 +2040,26 @@ unaddressableDemands = undefined) => {
|
|
|
1952
2040
|
reads.push(read === null
|
|
1953
2041
|
? ` if (gea_name == ${literal}) ${refuseFieldText(structName, accessor.key)}`
|
|
1954
2042
|
: ` if (gea_name == ${literal}) { if (!${presence}) return false; gea_out = ${read}; return true; }`);
|
|
2043
|
+
const native = nativeAccessorAccessOf(accessor, layouts?.accessorAbiFor);
|
|
2044
|
+
const getterCall = accessor.getter === null ? '' : `${cppBodyName(accessor.getter)}(${getEnvironment}${selfText})`;
|
|
2045
|
+
const nativeRead = native.read !== null
|
|
2046
|
+
? ` if (gea_name == ${literal}) { if (!${presence} || ` +
|
|
2047
|
+
`!gea_out.accepts<${cppTypeOf(native.read.value)}, ${nativeFieldPolicyType(native.read.value)}>()) return false; ` +
|
|
2048
|
+
`return gea_out.assign${nativeFieldPolicyTemplate(native.read.value)}(${native.read.voidResult ? `((void)(${getterCall}), gea::Undefined{})` : getterCall}); }`
|
|
2049
|
+
: ` if (gea_name == ${literal}) return false;`;
|
|
2050
|
+
if (fieldOperations === undefined || fieldOperations.get(accessor.key)?.has('native-read')) {
|
|
2051
|
+
nativeReads.push(nativeRead);
|
|
2052
|
+
nativeReadsByKey.set(accessor.key, nativeRead);
|
|
2053
|
+
}
|
|
2054
|
+
const nativeWrite = native.write !== null && accessor.setter !== null
|
|
2055
|
+
? ` if (gea_name == ${literal}) { if (!${presence}) return false; std::optional<${cppTypeOf(native.write.value)}> gea_native_value; ` +
|
|
2056
|
+
`if (!gea_value.read${nativeFieldPolicyTemplate(native.write.value)}(gea_native_value)) return false; ` +
|
|
2057
|
+
`${cppBodyName(accessor.setter)}(${setEnvironment}${selfText}, *gea_native_value); return true; }`
|
|
2058
|
+
: ` if (gea_name == ${literal}) return false;`;
|
|
2059
|
+
if (fieldOperations === undefined || fieldOperations.get(accessor.key)?.has('native-write')) {
|
|
2060
|
+
nativeFieldWrites.push(nativeWrite);
|
|
2061
|
+
nativeFieldWritesByKey.set(accessor.key, nativeWrite);
|
|
2062
|
+
}
|
|
1955
2063
|
// A `[[Set]]` on a getter-only accessor FAILS -- `false` here, never a
|
|
1956
2064
|
// fallthrough, which would let the box grow an expando that shadows the
|
|
1957
2065
|
// getter from then on.
|
|
@@ -2000,24 +2108,42 @@ unaddressableDemands = undefined) => {
|
|
|
2000
2108
|
// here) follows every field.
|
|
2001
2109
|
const ownKeys = interleavedOwnKeys(layout.fields, accessors);
|
|
2002
2110
|
const stringKeys = ownKeys.filter((key) => !cppRecordFieldKeyIsSymbol(key));
|
|
2111
|
+
// Small layouts retain straight-line traversal; larger layouts share one
|
|
2112
|
+
// native metadata table across the two enumeration protocols. Values never
|
|
2113
|
+
// enter the table: only name, presence and descriptor state do.
|
|
2114
|
+
const compactStringKeys = stringKeys.length >= 8;
|
|
2115
|
+
const stringFieldMetadata = compactStringKeys
|
|
2116
|
+
? [
|
|
2117
|
+
` inline static constexpr gea::detail::NativeStringFieldMetadata<${structName}> gea_stringFieldMetadata[] = {`,
|
|
2118
|
+
...stringKeys.map((key) => ` {${cppStringLiteral(key)}, &${structName}::${cppRecordFieldPresenceName(key)}, &${structName}::${cppRecordFieldAttributesName(key)}},`),
|
|
2119
|
+
' };'
|
|
2120
|
+
]
|
|
2121
|
+
: [];
|
|
2003
2122
|
const enumerableStringKeysBody = (base && base.native) || stringKeys.some(isArrayIndexKey)
|
|
2004
2123
|
? [' return false;']
|
|
2005
2124
|
: [
|
|
2006
2125
|
...(base ? [` if (!this->${base.structName}::gea_ownEnumerableStringKeys(gea_out)) return false;`] : []),
|
|
2007
|
-
...
|
|
2126
|
+
...(compactStringKeys
|
|
2127
|
+
? [' gea::detail::appendNativeEnumerableStringFieldKeys(*this, gea_stringFieldMetadata, gea_out);']
|
|
2128
|
+
: stringKeys.map((key) => ` if (${cppRecordFieldPresenceName(key)} && ${cppRecordFieldAttributesName(key)}.enumerable) gea_out.push_back(${cppStringLiteral(key)});`)),
|
|
2008
2129
|
...sidecarEnumerableStringKeys,
|
|
2009
2130
|
' return true;'
|
|
2010
2131
|
];
|
|
2011
|
-
const keys =
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2132
|
+
const keys = [
|
|
2133
|
+
...(compactStringKeys ? [' gea::detail::appendNativeStringFieldKeys(*this, gea_stringFieldMetadata, gea_declared);'] : []),
|
|
2134
|
+
...ownKeys.flatMap((key) => {
|
|
2135
|
+
if (compactStringKeys && !cppRecordFieldKeyIsSymbol(key))
|
|
2136
|
+
return [];
|
|
2137
|
+
if (!cppRecordFieldKeyIsSymbol(key))
|
|
2138
|
+
return [` if (${cppRecordFieldPresenceName(key)}) gea_declared.push_back(gea::PropertyKey::string(${cppStringLiteral(key)}));`];
|
|
2139
|
+
const wellKnown = wellKnownSymbolEnumNameOf(wellKnownSymbols, key);
|
|
2140
|
+
if (wellKnown === null)
|
|
2141
|
+
return [];
|
|
2142
|
+
return [
|
|
2143
|
+
` if (${cppRecordFieldPresenceName(key)}) gea_declared.push_back(gea::PropertyKey::symbol(gea::wellKnownSymbol(gea::detail::WellKnownSymbol::${wellKnown})));`
|
|
2144
|
+
];
|
|
2145
|
+
})
|
|
2146
|
+
];
|
|
2021
2147
|
const matches = ownKeys.map((key) => ` if (gea_name == ${cppStringLiteral(key)}) return true;`);
|
|
2022
2148
|
const matchesByKey = new Map(layout.fields.map((field) => [field.key, matches[ownKeys.indexOf(field.key)]]));
|
|
2023
2149
|
const presentFields = ownKeys.map((key) => ` if (gea_name == ${cppStringLiteral(key)}) { gea_out = ${cppRecordFieldPresenceName(key)}; return true; }`);
|
|
@@ -2075,8 +2201,8 @@ unaddressableDemands = undefined) => {
|
|
|
2075
2201
|
// deletion and the integrity levels are the same statement for every field,
|
|
2076
2202
|
// so the runtime states each once over `gea_eachOwnField` (gea_runtime.h's
|
|
2077
2203
|
// `nativeOwnFieldPresent` and siblings) where each hook spelled one line per
|
|
2078
|
-
// field -- eight lines per field of every struct,
|
|
2079
|
-
//
|
|
2204
|
+
// field -- eight lines per field of every struct, megabytes of a large
|
|
2205
|
+
// program's unit.
|
|
2080
2206
|
// Stated for a struct with NO declared field too: the runtime's
|
|
2081
2207
|
// `noteNativeIndexKeyCreated` walks the table of any record whose index
|
|
2082
2208
|
// sidecar takes a key, and a `{ [key: string]: T }` record has a sidecar
|
|
@@ -2184,11 +2310,14 @@ unaddressableDemands = undefined) => {
|
|
|
2184
2310
|
// recipes the dynamic protocol would emit, unreachable until reflection
|
|
2185
2311
|
// demand turns the protocol on. Stating only the predicate tripped the
|
|
2186
2312
|
// fail-closed static_assert in native-symbol-property-identity.
|
|
2313
|
+
const indexMember = indexProtocol ? classMember : () => [];
|
|
2314
|
+
const dynamicIndexMember = indexProtocol ? dynamicMember : () => [];
|
|
2187
2315
|
const nativeIndexMember = sidecarNativeWrites.size > 0 ? classMember : dynamicMember;
|
|
2188
2316
|
const nativeWriteMethods = [...sidecarNativeWrites].flatMap(([valueType, writes]) => [
|
|
2189
2317
|
...classMember(`bool gea_writeOwnIndexNative(const gea::PropertyKey& gea_key, const ${valueType}& gea_value, bool gea_extensible = true)`, [...writes, ' return false;'])
|
|
2190
2318
|
]);
|
|
2191
2319
|
return [
|
|
2320
|
+
...stringFieldMetadata,
|
|
2192
2321
|
...ownFieldTable,
|
|
2193
2322
|
// This struct's declared fields, as a boxed `gea::Value` reads them. `false` means the struct does not declare the key, which sends it to the box's expando table.
|
|
2194
2323
|
...classMember('bool gea_ownFieldPresent(const gea::PropertyKey& gea_key, bool& gea_out) const', [
|
|
@@ -2205,12 +2334,12 @@ unaddressableDemands = undefined) => {
|
|
|
2205
2334
|
...(base && !base.native ? [` if (this->${base.structName}::gea_ownFieldEnumerable(gea_key, gea_out)) return true;`] : []),
|
|
2206
2335
|
' return false;'
|
|
2207
2336
|
]),
|
|
2208
|
-
...
|
|
2337
|
+
...indexMember('bool gea_ownIndexPresent(const gea::PropertyKey& gea_key, bool& gea_out) const', [
|
|
2209
2338
|
...(base && !base.native ? [` if (this->${base.structName}::gea_ownIndexPresent(gea_key, gea_out)) return true;`] : []),
|
|
2210
2339
|
...sidecarPresent,
|
|
2211
2340
|
' return false;'
|
|
2212
2341
|
]),
|
|
2213
|
-
...
|
|
2342
|
+
...indexMember('bool gea_ownIndexEnumerable(const gea::PropertyKey& gea_key, bool& gea_out) const', [
|
|
2214
2343
|
...(base && !base.native ? [` if (this->${base.structName}::gea_ownIndexEnumerable(gea_key, gea_out)) return true;`] : []),
|
|
2215
2344
|
...sidecarEnumerable,
|
|
2216
2345
|
' return false;'
|
|
@@ -2228,8 +2357,8 @@ unaddressableDemands = undefined) => {
|
|
|
2228
2357
|
...symbolBranchFor('gea_readOwnFieldNative(gea_key, gea_out)', true),
|
|
2229
2358
|
...nameOf([...nativeReads, ...accessors.map((accessor) => accessor.key)]),
|
|
2230
2359
|
...nativeReads,
|
|
2231
|
-
//
|
|
2232
|
-
//
|
|
2360
|
+
// A demand without an actual getter ABI cannot name a native leaf.
|
|
2361
|
+
// An accessor still shadows a base data field of the same name.
|
|
2233
2362
|
...accessors.map((accessor) => ` if (gea_name == ${cppStringLiteral(accessor.key)}) return false;`),
|
|
2234
2363
|
...(base && !base.native ? [` return this->${base.structName}::gea_readOwnFieldNative(gea_key, gea_out);`] : [' return false;'])
|
|
2235
2364
|
]),
|
|
@@ -2340,54 +2469,50 @@ unaddressableDemands = undefined) => {
|
|
|
2340
2469
|
' return true;'
|
|
2341
2470
|
]),
|
|
2342
2471
|
// A present entry of this record's index-signature sidecar. It is deliberately separate from fixed C++ fields: the former is configurable, the latter is not.
|
|
2343
|
-
...
|
|
2472
|
+
...dynamicIndexMember('bool gea_readOwnIndex(const gea::PropertyKey& gea_key, gea::Value& gea_out) const', [
|
|
2344
2473
|
...baseIndexRead,
|
|
2345
2474
|
...sidecarRead,
|
|
2346
2475
|
' return false;'
|
|
2347
2476
|
]),
|
|
2348
2477
|
// Whether a key belongs to this typed index domain, even when no entry is present.
|
|
2349
|
-
...
|
|
2478
|
+
...dynamicIndexMember('bool gea_matchesOwnIndex(const gea::PropertyKey& gea_key) const', [
|
|
2350
2479
|
...baseIndexMatches,
|
|
2351
2480
|
...sidecarMatches,
|
|
2352
2481
|
' return false;'
|
|
2353
2482
|
]),
|
|
2354
2483
|
// Store one index-signature entry without making it masquerade as a fixed field.
|
|
2355
|
-
...
|
|
2356
|
-
...baseIndexWrite,
|
|
2357
|
-
...sidecarWrite,
|
|
2358
|
-
' return false;'
|
|
2359
|
-
]),
|
|
2484
|
+
...dynamicIndexMember('bool gea_writeOwnIndex(const gea::PropertyKey& gea_key, const gea::Value& gea_value, bool gea_extensible = true)', [...baseIndexWrite, ...sidecarWrite, ' return false;']),
|
|
2360
2485
|
// Complete descriptor reflection for one present typed index entry.
|
|
2361
|
-
...
|
|
2486
|
+
...dynamicIndexMember('bool gea_ownIndexDescriptor(const gea::PropertyKey& gea_key, gea::PropertyDescriptor& gea_out) const', [
|
|
2362
2487
|
...baseIndexDescriptor,
|
|
2363
2488
|
...sidecarDescriptor,
|
|
2364
2489
|
' return false;'
|
|
2365
2490
|
]),
|
|
2366
2491
|
// Data-descriptor-only ValidateAndApplyPropertyDescriptor for the typed index store.
|
|
2367
|
-
...
|
|
2492
|
+
...dynamicIndexMember('bool gea_defineOwnIndex(const gea::PropertyKey& gea_key, const gea::PropertyDescriptor& gea_descriptor, bool gea_extensible)', [...baseIndexDefine, ...sidecarDefine, ' return false;']),
|
|
2368
2493
|
// Typed indexed assignment keeps its value native while honoring the same descriptor bits.
|
|
2369
2494
|
...nativeWriteMethods,
|
|
2370
2495
|
// Delete an index-signature entry. Fixed fields intentionally never reach this hook.
|
|
2371
|
-
...
|
|
2496
|
+
...dynamicIndexMember('bool gea_deleteOwnIndex(const gea::PropertyKey& gea_key)', [
|
|
2372
2497
|
...baseIndexDelete,
|
|
2373
2498
|
...sidecarDelete,
|
|
2374
2499
|
' return false;'
|
|
2375
2500
|
]),
|
|
2376
2501
|
// Freeze the sidecar entries without changing their native value carrier.
|
|
2377
|
-
...
|
|
2502
|
+
...indexMember('void gea_freezeOwnIndex()', [...baseIndexFreeze, ...sidecarFreeze]),
|
|
2378
2503
|
// Seal keeps typed index values writable while making their present entries non-configurable.
|
|
2379
|
-
...
|
|
2504
|
+
...indexMember('void gea_sealOwnIndex()', [
|
|
2380
2505
|
...(base && !base.native ? [` this->${base.structName}::gea_sealOwnIndex();`] : []),
|
|
2381
2506
|
...sidecarSeal
|
|
2382
2507
|
]),
|
|
2383
2508
|
// TestIntegrityLevel(frozen) over present typed index entries.
|
|
2384
|
-
...
|
|
2509
|
+
...indexMember('bool gea_ownIndexFrozen() const', [
|
|
2385
2510
|
...(base && !base.native ? [` if (!this->${base.structName}::gea_ownIndexFrozen()) return false;`] : []),
|
|
2386
2511
|
...sidecarFrozen,
|
|
2387
2512
|
' return true;'
|
|
2388
2513
|
]),
|
|
2389
2514
|
// TestIntegrityLevel(sealed) over present typed index entries.
|
|
2390
|
-
...
|
|
2515
|
+
...indexMember('bool gea_ownIndexSealed() const', [
|
|
2391
2516
|
...(base && !base.native ? [` if (!this->${base.structName}::gea_ownIndexSealed()) return false;`] : []),
|
|
2392
2517
|
...sidecarSealed,
|
|
2393
2518
|
' return true;'
|
|
@@ -2403,8 +2528,8 @@ unaddressableDemands = undefined) => {
|
|
|
2403
2528
|
...keys,
|
|
2404
2529
|
...sidecarKeys,
|
|
2405
2530
|
// The runtime's one 10.1.11.1 ordering, which every other own-key list
|
|
2406
|
-
// takes; spelled out here it was the same fourteen lines in
|
|
2407
|
-
//
|
|
2531
|
+
// takes; spelled out here it was the same fourteen lines in every
|
|
2532
|
+
// struct of the program.
|
|
2408
2533
|
' gea::detail::orderOwnPropertyKeysFrom(gea_out, gea_start);'
|
|
2409
2534
|
]),
|
|
2410
2535
|
// `EnumerableOwnPropertyNames` (7.3.23) in ONE pass, for a struct whose
|
|
@@ -2413,7 +2538,7 @@ unaddressableDemands = undefined) => {
|
|
|
2413
2538
|
// `Object.keys` of a boxed struct otherwise built the full key list, sorted
|
|
2414
2539
|
// it twice (once here, once in `nativeOwnKeysInCreationOrder`) and asked
|
|
2415
2540
|
// for a descriptor per key -- thirteen allocations and a quadratic scan per
|
|
2416
|
-
//
|
|
2541
|
+
// object a serializing program walked. `false` hands the caller
|
|
2417
2542
|
// back to that path: a key 10.1.11.1 orders ahead of the fields, or a base
|
|
2418
2543
|
// this emitter did not generate.
|
|
2419
2544
|
...classMember('bool gea_ownEnumerableStringKeys(std::vector<std::string>& gea_out) const', enumerableStringKeysBody)
|
|
@@ -2486,20 +2611,24 @@ export const cppReactiveRevisionFieldName = (key) => `${cppRecordFieldName(key)}
|
|
|
2486
2611
|
* and paid for it with N per-field heap allocations where the whole struct
|
|
2487
2612
|
* needed at most one -- see `RecordTail`'s own comment in the runtime header).
|
|
2488
2613
|
*/
|
|
2614
|
+
// Native field protocols carry the cell's value, while writes must still notify
|
|
2615
|
+
// through the physical cell. Share the storage decision with every protocol.
|
|
2616
|
+
const fieldCellPayloadType = (field, reactive, celled, narrowed) => {
|
|
2617
|
+
if (reactive.cell === null || !celled.has(field.key) || !representationCanCell(field.value))
|
|
2618
|
+
return undefined;
|
|
2619
|
+
return narrowed ? cppNarrowedIntegerType : cppTypeOf(field.value);
|
|
2620
|
+
};
|
|
2489
2621
|
const fieldStorageType = (field, reactive, celled, narrowed) => {
|
|
2490
2622
|
const inner = narrowed ? cppNarrowedIntegerType : cppTypeOf(field.value);
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
if (!representationCanCell(field.value))
|
|
2494
|
-
return inner;
|
|
2495
|
-
return `${reactive.cell}<${inner}>`;
|
|
2623
|
+
const payload = fieldCellPayloadType(field, reactive, celled, narrowed);
|
|
2624
|
+
return payload === undefined ? inner : `${reactive.cell}<${payload}>`;
|
|
2496
2625
|
};
|
|
2497
2626
|
const emptyStringSet = new Set();
|
|
2498
2627
|
/**
|
|
2499
2628
|
* `GEA_SPARSE_RECORD_LAYOUT=0` turns the whole tail-field split off: every
|
|
2500
2629
|
* struct emits exactly the fields it would have before this layout existed,
|
|
2501
|
-
* byte-identical. The A/B this exists for is a CPU measurement on
|
|
2502
|
-
*
|
|
2630
|
+
* byte-identical. The A/B this exists for is a CPU measurement on a large
|
|
2631
|
+
* real program, not a correctness question -- both arms are sound -- so a
|
|
2503
2632
|
* single env read at emission time, asked everywhere `tailFieldsOf` is (never
|
|
2504
2633
|
* cached, since one process only ever emits with one answer), is the whole
|
|
2505
2634
|
* mechanism.
|
|
@@ -2511,10 +2640,10 @@ const sparseLayoutDisabled = () => process.env.GEA_SPARSE_RECORD_LAYOUT === '0';
|
|
|
2511
2640
|
* them optional, reserves every field's bytes in the block `makeRef` takes
|
|
2512
2641
|
* on every allocation of it, copies every one of those bytes on every
|
|
2513
2642
|
* `{...spread}`, and touches every one of them tracing and destroying it --
|
|
2514
|
-
* whether or not the field was ever set. Measured against
|
|
2515
|
-
* `extends`-connected options family
|
|
2516
|
-
*
|
|
2517
|
-
*
|
|
2643
|
+
* whether or not the field was ever set. Measured against an
|
|
2644
|
+
* `extends`-connected options family of 100+ fields, ~90% optional, allocated
|
|
2645
|
+
* many times per operation -- where those blocks were most of all bytes the
|
|
2646
|
+
* program allocated.
|
|
2518
2647
|
*/
|
|
2519
2648
|
const sparseLayoutFieldThreshold = 32;
|
|
2520
2649
|
/** The fraction of a qualifying struct's fields that must be optional for the layout to be worth sparsifying at all. */
|
|
@@ -2747,7 +2876,7 @@ const reactiveFieldsByStruct = (classes, reactive, fieldsByStruct, bound) => {
|
|
|
2747
2876
|
// Only the members a JSX slot actually BINDS, never every cellable one.
|
|
2748
2877
|
// `Signal<T>` is not the field's declared carrier, so celling a member
|
|
2749
2878
|
// nothing renders can stop the struct compiling for its other readers:
|
|
2750
|
-
//
|
|
2879
|
+
// one program held `rows` (rendered) beside `items` (parsed out of
|
|
2751
2880
|
// JSON), and celling `Item.id` made `gea_json_read(reader, out.id)` an
|
|
2752
2881
|
// error. `reactiveBoundRecordFields` answers which members are bound.
|
|
2753
2882
|
const elementStruct = cppRecordStructName(element.shapeId);
|
|
@@ -2954,6 +3083,13 @@ virtualDeclarations = new Map(),
|
|
|
2954
3083
|
layouts = undefined,
|
|
2955
3084
|
/** `traceLeafStructsOf` proved this struct a leaf of the cycle collector: written down for `gea::detail::RefTargetIsLeaf`. */
|
|
2956
3085
|
traceLeaf = false,
|
|
3086
|
+
/**
|
|
3087
|
+
* A leaf only because every edge it holds points at an older object
|
|
3088
|
+
* (`traceLeafStructsOf`'s `olderOnly`): it reports no traced edge at all, so
|
|
3089
|
+
* the collector never buffers it -- and so the runtime never asks
|
|
3090
|
+
* `TraceEdges` of its own self-referencing fields, which would be circular.
|
|
3091
|
+
*/
|
|
3092
|
+
untraced = false,
|
|
2957
3093
|
/**
|
|
2958
3094
|
* Whether no `freeze`/`seal`/`defineProperty` in the program can reach an
|
|
2959
3095
|
* instance of this struct (`integrity-restrictions.ts`'s
|
|
@@ -2969,15 +3105,15 @@ attributesConstant = false,
|
|
|
2969
3105
|
* exactly once (`immortalMethodStateRoots`): its per-instance method-state
|
|
2970
3106
|
* handle is then not an edge the collector follows -- see there.
|
|
2971
3107
|
*/
|
|
2972
|
-
methodStateUntraced = false) => {
|
|
3108
|
+
methodStateUntraced = false, indexProtocol = true, dynamicFieldLoad) => {
|
|
2973
3109
|
const isNarrowed = (field) => narrowedSlots.has(integerStorageSlot(structName, field.key));
|
|
2974
3110
|
// A class keeps every field inline. Its fields are stored by the
|
|
2975
3111
|
// constructor views, the property-store emitter and callable frames, which
|
|
2976
3112
|
// all address a class member by name; only the record paths spell a tail
|
|
2977
3113
|
// block (`tailAwareFieldWriteText`). A tailed class therefore rendered
|
|
2978
3114
|
// `gea_this->precision = ...` against a struct whose `precision` lived in
|
|
2979
|
-
// its tail --
|
|
2980
|
-
//
|
|
3115
|
+
// its tail -- a class that crossed the sparse-layout threshold had a
|
|
3116
|
+
// constructor that no longer compiled.
|
|
2981
3117
|
const tailFields = classDispatch ? emptyStringSet : tailFieldsOf(layout, celled, reactive.cell, isNarrowed);
|
|
2982
3118
|
const tailStructName = cppRecordTailStructName(structName);
|
|
2983
3119
|
const tailLines = [];
|
|
@@ -3182,25 +3318,30 @@ methodStateUntraced = false) => {
|
|
|
3182
3318
|
// renderer cannot see from one struct, so it never tries to predict it.
|
|
3183
3319
|
if (traceLeaf)
|
|
3184
3320
|
lines.push(' static constexpr bool gea_traceLeaf = true;');
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
lines.push(
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3321
|
+
if (untraced) {
|
|
3322
|
+
lines.push(` [[maybe_unused]] friend auto geaTraceRefs(const ${structName}&, gea::detail::RefVisitor&) -> std::false_type { return {}; }`);
|
|
3323
|
+
}
|
|
3324
|
+
else {
|
|
3325
|
+
lines.push(` [[maybe_unused]] friend auto geaTraceRefs(const ${structName}& value, gea::detail::RefVisitor& visitor)`);
|
|
3326
|
+
lines.push(` -> std::bool_constant<${traceableFields.length ? traceableFields.join(' || ') : 'false'}> {`);
|
|
3327
|
+
if (base)
|
|
3328
|
+
lines.push(` gea::detail::traceRefs(static_cast<const ${base.structName}&>(value), visitor);`);
|
|
3329
|
+
if (ownsMethodState && !staticMethodState && !methodStateUntraced)
|
|
3330
|
+
lines.push(' gea::detail::traceRefs(value.gea_method_state, visitor);');
|
|
3331
|
+
for (const field of layout.fields) {
|
|
3332
|
+
if (tailFields.has(field.key))
|
|
3333
|
+
continue;
|
|
3334
|
+
lines.push(` gea::detail::traceRefs(value.${cppRecordFieldName(field.key)}, visitor);`);
|
|
3335
|
+
}
|
|
3336
|
+
if (tailFields.size > 0)
|
|
3337
|
+
lines.push(` gea::detail::traceRefs(value.${cppRecordTailMemberName}, visitor);`);
|
|
3338
|
+
for (const index of layout.indexes)
|
|
3339
|
+
lines.push(` gea::detail::traceRefs(value.${cppRecordIndexSidecarNameFor(index, layout.indexes)}, visitor);`);
|
|
3340
|
+
lines.push(' return {};');
|
|
3341
|
+
lines.push(' }');
|
|
3195
3342
|
}
|
|
3196
|
-
if (tailFields.size > 0)
|
|
3197
|
-
lines.push(` gea::detail::traceRefs(value.${cppRecordTailMemberName}, visitor);`);
|
|
3198
|
-
for (const index of layout.indexes)
|
|
3199
|
-
lines.push(` gea::detail::traceRefs(value.${cppRecordIndexSidecarNameFor(index, layout.indexes)}, visitor);`);
|
|
3200
|
-
lines.push(' return {};');
|
|
3201
|
-
lines.push(' }');
|
|
3202
3343
|
const unaddressableDemands = [];
|
|
3203
|
-
for (const line of renderFieldDispatcher(structName, classDispatch ? reflectedClassLayout(layout) : layout, base?.hookless ? undefined : base, classDispatch, (field) => fieldStorageType(field, reactive, celled, isNarrowed(field)), tailFields, wellKnownSymbols, definitions, dynamicProtocol, fieldOperations, accessorCarriesEnvironment, isFinal && base === undefined, lazyArrowFields, virtualDeclarations, layouts, unaddressableDemands))
|
|
3344
|
+
for (const line of renderFieldDispatcher(structName, classDispatch ? reflectedClassLayout(layout) : layout, base?.hookless ? undefined : base, classDispatch, (field) => fieldStorageType(field, reactive, celled, isNarrowed(field)), tailFields, wellKnownSymbols, definitions, dynamicProtocol, fieldOperations, accessorCarriesEnvironment, isFinal && base === undefined, lazyArrowFields, virtualDeclarations, layouts, unaddressableDemands, indexProtocol, dynamicFieldLoad, (field) => fieldCellPayloadType(field, reactive, celled, isNarrowed(field))))
|
|
3204
3345
|
lines.push(line);
|
|
3205
3346
|
if (unaddressableDemands.length > 0)
|
|
3206
3347
|
return {
|
|
@@ -3209,8 +3350,8 @@ methodStateUntraced = false) => {
|
|
|
3209
3350
|
};
|
|
3210
3351
|
// `gea::makeRef<T>()` with no arguments value-initializes, and for an
|
|
3211
3352
|
// aggregate that is a memset of the whole object before any member's own
|
|
3212
|
-
// constructor runs --
|
|
3213
|
-
//
|
|
3353
|
+
// constructor runs -- kilobytes per record for a 100+-field options family
|
|
3354
|
+
// allocated many times per operation, all of it overwritten a byte at a time
|
|
3214
3355
|
// by the members' constructors. The marker tells `makeRef` (gea_runtime.h)
|
|
3215
3356
|
// to default-initialize instead. It is written only when every member
|
|
3216
3357
|
// provably initializes itself: an `Optional` writes its state, a `Ref` its
|
|
@@ -3313,9 +3454,10 @@ narrowedSlots = new Set(),
|
|
|
3313
3454
|
* lets a symbol-keyed field's dispatcher tell `Symbol.iterator` and its
|
|
3314
3455
|
* fourteen siblings, whose runtime identity is fixed at a known low id,
|
|
3315
3456
|
* apart from a genuinely unique symbol whose id only exists once the
|
|
3316
|
-
* program runs. See `wellKnownSymbolEnumNameOf`.
|
|
3457
|
+
* program runs. See `wellKnownSymbolEnumNameOf`. Required: an absent census
|
|
3458
|
+
* would silently read every well-known symbol key as a unique one.
|
|
3317
3459
|
*/
|
|
3318
|
-
wellKnownSymbols
|
|
3460
|
+
wellKnownSymbols, splitFieldDefinitions = false, reflection, representations = [...plan.selected.values()], physicalClasses = classes,
|
|
3319
3461
|
/**
|
|
3320
3462
|
* Whether an accessor body carries an environment -- `captures.ts`'s
|
|
3321
3463
|
* admission, asked rather than re-derived, so the member this struct
|
|
@@ -3327,7 +3469,16 @@ fixedFieldStateConstant = false,
|
|
|
3327
3469
|
/** `program-facts.ts`'s `singleEvaluationClasses` -- which classes may hold their method state statically. */
|
|
3328
3470
|
singleEvaluationClasses = new Set(),
|
|
3329
3471
|
/** `integrity-restrictions.ts`'s `restrictsRecordShape` -- see `renderStructDefinition`'s `attributesConstant`. */
|
|
3330
|
-
recordShapeRestricted = () => true
|
|
3472
|
+
recordShapeRestricted = () => true,
|
|
3473
|
+
/** `construction-only-fields.ts`'s `holdsOlder`: the class fields that can only ever point at an older object. */
|
|
3474
|
+
holdsOlder = () => false,
|
|
3475
|
+
/** Certified structural targets may own a traced native origin beyond their declared fields. */
|
|
3476
|
+
nativeViewTargets = new Set(),
|
|
3477
|
+
/** Getter/setter body ABIs authenticate erased native descriptor leaves. Required: no frame is not an answer. */
|
|
3478
|
+
accessorAbiOf,
|
|
3479
|
+
/** Generated dynamic writes consume the selected artifact's certified pair. */
|
|
3480
|
+
conversionSite) => {
|
|
3481
|
+
const classIndexProtocols = classIndexProtocolsOf(physicalClasses, (shapeId) => recordLayoutOfShapeId(deriver, shapeId));
|
|
3331
3482
|
const { links, unlinkable } = classBaseLinks(physicalClasses);
|
|
3332
3483
|
const { requiredStructs, fieldsByStruct, unlayoutable, shapesByStruct } = collectRequiredStructs(representations, deriver, links, unlinkable, classInstanceShapes(physicalClasses), new Map([...physicalClasses.values()].flatMap((layout) => layout.nativeStorage === undefined ? [] : [[cppClassName(layout.declaration), layout.nativeStorage.fields]])));
|
|
3333
3484
|
const celledByStruct = reactiveFieldsByStruct(classes, reactive, fieldsByStruct, boundRecordFields);
|
|
@@ -3360,6 +3511,7 @@ recordShapeRestricted = () => true) => {
|
|
|
3360
3511
|
declarations: [],
|
|
3361
3512
|
fieldDefinitionsByStruct: new Map(),
|
|
3362
3513
|
runtimeClassBases: [],
|
|
3514
|
+
classIndexProtocols,
|
|
3363
3515
|
refused: missing.map((structName) => ({
|
|
3364
3516
|
structName,
|
|
3365
3517
|
reason: `no record layout: ${unlayoutable.get(structName) ?? 'named by no reachable shape'}`
|
|
@@ -3448,7 +3600,7 @@ recordShapeRestricted = () => true) => {
|
|
|
3448
3600
|
staticMethodStateStructs.add(structName);
|
|
3449
3601
|
}
|
|
3450
3602
|
const virtualDeclarations = new Map();
|
|
3451
|
-
const layouts = recordLayoutPolicyOf(deriver, classes, wellKnownSymbols);
|
|
3603
|
+
const layouts = recordLayoutPolicyOf(deriver, classes, wellKnownSymbols, accessorAbiOf);
|
|
3452
3604
|
const ordered = definitionOrder(structNames, links, valueDependencies);
|
|
3453
3605
|
const evaluatedOnce = (structName) => {
|
|
3454
3606
|
const declaration = declarationByStruct.get(structName);
|
|
@@ -3459,7 +3611,13 @@ recordShapeRestricted = () => true) => {
|
|
|
3459
3611
|
const declaration = declarationByStruct.get(structName);
|
|
3460
3612
|
return declaration === undefined || (lazyArrowFieldPlansForClass(classes, declaration)?.size ?? 0) > 0;
|
|
3461
3613
|
});
|
|
3462
|
-
const traceLeafStructs = traceLeafStructsOf(fieldsByStruct, new Set([
|
|
3614
|
+
const { leaves: traceLeafStructs, olderOnly: untracedStructs } = traceLeafStructsOf(fieldsByStruct, new Set([
|
|
3615
|
+
...[...classStructNames, ...baseStructNames, ...links.keys()].filter((structName) => !leafClasses.has(structName)),
|
|
3616
|
+
...nativeViewTargets
|
|
3617
|
+
]), celledByStruct, leafClasses, (structName, key) => {
|
|
3618
|
+
const declaration = declarationByStruct.get(structName);
|
|
3619
|
+
return declaration !== undefined && holdsOlder(declaration, key);
|
|
3620
|
+
});
|
|
3463
3621
|
const orderOf = new Map(ordered.map((structName, index) => [structName, index]));
|
|
3464
3622
|
const rendered = ordered.map((structName) => {
|
|
3465
3623
|
const layout = fieldsByStruct.get(structName);
|
|
@@ -3469,6 +3627,28 @@ recordShapeRestricted = () => true) => {
|
|
|
3469
3627
|
if (!layout)
|
|
3470
3628
|
return { structName, reason: 'has no layout recorded despite passing the missing-struct check' };
|
|
3471
3629
|
const declaration = declarationByStruct.get(structName);
|
|
3630
|
+
const owners = declaration === undefined
|
|
3631
|
+
? [...(shapesByStruct.get(structName) ?? [])].map((shapeId) => dynamicFieldConversionOwnerOf({ kind: 'record', shapeId }))
|
|
3632
|
+
: [dynamicFieldConversionOwnerOf({ kind: 'class-ref', declaration })];
|
|
3633
|
+
const dynamicFieldLoad = (key, target) => {
|
|
3634
|
+
if (conversionSite === undefined)
|
|
3635
|
+
return null;
|
|
3636
|
+
const published = new Set(conversionSite.programConversionRecipes?.map(programConversionKey));
|
|
3637
|
+
const planned = owners.filter((owner) => published.has(programConversionKey({ role: 'dynamic-field-write', owner, slot: key })));
|
|
3638
|
+
if (planned.length === 0)
|
|
3639
|
+
return null;
|
|
3640
|
+
// One struct is one C++ type: two owners each holding a plan for one
|
|
3641
|
+
// member would be two answers for one dispatcher arm.
|
|
3642
|
+
if (planned.length > 1)
|
|
3643
|
+
throw createCppEmitBlockedError('runtime-helper:program-conversion-recipes', `struct ${structName} field ${key} holds ${planned.length} dynamic-field-write plans`);
|
|
3644
|
+
const owner = planned[0];
|
|
3645
|
+
return (text) => {
|
|
3646
|
+
const loaded = programConversionText(conversionSite, 'dynamic-field-write', owner, key, prototypeSetterValue, target, text);
|
|
3647
|
+
if (loaded === null)
|
|
3648
|
+
throw createCppEmitBlockedError('runtime-helper:program-conversion-recipes', `struct ${structName} field ${key} names a dynamic-field-write plan with no rendering`);
|
|
3649
|
+
return loaded;
|
|
3650
|
+
};
|
|
3651
|
+
};
|
|
3472
3652
|
const lazyArrowFields = declaration !== undefined ? lazyArrowFieldPlansForClass(classes, declaration) : undefined;
|
|
3473
3653
|
// An accessor arm calls a body function, and a struct is defined long
|
|
3474
3654
|
// before any body is even forward-declared. So a struct that answers for
|
|
@@ -3486,15 +3666,15 @@ recordShapeRestricted = () => true) => {
|
|
|
3486
3666
|
// treat classes.
|
|
3487
3667
|
const needsOutOfLineFields = (renderableAccessors(layout).length > 0 && !classStructNames.has(structName)) ||
|
|
3488
3668
|
(lazyArrowFields !== undefined && lazyArrowFields.size > 0) ||
|
|
3489
|
-
writesConvertIntoLaterStruct(layouts, layout, orderOf.get(structName) ?? 0, orderOf);
|
|
3669
|
+
writesConvertIntoLaterStruct(layouts, layout, orderOf.get(structName) ?? 0, orderOf, dynamicFieldLoad);
|
|
3490
3670
|
const definitions = splitFieldDefinitions || needsOutOfLineFields ? [] : undefined;
|
|
3491
3671
|
if (definitions)
|
|
3492
3672
|
fieldDefinitionsByStruct.set(structName, definitions);
|
|
3493
|
-
return renderStructDefinition(structName, layout, links.get(structName), reactive, celledByStruct.get(structName) ?? new Set(), narrowedSlots, virtualMembersByStruct.get(structName) ?? [], classStructNames.has(structName), refAddressStableStructs.has(structName), !baseStructNames.has(structName), wellKnownSymbols, definitions, dynamicProtocolByStruct.get(structName) ?? true, fieldOperationsByStruct.get(structName), accessorCarriesEnvironment, fixedFieldStateConstant, staticMethodStateStructs.has(structName), lazyArrowFields, virtualDeclarations, layouts, traceLeafStructs.has(structName), !classStructNames.has(structName) &&
|
|
3673
|
+
return renderStructDefinition(structName, layout, links.get(structName), reactive, celledByStruct.get(structName) ?? new Set(), narrowedSlots, virtualMembersByStruct.get(structName) ?? [], classStructNames.has(structName), refAddressStableStructs.has(structName), !baseStructNames.has(structName), wellKnownSymbols, definitions, dynamicProtocolByStruct.get(structName) ?? true, fieldOperationsByStruct.get(structName), accessorCarriesEnvironment, fixedFieldStateConstant, staticMethodStateStructs.has(structName), lazyArrowFields, virtualDeclarations, layouts, traceLeafStructs.has(structName), untracedStructs.has(structName), !classStructNames.has(structName) &&
|
|
3494
3674
|
!links.has(structName) &&
|
|
3495
3675
|
!baseStructNames.has(structName) &&
|
|
3496
3676
|
[...(shapesByStruct.get(structName) ?? [])].every((shapeId) => !recordShapeRestricted(shapeId, layout.fields.some((field) => cppRecordFieldKeyIsSymbol(field.key)))) &&
|
|
3497
|
-
(shapesByStruct.get(structName)?.size ?? 0) > 0, immortalStateRoots.has(structName));
|
|
3677
|
+
(shapesByStruct.get(structName)?.size ?? 0) > 0, immortalStateRoots.has(structName), declaration === undefined ? layout.indexes.length > 0 : classIndexProtocols.get(declaration) !== false, dynamicFieldLoad);
|
|
3498
3678
|
});
|
|
3499
3679
|
const refused = rendered.filter((entry) => typeof entry !== 'string');
|
|
3500
3680
|
if (refused.length > 0)
|
|
@@ -3502,6 +3682,7 @@ recordShapeRestricted = () => true) => {
|
|
|
3502
3682
|
declarations: [],
|
|
3503
3683
|
fieldDefinitionsByStruct: new Map(),
|
|
3504
3684
|
runtimeClassBases: [],
|
|
3685
|
+
classIndexProtocols,
|
|
3505
3686
|
refused,
|
|
3506
3687
|
revisionFields: new Map(),
|
|
3507
3688
|
celledFields: new Map(),
|
|
@@ -3513,10 +3694,20 @@ recordShapeRestricted = () => true) => {
|
|
|
3513
3694
|
// available fallback on embedded targets. Publish exactly the checker
|
|
3514
3695
|
// proven, emitted-program links to the runtime table; native bases are
|
|
3515
3696
|
// intentionally absent because this compiler has no authenticated native
|
|
3516
|
-
// ancestry contract for them.
|
|
3697
|
+
// ancestry contract for them -- except the runtime's one error record. Every
|
|
3698
|
+
// class extending `Error` (or a NativeError) is emitted as a struct whose
|
|
3699
|
+
// single, first base IS `gea::runtime::Error` (`classBaseLinks`), and the
|
|
3700
|
+
// runtime boxes that record as an ordinary counted object; its table is the
|
|
3701
|
+
// nominal target a caught value asserted `as Error` projects to
|
|
3702
|
+
// (`unboxValue<Ref<gea::runtime::Error>>`), so the link is as authenticated
|
|
3703
|
+
// as a program base's.
|
|
3517
3704
|
const runtimeClassBases = definitionOrder(structNames, links, valueDependencies).flatMap((structName) => {
|
|
3518
3705
|
const link = links.get(structName);
|
|
3519
|
-
if (!classStructNames.has(structName) || !link
|
|
3706
|
+
if (!classStructNames.has(structName) || !link)
|
|
3707
|
+
return [];
|
|
3708
|
+
if (link.native)
|
|
3709
|
+
return link.nativeError === true ? [{ derived: structName, base: link.structName, nativeBase: true }] : [];
|
|
3710
|
+
if (!classStructNames.has(link.structName))
|
|
3520
3711
|
return [];
|
|
3521
3712
|
return [{ derived: structName, base: link.structName }];
|
|
3522
3713
|
});
|
|
@@ -3550,6 +3741,7 @@ recordShapeRestricted = () => true) => {
|
|
|
3550
3741
|
],
|
|
3551
3742
|
fieldDefinitionsByStruct,
|
|
3552
3743
|
runtimeClassBases,
|
|
3744
|
+
classIndexProtocols,
|
|
3553
3745
|
refused: [],
|
|
3554
3746
|
revisionFields,
|
|
3555
3747
|
celledFields,
|
|
@@ -3599,7 +3791,7 @@ const arrayExtensionDeclarations = (representations) => {
|
|
|
3599
3791
|
* translation-unit-scope definitions -- zero-initialized, exactly the way
|
|
3600
3792
|
* `translation-unit.ts`'s own `globalDefinitions` declares a module-scope
|
|
3601
3793
|
* cell's storage. A bare definition rather than one with an inline
|
|
3602
|
-
* initializer on purpose: the ACTUAL value (`new
|
|
3794
|
+
* initializer on purpose: the ACTUAL value (`new Point(0, 1, 0)`, a
|
|
3603
3795
|
* `WeakMap`-closed-over reference, ...) is whatever expression the source
|
|
3604
3796
|
* assignment itself computed, and that expression already runs -- once, at
|
|
3605
3797
|
* the point the enclosing module body reaches that statement -- through the
|
|
@@ -3610,8 +3802,8 @@ const arrayExtensionDeclarations = (representations) => {
|
|
|
3610
3802
|
*
|
|
3611
3803
|
* Emitted after every struct declaration and before any body, mirroring
|
|
3612
3804
|
* `translation-unit.ts`'s own ordering for `globalDefinitions`: a static
|
|
3613
|
-
* whose declared carrier is itself a struct (`
|
|
3614
|
-
*
|
|
3805
|
+
* whose declared carrier is itself a struct (`Node.DEFAULT: Point`) needs
|
|
3806
|
+
* that struct to already be a complete type.
|
|
3615
3807
|
*
|
|
3616
3808
|
* Sorted by name for the same reason every other whole-program list in this
|
|
3617
3809
|
* file is: byte-identical output from one compile to the next, so a diff
|