@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,24 +1,32 @@
|
|
|
1
1
|
import { passingOf, representationKey } from '../../../representation/model.js';
|
|
2
2
|
import { hostMemberTemplateOf } from '../../../representation/host-templates.js';
|
|
3
3
|
import { instanceReparentVerdictOf, isClassConstructorCarrier } from '../../../ir/instance-reparenting.js';
|
|
4
|
-
import { createCppEmitBlockedError,
|
|
4
|
+
import { createCppEmitBlockedError, operandText } from '../emit-context.js';
|
|
5
5
|
import { evaluatedOnceText } from '../evaluated-once.js';
|
|
6
6
|
import { canonicalIndexLiteral, memberAccessOperator } from '../emit-carrier-members.js';
|
|
7
|
+
import { callableIdentityEqualityText } from '../emit-equality.js';
|
|
7
8
|
import { classMemberOf, lazyArrowFieldPlanOf } from '../class-layout.js';
|
|
8
|
-
import { alignedValueText, dynamicCarrierBoxText, recipeText } from '../emit-narrowing.js';
|
|
9
|
-
import {
|
|
9
|
+
import { alignedValueText, dynamicCarrierBoxText, namedConversionText, recipeText } from '../emit-narrowing.js';
|
|
10
|
+
import { nativeAccessorDefinitionText, nativeAccessorObservedFunctionText } from '../emit-native-accessor-definition.js';
|
|
11
|
+
import { nativeOwnAssignmentText } from '../emit-native-own-assignment.js';
|
|
12
|
+
import { nativeArrayDescriptorSnapshotText, nativeDescriptorSnapshotDefinitionLines } from '../emit-descriptor-snapshot.js';
|
|
13
|
+
import { nativeCallablePrototypeObservationText } from '../emit-native-callable-data.js';
|
|
14
|
+
import { getOwnValue, isDynamicCarrier, objectViewFrom, objectViewOf, nativeHandleShapeCallText, callableShapeCallText, ownEnumerableKeysText, ownKeyFields, ownKeyPresenceText, refuseDictionaryArm, refuseObjectCarrier, runtimeOwnKeyText, setOwnCallableText, setOwnText } from './object-protocol.js';
|
|
10
15
|
import { hostIntrinsicLengthOf, hostMemberOf } from './host-members.js';
|
|
11
16
|
import { hostFunctionValueText, hostPrototypeMethodValueText } from './emit-host-value.js';
|
|
12
17
|
import { armAt, armIs } from '../emit-union-properties.js';
|
|
13
18
|
import { constructorStateText, constructorViewFieldFor } from '../class-properties/emit-class-properties.js';
|
|
14
19
|
import { isNativeError } from '../error-types.js';
|
|
15
|
-
import { nativeBaseFieldOf, recordFieldsOfShape, recordIndexesOfShape } from '../records.js';
|
|
20
|
+
import { nativeBaseFieldOf, nativeFieldPolicyType, recordFieldsOfShape, recordIndexesOfShape } from '../records.js';
|
|
16
21
|
import { keyOrderUnobservedIn } from '../key-order-tracking.js';
|
|
17
22
|
import { indexedRecordViewOf } from '../../../ir/certify/carrier-keys.js';
|
|
18
23
|
import { cppArrayExtensionStructName, cppBodyName, cppClassName, cppRecordFieldAttributesName, cppRecordFieldName, cppRecordFieldPresenceName, cppRecordStructName, cppStringLiteral, cppTypeOf, cppUndefinedValue, unitFunctionName } from '../types.js';
|
|
19
24
|
import { isNativeCallableCarrier, ownershipOfGeneratedCarrier, propertyKeyText as propertyKeyOperandText, stringKeyPreludeText } from '../emit-dynamic-properties.js';
|
|
20
25
|
import { regexpRoleOf } from '../prototype/emit-prototype-regexp.js';
|
|
21
26
|
import { ownPropertySymbolsText } from './emit-host-reflect.js';
|
|
27
|
+
import { hostObjectRouteKey } from '../../../ir/host-template-conversions.js';
|
|
28
|
+
import { structuralConversionKey } from '../../../conversion/structural-plan.js';
|
|
29
|
+
import { nativeCallableDataDefinitionValueText } from '../emit-native-callable-data.js';
|
|
22
30
|
/**
|
|
23
31
|
* `Object`'s statics -- the call-site half of the `ObjectConstructor@1`
|
|
24
32
|
* boundary.
|
|
@@ -113,9 +121,9 @@ const targetOf = (ctx, member, operation) => {
|
|
|
113
121
|
* chain is well typed whatever mix of records and dictionaries the union
|
|
114
122
|
* holds.
|
|
115
123
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* Record<
|
|
124
|
+
* The case: `Object.entries( headers )` where `headers` is
|
|
125
|
+
* `Record<'Content-Type', Mime> | Record<HeaderName, string> |
|
|
126
|
+
* Record<string, string>` -- two records and
|
|
119
127
|
* a dictionary, and refusing the union outright refused a program in which
|
|
120
128
|
* every arm on its own is renderable.
|
|
121
129
|
*
|
|
@@ -132,11 +140,11 @@ const overCarrier = (ctx, member, operation, render, renderArray) => {
|
|
|
132
140
|
* A deferred value's text IS the expression that computes it
|
|
133
141
|
* (`isDeferredValue`), and the static arms of `entries`, `values` and `keys`
|
|
134
142
|
* name the receiver once per field -- in the read, the presence test, the
|
|
135
|
-
* `[[Enumerable]]` test and the creation-order walk.
|
|
136
|
-
* `Object.entries(this.options)`
|
|
137
|
-
* conversion
|
|
138
|
-
*
|
|
139
|
-
* evaluated the options' sidecar reads
|
|
143
|
+
* `[[Enumerable]]` test and the creation-order walk.
|
|
144
|
+
* `Object.entries(this.options)` reading a class's options through a record
|
|
145
|
+
* conversion pasted that conversion once per field use -- hundreds of times
|
|
146
|
+
* over a wide options family, one multi-megabyte statement no C++ compiler
|
|
147
|
+
* finishes -- and evaluated the options' sidecar reads as often at run time. A named value is
|
|
140
148
|
* already evaluated once and renders unchanged; `evaluated-once.ts` is the one
|
|
141
149
|
* binding rule, shared with the conversion printer.
|
|
142
150
|
*/
|
|
@@ -240,12 +248,6 @@ const valuesOfView = (ctx, operation, view) => {
|
|
|
240
248
|
}
|
|
241
249
|
const element = representationKey(result.element);
|
|
242
250
|
const ordered = ownKeyFields(view);
|
|
243
|
-
for (const field of ordered) {
|
|
244
|
-
if (!field.required) {
|
|
245
|
-
throw createCppEmitBlockedError('host-member-call:Object.values', `"Object.values" cannot include the optional field "${field.key}": an absent field contributes no element, and ` +
|
|
246
|
-
'the length of the array would then depend on a presence flag this arm does not test');
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
251
|
// A field whose carrier differs from the element (`{ on: true, none: 'none' }`
|
|
250
252
|
// read as `(boolean | string)[]`) widens into it through the conversion
|
|
251
253
|
// census, the same authority every other slot write uses; a pair the census
|
|
@@ -261,17 +263,30 @@ const valuesOfView = (ctx, operation, view) => {
|
|
|
261
263
|
}
|
|
262
264
|
return converted;
|
|
263
265
|
});
|
|
264
|
-
const fixed = `gea::detail::hostArrayResult(std::vector<${cppTypeOf(result.element)}>{${reads.join(', ')}})`;
|
|
265
266
|
// The one own-key order `keys` and `entries` also take: a key outside the
|
|
266
267
|
// layout contributes its value, where it was created.
|
|
267
|
-
const creationOrdered = creationOrderedOwnCopyText(ctx, view, (_key, value) => {
|
|
268
|
-
const converted = alignedValueText(
|
|
268
|
+
const creationOrdered = creationOrderedOwnCopyText(ctx, view, 'values', (_key, value, walkCtx) => {
|
|
269
|
+
const converted = alignedValueText(walkCtx, 'host/emit-host-object.ts:values-in-creation-order', dynamicCarrier, result.element, value);
|
|
269
270
|
return converted === null ? null : `__gea_values.push_back(${converted});`;
|
|
270
271
|
});
|
|
271
|
-
if (
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
if (ordered.every((field) => field.required)) {
|
|
273
|
+
const fixed = `gea::detail::hostArrayResult(std::vector<${cppTypeOf(result.element)}>{${reads.join(', ')}})`;
|
|
274
|
+
if (creationOrdered === null)
|
|
275
|
+
return fixed;
|
|
276
|
+
return (`([&]() { std::vector<${cppTypeOf(result.element)}> __gea_values; ` +
|
|
277
|
+
`if (${creationOrdered}) return gea::detail::hostArrayResult(std::move(__gea_values)); return ${fixed}; })()`);
|
|
278
|
+
}
|
|
279
|
+
// An optional field is an own key only while its presence bit says so, so
|
|
280
|
+
// the array's LENGTH is a run-time fact: the same presence-and-enumerable
|
|
281
|
+
// gate `entries` and `keys` apply, so the three cannot disagree.
|
|
282
|
+
const pushes = ordered.map((field, index) => {
|
|
283
|
+
const present = ownKeyPresenceText('values', view, field);
|
|
284
|
+
const enumerable = `${view.receiver}${view.accessor}${cppRecordFieldAttributesName(field.key)}.enumerable`;
|
|
285
|
+
return `if (${present === null ? enumerable : `(${present} && ${enumerable})`}) __gea_values.push_back(${reads[index]});`;
|
|
286
|
+
});
|
|
287
|
+
const walked = creationOrdered === null ? pushes.join(' ') : `if (!${creationOrdered}) { ${pushes.join(' ')} }`;
|
|
288
|
+
return (`([&]() { std::vector<${cppTypeOf(result.element)}> __gea_values; ${walked} ` +
|
|
289
|
+
`return gea::detail::hostArrayResult(std::move(__gea_values)); })()`);
|
|
275
290
|
};
|
|
276
291
|
/** Consume the representation already selected for the entry's [string, T] tuple. */
|
|
277
292
|
const entryCarrierOf = (ctx, operation) => {
|
|
@@ -316,7 +331,7 @@ const entryCarrierOf = (ctx, operation) => {
|
|
|
316
331
|
// The KEY has to be a string -- `OwnPropertyKeys` yields one and there is
|
|
317
332
|
// nothing to convert it into. The VALUE slot is whatever the checker typed
|
|
318
333
|
// it: `dynamic` for a target the program declared `any`, and a real carrier
|
|
319
|
-
// wherever the source's own values have one --
|
|
334
|
+
// wherever the source's own values have one -- a header record's entries
|
|
320
335
|
// are `[string, string | string[]]`, a tagged union and not a box. Demanding
|
|
321
336
|
// `dynamic` here refused that program for having stated MORE than the arm
|
|
322
337
|
// expected; each value is reconciled into the slot by `convertedValueText`
|
|
@@ -365,8 +380,8 @@ const entriesText = (ctx, operation) => overCarrier(ctx, 'entries', operation, (
|
|
|
365
380
|
/**
|
|
366
381
|
* A known view's entries depend on nothing at the site but the receiver: a
|
|
367
382
|
* push per declared field behind its presence and `[[Enumerable]]` tests,
|
|
368
|
-
* after the creation-order walk. Over
|
|
369
|
-
*
|
|
383
|
+
* after the creation-order walk. Over a 100+-field options family that is a
|
|
384
|
+
* tens-of-KB expression per call, so a unit defines it once per receiver carrier
|
|
370
385
|
* and entry carrier and every site calls it (`unitFunctionName`).
|
|
371
386
|
*/
|
|
372
387
|
const entriesOfKnownView = (ctx, operation, view) => {
|
|
@@ -381,8 +396,8 @@ const entriesOfKnownView = (ctx, operation, view) => {
|
|
|
381
396
|
/**
|
|
382
397
|
* `Object.entries` of an Array: one entry per present index, then one per
|
|
383
398
|
* enumerable sidecar key (`gea::host::ObjectConstructor::arrayEntriesOf`).
|
|
384
|
-
*
|
|
385
|
-
* `
|
|
399
|
+
* A program reaches it through a union whose `ReadonlyArray` arm
|
|
400
|
+
* `Array.isArray` has already excluded -- the checker
|
|
386
401
|
* keeps the arm, so the dispatch must still be able to spell it.
|
|
387
402
|
*/
|
|
388
403
|
const arrayEntriesText = (ctx, operation, array, receiver) => {
|
|
@@ -439,8 +454,8 @@ const entriesOfView = (ctx, operation, view) => {
|
|
|
439
454
|
const value = intoSlot(read.representation, read.text, `the field "${field.key}"`);
|
|
440
455
|
return `[&]() { ${entryText(entry, cppStringLiteral(field.key), value)} }()`;
|
|
441
456
|
};
|
|
442
|
-
const creationOrdered = creationOrderedOwnCopyText(ctx, view, (key, value) => {
|
|
443
|
-
const converted = alignedValueText(
|
|
457
|
+
const creationOrdered = creationOrderedOwnCopyText(ctx, view, 'entries', (key, value, walkCtx) => {
|
|
458
|
+
const converted = alignedValueText(walkCtx, 'host/emit-host-object.ts:entries-in-creation-order', dynamicCarrier, entry.value, value);
|
|
444
459
|
return converted === null ? null : `__gea_entries.push_back([&]() { ${entryText(entry, key, converted)} }());`;
|
|
445
460
|
});
|
|
446
461
|
if (creationOrdered === null && ordered.every((field) => field.required)) {
|
|
@@ -461,38 +476,29 @@ const entriesOfView = (ctx, operation, view) => {
|
|
|
461
476
|
return (`([&]() { std::vector<${cppTypeOf(entry.element)}> __gea_entries; ${walked} ` +
|
|
462
477
|
`return gea::detail::hostArrayResult(std::move(__gea_entries)); })()`);
|
|
463
478
|
};
|
|
464
|
-
|
|
465
|
-
* The own enumerable properties of a shared record, walked by the runtime in
|
|
466
|
-
* creation order, as a call answering whether it walked them.
|
|
467
|
-
*
|
|
468
|
-
* The static arms of `entries`, `values` and `assign` list a known view's
|
|
469
|
-
* declared fields, and a record can have more own keys than that -- its index
|
|
470
|
-
* sidecar's entries, or the expando keys any shared record gains through a
|
|
471
|
-
* dynamic write -- in an order interleaved with the fields once a key outside
|
|
472
|
-
* the layout exists (`gea::copyOwnPropertiesInCreationOrder`). An indexed
|
|
473
|
-
* record is walked whenever it has a property protocol, since the static arm
|
|
474
|
-
* never sees its sidecar; any other only once it has such a key, since until
|
|
475
|
-
* then the static arm is exactly its own keys. The call answers false where
|
|
476
|
-
* it does not walk, so the static arm still runs. `each` renders the store of
|
|
477
|
-
* one key and its property value, or null when that value has no conversion
|
|
478
|
-
* into the destination; there is then no runtime walk.
|
|
479
|
-
*/
|
|
480
|
-
const creationOrderedOwnCopyText = (ctx, view, each, assigned = null) => {
|
|
479
|
+
const creationOrderedOwnCopyText = (ctx, view, destination, each, assigned = null) => {
|
|
481
480
|
const indexed = indexedRecordViewOf(ctx.deriver, view.representation);
|
|
482
481
|
const ownership = indexed !== null ? indexed.ownership : ownershipOfGeneratedCarrier(view.representation);
|
|
483
482
|
if (ownership !== 'shared-refcount')
|
|
484
483
|
return null;
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
body = each('__gea_ordered_key', '__gea_ordered_value');
|
|
488
|
-
}
|
|
489
|
-
catch (error) {
|
|
490
|
-
if (isCppEmitBlockedError(error))
|
|
491
|
-
return null;
|
|
492
|
-
throw error;
|
|
493
|
-
}
|
|
494
|
-
if (body === null)
|
|
484
|
+
const leaves = ctx.hostObjectWalkPlan?.routes.get(hostObjectRouteKey(view.representation, destination));
|
|
485
|
+
if (leaves === undefined)
|
|
495
486
|
return null;
|
|
487
|
+
const walkCtx = {
|
|
488
|
+
...ctx,
|
|
489
|
+
conversions: {
|
|
490
|
+
...ctx.conversions,
|
|
491
|
+
nodeFor: (source, target) => {
|
|
492
|
+
const node = leaves.get(structuralConversionKey(source, target));
|
|
493
|
+
if (node === undefined)
|
|
494
|
+
throw createCppEmitBlockedError('runtime-helper:host-object-walk-recipes', 'an Object walk requested a conversion outside its sealed callback');
|
|
495
|
+
return node;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
const body = each('__gea_ordered_key', '__gea_ordered_value', walkCtx);
|
|
500
|
+
if (body === null)
|
|
501
|
+
throw createCppEmitBlockedError('runtime-helper:host-object-walk-recipes', 'an admitted Object walk callback has no rendering');
|
|
496
502
|
// A copy into a known target with its static copy in hand: the runtime runs
|
|
497
503
|
// that copy itself when the source's keys only left layout order
|
|
498
504
|
// (`gea::assignOwnPropertiesInCreationOrderWith`).
|
|
@@ -580,16 +586,8 @@ const declaredFixedFieldOf = (ctx, representation, key) => {
|
|
|
580
586
|
: null;
|
|
581
587
|
return fields?.find((field) => field.key === key) ?? null;
|
|
582
588
|
};
|
|
583
|
-
/**
|
|
584
|
-
|
|
585
|
-
* a deleted configurable fixed field no longer reads as present, but it is
|
|
586
|
-
* still a declared slot and must be redefined there rather than shadowed in
|
|
587
|
-
* the expando. The generated match hooks retain that distinction.
|
|
588
|
-
*/
|
|
589
|
-
const generatedDefineOwnText = (receiver, key, descriptor) => `([&]() -> bool { const gea::PropertyKey __gea_key = ${key}; ` +
|
|
590
|
-
`if (${receiver}->gea_matchesOwnField(__gea_key)) return ${receiver}->gea_defineOwnField(__gea_key, ${descriptor}, gea::nativeIsExtensible(${receiver})); ` +
|
|
591
|
-
`if (${receiver}->gea_matchesOwnIndex(__gea_key)) return ${receiver}->gea_defineOwnIndex(__gea_key, ${descriptor}, gea::nativeIsExtensible(${receiver})); ` +
|
|
592
|
-
`return gea::nativeDynamicDefineProperty(${receiver}, __gea_key, ${descriptor}); })()`;
|
|
589
|
+
/** The native substrate dispatches fixed fields, available index hooks and expandos against one property identity. */
|
|
590
|
+
const generatedDefineOwnText = (receiver, key, descriptor) => `gea::record::defineLiveField(${receiver}, ${key}, ${descriptor})`;
|
|
593
591
|
/**
|
|
594
592
|
* `Object.freeze` / `Object.isFrozen` -- the two members of this family that
|
|
595
593
|
* are NOT a loop over the three primitives.
|
|
@@ -601,6 +599,36 @@ const generatedDefineOwnText = (receiver, key, descriptor) => `([&]() -> bool {
|
|
|
601
599
|
*/
|
|
602
600
|
const integrityText = (ctx, member, operation, call) => {
|
|
603
601
|
const target = targetOf(ctx, member, operation);
|
|
602
|
+
if (isNativeCallableCarrier(target.representation.kind) && target.representation.kind !== 'function-and-constructor') {
|
|
603
|
+
if (operation.nativeCallableIntegrity === undefined)
|
|
604
|
+
return refuseObjectCarrier(member, target.representation, 'the source Function own-prototype descriptors are not authenticated');
|
|
605
|
+
// Own facts and native payload holders share this exact Function table.
|
|
606
|
+
// Integrity changes descriptor attributes without observing those payloads
|
|
607
|
+
// or requesting the Function's dynamic materializer.
|
|
608
|
+
const prepare = `const auto __gea_callable = ${operandText(ctx, target)}; ` +
|
|
609
|
+
'const auto& __gea_identity = __gea_callable.functionObjectIdentity(); ' +
|
|
610
|
+
`if (!__gea_identity) return ${call === 'isExtensible' ? 'false' : call === 'isFrozen' || call === 'isSealed' ? 'true' : '__gea_callable'}; ` +
|
|
611
|
+
'gea::installCallableOwnFacts(__gea_identity, __gea_callable.name(), __gea_callable.length()); ' +
|
|
612
|
+
(operation.nativeCallableIntegrity.prototype ? 'gea::installCallableNativePrototype(__gea_callable); ' : '') +
|
|
613
|
+
'const auto& __gea_properties = __gea_identity->properties; ';
|
|
614
|
+
if (call === 'freeze')
|
|
615
|
+
return `([&]() { ${prepare}__gea_properties->freezeIntegrity(); return __gea_callable; })()`;
|
|
616
|
+
if (call === 'isFrozen')
|
|
617
|
+
return `([&]() -> bool { ${prepare}return __gea_properties->hasFrozenIntegrity(); })()`;
|
|
618
|
+
if (call === 'isExtensible')
|
|
619
|
+
return `([&]() -> bool { ${prepare}return __gea_properties->extensible(); })()`;
|
|
620
|
+
if (call === 'preventExtensions')
|
|
621
|
+
return `([&]() { ${prepare}__gea_properties->preventExtensions(); return __gea_callable; })()`;
|
|
622
|
+
if (call === 'seal')
|
|
623
|
+
return (`([&]() { ${prepare}for (const auto& __gea_key : __gea_properties->ownKeys()) { ` +
|
|
624
|
+
'gea::PropertyDescriptor __gea_update; __gea_update.hasConfigurable = true; __gea_update.configurable = false; ' +
|
|
625
|
+
'if (!__gea_properties->defineOwnProperty(__gea_key, __gea_update)) gea::host::throwRuntimeError("TypeError", "Cannot seal Function own property"); } ' +
|
|
626
|
+
'__gea_properties->preventExtensions(); return __gea_callable; })()');
|
|
627
|
+
return (`([&]() -> bool { ${prepare}if (__gea_properties->extensible()) return false; ` +
|
|
628
|
+
'for (const auto& __gea_key : __gea_properties->ownKeys()) { ' +
|
|
629
|
+
'const gea::PropertyDescriptor* __gea_descriptor = __gea_properties->ownProperty(__gea_key); ' +
|
|
630
|
+
'if (__gea_descriptor != nullptr && __gea_descriptor->configurable) return false; } return true; })()');
|
|
631
|
+
}
|
|
604
632
|
if (target.representation.kind === 'array-object' && target.representation.ownership === 'shared-refcount') {
|
|
605
633
|
if (call === 'seal' || call === 'isSealed' || call === 'preventExtensions') {
|
|
606
634
|
return refuseObjectCarrier(member, target.representation, 'this array path has no native seal/preventExtensions implementation');
|
|
@@ -647,13 +675,16 @@ const integrityText = (ctx, member, operation, call) => {
|
|
|
647
675
|
view.representation.kind === 'class-ref' ||
|
|
648
676
|
(view.representation.kind === 'native-record-ref' && view.representation.native === null);
|
|
649
677
|
const receiver = view.receiver;
|
|
678
|
+
const indexed = view.representation.kind === 'class-ref'
|
|
679
|
+
? ctx.classIndexProtocols.get(view.representation.declaration) !== false
|
|
680
|
+
: recordIndexesOfShape(ctx.deriver, view.representation.shapeId).length > 0;
|
|
650
681
|
const expando = `gea::detail::expandoFor(gea::refCastToVoid(${receiver}), true)`;
|
|
651
682
|
if (call === 'freeze') {
|
|
652
|
-
const fields = generated ? `${receiver}->gea_freezeOwnFields(); ${receiver}->gea_freezeOwnIndex(); ` : '';
|
|
683
|
+
const fields = generated ? `${receiver}->gea_freezeOwnFields(); ${indexed ? `${receiver}->gea_freezeOwnIndex(); ` : ''}` : '';
|
|
653
684
|
return `([&]() { ${fields}gea::nativeFreeze(${receiver}); return ${receiver}; })()`;
|
|
654
685
|
}
|
|
655
686
|
if (call === 'isFrozen') {
|
|
656
|
-
const fields = generated ? `${receiver}->gea_ownFieldsFrozen() && ${receiver}->gea_ownIndexFrozen() && ` : '';
|
|
687
|
+
const fields = generated ? `${receiver}->gea_ownFieldsFrozen() && ${indexed ? `${receiver}->gea_ownIndexFrozen() && ` : ''}` : '';
|
|
657
688
|
return `${fields}gea::nativeIsFrozen(${receiver})`;
|
|
658
689
|
}
|
|
659
690
|
if (call === 'isExtensible')
|
|
@@ -661,18 +692,20 @@ const integrityText = (ctx, member, operation, call) => {
|
|
|
661
692
|
if (call === 'preventExtensions')
|
|
662
693
|
return `([&]() { ${expando}->preventExtensions(); return ${receiver}; })()`;
|
|
663
694
|
if (call === 'seal') {
|
|
664
|
-
const fields = generated ? `${receiver}->gea_sealOwnFields(); ${receiver}->gea_sealOwnIndex(); ` : '';
|
|
695
|
+
const fields = generated ? `${receiver}->gea_sealOwnFields(); ${indexed ? `${receiver}->gea_sealOwnIndex(); ` : ''}` : '';
|
|
665
696
|
return (`([&]() { ${fields}const auto __gea_sidecar = ${expando}; ` +
|
|
666
697
|
'for (const auto& __gea_key : __gea_sidecar->ownKeys()) { gea::PropertyDescriptor __gea_update; __gea_update.hasConfigurable = true; __gea_update.configurable = false; ' +
|
|
667
698
|
'if (!__gea_sidecar->defineOwnProperty(__gea_key, __gea_update)) gea::host::throwRuntimeError("TypeError", "Cannot seal native own property"); } ' +
|
|
668
699
|
`__gea_sidecar->preventExtensions(); return ${receiver}; })()`);
|
|
669
700
|
}
|
|
670
|
-
const fields = generated
|
|
701
|
+
const fields = generated
|
|
702
|
+
? `if (!${receiver}->gea_ownFieldsSealed()${indexed ? ` || !${receiver}->gea_ownIndexSealed()` : ''}) return false; `
|
|
703
|
+
: '';
|
|
671
704
|
return (`([&]() -> bool { ${fields}const auto __gea_sidecar = gea::detail::expandoFor(gea::refCastToVoid(${receiver}), false); ` +
|
|
672
705
|
'if (!__gea_sidecar || __gea_sidecar->extensible()) return false; for (const auto& __gea_key : __gea_sidecar->ownKeys()) { ' +
|
|
673
706
|
'const gea::PropertyDescriptor* __gea_descriptor = __gea_sidecar->ownProperty(__gea_key); if (__gea_descriptor != nullptr && __gea_descriptor->configurable) return false; } return true; })()');
|
|
674
707
|
}
|
|
675
|
-
// A shared Document (
|
|
708
|
+
// A shared Document (a `{ ...doc }` copy a program freezes before handing it
|
|
676
709
|
// on) has identity; its frozen state lives in the object the table migrates
|
|
677
710
|
// into, see `gea::dictionary::freeze`. seal/preventExtensions are not wired.
|
|
678
711
|
if (view.kind === 'dictionary' &&
|
|
@@ -786,6 +819,10 @@ const hasOwnText = (ctx, operation) => {
|
|
|
786
819
|
if (regexpRoleOf(target.representation) === 'pattern') {
|
|
787
820
|
return `gea::nativeDynamicHas(${operandText(ctx, target)}, ${propertyKeyText(ctx, 'hasOwn', key)})`;
|
|
788
821
|
}
|
|
822
|
+
if (target.representation.kind === 'native-handle')
|
|
823
|
+
return nativeHandleShapeCallText(ctx, 'hasOwnProperty', target.representation.native ?? target.representation.protocol, [key]);
|
|
824
|
+
if (isNativeCallableCarrier(target.representation.kind))
|
|
825
|
+
return callableShapeCallText(ctx, 'hasOwnProperty', operandText(ctx, target), [key]);
|
|
789
826
|
if (target.representation.kind === 'array-object')
|
|
790
827
|
return arrayHasOwnText(ctx, target.representation, operandText(ctx, target), key);
|
|
791
828
|
const view = objectViewOf(ctx, 'hasOwn', target, 'object');
|
|
@@ -916,7 +953,7 @@ const mathPackedRestHostMethodValueText = (spelling) => {
|
|
|
916
953
|
* accessor" for `get`/`set`, and "no id yet" for whichever `writable` /
|
|
917
954
|
* `enumerable` / `configurable` field is not among the three passed).
|
|
918
955
|
*/
|
|
919
|
-
const descriptorAggregateBuilder = (ctx, resultRepresentation, contextLabel) => {
|
|
956
|
+
const descriptorAggregateBuilder = (ctx, resultRepresentation, contextLabel, operation) => {
|
|
920
957
|
const optional = resultRepresentation.kind === 'optional' ? resultRepresentation : null;
|
|
921
958
|
const recordRepresentation = optional ? optional.payload : resultRepresentation;
|
|
922
959
|
const structNameAndFields = (() => {
|
|
@@ -1018,6 +1055,10 @@ const descriptorAggregateBuilder = (ctx, resultRepresentation, contextLabel) =>
|
|
|
1018
1055
|
};
|
|
1019
1056
|
const convertValueField = (source, text) => {
|
|
1020
1057
|
if (valueFieldRepresentation === null) {
|
|
1058
|
+
// A source-authenticated accessor descriptor states get/set rather
|
|
1059
|
+
// than a data value. aggregateOf ignores keys its native shape lacks.
|
|
1060
|
+
if (operation?.nativeAccessorObservation)
|
|
1061
|
+
return cppUndefinedValue;
|
|
1021
1062
|
throw createCppEmitBlockedError('host-member-call:Object.getOwnPropertyDescriptor', `${contextLabel} descriptor names no "value" field to store into`);
|
|
1022
1063
|
}
|
|
1023
1064
|
if (representationKey(source) === representationKey(valueFieldRepresentation))
|
|
@@ -1049,13 +1090,25 @@ const descriptorAggregateBuilder = (ctx, resultRepresentation, contextLabel) =>
|
|
|
1049
1090
|
if (field === undefined)
|
|
1050
1091
|
continue;
|
|
1051
1092
|
const carried = field.value.kind === 'optional' ? field.value.payload : field.value;
|
|
1093
|
+
const observed = operation?.nativeAccessorObservation?.halves.find((candidate) => candidate.half === half.key);
|
|
1094
|
+
if (observed !== undefined) {
|
|
1095
|
+
if (representationKey(carried) !== representationKey(observed.target))
|
|
1096
|
+
throw createCppEmitBlockedError(`conversion:${observed.conversion}`, 'a reflected accessor field changed its published Function carrier');
|
|
1097
|
+
const built = nativeAccessorObservedFunctionText(ctx, observed, object);
|
|
1098
|
+
const fieldType = cppTypeOf(field.value);
|
|
1099
|
+
const presentFunction = `(${object}.${half.has} && static_cast<bool>(${object}.${half.key === 'get' ? 'nativeGet' : 'nativeSet'}))`;
|
|
1100
|
+
overrides[half.key] = field.value.kind === 'optional' ? `(${presentFunction} ? ${fieldType}(${built}) : ${fieldType}())` : built;
|
|
1101
|
+
present[half.key] = `${object}.${half.has}`;
|
|
1102
|
+
continue;
|
|
1103
|
+
}
|
|
1052
1104
|
if (cppTypeOf(carried) !== half.type)
|
|
1053
1105
|
continue;
|
|
1054
1106
|
const built = `gea::${half.helper}(${object})`;
|
|
1055
1107
|
const fieldType = cppTypeOf(field.value);
|
|
1056
1108
|
// A complete accessor property states both halves, and a missing one is
|
|
1057
1109
|
// present as `undefined` (10.1.6.3): the key is there, the callable is not.
|
|
1058
|
-
const
|
|
1110
|
+
const native = half.key === 'get' ? 'nativeGet' : 'nativeSet';
|
|
1111
|
+
const callable = `(${object}.${half.has} && (static_cast<bool>(${object}.${half.key}) || static_cast<bool>(${object}.${native})))`;
|
|
1059
1112
|
overrides[half.key] = field.value.kind === 'optional' ? `(${callable} ? ${fieldType}(${built}) : ${fieldType}())` : built;
|
|
1060
1113
|
present[half.key] = `${object}.${half.has}`;
|
|
1061
1114
|
}
|
|
@@ -1185,6 +1238,9 @@ const nativeHandleDescriptorText = (ctx, protocol, key, operation) => {
|
|
|
1185
1238
|
* string key all observe the same own-property set as their literal forms.
|
|
1186
1239
|
*/
|
|
1187
1240
|
const arrayObjectDescriptorText = (ctx, receiver, representation, key, operation) => {
|
|
1241
|
+
const snapshot = nativeArrayDescriptorSnapshotText(ctx, operation, receiver);
|
|
1242
|
+
if (snapshot !== null)
|
|
1243
|
+
return snapshot;
|
|
1188
1244
|
const resultRepresentation = operation.result?.representation ?? null;
|
|
1189
1245
|
if (resultRepresentation === null) {
|
|
1190
1246
|
throw createCppEmitBlockedError('host-member-call:Object.getOwnPropertyDescriptor', '"Object.getOwnPropertyDescriptor" of an array published no result to build a descriptor into');
|
|
@@ -1234,9 +1290,12 @@ const arrayObjectDescriptorText = (ctx, receiver, representation, key, operation
|
|
|
1234
1290
|
// raw-strings array; a descriptor whose "value" field cannot hold
|
|
1235
1291
|
// `undefined` at all (a `number[]` literal's own minted record) is one
|
|
1236
1292
|
// no such array reaches, and the branch is not spelled for it.
|
|
1237
|
-
const
|
|
1238
|
-
?
|
|
1239
|
-
:
|
|
1293
|
+
const undefinedNode = valueFieldRepresentation === null
|
|
1294
|
+
? undefined
|
|
1295
|
+
: ctx.hostObjectWalkPlan?.routes
|
|
1296
|
+
.get(hostObjectRouteKey(representation, 'array-undefined'))
|
|
1297
|
+
?.get(structuralConversionKey({ kind: 'undefined' }, valueFieldRepresentation));
|
|
1298
|
+
const undefinedValue = undefinedNode === undefined ? null : recipeText(ctx, undefinedNode, cppUndefinedValue);
|
|
1240
1299
|
if (undefinedValue === null)
|
|
1241
1300
|
return descriptorWith(value);
|
|
1242
1301
|
return `(${receiver}${accessor}elementIsUndefined(static_cast<std::size_t>(${index})) ? ${descriptorWith(undefinedValue)} : ${descriptorWith(value)})`;
|
|
@@ -1288,7 +1347,7 @@ const knownDescriptorText = (ctx, member, view, key, operation) => {
|
|
|
1288
1347
|
if (resultRepresentation === null) {
|
|
1289
1348
|
throw createCppEmitBlockedError(`host-member-call:Object.${member}`, `"Object.${member}" published no result to build a descriptor into`);
|
|
1290
1349
|
}
|
|
1291
|
-
const { resultType, someText, absentText, aggregateOf, convertValueField, attributeText, accessorHalvesOf } = descriptorAggregateBuilder(ctx, resultRepresentation, `"Object.${member}" of a known receiver
|
|
1350
|
+
const { resultType, someText, absentText, aggregateOf, convertValueField, attributeText, accessorHalvesOf } = descriptorAggregateBuilder(ctx, resultRepresentation, `"Object.${member}" of a known receiver`, operation);
|
|
1292
1351
|
const aggregateFor = (valueSource, valueText, attributes) => aggregateOf({
|
|
1293
1352
|
value: convertValueField(valueSource, valueText),
|
|
1294
1353
|
writable: attributeText('writable', 'true', `${attributes}.writable`),
|
|
@@ -1398,7 +1457,7 @@ const dynamicDescriptorConversionText = (ctx, member, receiver, key, operation)
|
|
|
1398
1457
|
if (resultRepresentation === null) {
|
|
1399
1458
|
throw createCppEmitBlockedError(`host-member-call:Object.${member}`, `"Object.${member}" of a dynamic receiver published no result to build a descriptor into`);
|
|
1400
1459
|
}
|
|
1401
|
-
const { resultType, someText, absentText, aggregateOf, attributeText, convertValueField, accessorHalvesOf } = descriptorAggregateBuilder(ctx, resultRepresentation, `"Object.${member}" of a dynamic receiver
|
|
1460
|
+
const { resultType, someText, absentText, aggregateOf, attributeText, convertValueField, accessorHalvesOf } = descriptorAggregateBuilder(ctx, resultRepresentation, `"Object.${member}" of a dynamic receiver`, operation);
|
|
1402
1461
|
const nativeCall = `gea::host::ObjectConstructor::${member}(${receiver}, ${propertyKeyText(ctx, member, key)})`;
|
|
1403
1462
|
const halves = accessorHalvesOf('static_cast<const gea::PropertyDescriptor&>(*__gea_native)');
|
|
1404
1463
|
const aggregate = aggregateOf({
|
|
@@ -1482,7 +1541,7 @@ const callableDescriptorText = (ctx, representation, receiver, key, operation) =
|
|
|
1482
1541
|
const { resultType, someText, absentText, aggregateOf, convertValueField, attributeText } = descriptorAggregateBuilder(ctx, resultRepresentation, '"Object.getOwnPropertyDescriptor" of a function');
|
|
1483
1542
|
const dynamic = { kind: 'dynamic', reason: 'declared-any-never-narrowed' };
|
|
1484
1543
|
const aggregate = aggregateOf({
|
|
1485
|
-
value: convertValueField(dynamic, '__gea_descriptor->
|
|
1544
|
+
value: convertValueField(dynamic, '__gea_descriptor->dataValue()'),
|
|
1486
1545
|
writable: attributeText('writable', '__gea_descriptor->hasWritable', '__gea_descriptor->writable'),
|
|
1487
1546
|
enumerable: attributeText('enumerable', '__gea_descriptor->hasEnumerable', '__gea_descriptor->enumerable'),
|
|
1488
1547
|
configurable: attributeText('configurable', '__gea_descriptor->hasConfigurable', '__gea_descriptor->configurable')
|
|
@@ -1502,8 +1561,8 @@ const callableDescriptorText = (ctx, representation, receiver, key, operation) =
|
|
|
1502
1561
|
'const gea::PropertyDescriptor* __gea_descriptor = __gea_identity->properties->ownProperty(__gea_key); ' +
|
|
1503
1562
|
`if (__gea_descriptor == nullptr) return ${absentText()}; return ${someText(aggregate)}; })()`);
|
|
1504
1563
|
}
|
|
1505
|
-
const constructorSetup =
|
|
1506
|
-
?
|
|
1564
|
+
const constructorSetup = operation.nativeCallablePrototypeDescriptor
|
|
1565
|
+
? `${nativeCallablePrototypeObservationText(ctx, operation.nativeCallablePrototypeDescriptor, '__gea_callable')}; `
|
|
1507
1566
|
: '';
|
|
1508
1567
|
return (`([&]() -> ${resultType} { const auto& __gea_callable = ${receiver}; ` +
|
|
1509
1568
|
// A heap-environment callable anchors its identity lazily in its
|
|
@@ -1608,14 +1667,14 @@ const createText = (operation) => {
|
|
|
1608
1667
|
// `DynamicObject`, so the store's `unboxValue<Ref<Dictionary<V>>>` finds a
|
|
1609
1668
|
// payload of a different C++ type and refuses at runtime -- a program that
|
|
1610
1669
|
// aborts on its first statement, which is what `const emptyParams: Params =
|
|
1611
|
-
// Object.create(null)` did
|
|
1670
|
+
// Object.create(null)` did.
|
|
1612
1671
|
if (result !== null && (result.kind === 'dictionary' || result.kind === 'record' || result.kind === 'record-with-index')) {
|
|
1613
1672
|
const storage = cppTypeOf(result, 'owned');
|
|
1614
1673
|
return result.ownership === 'shared-refcount' ? `gea::makeRef<${storage}>()` : `${storage}{}`;
|
|
1615
1674
|
}
|
|
1616
|
-
// A NAMED shape is the same empty struct:
|
|
1617
|
-
// `const
|
|
1618
|
-
//
|
|
1675
|
+
// A NAMED shape is the same empty struct: a function fills
|
|
1676
|
+
// `const options = Object.create(null)` and returns it as a named
|
|
1677
|
+
// interface, so the census gives the call that interface's
|
|
1619
1678
|
// carrier. Spelled the way `emitAllocateRecord` spells the same carrier --
|
|
1620
1679
|
// the host's own struct when one is stated -- since `gea::Value::object()`
|
|
1621
1680
|
// is not a value of it at all.
|
|
@@ -1667,10 +1726,10 @@ const assignedKeyFields = (ctx, view) => ownKeyFields(view).filter((field) => !n
|
|
|
1667
1726
|
* Between two known shapes the copy's text depends on nothing but the two
|
|
1668
1727
|
* carriers and the two receivers: a static store per source field, then the
|
|
1669
1728
|
* creation-order walk, whose callback routes every run-time key through the
|
|
1670
|
-
* target's own field list. Into
|
|
1671
|
-
*
|
|
1672
|
-
*
|
|
1673
|
-
*
|
|
1729
|
+
* target's own field list. Into a 100+-field options family that walk alone
|
|
1730
|
+
* is a 100+-branch chain, and `Object.assign({}, a, b)` over the same pair
|
|
1731
|
+
* recurs at dozens of sites -- megabytes of a unit in chains that differed
|
|
1732
|
+
* only in which local named the target. Rendered over the
|
|
1674
1733
|
* function's own formals, the pair is defined once and every site calls it
|
|
1675
1734
|
* (`unitFunctionName`). The target is shared, so the stores the function
|
|
1676
1735
|
* makes through its formal are stores into the site's object.
|
|
@@ -1743,8 +1802,8 @@ const assignSourceTextAt = (ctx, targetView, sourceView) => {
|
|
|
1743
1802
|
const presence = ownKeyPresenceText('assign', sourceView, field);
|
|
1744
1803
|
return presence === null ? store : `if (${presence}) ${store}`;
|
|
1745
1804
|
});
|
|
1746
|
-
const creationOrdered = creationOrderedOwnCopyText(ctx, sourceView, (key, value) => {
|
|
1747
|
-
const converted = alignedValueText(
|
|
1805
|
+
const creationOrdered = creationOrderedOwnCopyText(ctx, sourceView, `assign:${representationKey(targetView.representation)}`, (key, value, walkCtx) => {
|
|
1806
|
+
const converted = alignedValueText(walkCtx, 'host/emit-host-object.ts:assign-in-creation-order', dynamicCarrier, targetView.value, value);
|
|
1748
1807
|
return converted === null
|
|
1749
1808
|
? null
|
|
1750
1809
|
: `if (!${targetView.receiver}.setProperty(${key}, ${converted})) gea::host::throwRuntimeError("TypeError", "Cannot assign to read only property");`;
|
|
@@ -1758,8 +1817,8 @@ const assignSourceTextAt = (ctx, targetView, sourceView) => {
|
|
|
1758
1817
|
return `gea::host::ObjectConstructor::assignInto(${targetView.receiver}, ${sourceView.receiver});`;
|
|
1759
1818
|
}
|
|
1760
1819
|
// A dynamic source into a string-keyed dictionary whose values are typed
|
|
1761
|
-
// (
|
|
1762
|
-
//
|
|
1820
|
+
// (`Object.assign( this.table, source )` with an untyped `source`). The
|
|
1821
|
+
// source's keys exist only at runtime, so each
|
|
1763
1822
|
// enumerable own string key is read as a `gea::Value` and stored through the
|
|
1764
1823
|
// same checked per-value conversion a typed dictionary store uses -- an
|
|
1765
1824
|
// entry the target's value type cannot hold is refused at run time by that
|
|
@@ -1834,9 +1893,8 @@ const assignSourceTextAt = (ctx, targetView, sourceView) => {
|
|
|
1834
1893
|
}
|
|
1835
1894
|
if (targetView.kind === 'dynamic' && sourceView.kind === 'known') {
|
|
1836
1895
|
// The source's keys are known here and the target is an object the
|
|
1837
|
-
// program declared `any` and never narrowed --
|
|
1838
|
-
// `Object.assign(
|
|
1839
|
-
// `Document`. 7.3.25 is then one `[[Set]]` per present source field on
|
|
1896
|
+
// program declared `any` and never narrowed --
|
|
1897
|
+
// `Object.assign(doc.nested, { field })` over a `Document`. 7.3.25 is then one `[[Set]]` per present source field on
|
|
1840
1898
|
// the dynamic object; each value is boxed because the dynamic object is
|
|
1841
1899
|
// where it lands, not because the source is. The target is bound once:
|
|
1842
1900
|
// an operand may be a deferred expression.
|
|
@@ -1852,7 +1910,7 @@ const assignSourceTextAt = (ctx, targetView, sourceView) => {
|
|
|
1852
1910
|
const presence = ownKeyPresenceText('assign', sourceView, field);
|
|
1853
1911
|
stores.push(presence === null ? store : `if (${presence}) ${store}`);
|
|
1854
1912
|
}
|
|
1855
|
-
const creationOrdered = creationOrderedOwnCopyText(ctx, sourceView, (key, value) => `__gea_target.setProperty(gea::PropertyKey::string(${key}), ${value});`);
|
|
1913
|
+
const creationOrdered = creationOrderedOwnCopyText(ctx, sourceView, 'assign:dynamic', (key, value) => `__gea_target.setProperty(gea::PropertyKey::string(${key}), ${value});`);
|
|
1856
1914
|
const walked = creationOrdered === null ? stores.join(' ') : `if (!${creationOrdered}) { ${stores.join(' ')} }`;
|
|
1857
1915
|
return `{ gea::Value __gea_target = ${targetView.receiver}; ${walked} }`;
|
|
1858
1916
|
}
|
|
@@ -1880,14 +1938,14 @@ const assignSourceTextAt = (ctx, targetView, sourceView) => {
|
|
|
1880
1938
|
const handsOver = targetShared && indexedRecordViewOf(ctx.deriver, sourceView.representation) === null;
|
|
1881
1939
|
const creationOrdered = !targetShared
|
|
1882
1940
|
? null
|
|
1883
|
-
: creationOrderedOwnCopyText(ctx, sourceView, (key, value) => {
|
|
1941
|
+
: creationOrderedOwnCopyText(ctx, sourceView, `assign:${representationKey(targetView.representation)}`, (key, value, walkCtx) => {
|
|
1884
1942
|
// The routing depends on the target alone, whichever source is being
|
|
1885
1943
|
// walked, so it is one unit function per target carrier.
|
|
1886
1944
|
const at = (target, name, property) => {
|
|
1887
1945
|
const view = { ...targetView, receiver: target };
|
|
1888
1946
|
const declared = view.fields.filter((field) => !field.key.startsWith('sym('));
|
|
1889
1947
|
const branches = declared.map((field) => `if (${name} == ${cppStringLiteral(field.key)}) { ` +
|
|
1890
|
-
`${setOwnText(
|
|
1948
|
+
`${setOwnText(walkCtx, 'assign', view, field.key, { text: property, representation: dynamicCarrier })} }`);
|
|
1891
1949
|
const created = `{ if (!gea::nativeDynamicSet(${target}, gea::PropertyKey::string(${name}), ${property})) ` +
|
|
1892
1950
|
'gea::host::throwRuntimeError("TypeError", "Cannot assign to read only property"); }';
|
|
1893
1951
|
return [...branches, created].join(' else ');
|
|
@@ -1911,10 +1969,10 @@ const assignSourceTextAt = (ctx, targetView, sourceView) => {
|
|
|
1911
1969
|
* lambda over the two receivers, beside the source field's presence member.
|
|
1912
1970
|
* The loop tests presence from the table and calls only the present fields'
|
|
1913
1971
|
* stores, so the code the copy executes is proportional to the fields the
|
|
1914
|
-
* source has rather than to the fields the layout declares:
|
|
1915
|
-
* `Object.assign({}, options,
|
|
1916
|
-
* family struct into another as
|
|
1917
|
-
*
|
|
1972
|
+
* source has rather than to the fields the layout declares:
|
|
1973
|
+
* `Object.assign({}, options, resolveOptions(...))` copied one 100+-field
|
|
1974
|
+
* family struct into another as tens of KB of straight-line code per call,
|
|
1975
|
+
* with measurable CPU spent in the front end on tests that nearly all failed.
|
|
1918
1976
|
* Below `steppedAssignFields` the unrolled stores are shorter than the table
|
|
1919
1977
|
* and its indirect calls, so a small record keeps them.
|
|
1920
1978
|
*/
|
|
@@ -1951,8 +2009,8 @@ const steppedAssignText = (ctx, targetView, sourceView) => {
|
|
|
1951
2009
|
/**
|
|
1952
2010
|
* A native `Error` source copied into a struct target.
|
|
1953
2011
|
*
|
|
1954
|
-
*
|
|
1955
|
-
*
|
|
2012
|
+
* An error subclass's constructor ending in `Object.assign(this, error)` over
|
|
2013
|
+
* a union one of whose arms is a plain `Error`. An Error's
|
|
1956
2014
|
* own `name`/`message`/`stack` are non-enumerable (20.5.6.3), so its
|
|
1957
2015
|
* enumerable own keys are exactly what the program added to its expando
|
|
1958
2016
|
* sidecar -- a set that exists only at runtime, which `gea::nativeDynamicKeys`
|
|
@@ -2048,6 +2106,9 @@ const assignIntoCallableText = (ctx, operation, target) => {
|
|
|
2048
2106
|
return `([&]() { ${body} return ${targetText}; })()`;
|
|
2049
2107
|
};
|
|
2050
2108
|
const assignText = (ctx, operation) => {
|
|
2109
|
+
const native = nativeOwnAssignmentText(ctx, operation);
|
|
2110
|
+
if (native !== null)
|
|
2111
|
+
return native;
|
|
2051
2112
|
const target = targetOf(ctx, 'assign', operation);
|
|
2052
2113
|
const targetText = operandText(ctx, target);
|
|
2053
2114
|
const sources = operation.arguments.slice(1);
|
|
@@ -2089,14 +2150,20 @@ const assignText = (ctx, operation) => {
|
|
|
2089
2150
|
* struct copy that set every field would rewrite attributes the program
|
|
2090
2151
|
* never mentioned.
|
|
2091
2152
|
*
|
|
2092
|
-
*
|
|
2093
|
-
*
|
|
2094
|
-
* (`gea::runtime::object::get`), so the model is not the gap -- what is
|
|
2095
|
-
* missing is the conversion from the program's own callable carrier into that
|
|
2096
|
-
* signature, and inventing one that dropped the receiver would make
|
|
2097
|
-
* `get: () => this.x` read the wrong object.
|
|
2153
|
+
* Accessor Functions stay in native holders. Each certified half names its
|
|
2154
|
+
* actual zero/one-argument invocation frame, forwarding this at access time.
|
|
2098
2155
|
*/
|
|
2099
|
-
const defineDescriptorLines = (ctx, operation, descriptor, slot) =>
|
|
2156
|
+
const defineDescriptorLines = (ctx, operation, descriptor, slot) => {
|
|
2157
|
+
const snapshot = nativeDescriptorSnapshotDefinitionLines(ctx, operation, slot);
|
|
2158
|
+
if (snapshot !== null)
|
|
2159
|
+
return snapshot;
|
|
2160
|
+
const restored = operation.nativeAccessorReinstallation;
|
|
2161
|
+
if (restored !== undefined) {
|
|
2162
|
+
const lookup = `gea::nativeOwnPropertyDescriptor(${operandText(ctx, restored.snapshotReceiver)}, ${propertyKeyText(ctx, 'defineProperty', restored.snapshotKey)})`;
|
|
2163
|
+
return `const auto ${slot}_snapshot = ${lookup}; if (!${slot}_snapshot.has_value()) gea::host::throwRuntimeError("TypeError", "An accessor descriptor snapshot lost its original property"); const gea::PropertyDescriptor& ${slot} = *${slot}_snapshot;`;
|
|
2164
|
+
}
|
|
2165
|
+
return descriptorSlotLines(ctx, operation, descriptor.representation, operandText(ctx, descriptor), slot);
|
|
2166
|
+
};
|
|
2100
2167
|
/**
|
|
2101
2168
|
* The descriptor operand of `Object.defineProperty`, in every carrier a
|
|
2102
2169
|
* program hands one over as: the host's own `gea::PropertyDescriptor`; an
|
|
@@ -2105,7 +2172,7 @@ const defineDescriptorLines = (ctx, operation, descriptor, slot) => descriptorSl
|
|
|
2105
2172
|
* OPTIONAL fields carry a presence bit -- a descriptor read back off an
|
|
2106
2173
|
* accessor states no `value`, and `hasValue` must say so rather than copy a
|
|
2107
2174
|
* default-constructed one); and an `optional` of that record, which is how
|
|
2108
|
-
*
|
|
2175
|
+
* a property-descriptor check holds the descriptor it restores with. The
|
|
2109
2176
|
* absent optional is ECMA-262 20.1.2.4 step 3's TypeError
|
|
2110
2177
|
* (`ToPropertyDescriptor` of `undefined`), thrown where the language throws it.
|
|
2111
2178
|
*/
|
|
@@ -2133,6 +2200,47 @@ const descriptorSlotLines = (ctx, operation, representation, text, slot) => {
|
|
|
2133
2200
|
};
|
|
2134
2201
|
for (const field of fields) {
|
|
2135
2202
|
const read = `${text}${accessor}${cppRecordFieldName(field.key)}`;
|
|
2203
|
+
if (field.key === 'get' || field.key === 'set') {
|
|
2204
|
+
const half = operation.nativeAccessorDefinition?.halves.find((candidate) => candidate.half === field.key);
|
|
2205
|
+
if (half !== undefined) {
|
|
2206
|
+
if (representationKey(field.value) !== representationKey(half.source))
|
|
2207
|
+
throw createCppEmitBlockedError(`conversion:${half.conversion}`, 'a native accessor field disagrees with its actual Function carrier');
|
|
2208
|
+
push(field, `gea::${field.key === 'get' ? 'installNativeDescriptorGetter' : 'installNativeDescriptorSetter'}(${slot}, ${nativeAccessorDefinitionText(ctx, half, read)});`);
|
|
2209
|
+
continue;
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
if (field.key === 'value' && operation.nativeCallableDataWrite?.definition) {
|
|
2213
|
+
const receipt = operation.nativeCallableDataWrite;
|
|
2214
|
+
if (representationKey(field.value) !== representationKey(receipt.storage))
|
|
2215
|
+
throw createCppEmitBlockedError(`conversion:${receipt.storageConversion}`, 'a native Function definition disagrees with its descriptor value carrier');
|
|
2216
|
+
push(field, `${slot}.hasValue = true; ${slot}.nativeValue = ${nativeCallableDataDefinitionValueText(ctx, receipt, read)};`);
|
|
2217
|
+
continue;
|
|
2218
|
+
}
|
|
2219
|
+
if (field.key === 'value' && operation.nativeDataDefinition) {
|
|
2220
|
+
const recipe = operation.nativeDataDefinition;
|
|
2221
|
+
const node = ctx.conversions.nodeById(recipe.conversion);
|
|
2222
|
+
const converted = node === null ||
|
|
2223
|
+
representationKey(field.value) !== representationKey(recipe.source) ||
|
|
2224
|
+
representationKey(node.source) !== representationKey(recipe.source) ||
|
|
2225
|
+
representationKey(node.target) !== representationKey(recipe.held)
|
|
2226
|
+
? null
|
|
2227
|
+
: recipeText(ctx, node, read);
|
|
2228
|
+
if (converted === null)
|
|
2229
|
+
throw createCppEmitBlockedError(`conversion:${recipe.conversion}`, 'a native descriptor value lacks its certified destination-field conversion');
|
|
2230
|
+
// A dynamic observer (a `dynamic` arm, a view's original Document) reads
|
|
2231
|
+
// the native payload through its certified Value boundary, run lazily.
|
|
2232
|
+
const materializer = recipe.materialization === undefined ? null : ctx.conversions.nodeById(recipe.materialization);
|
|
2233
|
+
const materialized = materializer === null
|
|
2234
|
+
? null
|
|
2235
|
+
: namedConversionText(ctx, 'emit-host-object.ts:data-definition-materializer', materializer, 'gea_data');
|
|
2236
|
+
if (recipe.materialization !== undefined && materialized === null)
|
|
2237
|
+
throw createCppEmitBlockedError(`conversion:${recipe.materialization}`, 'a native descriptor value lacks its certified dynamic observation boundary');
|
|
2238
|
+
const held = cppTypeOf(recipe.held);
|
|
2239
|
+
push(field, `${slot}.hasValue = true; ${slot}.nativeValue = gea::NativeDescriptorData::make<${held}, ${nativeFieldPolicyType(recipe.held)}>(${held}{${converted}}` +
|
|
2240
|
+
(materialized === null ? ')' : `, +[](const ${held}& gea_data) -> gea::Value { return ${materialized}; })`) +
|
|
2241
|
+
';');
|
|
2242
|
+
continue;
|
|
2243
|
+
}
|
|
2136
2244
|
// A field the descriptor record carries as `optional(T, undefined)` -- the
|
|
2137
2245
|
// shape `Object.getOwnPropertyDescriptor` publishes for its `value?: any`
|
|
2138
2246
|
// and `writable?: boolean` members -- states the attribute exactly when
|
|
@@ -2148,7 +2256,7 @@ const descriptorSlotLines = (ctx, operation, representation, text, slot) => {
|
|
|
2148
2256
|
if ((field.key === 'get' || field.key === 'set') && (!field.required || field.value.kind === 'optional')) {
|
|
2149
2257
|
// The record `Object.getOwnPropertyDescriptor` publishes declares
|
|
2150
2258
|
// `get?`/`set?` beside the data fields, and for every data property --
|
|
2151
|
-
// which is what
|
|
2259
|
+
// which is what a property-descriptor check restores -- both are absent.
|
|
2152
2260
|
// A PRESENT accessor is the case the compile-time refusal below states,
|
|
2153
2261
|
// reached here at runtime rather than at compile time because the same
|
|
2154
2262
|
// record carries both kinds; it refuses by name where the language would
|
|
@@ -2158,27 +2266,22 @@ const descriptorSlotLines = (ctx, operation, representation, text, slot) => {
|
|
|
2158
2266
|
push(field, stated(`gea::host::throwRuntimeError("TypeError", "Object.defineProperty with an accessor descriptor (${field.key}) is not rendered by this backend");`));
|
|
2159
2267
|
continue;
|
|
2160
2268
|
}
|
|
2161
|
-
// A
|
|
2162
|
-
//
|
|
2163
|
-
//
|
|
2164
|
-
// receiver of each [[Get]]/[[Set]]. ToPropertyDescriptor's own check that
|
|
2165
|
-
// a descriptor is not both kinds runs after every field is read, below.
|
|
2269
|
+
// A genuinely dynamic half already carries Value. Typed Functions need
|
|
2270
|
+
// the native receipt above; the ambient PropertyDescriptor signature
|
|
2271
|
+
// cannot authorize boxing their source frame.
|
|
2166
2272
|
if (field.key === 'get' || field.key === 'set') {
|
|
2167
|
-
|
|
2168
|
-
|
|
2273
|
+
if (carried.kind === 'undefined') {
|
|
2274
|
+
push(field, `${slot}.${field.key === 'get' ? 'hasGet' : 'hasSet'} = true;`);
|
|
2275
|
+
continue;
|
|
2276
|
+
}
|
|
2277
|
+
if (carried.kind !== 'dynamic')
|
|
2278
|
+
throw createCppEmitBlockedError('call-abi:object-value-conversions', 'a typed accessor Function has no native installation receipt');
|
|
2279
|
+
push(field, `gea::${field.key === 'get' ? 'installDescriptorGetter' : 'installDescriptorSetter'}(${slot}, ${held});`);
|
|
2169
2280
|
continue;
|
|
2170
2281
|
}
|
|
2171
2282
|
if (field.key === 'value') {
|
|
2172
|
-
// A
|
|
2173
|
-
//
|
|
2174
|
-
// than a defect. But the LITERAL's field carries whatever the program
|
|
2175
|
-
// wrote (`{ value }` where `value: string` carries `std::string`), so
|
|
2176
|
-
// the widening has to be spelled: `gea::Value` declares no converting
|
|
2177
|
-
// assignment from an arbitrary type, and relying on one would have been
|
|
2178
|
-
// a clang error at every call site rather than a named refusal here.
|
|
2179
|
-
//
|
|
2180
|
-
// A field already carried as `dynamic` assigns straight across -- it is
|
|
2181
|
-
// a `gea::Value` on both sides, and boxing a box would nest two.
|
|
2283
|
+
// A genuinely dynamic descriptor already carries Value. Typed data
|
|
2284
|
+
// fields use the certified native destination recipe above.
|
|
2182
2285
|
if (carried.kind === 'dynamic') {
|
|
2183
2286
|
push(field, stated(`${slot}.hasValue = true; ${slot}.value = ${held};`));
|
|
2184
2287
|
continue;
|
|
@@ -2251,7 +2354,7 @@ const dictionaryDefinePropertyValue = (ctx, descriptor) => {
|
|
|
2251
2354
|
*/
|
|
2252
2355
|
/**
|
|
2253
2356
|
* `Object.defineProperty` aimed at a namespace-shaped host intrinsic (`Math`):
|
|
2254
|
-
* the fourth reflection operation
|
|
2357
|
+
* the fourth reflection operation a property-descriptor check performs on one,
|
|
2255
2358
|
* restoring a member with the descriptor it read. A non-configurable member
|
|
2256
2359
|
* (every 21.3.1 constant) is validated at runtime by
|
|
2257
2360
|
* `gea::detail::hostIntrinsicRedefineFixed` -- the one admitted redefinition
|
|
@@ -2309,8 +2412,41 @@ const fixedFieldDefinePropertyText = (ctx, view, recipe, descriptor, targetOpera
|
|
|
2309
2412
|
const accessor = memberAccessOperator(representation.ownership);
|
|
2310
2413
|
const descriptorText = operandText(ctx, descriptor);
|
|
2311
2414
|
const read = (member) => `${descriptorText}${accessor}${cppRecordFieldName(member.key)}`;
|
|
2312
|
-
|
|
2313
|
-
|
|
2415
|
+
if (recipe.attributesOnly !== undefined) {
|
|
2416
|
+
if (recipe.value !== null || recipe.conversion !== null)
|
|
2417
|
+
throw createCppEmitBlockedError('host-member-call:ObjectConstructor.defineProperty', 'attribute-only definition carries a value recipe');
|
|
2418
|
+
const receiver = 'gea_attributes_target';
|
|
2419
|
+
const description = 'gea_attributes_input';
|
|
2420
|
+
const fieldText = `${receiver}${view.accessor}${cppRecordFieldName(field.key)}`;
|
|
2421
|
+
const attributesText = `${receiver}${view.accessor}${cppRecordFieldAttributesName(field.key)}`;
|
|
2422
|
+
const presenceText = `${receiver}${view.accessor}${cppRecordFieldPresenceName(field.key)}`;
|
|
2423
|
+
const flags = recipe.attributes
|
|
2424
|
+
.map((member) => `gea_attributes.has${member.key[0].toUpperCase()}${member.key.slice(1)} = true; ` +
|
|
2425
|
+
`gea_attributes.${member.key} = ${description}${accessor}${cppRecordFieldName(member.key)};`)
|
|
2426
|
+
.join(' ');
|
|
2427
|
+
let create = 'gea::host::throwRuntimeError("TypeError", "A native attribute definition lost its authenticated own property");';
|
|
2428
|
+
if (recipe.attributesOnly.absence !== null) {
|
|
2429
|
+
const node = ctx.conversions.nodeById(recipe.attributesOnly.absence);
|
|
2430
|
+
const value = node && recipeText(ctx, node, cppUndefinedValue);
|
|
2431
|
+
if (value === null || value === undefined)
|
|
2432
|
+
throw createCppEmitBlockedError('host-member-call:ObjectConstructor.defineProperty', 'attribute-only Undefined creation has no renderer');
|
|
2433
|
+
create =
|
|
2434
|
+
`if (!gea::nativeIsExtensible(${receiver}) || !gea::applyNativeFixedDataDescriptor(` +
|
|
2435
|
+
`${fieldText}, ${attributesText}, ${cppTypeOf(held)}{${value}}, false, ` +
|
|
2436
|
+
'gea_attributes.hasWritable, gea_attributes.writable, gea_attributes.hasEnumerable, gea_attributes.enumerable, ' +
|
|
2437
|
+
'gea_attributes.hasConfigurable, gea_attributes.configurable)) ' +
|
|
2438
|
+
`gea::host::throwRuntimeError("TypeError", "Cannot redefine property: ${field.key}"); ` +
|
|
2439
|
+
`gea::detail::noteNativeDeclaredKeyCreated(${receiver}, ${cppStringLiteral(field.key)}); ` +
|
|
2440
|
+
`${presenceText} = true;`;
|
|
2441
|
+
}
|
|
2442
|
+
return (`([&]() { const auto& ${receiver} = ${view.receiver}; const auto& ${description} = ${descriptorText}; ` +
|
|
2443
|
+
`gea::PropertyDescriptor gea_attributes; ${flags}bool gea_present = ${presenceText}; ` +
|
|
2444
|
+
`if (!gea_present) { ${create} } else if (!gea::applyNativeFieldDescriptor<${cppTypeOf(held)}, ${nativeFieldPolicyType(held)}>(` +
|
|
2445
|
+
`${fieldText}, ${attributesText}, gea_present, gea_attributes, true, gea::Value::Tag::Object)) ` +
|
|
2446
|
+
`gea::host::throwRuntimeError("TypeError", "Cannot redefine property: ${field.key}"); return ${receiver}; })()`);
|
|
2447
|
+
}
|
|
2448
|
+
const node = recipe.conversion === null ? null : ctx.conversions.nodeById(recipe.conversion);
|
|
2449
|
+
const incoming = node === null || recipe.value === null ? null : recipeText(ctx, node, read(recipe.value));
|
|
2314
2450
|
if (incoming === null) {
|
|
2315
2451
|
throw createCppEmitBlockedError('host-member-call:ObjectConstructor.defineProperty', 'fixed data definition conversion has no renderer');
|
|
2316
2452
|
}
|
|
@@ -2391,9 +2527,9 @@ const fixedFieldDefinePropertyText = (ctx, view, recipe, descriptor, targetOpera
|
|
|
2391
2527
|
/**
|
|
2392
2528
|
* `Object.defineProperty` of a union whose every arm is a generated shared
|
|
2393
2529
|
* record or a box: the live arm defines the key through its own protocol, as
|
|
2394
|
-
* the two single-carrier arms of `definePropertyText` below do.
|
|
2395
|
-
*
|
|
2396
|
-
*
|
|
2530
|
+
* the two single-carrier arms of `definePropertyText` below do. A recursive
|
|
2531
|
+
* walk holds the caller's adopted Document in the record arm and every nested
|
|
2532
|
+
* `doc[k]` its recursion passes in the box arm.
|
|
2397
2533
|
* `null` for any other receiver.
|
|
2398
2534
|
*/
|
|
2399
2535
|
const unionDefinePropertyText = (ctx, operation, target, key, descriptor) => {
|
|
@@ -2427,9 +2563,9 @@ const unionDefinePropertyText = (ctx, operation, target, key, descriptor) => {
|
|
|
2427
2563
|
* class constructors are viewed as declares: the constructor's own property
|
|
2428
2564
|
* lives in its view record (`constructorViewFieldFor`), the storage
|
|
2429
2565
|
* `C.key = v` writes and `(this.constructor as { key?: T }).key` reads, so the
|
|
2430
|
-
* define goes through that record's own [[DefineOwnProperty]]
|
|
2431
|
-
* `
|
|
2432
|
-
*
|
|
2566
|
+
* define goes through that record's own [[DefineOwnProperty]]: a helper
|
|
2567
|
+
* `f(target: { tags?: Set<symbol> }, ...)` receives each class itself.
|
|
2568
|
+
* `null` for any other arm, or a key no view declares.
|
|
2433
2569
|
*/
|
|
2434
2570
|
const constructorViewDefineText = (ctx, arm, armText, key, propertyKey, slot) => {
|
|
2435
2571
|
if (arm.kind !== 'constructor-family' && arm.kind !== 'constructor-identity')
|
|
@@ -2454,6 +2590,49 @@ const definePropertyText = (ctx, operation) => {
|
|
|
2454
2590
|
if (key === undefined || descriptor === undefined) {
|
|
2455
2591
|
throw createCppEmitBlockedError('host-member-call:ObjectConstructor.defineProperty', '"Object.defineProperty" takes a target, a key and a descriptor; this call passes fewer');
|
|
2456
2592
|
}
|
|
2593
|
+
if (operation.nativeArrayDescriptorReinstallation) {
|
|
2594
|
+
const receipt = operation.nativeArrayDescriptorReinstallation;
|
|
2595
|
+
if (target.representation.kind !== 'array-object' ||
|
|
2596
|
+
target.value !== receipt.receiver.value ||
|
|
2597
|
+
key.value !== receipt.key.value ||
|
|
2598
|
+
descriptor.value !== receipt.descriptor.value)
|
|
2599
|
+
throw createCppEmitBlockedError('runtime-helper:native-array-descriptor-snapshot', 'the copied descriptor has no native array owner');
|
|
2600
|
+
const valueNames = new Map(ctx.valueNames)
|
|
2601
|
+
.set(target.value, '__gea_target')
|
|
2602
|
+
.set(key.value, '__gea_key_input')
|
|
2603
|
+
.set(descriptor.value, '__gea_descriptor_input');
|
|
2604
|
+
const deferredTexts = new Map(ctx.deferredTexts);
|
|
2605
|
+
const pendingPacks = new Map(ctx.pendingPacks);
|
|
2606
|
+
for (const operand of [target, key, descriptor]) {
|
|
2607
|
+
deferredTexts.delete(operand.value);
|
|
2608
|
+
pendingPacks.delete(operand.value);
|
|
2609
|
+
}
|
|
2610
|
+
const bound = { ...ctx, valueNames, deferredTexts, pendingPacks };
|
|
2611
|
+
return (`([&]() { const auto& __gea_target = ${operandText(ctx, target)}; const auto& __gea_key_input = ${operandText(ctx, key)}; ` +
|
|
2612
|
+
`const auto& __gea_descriptor_input = ${operandText(ctx, descriptor)}; ` +
|
|
2613
|
+
`${defineDescriptorLines(bound, operation, descriptor, '__gea_descriptor')} ` +
|
|
2614
|
+
`if (!gea::nativeDynamicDefineProperty(__gea_target, ${propertyKeyOperandText(bound, key, '"Object.defineProperty" of a captured native descriptor')}, __gea_descriptor)) ` +
|
|
2615
|
+
'gea::host::throwRuntimeError("TypeError", "Cannot reinstall native array descriptor"); return __gea_target; })()');
|
|
2616
|
+
}
|
|
2617
|
+
const delegatedReceiver = generatedRecordReceiver(target.representation, '__gea_target');
|
|
2618
|
+
if (operation.nativeDataDefinition?.delegatesView && delegatedReceiver !== null) {
|
|
2619
|
+
const valueNames = new Map(ctx.valueNames)
|
|
2620
|
+
.set(target.value, '__gea_target')
|
|
2621
|
+
.set(key.value, '__gea_key_input')
|
|
2622
|
+
.set(descriptor.value, '__gea_descriptor_input');
|
|
2623
|
+
const deferredTexts = new Map(ctx.deferredTexts);
|
|
2624
|
+
const pendingPacks = new Map(ctx.pendingPacks);
|
|
2625
|
+
for (const operand of [target, key, descriptor]) {
|
|
2626
|
+
deferredTexts.delete(operand.value);
|
|
2627
|
+
pendingPacks.delete(operand.value);
|
|
2628
|
+
}
|
|
2629
|
+
const bound = { ...ctx, valueNames, deferredTexts, pendingPacks };
|
|
2630
|
+
return (`([&]() { const auto& __gea_target = ${operandText(ctx, target)}; const auto& __gea_key_input = ${operandText(ctx, key)}; ` +
|
|
2631
|
+
`const auto& __gea_descriptor_input = ${operandText(ctx, descriptor)}; ` +
|
|
2632
|
+
`${defineDescriptorLines(bound, operation, descriptor, '__gea_descriptor')} ` +
|
|
2633
|
+
`if (!${generatedDefineOwnText('__gea_target', propertyKeyOperandText(bound, key, '"Object.defineProperty" of a native view'), '__gea_descriptor')}) ` +
|
|
2634
|
+
'gea::host::throwRuntimeError("TypeError", "Cannot define a native view property"); return __gea_target; })()');
|
|
2635
|
+
}
|
|
2457
2636
|
if (operation.fixedDataDefinition !== undefined) {
|
|
2458
2637
|
const view = objectViewOf(ctx, 'defineProperty', target, 'target');
|
|
2459
2638
|
if (view.kind !== 'known')
|
|
@@ -2676,7 +2855,7 @@ const pairWalkFromEntriesText = (ctx, operation, source) => {
|
|
|
2676
2855
|
if (halves === null)
|
|
2677
2856
|
return refuse(`its entry "${representationKey(pair)}" is not a two-position [key, value] pair`);
|
|
2678
2857
|
// ToPropertyKey of an absent key is its ToString: an entry whose key is
|
|
2679
|
-
// `undefined` (
|
|
2858
|
+
// `undefined` (an optional field used as the key) lands under
|
|
2680
2859
|
// "undefined", exactly as node stores it.
|
|
2681
2860
|
const keyCarrier = halves.key;
|
|
2682
2861
|
const keyText = keyCarrier.kind === 'string'
|
|
@@ -2695,7 +2874,7 @@ const pairWalkFromEntriesText = (ctx, operation, source) => {
|
|
|
2695
2874
|
const store = `(*gea_object)[${keyText}] = ${value};`;
|
|
2696
2875
|
const dictionaryType = cppTypeOf({ ...result, ownership: 'owned' });
|
|
2697
2876
|
const walk = carrier.kind === 'array-object'
|
|
2698
|
-
? `if (gea_source) for (const auto& gea_slot : gea_source->
|
|
2877
|
+
? `if (gea_source) for (const auto& gea_slot : gea_source->readSlots()) { ` +
|
|
2699
2878
|
`if (!gea_slot.present) gea::host::throwRuntimeError("TypeError", "Iterator value undefined is not an entry object"); ` +
|
|
2700
2879
|
`const auto& gea_pair = gea_slot.value; ${store} }`
|
|
2701
2880
|
: `auto gea_cursor = gea_source; while (true) { auto gea_pair = gea_cursor.arrayNext(); if (gea_cursor.done()) break; ${store} }`;
|
|
@@ -2789,6 +2968,9 @@ const sameValueText = (leftCarrier, leftText, rightCarrier, rightText, depth = 0
|
|
|
2789
2968
|
return `gea::sameNumberValue(static_cast<double>(${leftText}), static_cast<double>(${rightText}))`;
|
|
2790
2969
|
if (leftType !== null)
|
|
2791
2970
|
return `${leftText} == ${rightText}`;
|
|
2971
|
+
const callable = callableIdentityEqualityText('===', { representation: leftCarrier, text: leftText }, { representation: rightCarrier, text: rightText });
|
|
2972
|
+
if (callable !== null)
|
|
2973
|
+
return callable;
|
|
2792
2974
|
if (representationKey(leftCarrier) === representationKey(rightCarrier) &&
|
|
2793
2975
|
(leftCarrier.kind === 'array-buffer' ||
|
|
2794
2976
|
leftCarrier.kind === 'shared-array-buffer' ||
|
|
@@ -2808,6 +2990,7 @@ const composite = (carrier, name, leaf) => {
|
|
|
2808
2990
|
return `${arms.join(' ')} return false;`;
|
|
2809
2991
|
};
|
|
2810
2992
|
export const objectMemberText = (ctx, member, operation) => {
|
|
2993
|
+
ctx = { ...ctx, hostObjectWalkPlan: operation.hostObjectWalkPlan };
|
|
2811
2994
|
if (member === 'keys' || member === 'getOwnPropertyNames')
|
|
2812
2995
|
return keysText(ctx, member, operation);
|
|
2813
2996
|
if (member === 'getOwnPropertySymbols')
|