@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,26 +1,48 @@
|
|
|
1
1
|
import { callableCompletionSummaryOf } from './flow/callable-completions.js';
|
|
2
|
+
import { relative } from 'node:path';
|
|
2
3
|
import ts from 'typescript';
|
|
3
4
|
import { globalSymbolBehindModuleAmbientConst, isAmbientDeclaration, moduleAmbientGlobalSatisfiesDeclaration } from '../ambient.js';
|
|
4
|
-
import { unwrapErasedExpression } from './producers/erasure.js';
|
|
5
|
+
import { outermostErasureOf, unwrapErasedExpression } from './producers/erasure.js';
|
|
5
6
|
import { scriptGlobalValueRedefinitionOf } from './script-global-redefinition.js';
|
|
6
7
|
import { reflectiveDefinitionMayInstallGetterOf, sourceClassDataMemberPlanOf } from './flow/source-class-data.js';
|
|
7
8
|
import { sourceRecordSlotValuesOf } from './flow/source-record-data.js';
|
|
8
9
|
import { isRealCallableDeclaration, runtimeParametersOf } from './flow/targets.js';
|
|
9
10
|
import { isVacuousOrigin, seededOriginSolver } from './flow/seeded-origins.js';
|
|
10
|
-
import { closedCallableAuthorityOf, closedValueOriginAuthorityOf } from './flow/callable-reach.js';
|
|
11
|
+
import { closedCallableAuthorityOf, closedValueOriginAuthorityOf, hasClosedValueUses, sourceInvocationFactHasJointTargets } from './flow/callable-reach.js';
|
|
12
|
+
import { sourceValueSessionOf } from './flow/source-value-session.js';
|
|
13
|
+
import { sourceBindingValuesOf } from './flow/value-provenance.js';
|
|
14
|
+
import { sourceExecutingParameterValuesOf } from './flow/source-executing-parameter-values.js';
|
|
15
|
+
import { standardPrototypeMethodSourceOf } from './flow/standard-prototype-method-source.js';
|
|
16
|
+
import { sourceCallableObjectOf, sourceCallableOwnDataWriteOf } from './flow/source-callable-own-data.js';
|
|
17
|
+
import { sourceIntrinsicMemberInvocationOf } from './flow/source-intrinsic-member-data.js';
|
|
11
18
|
import { sourceConstructorSelectionsOf, sourceConstructorReturnValuesOf } from './flow/member-call-forwarding.js';
|
|
12
19
|
import { wholeProgram } from './reachability.js';
|
|
13
20
|
import { createPropertyKeyDomains } from './property-key-domain.js';
|
|
14
|
-
import { HostMutationTaint, everyKey, keySetTouches, namedKey, numericKeys } from './host-mutation-keys.js';
|
|
21
|
+
import { HostMutationTaint, everyKey, keySetTouches, namedKey, numericKeys, programSymbolKeys } from './host-mutation-keys.js';
|
|
15
22
|
import { attachDeferredIntrinsicProtocolLedger, createDeferredIntrinsicProtocolLedger, deferredIntrinsicProtocolLedgerOf, failedIntrinsicProtocolRequirements } from './deferred-intrinsic-protocols.js';
|
|
16
23
|
import { symbolIsStandardLibraryMutator, symbolStatesHostInert, symbolWritesNoIntrinsicProperty } from './host-effect-contracts.js';
|
|
17
|
-
import { createMutationKeyReader, hostAccessorNamesOf,
|
|
24
|
+
import { createMutationKeyReader, hostAccessorNamesOf, keyOfName } from './host-mutation-key-reader.js';
|
|
25
|
+
import { programSymbolOriginOf } from './callable-data-write.js';
|
|
26
|
+
import { intrinsicAccessorGetterChainOf } from './intrinsic-accessor-getter.js';
|
|
27
|
+
// A source file named the way a reader finds it: from the directory the compiler runs in.
|
|
28
|
+
const displayPath = (fileName) => relative(process.cwd(), fileName);
|
|
18
29
|
const staticKeyOf = (node) => {
|
|
19
30
|
if (ts.isPropertyAccessExpression(node))
|
|
20
31
|
return node.name.text;
|
|
21
32
|
const argument = node.argumentExpression;
|
|
22
33
|
return ts.isStringLiteralLike(argument) || ts.isNumericLiteral(argument) ? argument.text : null;
|
|
23
34
|
};
|
|
35
|
+
/** A function declaration with no body in an ambient context: a declaration file, or under `declare` (`declare global { ... }`). */
|
|
36
|
+
const isBodilessAmbientFunction = (declaration) => {
|
|
37
|
+
if (!ts.isFunctionDeclaration(declaration) || declaration.body !== undefined)
|
|
38
|
+
return false;
|
|
39
|
+
if (declaration.getSourceFile().isDeclarationFile)
|
|
40
|
+
return true;
|
|
41
|
+
for (let current = declaration; current !== undefined; current = current.parent)
|
|
42
|
+
if (ts.canHaveModifiers(current) && (ts.getCombinedModifierFlags(current) & ts.ModifierFlags.Ambient) !== 0)
|
|
43
|
+
return true;
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
24
46
|
const staticKeyExpression = (expression) => {
|
|
25
47
|
const current = unwrapErasedExpression(expression);
|
|
26
48
|
return ts.isStringLiteralLike(current) || ts.isNumericLiteral(current) ? current.text : null;
|
|
@@ -44,35 +66,6 @@ const isIntrinsicGlobalThis = (node, names) => {
|
|
|
44
66
|
const expression = unwrapErasedExpression(node);
|
|
45
67
|
return ts.isIdentifier(expression) && names.isIntrinsicGlobalThis(expression);
|
|
46
68
|
};
|
|
47
|
-
const isDirectAssignmentTarget = (node) => {
|
|
48
|
-
let current = node;
|
|
49
|
-
let parent = current.parent;
|
|
50
|
-
while (true) {
|
|
51
|
-
const nested = (ts.isParenthesizedExpression(parent) && parent.expression === current) ||
|
|
52
|
-
(ts.isPropertyAssignment(parent) && parent.initializer === current) ||
|
|
53
|
-
(ts.isShorthandPropertyAssignment(parent) && parent.name === current) ||
|
|
54
|
-
(ts.isSpreadAssignment(parent) && parent.expression === current) ||
|
|
55
|
-
(ts.isSpreadElement(parent) && parent.expression === current) ||
|
|
56
|
-
(ts.isObjectLiteralExpression(parent) && parent.properties.includes(current)) ||
|
|
57
|
-
(ts.isArrayLiteralExpression(parent) && parent.elements.includes(current));
|
|
58
|
-
if (!nested)
|
|
59
|
-
break;
|
|
60
|
-
current = parent;
|
|
61
|
-
parent = current.parent;
|
|
62
|
-
}
|
|
63
|
-
if (ts.isDeleteExpression(parent) && parent.expression === current)
|
|
64
|
-
return true;
|
|
65
|
-
if ((ts.isPrefixUnaryExpression(parent) || ts.isPostfixUnaryExpression(parent)) &&
|
|
66
|
-
parent.operand === current &&
|
|
67
|
-
(parent.operator === ts.SyntaxKind.PlusPlusToken || parent.operator === ts.SyntaxKind.MinusMinusToken)) {
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
return ((ts.isBinaryExpression(parent) &&
|
|
71
|
-
parent.left === current &&
|
|
72
|
-
parent.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
|
|
73
|
-
parent.operatorToken.kind <= ts.SyntaxKind.LastAssignment) ||
|
|
74
|
-
((ts.isForOfStatement(parent) || ts.isForInStatement(parent)) && parent.initializer === current));
|
|
75
|
-
};
|
|
76
69
|
const initialCensusSeed = {
|
|
77
70
|
names: new Set(),
|
|
78
71
|
all: false,
|
|
@@ -113,6 +106,14 @@ computedKeysOf = () => null,
|
|
|
113
106
|
*/
|
|
114
107
|
staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
115
108
|
const tainted = new HostMutationTaint();
|
|
109
|
+
const invocationRequirements = new Map();
|
|
110
|
+
const invocationLedger = deferredIntrinsicProtocolLedgerOf(flow) ?? createDeferredIntrinsicProtocolLedger();
|
|
111
|
+
if (!deferredIntrinsicProtocolLedgerOf(flow))
|
|
112
|
+
attachDeferredIntrinsicProtocolLedger(flow, invocationLedger);
|
|
113
|
+
const retainRequirements = (node, requirements) => {
|
|
114
|
+
const previous = invocationRequirements.get(node) ?? [];
|
|
115
|
+
invocationRequirements.set(node, [...previous, ...requirements.filter((requirement) => !previous.includes(requirement))]);
|
|
116
|
+
};
|
|
116
117
|
// Every intrinsic member name this run trusted, and every key its visit
|
|
117
118
|
// wrote on a surface, a global binding or an intrinsic object: see
|
|
118
119
|
// `IntrinsicTrustSeed`.
|
|
@@ -131,6 +132,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
131
132
|
return {
|
|
132
133
|
names: new Set([...surface.names, ...(own?.names ?? [])]),
|
|
133
134
|
numeric: surface.numeric || (own?.numeric ?? false),
|
|
135
|
+
programSymbols: surface.programSymbols === true || own?.programSymbols === true,
|
|
134
136
|
every: surface.every || (own?.every ?? false)
|
|
135
137
|
};
|
|
136
138
|
};
|
|
@@ -153,7 +155,16 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
153
155
|
const intrinsicReflectionIsIntact = () => !allIntrinsicTrustInvalidated && !intrinsicSurfaceMemberReplaced;
|
|
154
156
|
/** `GEA_PROGRAM_BODY_CALLS=0` files the wildcard for every unnamed callee again, so one build can be measured with and without the rule. */
|
|
155
157
|
const programBodyCallsEnabled = process.env['GEA_PROGRAM_BODY_CALLS'] !== '0';
|
|
156
|
-
|
|
158
|
+
// These entries authenticate a real own-data installation and its exact
|
|
159
|
+
// source frame, independently of the intentionally replaced library
|
|
160
|
+
// member. Their captured obligations still owe final census discharge.
|
|
161
|
+
const sourceIntrinsicReplacementCalls = new Set();
|
|
162
|
+
const sourceJointInvocationCalls = new Set();
|
|
163
|
+
const sourceIntrinsicInstallations = new Set();
|
|
164
|
+
const callRunsOnlyProgramBodies = (call) => programBodyCallsEnabled &&
|
|
165
|
+
((programBodyOnlyCalls.has(call) && intrinsicReflectionIsIntact()) ||
|
|
166
|
+
sourceIntrinsicReplacementCalls.has(call) ||
|
|
167
|
+
sourceJointInvocationIsClosed(call));
|
|
157
168
|
const wildcardReasonCounts = new Map();
|
|
158
169
|
/** `GEA_PROGRAM_BODY_DEBUG=1`: every wildcard site, so the residue can be ranked by shape without the full mutation log. */
|
|
159
170
|
const wildcardSites = [];
|
|
@@ -168,7 +179,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
168
179
|
wildcardReasonCounts.set(reason, (wildcardReasonCounts.get(reason) ?? 0) + 1);
|
|
169
180
|
const file = node.getSourceFile();
|
|
170
181
|
const position = file.getLineAndCharacterOfPosition(node.getStart(file));
|
|
171
|
-
const where = `${file.fileName
|
|
182
|
+
const where = `${displayPath(file.fileName)}:${position.line + 1}`;
|
|
172
183
|
wildcardSites.push(`${reason} :: ${where} ${node.getText(file).slice(0, 90).replace(/\s+/g, ' ')}`);
|
|
173
184
|
}
|
|
174
185
|
tainted.taintSurface(everyKey);
|
|
@@ -202,6 +213,46 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
202
213
|
};
|
|
203
214
|
const reachableFlowCalls = flow.calls.filter((site) => flowSiteIsReachable(site.call));
|
|
204
215
|
const reachableWrites = flow.allWrites.filter((write) => flowSiteIsReachable(write.site));
|
|
216
|
+
// Write positions come from the shared edge inventory, including erased
|
|
217
|
+
// wrappers and destructuring. Reclassifying parent syntax here missed
|
|
218
|
+
// `(Symbol as any) = replacement` and preserved a false stock-factory proof.
|
|
219
|
+
const directWriteTargets = new Set();
|
|
220
|
+
for (const write of reachableWrites) {
|
|
221
|
+
if (write.propertyAccess !== null) {
|
|
222
|
+
directWriteTargets.add(write.propertyAccess);
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (write.slot !== 'whole' || write.naming === null)
|
|
226
|
+
continue;
|
|
227
|
+
if (write.edge === 'identifier-assignment' ||
|
|
228
|
+
write.edge === 'compound-assignment' ||
|
|
229
|
+
write.edge === 'logical-assignment' ||
|
|
230
|
+
write.edge === 'destructuring' ||
|
|
231
|
+
write.edge === 'destructuring-default' ||
|
|
232
|
+
write.edge === 'iteration-binding')
|
|
233
|
+
directWriteTargets.add(write.naming);
|
|
234
|
+
}
|
|
235
|
+
const isDirectAssignmentTarget = (node) => directWriteTargets.has(node);
|
|
236
|
+
// The JS binder adds expando-owner identifiers to a library symbol's
|
|
237
|
+
// declarations. They describe these runtime writes, not a new value binding.
|
|
238
|
+
// Keep only names on the shared write-address spine; a source declaration
|
|
239
|
+
// that really shadows the binding remains outside the standard identity.
|
|
240
|
+
const writtenAddressNames = new Set();
|
|
241
|
+
for (const write of reachableWrites) {
|
|
242
|
+
let address = write.propertyAccess ?? write.naming;
|
|
243
|
+
while (address !== null) {
|
|
244
|
+
const current = unwrapErasedExpression(address);
|
|
245
|
+
if (ts.isIdentifier(current)) {
|
|
246
|
+
writtenAddressNames.add(current);
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
if (ts.isPropertyAccessExpression(current) && ts.isIdentifier(current.name))
|
|
250
|
+
writtenAddressNames.add(current.name);
|
|
251
|
+
if (!ts.isPropertyAccessExpression(current) && !ts.isElementAccessExpression(current))
|
|
252
|
+
break;
|
|
253
|
+
address = current.expression;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
205
256
|
const nodes = [];
|
|
206
257
|
for (const file of files) {
|
|
207
258
|
if (file.isDeclarationFile)
|
|
@@ -218,8 +269,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
218
269
|
// `ts.isExpression` is a pure SYNTAX-KIND test: `Identifier` is one shared
|
|
219
270
|
// node kind between value and type positions, so it answers `true` for the
|
|
220
271
|
// `globalThis` naming a dotted TYPE too -- the qualifier of a
|
|
221
|
-
// `ts.QualifiedName` (`globalThis.ResponseInit`
|
|
222
|
-
//
|
|
272
|
+
// `ts.QualifiedName` (a `globalThis.ResponseInit` type annotation, as a
|
|
273
|
+
// library may spell it). A `QualifiedName` navigates a
|
|
223
274
|
// NAMESPACE to look up a type member; it never asks what `globalThis` is AS
|
|
224
275
|
// A VALUE, so `checker.getTypeAtLocation` on the qualifier answers `any` --
|
|
225
276
|
// and an `any` `intrinsicGlobalType` makes `isTypeAssignableTo(x,
|
|
@@ -227,12 +278,12 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
227
278
|
// authenticating every one of them (`isAuthenticatedEquivalentGlobal`) as
|
|
228
279
|
// the global object itself. That was the whole of a false
|
|
229
280
|
// `Buffer.from`/`Buffer.isBuffer`/`Buffer.alloc` "opaque or global method
|
|
230
|
-
// receiver" wildcard on
|
|
231
|
-
//
|
|
281
|
+
// receiver" wildcard on a program where nothing reachable reads
|
|
282
|
+
// `globalThis` as a value, but one library file spells `init?:
|
|
232
283
|
// globalThis.ResponseInit`, and this loop took that type-only occurrence as
|
|
233
284
|
// its evidence of the real thing.
|
|
234
285
|
//
|
|
235
|
-
// A bare `typeof globalThis` type QUERY (
|
|
286
|
+
// A bare `typeof globalThis` type QUERY (a host global script's `var global:
|
|
236
287
|
// typeof globalThis`) is not the same hazard and must NOT be excluded the
|
|
237
288
|
// same way: `typeof X` has to resolve `X` as a value to build its type, so
|
|
238
289
|
// `getTypeAtLocation` on a `TypeQueryNode`'s `exprName` answers with
|
|
@@ -321,8 +372,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
321
372
|
* own "does this file have a top-level `import`/`export`" answer, so it is
|
|
322
373
|
* the same fact the runtime uses to decide the file's own module-ness.
|
|
323
374
|
* A file with neither is a SCRIPT and is sloppy unless it opens with its
|
|
324
|
-
* own `'use strict'` directive prologue --
|
|
325
|
-
*
|
|
375
|
+
* own `'use strict'` directive prologue -- runtime polyfill files that
|
|
376
|
+
* install globals are often exactly this: deliberately-authored scripts,
|
|
326
377
|
* not modules, so they must NOT be read as strict just because the rest of
|
|
327
378
|
* the program is ESM.
|
|
328
379
|
*
|
|
@@ -449,7 +500,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
449
500
|
// anywhere in a program took `Object` with it, and every proof that asks
|
|
450
501
|
// whether `Object.getOwnPropertyDescriptor` is intact answered no.
|
|
451
502
|
return (declarations.some((declaration) => declaration.getSourceFile().hasNoDefaultLib) &&
|
|
452
|
-
declarations.every((declaration) => declaration.getSourceFile().hasNoDefaultLib ||
|
|
503
|
+
declarations.every((declaration) => declaration.getSourceFile().hasNoDefaultLib ||
|
|
504
|
+
ts.isInterfaceDeclaration(declaration) ||
|
|
505
|
+
(ts.isIdentifier(declaration) && writtenAddressNames.has(declaration))));
|
|
453
506
|
};
|
|
454
507
|
const hasStandardLibraryDeclaration = (symbol) => (symbol.declarations ?? []).some((declaration) => declaration.getSourceFile().hasNoDefaultLib);
|
|
455
508
|
const isStandardLibraryDeclaration = (declaration) => !!declaration && declaration.getSourceFile().hasNoDefaultLib;
|
|
@@ -465,7 +518,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
465
518
|
if (!symbol || !isStandardLibrarySymbol(symbol))
|
|
466
519
|
return;
|
|
467
520
|
const type = checker.getTypeOfSymbolAtLocation(symbol, location);
|
|
468
|
-
|
|
521
|
+
// Call-only factories and namespace objects own replaceable members too;
|
|
522
|
+
// their aliases must participate in the same mutation authority as constructors.
|
|
523
|
+
if (type.getConstructSignatures().length > 0 || symbol.name === 'Reflect' || symbol.name === 'Symbol' || symbol.name === 'JSON') {
|
|
469
524
|
canonicalConstructors.set(symbol, symbol);
|
|
470
525
|
const declaration = identities.symbolValueDeclarationId(symbol, location);
|
|
471
526
|
if (declaration !== null)
|
|
@@ -706,11 +761,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
706
761
|
// `null`/`undefined` in the union is not the global object -- it is not
|
|
707
762
|
// ANY object, native or otherwise -- so it must not force the whole union
|
|
708
763
|
// to answer "not proven native" the way an unauthenticated member
|
|
709
|
-
// correctly does. Before this, `
|
|
710
|
-
// checker's own type for
|
|
764
|
+
// correctly does. Before this, `NativeHostContext | null` (the
|
|
765
|
+
// checker's own type for a host-context field at every call the compiler had not already
|
|
711
766
|
// null-narrowed) answered `false` here on the strength of the `null`
|
|
712
767
|
// member alone, even though the SAME symbol, read at a narrowed site with
|
|
713
|
-
// type `
|
|
768
|
+
// type `NativeHostContext`, already authenticates. Allowing a
|
|
714
769
|
// primitive member (which is what `null`/`undefined` are, per
|
|
715
770
|
// `primitiveResult`'s mask) to satisfy its own slot mirrors the identical
|
|
716
771
|
// allowance `objectResult`/`representedObjectResult` already make below --
|
|
@@ -797,36 +852,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
797
852
|
.keysOfKeyExpression(expression.argumentExpression)
|
|
798
853
|
.every((key) => key.kind === 'numeric' || (key.kind === 'name' && String(Number(key.name)) === key.name));
|
|
799
854
|
};
|
|
800
|
-
/**
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
* above, and a stronger one: a symbol is not a string and never converts to
|
|
804
|
-
* one implicitly, so `o[sym] = v` cannot be the write that replaces
|
|
805
|
-
* `__proto__`, `prototype`, or any named intrinsic member, whatever `o`
|
|
806
|
-
* turns out to be at run time. `invalidateAllIntrinsicTrust` exists for
|
|
807
|
-
* exactly those names and has nothing to fire on here.
|
|
808
|
-
*
|
|
809
|
-
* ⛔ Program-declared is the whole guard. A WELL-KNOWN symbol -- the
|
|
810
|
-
* `unique symbol`s the standard library declares on `SymbolConstructor` --
|
|
811
|
-
* is the opposite case: `X.prototype[Symbol.iterator] = f` genuinely
|
|
812
|
-
* redefines intrinsic behavior under a key whose name is not a string, so
|
|
813
|
-
* it stays on the invalidating path. `hasStandardLibraryDeclaration` is the
|
|
814
|
-
* same test `intrinsicPrototypeDeclarationOf` uses to decide whether a
|
|
815
|
-
* member belongs to the standard library at all. A bare `symbol`-typed key
|
|
816
|
-
* (not unique) names an unknown symbol, so it fails closed too.
|
|
817
|
-
*
|
|
818
|
-
* Measured on hono. `@hono/node-server`'s `request.ts` attaches its private
|
|
819
|
-
* state with module-level `Symbol()` keys through a `Record<string | symbol,
|
|
820
|
-
* any>` parameter -- `request[bodyConsumedDirectlyKey] = true` at line 279.
|
|
821
|
-
* That one write set `allIntrinsicTrustInvalidated` for the WHOLE program,
|
|
822
|
-
* so `intrinsicReflectionIsIntact()` was false everywhere after it, so
|
|
823
|
-
* `callRunsOnlyProgramBodies` refused at every call site, and 697 sites took
|
|
824
|
-
* a wildcard for it -- 329 `opaque or global method receiver`, 368 `global
|
|
825
|
-
* contained in unknown call argument`. All 39 `Buffer.*` reads were in that
|
|
826
|
-
* set, and none of them has anything to do with `request.ts`.
|
|
855
|
+
/** Stock factory provenance, rather than a unique-symbol checker spelling,
|
|
856
|
+
* keeps private symbol writes separate from named intrinsic replacement.
|
|
857
|
+
* Factory integrity is discharged by the shared final census fixed point.
|
|
827
858
|
*/
|
|
828
|
-
const isDefinitelyProgramSymbolElementKey = (expression) => ts.isElementAccessExpression(expression) &&
|
|
829
|
-
isProgramDeclaredSymbolKey(publishedTypeAt(unwrapErasedExpression(expression.argumentExpression)));
|
|
859
|
+
const isDefinitelyProgramSymbolElementKey = (expression) => ts.isElementAccessExpression(expression) && isProgramSymbolKeyExpression(expression.argumentExpression);
|
|
830
860
|
const overwrittenIntrinsicSymbols = new Set();
|
|
831
861
|
const propertyKeyDomains = createPropertyKeyDomains(checker, flow, flowSiteIsReachable, publishedTypeAt);
|
|
832
862
|
// A computed key set, with Object.prototype's possible enumerable keys
|
|
@@ -850,9 +880,81 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
850
880
|
keys.push(keyOfName(name));
|
|
851
881
|
if (inherited.numeric)
|
|
852
882
|
keys.push(numericKeys);
|
|
883
|
+
if (inherited.programSymbols)
|
|
884
|
+
keys.push(programSymbolKeys);
|
|
853
885
|
}
|
|
854
886
|
return keys;
|
|
855
|
-
}, publishedTypeAt)
|
|
887
|
+
}, publishedTypeAt, (key) => {
|
|
888
|
+
if (trustSeed.noComputedKeys)
|
|
889
|
+
return false;
|
|
890
|
+
const origin = programSymbolOriginOf(key, {
|
|
891
|
+
checker,
|
|
892
|
+
isStandardLibraryDeclaration: (declaration) => declaration.getSourceFile().hasNoDefaultLib
|
|
893
|
+
});
|
|
894
|
+
if (origin === null)
|
|
895
|
+
return false;
|
|
896
|
+
computedKeyRequirements.push(...origin.requirements);
|
|
897
|
+
return true;
|
|
898
|
+
});
|
|
899
|
+
/** The names a computed read of the intrinsic global object can select, when the key set is closed and holds only names. */
|
|
900
|
+
const globalReadKeysOf = (access, owner) => {
|
|
901
|
+
if (!ts.isElementAccessExpression(access) || staticKeyOf(access) !== null || !isIntrinsicGlobalThis(owner, names))
|
|
902
|
+
return null;
|
|
903
|
+
const keyNames = [];
|
|
904
|
+
for (const key of keyReader.keysOfKeyExpression(access.argumentExpression)) {
|
|
905
|
+
if (key.kind !== 'name')
|
|
906
|
+
return null;
|
|
907
|
+
keyNames.push(key.name);
|
|
908
|
+
}
|
|
909
|
+
return keyNames.length > 0 ? keyNames : null;
|
|
910
|
+
};
|
|
911
|
+
/**
|
|
912
|
+
* `globalField('navigator')`, where `globalField(name)` returns
|
|
913
|
+
* `globalThis[name]`: the call's result is the global's `navigator` slot,
|
|
914
|
+
* not every slot every other call of the helper reads. One shared return
|
|
915
|
+
* node merges `globalField('window')` -- the global object itself -- into
|
|
916
|
+
* every caller's result, so a context-free link made each `nav.method()` a
|
|
917
|
+
* possibly-global receiver. Only the exact shape: the returned read is keyed
|
|
918
|
+
* by the callee's own never-reassigned parameter, in a module body (strict,
|
|
919
|
+
* so `arguments` cannot alias it), and this call passes a string literal.
|
|
920
|
+
*/
|
|
921
|
+
const callSiteGlobalReadKeysOf = (call, returned) => {
|
|
922
|
+
const access = unwrapErasedExpression(returned);
|
|
923
|
+
if (!ts.isElementAccessExpression(access) || staticKeyOf(access) !== null)
|
|
924
|
+
return null;
|
|
925
|
+
if (!isIntrinsicGlobalThis(unwrapErasedExpression(access.expression), names))
|
|
926
|
+
return null;
|
|
927
|
+
const key = unwrapErasedExpression(access.argumentExpression);
|
|
928
|
+
if (!ts.isIdentifier(key))
|
|
929
|
+
return null;
|
|
930
|
+
const parameter = bindingOf(key);
|
|
931
|
+
if (!parameter || !ts.isParameter(parameter) || parameter.dotDotDotToken || parameter.initializer || !ts.isIdentifier(parameter.name))
|
|
932
|
+
return null;
|
|
933
|
+
const owner = parameter.parent;
|
|
934
|
+
let enclosing = access.parent;
|
|
935
|
+
while (enclosing && !ts.isFunctionLike(enclosing))
|
|
936
|
+
enclosing = enclosing.parent;
|
|
937
|
+
if (!ts.isFunctionLike(owner) || enclosing !== owner)
|
|
938
|
+
return null;
|
|
939
|
+
if (!ts.isExternalModule(owner.getSourceFile()))
|
|
940
|
+
return null;
|
|
941
|
+
if (flow.writesToDeclaration(parameter).some((write) => write.slot === 'whole' && write.edge !== 'call-argument'))
|
|
942
|
+
return null;
|
|
943
|
+
const index = owner.parameters.indexOf(parameter);
|
|
944
|
+
if (call.arguments.slice(0, index + 1).some(ts.isSpreadElement))
|
|
945
|
+
return null;
|
|
946
|
+
const actual = call.arguments[index];
|
|
947
|
+
const literal = actual === undefined ? undefined : unwrapErasedExpression(actual);
|
|
948
|
+
return literal !== undefined && ts.isStringLiteralLike(literal) ? [literal.text] : null;
|
|
949
|
+
};
|
|
950
|
+
const linkReturnedValue = (call, returned, node) => {
|
|
951
|
+
const keys = ts.isCallExpression(call) ? callSiteGlobalReadKeysOf(call, returned) : null;
|
|
952
|
+
if (keys === null)
|
|
953
|
+
return link(valueNodeOf(returned), node);
|
|
954
|
+
const read = unwrapErasedExpression(returned);
|
|
955
|
+
for (const key of keys)
|
|
956
|
+
select(valueNodeOf(read.expression), key, node);
|
|
957
|
+
};
|
|
856
958
|
/** The keys an intrinsic mutator call writes on its target, from syntax alone. */
|
|
857
959
|
const staticMutatorKeys = (call, mutator) => {
|
|
858
960
|
if (mutator === 'Object.defineProperty' ||
|
|
@@ -902,9 +1004,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
902
1004
|
* replacement" states it as exactly `Object.keys = replacement`.
|
|
903
1005
|
*
|
|
904
1006
|
* `isIntrinsicSurface` is the wrong instrument for it: that predicate is
|
|
905
|
-
* true of every NATIVE host object as well, so
|
|
906
|
-
*
|
|
907
|
-
*
|
|
1007
|
+
* true of every NATIVE host object as well, so a library's `_ctx.<slot> = v`
|
|
1008
|
+
* on a realized native host context object set this on the first frame
|
|
1009
|
+
* that program drew. Replacing a slot on a host object says nothing about
|
|
908
1010
|
* whether `Object.keys` still answers own keys.
|
|
909
1011
|
*/
|
|
910
1012
|
let intrinsicSurfaceMemberReplaced = false;
|
|
@@ -1012,7 +1114,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1012
1114
|
if (visited.has(current))
|
|
1013
1115
|
continue;
|
|
1014
1116
|
visited.add(current);
|
|
1015
|
-
const direct = intrinsicPrototypeDeclarationOf(current);
|
|
1117
|
+
const direct = intrinsicPrototypeDeclarationOf(current) ?? intrinsicCallableDeclarationOf(current);
|
|
1016
1118
|
if (direct !== null) {
|
|
1017
1119
|
identities.add(direct);
|
|
1018
1120
|
continue;
|
|
@@ -1042,6 +1144,23 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1042
1144
|
checker.getPropertyOfType(checker.getTypeAtLocation(unwrapErasedExpression(current.expression)), 'prototype');
|
|
1043
1145
|
return symbol && hasStandardLibraryDeclaration(symbol) ? identities.symbolDeclarationId(symbol) : null;
|
|
1044
1146
|
};
|
|
1147
|
+
// A primordial method is itself a mutable Function object. Its own slots
|
|
1148
|
+
// participate in the same alias graph as the prototype/namespace that
|
|
1149
|
+
// initially owns it; Function.prototype integrity alone cannot guard them.
|
|
1150
|
+
const intrinsicCallableDeclarationOf = (expression) => {
|
|
1151
|
+
const current = unwrapErasedExpression(expression);
|
|
1152
|
+
if (!ts.isPropertyAccessExpression(current) && !ts.isElementAccessExpression(current))
|
|
1153
|
+
return null;
|
|
1154
|
+
const holder = unwrapErasedExpression(current.expression);
|
|
1155
|
+
if (intrinsicPrototypeDeclarationOf(holder) === null && constructorFactsOf(holder).size === 0)
|
|
1156
|
+
return null;
|
|
1157
|
+
const symbol = memberSymbolOf(current);
|
|
1158
|
+
if (symbol === null ||
|
|
1159
|
+
!isStandardLibrarySymbol(symbol) ||
|
|
1160
|
+
checker.getTypeOfSymbolAtLocation(symbol, current).getCallSignatures().length === 0)
|
|
1161
|
+
return null;
|
|
1162
|
+
return identities.symbolDeclarationId(symbol);
|
|
1163
|
+
};
|
|
1045
1164
|
const markIntrinsicPrototypeMutation = (target) => {
|
|
1046
1165
|
for (const id of intrinsicPrototypesOf(target))
|
|
1047
1166
|
tainted.add(id);
|
|
@@ -1053,9 +1172,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1053
1172
|
};
|
|
1054
1173
|
/**
|
|
1055
1174
|
* A write of an unknown key through a receiver only the STRUCTURAL fallback
|
|
1056
|
-
* places on an intrinsic surface --
|
|
1057
|
-
* Object.create(null)`,
|
|
1058
|
-
* the alias graph, not here. `
|
|
1175
|
+
* places on an intrinsic surface -- `obj: Record<string, unknown> =
|
|
1176
|
+
* Object.create(null)`, or a `dest: Bag` parameter -- is decided after
|
|
1177
|
+
* the alias graph, not here. `Bag`'s `[key: string]: any` accepts every
|
|
1059
1178
|
* object type, so the type test says yes for every such receiver; only the
|
|
1060
1179
|
* value's provenance can say no, and the provenance proof
|
|
1061
1180
|
* (`isFreshProgramObject` below) needs the closed caller frames and source
|
|
@@ -1069,6 +1188,16 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1069
1188
|
* clear it, and a re-run would only cost the time.
|
|
1070
1189
|
*/
|
|
1071
1190
|
const deferredSurfaceWrites = [];
|
|
1191
|
+
const deferredDescriptorTargets = new Set();
|
|
1192
|
+
const isIntrinsicAccessorGetterDescriptorCall = (call) => {
|
|
1193
|
+
let current = call;
|
|
1194
|
+
for (let depth = 0; depth < 4 && current.parent !== undefined; depth++) {
|
|
1195
|
+
current = current.parent;
|
|
1196
|
+
if (ts.isPropertyAccessExpression(current) && current.name.text === 'get')
|
|
1197
|
+
return intrinsicAccessorGetterChainOf(checker, current)?.parts.includes(call) === true;
|
|
1198
|
+
}
|
|
1199
|
+
return false;
|
|
1200
|
+
};
|
|
1072
1201
|
const invalidateForSurfaceWrite = (receiver, site) => {
|
|
1073
1202
|
if (allIntrinsicTrustInvalidated)
|
|
1074
1203
|
return;
|
|
@@ -1077,15 +1206,17 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1077
1206
|
else
|
|
1078
1207
|
deferredSurfaceWrites.push(receiver);
|
|
1079
1208
|
};
|
|
1080
|
-
/**
|
|
1081
|
-
*
|
|
1082
|
-
* symbol: the same argument `isDefinitelyProgramSymbolElementKey` makes for
|
|
1083
|
-
* `o[sym] = v`. The key names no string member and is not `__proto__`, so
|
|
1084
|
-
* whatever `o` is, it replaces no intrinsic member a static call resolves to.
|
|
1209
|
+
/** A proven stock program symbol names no string-resolved member. Its
|
|
1210
|
+
* inherited symbol interception remains visible in the program-symbol domain.
|
|
1085
1211
|
*/
|
|
1086
|
-
const isProgramSymbolKeyExpression = (expression) =>
|
|
1212
|
+
const isProgramSymbolKeyExpression = (expression) => {
|
|
1213
|
+
if (expression === undefined)
|
|
1214
|
+
return false;
|
|
1215
|
+
const keys = keyReader.keysOfKeyExpression(expression);
|
|
1216
|
+
return keys.length > 0 && keys.every((key) => key.kind === 'program-symbol');
|
|
1217
|
+
};
|
|
1087
1218
|
const markOverwrittenMember = (target, key, keyExpression) => {
|
|
1088
|
-
markIntrinsicPrototypeKeys(target, key === null ?
|
|
1219
|
+
markIntrinsicPrototypeKeys(target, key === null ? keyReader.keysOfKeyExpression(keyExpression) : [key === '__proto__' ? everyKey : namedKey(key)]);
|
|
1089
1220
|
if (key === null) {
|
|
1090
1221
|
if (!isProgramSymbolKeyExpression(keyExpression) && isIntrinsicSurface(target))
|
|
1091
1222
|
invalidateForSurfaceWrite(target, target);
|
|
@@ -1134,6 +1265,17 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1134
1265
|
!isDefinitelyNumericElementKey(node) &&
|
|
1135
1266
|
!isDefinitelyProgramSymbolElementKey(node) &&
|
|
1136
1267
|
isIntrinsicSurface(node.expression)) {
|
|
1268
|
+
const actualKeys = keyReader.keysOfAccess(node);
|
|
1269
|
+
if (actualKeys.length > 0 && actualKeys.every((key) => key.kind !== 'every')) {
|
|
1270
|
+
for (const key of actualKeys) {
|
|
1271
|
+
if (key.kind !== 'name')
|
|
1272
|
+
continue;
|
|
1273
|
+
const member = actualSymbol(checker.getPropertyOfType(checker.getTypeAtLocation(node.expression), key.name));
|
|
1274
|
+
if (member)
|
|
1275
|
+
overwrittenIntrinsicSymbols.add(member);
|
|
1276
|
+
}
|
|
1277
|
+
continue;
|
|
1278
|
+
}
|
|
1137
1279
|
const domain = ts.isElementAccessExpression(node) ? propertyKeyDomains.of(node.argumentExpression) : null;
|
|
1138
1280
|
// A prototype replacement can affect every method, regardless of its
|
|
1139
1281
|
// name. Other computed writes invalidate only the names they can reach.
|
|
@@ -1181,11 +1323,27 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1181
1323
|
const declaration = bindingOf(expression);
|
|
1182
1324
|
if (!declaration || !ts.isVariableDeclaration(declaration) || !declaration.initializer)
|
|
1183
1325
|
return null;
|
|
1184
|
-
|
|
1185
|
-
if (!ts.isVariableDeclarationList(declarationList) || (declarationList.flags & ts.NodeFlags.Const) === 0)
|
|
1326
|
+
if (trustSeed.rejectedCallableProofs.has(declaration))
|
|
1186
1327
|
return null;
|
|
1187
|
-
const
|
|
1188
|
-
|
|
1328
|
+
const proof = invocationLedger.capture(() => sourceBindingValuesOf(checker, flow, declaration));
|
|
1329
|
+
if (proof.value?.length !== 1 || proof.value[0] !== declaration.initializer)
|
|
1330
|
+
return null;
|
|
1331
|
+
retainRequirements(declaration, proof.requirements);
|
|
1332
|
+
return declaration.initializer;
|
|
1333
|
+
};
|
|
1334
|
+
const standardPrototypeMethodIsDistinct = (expression) => {
|
|
1335
|
+
const current = unwrapErasedExpression(expression);
|
|
1336
|
+
if (allIntrinsicTrustInvalidated || trustSeed.rejectedCallableProofs.has(current))
|
|
1337
|
+
return false;
|
|
1338
|
+
const method = standardPrototypeMethodSourceOf(checker, current, isStandardLibraryDeclaration);
|
|
1339
|
+
if (method === null)
|
|
1340
|
+
return false;
|
|
1341
|
+
const proof = invocationLedger.capture(() => invocationLedger.requirePrototypeKeys(method.intrinsic, { names: [method.key] }, current));
|
|
1342
|
+
if (!proof.value)
|
|
1343
|
+
return false;
|
|
1344
|
+
retainRequirements(current, proof.requirements);
|
|
1345
|
+
invocationLedger.include(proof.requirements);
|
|
1346
|
+
return true;
|
|
1189
1347
|
};
|
|
1190
1348
|
const authenticatedNativeConstructor = (expression, seen = new Set()) => {
|
|
1191
1349
|
const current = unwrapErasedExpression(expression);
|
|
@@ -1283,8 +1441,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1283
1441
|
* graph records (`AliasTerm` `proxy`). Anything else keeps the ordinary
|
|
1284
1442
|
* `new` rule: a library constructor with no body is opaque.
|
|
1285
1443
|
*
|
|
1286
|
-
*
|
|
1287
|
-
*
|
|
1444
|
+
* An optional-dependency stub is the typical case: a proxy over
|
|
1445
|
+
* `{ kModuleError }` whose `get` trap throws.
|
|
1288
1446
|
*/
|
|
1289
1447
|
const proxyConstructorSymbol = (() => {
|
|
1290
1448
|
const anchor = files[0];
|
|
@@ -1454,7 +1612,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1454
1612
|
// does there -- home-object lookup changes which body runs, never which
|
|
1455
1613
|
// object it runs on -- so every fact this walk proves from the ancestor
|
|
1456
1614
|
// chain (a real class, not a declaration file) holds for `super` exactly
|
|
1457
|
-
// as it does for `this`.
|
|
1615
|
+
// as it does for `this`. A `copy(s) { super.copy(s); ... }` override reads
|
|
1458
1616
|
// `super` as a method call's receiver; refusing it here (the ThisKeyword
|
|
1459
1617
|
// only gate this used to be) left it "opaque", which is what widened the
|
|
1460
1618
|
// final host-mutation census to `*` for the whole clone-idiom family.
|
|
@@ -1620,7 +1778,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1620
1778
|
// patch has replaced it -- the same two facts `authenticatedCallable`
|
|
1621
1779
|
// asks of an intrinsic. Without this every `fetch(url).text()` was an
|
|
1622
1780
|
// opaque method receiver, and one of them wildcarded every host global
|
|
1623
|
-
// in the program
|
|
1781
|
+
// in the program.
|
|
1624
1782
|
return (ts.isFunctionDeclaration(binding) &&
|
|
1625
1783
|
!binding.body &&
|
|
1626
1784
|
writes.length === 0 &&
|
|
@@ -1683,7 +1841,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1683
1841
|
return publishingRepresentations.get(current) ?? null;
|
|
1684
1842
|
publishingRepresentations.set(current, expected);
|
|
1685
1843
|
let result = null;
|
|
1686
|
-
if (
|
|
1844
|
+
if (standardPrototypeMethodIsDistinct(current)) {
|
|
1845
|
+
result = 'object';
|
|
1846
|
+
}
|
|
1847
|
+
else if (authenticatedIntrinsicPrototype(current)) {
|
|
1687
1848
|
result = 'object';
|
|
1688
1849
|
}
|
|
1689
1850
|
else if (standardGlobalValue(current) && !isProvenGlobalObject(current)) {
|
|
@@ -1725,8 +1886,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1725
1886
|
result = expected;
|
|
1726
1887
|
}
|
|
1727
1888
|
// MEASURED DEAD END (2026-09-15): a parameter with real callers whose
|
|
1728
|
-
// argument values do not all resolve -- `
|
|
1729
|
-
//
|
|
1889
|
+
// argument values do not all resolve -- a `material`-style parameter
|
|
1890
|
+
// forwarded many levels deep through other parameters of
|
|
1730
1891
|
// the identical shape -- cannot be trusted from `expected` alone by
|
|
1731
1892
|
// relaxing the branch above to "no resolved value disagreed". Tried
|
|
1732
1893
|
// exactly that; it broke `new NativeView()` off a REASSIGNED
|
|
@@ -1753,15 +1914,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1753
1914
|
//
|
|
1754
1915
|
// The TYPE could not answer this: `representedObjectResult` asks whether
|
|
1755
1916
|
// the type's symbol is declared by a class, and an object literal's
|
|
1756
|
-
// anonymous type is declared by the literal itself. That gap made
|
|
1757
|
-
//
|
|
1758
|
-
//
|
|
1759
|
-
//
|
|
1760
|
-
//
|
|
1761
|
-
//
|
|
1762
|
-
//
|
|
1763
|
-
//
|
|
1764
|
-
// wildcard.
|
|
1917
|
+
// anonymous type is declared by the literal itself. That gap made a whole
|
|
1918
|
+
// library written as REVEALING MODULE factories unprovable --
|
|
1919
|
+
// `function Properties() { ... return { get, remove, update, dispose } }`
|
|
1920
|
+
// -- because the `new Properties()` above reaches
|
|
1921
|
+
// `localResultIsPublished` with `localReturns = [ <the literal> ]` and
|
|
1922
|
+
// asked this function what that literal publishes. Answering `null` left
|
|
1923
|
+
// every slot holding such a record opaque, and every method call on them
|
|
1924
|
+
// owed a wildcard.
|
|
1765
1925
|
//
|
|
1766
1926
|
// Asking the EXPRESSION rather than its type is what keeps this from
|
|
1767
1927
|
// laundering an identity: a cast (`globalThis as unknown as typeof lit`)
|
|
@@ -1863,12 +2023,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1863
2023
|
// not only at `primitive`.
|
|
1864
2024
|
//
|
|
1865
2025
|
// Restricting this arm to primitives was not a rule about evidence, it
|
|
1866
|
-
// was the shape the arm happened to be written in. It cost
|
|
1867
|
-
// of
|
|
1868
|
-
// `this.position.copy( v )
|
|
1869
|
-
//
|
|
1870
|
-
//
|
|
1871
|
-
// object", and one such read taints EVERY intrinsic member query in the
|
|
2026
|
+
// was the shape the arm happened to be written in. It cost a large share
|
|
2027
|
+
// of a program's `opaque or global method receiver` wildcards: every
|
|
2028
|
+
// `this.position.copy( v )` or `shape.points.set(...)` -- receivers
|
|
2029
|
+
// typed by a program class stored in a field -- read as "this might be
|
|
2030
|
+
// the global object", and one such read taints EVERY intrinsic member query in the
|
|
1872
2031
|
// program, which is what makes `Object.keys` fail authentication in a
|
|
1873
2032
|
// program that never touches `Object.prototype`.
|
|
1874
2033
|
result = expected;
|
|
@@ -2104,6 +2263,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2104
2263
|
if (!isIntrinsicSurface(target) && !standardGlobalValue(target))
|
|
2105
2264
|
return;
|
|
2106
2265
|
if (key === null) {
|
|
2266
|
+
const actualKeys = keyExpression === undefined ? [] : keyReader.keysOfKeyExpression(keyExpression);
|
|
2267
|
+
if (actualKeys.length > 0 && actualKeys.every((one) => one.kind !== 'every')) {
|
|
2268
|
+
markIntrinsicPrototypeKeys(target, actualKeys);
|
|
2269
|
+
for (const actual of actualKeys)
|
|
2270
|
+
if (actual.kind === 'name')
|
|
2271
|
+
markOverwrittenMember(target, actual.name);
|
|
2272
|
+
return;
|
|
2273
|
+
}
|
|
2107
2274
|
if (standardGlobalValue(target))
|
|
2108
2275
|
invalidateAllIntrinsicTrust(target);
|
|
2109
2276
|
else if (!isProgramSymbolKeyExpression(keyExpression))
|
|
@@ -2308,10 +2475,6 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2308
2475
|
const callDeclarationAt = (call) => overwrittenCalls.has(call) ? undefined : (reachableCallOfNode.get(call)?.declaration ?? checker.getResolvedSignature(call)?.declaration);
|
|
2309
2476
|
// Receiver, parameter and stored-call closure must consume the same proof
|
|
2310
2477
|
// context. A private named-function-only enumeration loses stored methods.
|
|
2311
|
-
const invocationRequirements = new Map();
|
|
2312
|
-
const invocationLedger = deferredIntrinsicProtocolLedgerOf(flow) ?? createDeferredIntrinsicProtocolLedger();
|
|
2313
|
-
if (!deferredIntrinsicProtocolLedgerOf(flow))
|
|
2314
|
-
attachDeferredIntrinsicProtocolLedger(flow, invocationLedger);
|
|
2315
2478
|
const callableFrames = closedCallableAuthorityOf(checker, flow, publishedTypeAt, (owner) => argumentsUsesByOwner.get(owner), (call) => {
|
|
2316
2479
|
if (!isAuthenticatedInvocationWrapper(call))
|
|
2317
2480
|
return false;
|
|
@@ -2324,6 +2487,15 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2324
2487
|
const sourceInvocationFacts = new Map();
|
|
2325
2488
|
const sourceFrameOwnedCalls = new Set();
|
|
2326
2489
|
const refusedSourceInvocationCalls = new Set();
|
|
2490
|
+
const sourceJointInvocationIsClosed = (call) => {
|
|
2491
|
+
const fact = sourceInvocationFacts.get(call);
|
|
2492
|
+
return (sourceJointInvocationCalls.has(call) &&
|
|
2493
|
+
fact !== undefined &&
|
|
2494
|
+
!trustSeed.rejectedCallableProofs.has(call) &&
|
|
2495
|
+
!incompleteSourceInvocationCalls.has(call) &&
|
|
2496
|
+
!refusedSourceInvocationCalls.has(call) &&
|
|
2497
|
+
sourceInvocationFactHasJointTargets(flow, fact));
|
|
2498
|
+
};
|
|
2327
2499
|
/**
|
|
2328
2500
|
* Source-owned calls whose EVERY candidate callee is a body compiled here.
|
|
2329
2501
|
*
|
|
@@ -2334,10 +2506,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2334
2506
|
* wildcard is owed only where the callee may be EXTERNAL (an ambient host
|
|
2335
2507
|
* function, a replaced intrinsic, a value this program never allocated),
|
|
2336
2508
|
* because external code is not walked and could write any key on anything
|
|
2337
|
-
* it is handed. Refusing to tell those two apart is what made
|
|
2338
|
-
* source invocations
|
|
2339
|
-
*
|
|
2340
|
-
*
|
|
2509
|
+
* it is handed. Refusing to tell those two apart is what made hundreds of
|
|
2510
|
+
* refused source invocations -- `properties.remove( item )` and its kin --
|
|
2511
|
+
* file `*` for the whole program, which in turn refused every
|
|
2512
|
+
* `Object.prototype` key obligation and blocked the certificate.
|
|
2341
2513
|
*
|
|
2342
2514
|
* `every`, not `some`: one ambient candidate is a possible external callee
|
|
2343
2515
|
* and the wildcard is owed again. Candidates are the checker's and the
|
|
@@ -2400,21 +2572,21 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2400
2572
|
declaration.body !== undefined;
|
|
2401
2573
|
// A body is only what this call reaches while nothing can put a
|
|
2402
2574
|
// different callable in its place: the member slot that holds it, and
|
|
2403
|
-
// the class binding the slot belongs to, must be unwritten.
|
|
2575
|
+
// the class binding the slot belongs to, must be unwritten. The
|
|
2404
2576
|
// `Writer.prototype.write = external` and `Light = opaque()` are
|
|
2405
2577
|
// exactly these two replacements, and both make the callee external
|
|
2406
2578
|
// again (`global-this-host-bindings.test.ts` states both).
|
|
2407
2579
|
const selectionIsIntact = (declaration) => {
|
|
2408
2580
|
// Only a WHOLE-cell write replaces what a cell holds. A write to a
|
|
2409
|
-
// member of it does not: `
|
|
2581
|
+
// member of it does not: `Node.DEFAULT_AXIS = new Point()` is a
|
|
2410
2582
|
// static field on the class, and counting it made every
|
|
2411
|
-
// `this.
|
|
2412
|
-
//
|
|
2583
|
+
// `this.root.add( ... )` and `super.copy( ... )` on that class
|
|
2584
|
+
// read as a call through a replaceable callable.
|
|
2413
2585
|
// `isIntrinsicSurface` above already filters writes the same way.
|
|
2414
2586
|
//
|
|
2415
2587
|
// A slot's OWN defining write does not replace what it holds either.
|
|
2416
|
-
// `Foo.prototype.bar = function () { ... }` --
|
|
2417
|
-
//
|
|
2588
|
+
// `Foo.prototype.bar = function () { ... }` -- the whole pre-class
|
|
2589
|
+
// library idiom -- writes the slot exactly once, with this very callable;
|
|
2418
2590
|
// counting that write refused the call for being replaceable by
|
|
2419
2591
|
// itself. A second write, with anything else, still refuses.
|
|
2420
2592
|
const replaced = (node) => flow
|
|
@@ -2456,14 +2628,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2456
2628
|
const selected = site.checkerDeclaration;
|
|
2457
2629
|
const candidates = [selected, ...site.targets];
|
|
2458
2630
|
// The checker cannot always NAME a declaration, and its silence is not a
|
|
2459
|
-
// statement that the callee is open.
|
|
2460
|
-
// `function
|
|
2461
|
-
// get, ... } }`, then `properties.get(
|
|
2462
|
-
// `new
|
|
2631
|
+
// statement that the callee is open. The factory-record idiom --
|
|
2632
|
+
// `function Properties() { function get( o ) { ... }; return { has,
|
|
2633
|
+
// get, ... } }`, then `properties.get( item )` -- types
|
|
2634
|
+
// `new Properties()` as `any`, because TS only infers a constructed
|
|
2463
2635
|
// type from a `this.x = ...` body. `getResolvedSignature` names no
|
|
2464
|
-
// declaration for ANY call on that record, so this whole family (
|
|
2465
|
-
//
|
|
2466
|
-
// `no-checker-declaration`.
|
|
2636
|
+
// declaration for ANY call on that record, so this whole family (most
|
|
2637
|
+
// of a program's wildcard sites, where the idiom is pervasive) reached
|
|
2638
|
+
// the census as `no-checker-declaration`.
|
|
2467
2639
|
//
|
|
2468
2640
|
// `callable-reach.ts` already proves these closed from the ALLOCATION
|
|
2469
2641
|
// rather than from the checker's type: the record literal is reached from
|
|
@@ -2472,8 +2644,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2472
2644
|
// selection -- it refuses when the slot is replaced or the allocation
|
|
2473
2645
|
// merges with anything opaque -- so it admits the call on its own.
|
|
2474
2646
|
// `selectionIsIntact` is also a reason to ASK the allocation proof, not only
|
|
2475
|
-
// a missing body: `
|
|
2476
|
-
// `
|
|
2647
|
+
// a missing body: `node.onBeforeDraw( ... )` names a compiled
|
|
2648
|
+
// `Node.prototype.onBeforeDraw`, but its slot is written elsewhere, so
|
|
2477
2649
|
// the checker's pick alone is not what this call reaches. The allocation
|
|
2478
2650
|
// proof answers the stronger question -- every value the slot can hold is a
|
|
2479
2651
|
// body compiled here -- so a replaced-but-closed slot still admits.
|
|
@@ -2507,8 +2679,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2507
2679
|
// `[PB-REJECT]` line even though the authority had refused it and it
|
|
2508
2680
|
// never entered `programBodyOnlyCalls`. That is the whole of the
|
|
2509
2681
|
// `admitted=842 set=281` gap, and it is why every ranking taken off
|
|
2510
|
-
// this channel pointed at ambient builtins: on
|
|
2511
|
-
// the
|
|
2682
|
+
// this channel pointed at ambient builtins: on one server program most
|
|
2683
|
+
// of the asking sites were in this bucket and NONE of them appeared
|
|
2512
2684
|
// in the rejection list -- `this.emit( 'error', e )` 39,
|
|
2513
2685
|
// `outgoing.writeHead` 9, `incoming.on`/`off`, `super.on`/`once`/
|
|
2514
2686
|
// `emit`, `this.push`. Ranked wrong, they sent two sessions after the
|
|
@@ -2537,7 +2709,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2537
2709
|
if (why !== 'admitted') {
|
|
2538
2710
|
const file = site.call.getSourceFile();
|
|
2539
2711
|
const position = file.getLineAndCharacterOfPosition(site.call.getStart(file));
|
|
2540
|
-
const where = `${file.fileName
|
|
2712
|
+
const where = `${displayPath(file.fileName)}:${position.line + 1}`;
|
|
2541
2713
|
programBodyRejections.push(`${why} :: ${where} ${site.call.getText(file).slice(0, 80).replace(/\s+/g, ' ')}`);
|
|
2542
2714
|
}
|
|
2543
2715
|
}
|
|
@@ -2576,7 +2748,22 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2576
2748
|
continue;
|
|
2577
2749
|
}
|
|
2578
2750
|
}
|
|
2579
|
-
const frameFact = ts.isCallExpression(site.call) && !
|
|
2751
|
+
const frameFact = ts.isCallExpression(site.call) && invocationFact !== null && !invocationFact.operands.explicitThis ? invocationFact : null;
|
|
2752
|
+
if (frameFact !== null && frameFact.frames.every(frameForwardingIsModelled)) {
|
|
2753
|
+
if (sourceInvocationFactHasJointTargets(flow, frameFact))
|
|
2754
|
+
sourceJointInvocationCalls.add(frameFact.call);
|
|
2755
|
+
const proof = invocationLedger.capture(() => sourceIntrinsicMemberInvocationOf(checker, flow, frameFact));
|
|
2756
|
+
if (proof.value !== null) {
|
|
2757
|
+
sourceIntrinsicReplacementCalls.add(frameFact.call);
|
|
2758
|
+
sourceIntrinsicInstallations.add(proof.value.installation);
|
|
2759
|
+
invocationRequirements.set(frameFact.call, [...(invocationRequirements.get(frameFact.call) ?? []), ...proof.requirements]);
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
if (frameFact !== null &&
|
|
2763
|
+
frameFact.operands !== site.operands &&
|
|
2764
|
+
frameFact.frames.length > 0 &&
|
|
2765
|
+
frameFact.frames.every(frameForwardingIsModelled))
|
|
2766
|
+
programBodyOnlyCalls.add(site.call);
|
|
2580
2767
|
if (frameFact !== null) {
|
|
2581
2768
|
sourceFrameOwnedCalls.add(site.call);
|
|
2582
2769
|
if (frameFact.frames.some((frame) => !frameForwardingIsModelled(frame)))
|
|
@@ -2605,16 +2792,17 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2605
2792
|
overwrittenCalls.add(site.call);
|
|
2606
2793
|
continue;
|
|
2607
2794
|
}
|
|
2608
|
-
const
|
|
2609
|
-
const
|
|
2610
|
-
const
|
|
2795
|
+
const actualOperands = frameFact?.operands ?? site.operands;
|
|
2796
|
+
const argumentsArray = actualOperands.args;
|
|
2797
|
+
const callable = actualOperands.callee;
|
|
2798
|
+
const thisArgument = actualOperands.receiver;
|
|
2611
2799
|
const reachableCall = {
|
|
2612
2800
|
call: site.call,
|
|
2613
2801
|
declaration,
|
|
2614
2802
|
callable,
|
|
2615
2803
|
arguments: argumentsArray,
|
|
2616
2804
|
thisArgument,
|
|
2617
|
-
explicitThis: site.explicitThis,
|
|
2805
|
+
explicitThis: actualOperands.explicitThis ? site.explicitThis : null,
|
|
2618
2806
|
frame
|
|
2619
2807
|
};
|
|
2620
2808
|
reachableCalls.push(reachableCall);
|
|
@@ -2695,8 +2883,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2695
2883
|
* sites -- `enumeratedThisReceiversOf`'s own question, asked of an argument
|
|
2696
2884
|
* instead of a receiver. A parameter nobody reassigns is not "no
|
|
2697
2885
|
* information": `writesOf` only sees body-local writes, and an unannotated
|
|
2698
|
-
* module-private helper (
|
|
2699
|
-
*
|
|
2886
|
+
* module-private helper (`drawItem( item, view, style, group )`) is never
|
|
2887
|
+
* reassigned yet is called from
|
|
2700
2888
|
* every one of its own call sites with a real, known value. Filing that as
|
|
2701
2889
|
* "no evidence" and sealing to `OPAQUE_UNKNOWN` is the fail-open half of
|
|
2702
2890
|
* `containsGlobal` this proof closes: `callableFrames.parameterValuesOf`
|
|
@@ -2711,11 +2899,16 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2711
2899
|
if (!isRealCallableDeclaration(owner) || trustSeed.rejectedCallableProofs.has(owner))
|
|
2712
2900
|
return null;
|
|
2713
2901
|
try {
|
|
2902
|
+
const executing = invocationLedger.capture(() => sourceExecutingParameterValuesOf(checker, flow, parameter));
|
|
2903
|
+
if (executing.value !== null) {
|
|
2904
|
+
retainRequirements(owner, executing.requirements);
|
|
2905
|
+
return executing.value;
|
|
2906
|
+
}
|
|
2714
2907
|
// `callableFrames.parameterValuesOf` is a live, actively-edited proof
|
|
2715
2908
|
// (`flow/callable-reach.ts`'s `closedCallerSitesUncached` /
|
|
2716
2909
|
// `baseMemberOf`); measured against a bare `new`-invoked JS constructor
|
|
2717
|
-
// function with nested function-declaration helpers --
|
|
2718
|
-
//
|
|
2910
|
+
// function with nested function-declaration helpers -- the pre-class
|
|
2911
|
+
// library constructor shape -- it can throw rather than return `null`
|
|
2719
2912
|
// (`checker.getBaseTypes` on a non-class constructor type). A caller
|
|
2720
2913
|
// proof this file cannot evaluate is exactly the "cannot be closed"
|
|
2721
2914
|
// case the soundness rule already names: catch it and fail CLOSED,
|
|
@@ -2724,7 +2917,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2724
2917
|
// this fix existed.
|
|
2725
2918
|
const proof = invocationLedger.capture(() => callableFrames.parameterValuesOf(parameter));
|
|
2726
2919
|
if (proof.value !== null)
|
|
2727
|
-
|
|
2920
|
+
retainRequirements(owner, proof.requirements);
|
|
2728
2921
|
return proof.value;
|
|
2729
2922
|
}
|
|
2730
2923
|
catch {
|
|
@@ -3444,8 +3637,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3444
3637
|
visited.add(declaration);
|
|
3445
3638
|
if (declaration.getSourceFile().isDeclarationFile)
|
|
3446
3639
|
return false;
|
|
3447
|
-
// A pre-class constructor FUNCTION --
|
|
3448
|
-
// `function
|
|
3640
|
+
// A pre-class constructor FUNCTION -- `function Renderer()`,
|
|
3641
|
+
// `function Textures()` -- has no implicit base call at all: any
|
|
3449
3642
|
// `Base.call( this )` in its body is an ordinary call, not a completion
|
|
3450
3643
|
// this construction takes its value from. So there is no chain to walk,
|
|
3451
3644
|
// and the only escape is the function's own `return someObject`, which
|
|
@@ -3493,8 +3686,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3493
3686
|
const sourceFact = ts.isCallExpression(current) && sourceFrameOwnedCalls.has(current) ? sourceInvocationFacts.get(current) : undefined;
|
|
3494
3687
|
if (sourceFact) {
|
|
3495
3688
|
for (const frame of sourceFact.frames) {
|
|
3496
|
-
for (const returned of
|
|
3497
|
-
|
|
3689
|
+
for (const returned of frame.completionSummary.values)
|
|
3690
|
+
linkReturnedValue(current, returned, node);
|
|
3691
|
+
for (const yielded of frame.completionSummary.yields)
|
|
3692
|
+
link(valueNodeOf(yielded), node);
|
|
3498
3693
|
}
|
|
3499
3694
|
}
|
|
3500
3695
|
else {
|
|
@@ -3505,7 +3700,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3505
3700
|
if (!flow.callableBodyIsIndexed(declaration))
|
|
3506
3701
|
node.seeds.add(opaqueTerm);
|
|
3507
3702
|
for (const returned of observableCompletionValuesOf(declaration))
|
|
3508
|
-
|
|
3703
|
+
linkReturnedValue(current, returned, node);
|
|
3509
3704
|
}
|
|
3510
3705
|
}
|
|
3511
3706
|
}
|
|
@@ -3552,7 +3747,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3552
3747
|
const owner = unwrapErasedExpression(current.expression);
|
|
3553
3748
|
const argumentsStorage = ts.isIdentifier(owner) ? argumentsStorageOfExpression.get(owner) : undefined;
|
|
3554
3749
|
const declaration = isIntrinsicGlobalThis(owner, names) || !ts.isIdentifier(owner) ? null : (argumentsStorage ?? bindingOf(owner));
|
|
3555
|
-
|
|
3750
|
+
// `globalThis[name]` under a closed key set reads exactly those keys --
|
|
3751
|
+
// a `globalField('navigator')`-style helper. An unknown key set still
|
|
3752
|
+
// selects every key, the global object itself among them.
|
|
3753
|
+
const keys = declaration === null ? globalReadKeysOf(current, owner) : null;
|
|
3754
|
+
if (keys !== null)
|
|
3755
|
+
for (const key of keys)
|
|
3756
|
+
select(valueNodeOf(current.expression), key, node);
|
|
3757
|
+
else if (declaration === null)
|
|
3556
3758
|
select(valueNodeOf(current.expression), staticKeyOf(current), node);
|
|
3557
3759
|
else
|
|
3558
3760
|
link(storageSelectionNodeOf(declaration, staticKeyOf(current)), node);
|
|
@@ -3576,7 +3778,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3576
3778
|
// completes normally: the backend throws `MODULE_NOT_FOUND` in its place
|
|
3577
3779
|
// (`gea::commonjs::absentPackage`). It hands its binding no value at all,
|
|
3578
3780
|
// so it contributes no origin -- the `catch` arm's value is the only one
|
|
3579
|
-
//
|
|
3781
|
+
// a `try { return require( 'optional-peer' ) } catch { ... }` loader
|
|
3782
|
+
// can return.
|
|
3580
3783
|
if (staticCommonJsRequireOutcomeOf(current) === 'absent-package')
|
|
3581
3784
|
return;
|
|
3582
3785
|
const call = reachableCallOfNode.get(current);
|
|
@@ -3600,13 +3803,13 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3600
3803
|
for (const frame of frames)
|
|
3601
3804
|
if (frame.completions.kind === 'values')
|
|
3602
3805
|
for (const value of frame.completions.values)
|
|
3603
|
-
|
|
3806
|
+
linkReturnedValue(current, value, node);
|
|
3604
3807
|
return;
|
|
3605
3808
|
}
|
|
3606
3809
|
node.seeds.add(representedNonGlobalTerm);
|
|
3607
3810
|
if (representation === 'object' && declaration && !declaration.getSourceFile().isDeclarationFile && body) {
|
|
3608
3811
|
for (const returned of observableCompletionValuesOf(declaration))
|
|
3609
|
-
|
|
3812
|
+
linkReturnedValue(current, returned, node);
|
|
3610
3813
|
}
|
|
3611
3814
|
}
|
|
3612
3815
|
else if (!declaration || declaration.getSourceFile().isDeclarationFile || !body || !flow.callableBodyIsIndexed(declaration)) {
|
|
@@ -3625,7 +3828,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3625
3828
|
link(valueNodeOf(call.thisArgument), valueNodeOf(thisExpression));
|
|
3626
3829
|
}
|
|
3627
3830
|
for (const returned of observableCompletionValuesOf(declaration))
|
|
3628
|
-
|
|
3831
|
+
linkReturnedValue(current, returned, node);
|
|
3629
3832
|
}
|
|
3630
3833
|
return;
|
|
3631
3834
|
}
|
|
@@ -3656,7 +3859,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3656
3859
|
// body, which `observableCompletionValuesOf` enumerates and links, and
|
|
3657
3860
|
// a base whose construction returns, which `sourceConstructionReturnsOf`
|
|
3658
3861
|
// handled above. Seeding `opaque` here instead made every unrepresented
|
|
3659
|
-
//
|
|
3862
|
+
// library instance -- every `new Point()`, every `new Node()` --
|
|
3660
3863
|
// a value that might be `globalThis`, so every method call on one and
|
|
3661
3864
|
// every key written through one taints the intrinsic surface.
|
|
3662
3865
|
else
|
|
@@ -3701,7 +3904,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3701
3904
|
const receivers = enumeratedThisReceiversOf(current);
|
|
3702
3905
|
if (receivers === null) {
|
|
3703
3906
|
// No enumerated caller means this `this` reaches here through a
|
|
3704
|
-
// dispatch the census cannot trace -- exactly
|
|
3907
|
+
// dispatch the census cannot trace -- exactly the
|
|
3705
3908
|
// `Object.defineProperty(requestPrototype, 'body', { get() { return
|
|
3706
3909
|
// this[...] } })` shape, where the getter is installed dynamically
|
|
3707
3910
|
// and never appears as a resolvable call target. The checker types
|
|
@@ -3892,7 +4095,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3892
4095
|
shown++;
|
|
3893
4096
|
const file = declaration.getSourceFile();
|
|
3894
4097
|
const { line, character } = file.getLineAndCharacterOfPosition(declaration.getStart(file));
|
|
3895
|
-
process.stderr.write(` storage decl :: ${file.fileName
|
|
4098
|
+
process.stderr.write(` storage decl :: ${displayPath(file.fileName)}:${line + 1}:${character + 1} ${ts.SyntaxKind[declaration.kind]} ${declaration.getText(file).slice(0, 70).replace(/\s+/g, ' ')}\n`);
|
|
3896
4099
|
}
|
|
3897
4100
|
process.stderr.write(` total storage declarations mapping to biggest component: ${total} of ${storageValueNodes.size}\n`);
|
|
3898
4101
|
}
|
|
@@ -3916,7 +4119,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3916
4119
|
if (node.expression) {
|
|
3917
4120
|
const file = node.expression.getSourceFile();
|
|
3918
4121
|
const { line, character } = file.getLineAndCharacterOfPosition(node.expression.getStart(file));
|
|
3919
|
-
return `${file.fileName
|
|
4122
|
+
return `${displayPath(file.fileName)}:${line + 1}:${character + 1} ${node.expression.getText(file).slice(0, 80)}`;
|
|
3920
4123
|
}
|
|
3921
4124
|
}
|
|
3922
4125
|
return `<synthetic component ${component.id}>`;
|
|
@@ -3943,7 +4146,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3943
4146
|
for (const [declaration, count] of topWalks) {
|
|
3944
4147
|
const file = declaration.getSourceFile();
|
|
3945
4148
|
const { line, character } = file.getLineAndCharacterOfPosition(declaration.getStart(file));
|
|
3946
|
-
process.stderr.write(` fn-walk count=${count} :: ${file.fileName
|
|
4149
|
+
process.stderr.write(` fn-walk count=${count} :: ${displayPath(file.fileName)}:${line + 1}:${character + 1} ${declaration.getText(file).slice(0, 60).replace(/\s+/g, ' ')}\n`);
|
|
3947
4150
|
}
|
|
3948
4151
|
};
|
|
3949
4152
|
const componentOfExpression = (expression) => {
|
|
@@ -4272,7 +4475,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4272
4475
|
// A rest whose own source component carries this same term re-enters
|
|
4273
4476
|
// this rule with a strictly larger key every round: `k -> k + offset`
|
|
4274
4477
|
// never repeats, so `addSelector`'s (source, key, mode) dedup can
|
|
4275
|
-
// never fire and the key space grows without bound -- one
|
|
4478
|
+
// never fire and the key space grows without bound -- one library
|
|
4276
4479
|
// component minted millions of selectors this way, all naming the
|
|
4277
4480
|
// same target, until the V8 Map hit its 2^24 cap. The unknown-key
|
|
4278
4481
|
// selector is the terminating answer: it matches EVERY key, so it
|
|
@@ -4390,11 +4593,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4390
4593
|
* the value came from. It says nothing about what the value is, so on its
|
|
4391
4594
|
* own it reads `header.slice(...)` -- `header: string` -- as a call that
|
|
4392
4595
|
* might be running host code off the global object, and files a wildcard
|
|
4393
|
-
* over every authenticated global for it. On
|
|
4394
|
-
* the wildcard:
|
|
4395
|
-
*
|
|
4396
|
-
*
|
|
4397
|
-
*
|
|
4596
|
+
* over every authenticated global for it. On a typical server program that
|
|
4597
|
+
* is most of the wildcard: the receivers reaching here are typed `string`,
|
|
4598
|
+
* `string[]`, `RegExp`, `Buffer`, `Promise<void>`, `Record<string, string>`
|
|
4599
|
+
* and the library's own generic classes -- none of which the global object
|
|
4600
|
+
* inhabits.
|
|
4398
4601
|
*
|
|
4399
4602
|
* So ask the checker its own question: is the intrinsic global type
|
|
4400
4603
|
* assignable to this expression's type? Where it is not, the value is not
|
|
@@ -4453,11 +4656,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4453
4656
|
* those, the global object is never a value anything holds -- and then an
|
|
4454
4657
|
* unplaced value has nothing global to have come from.
|
|
4455
4658
|
*
|
|
4456
|
-
* This is
|
|
4457
|
-
* `const global = globalThis as any
|
|
4458
|
-
* `
|
|
4459
|
-
*
|
|
4460
|
-
* binds the members and not the object. The assertion to `any` is why the
|
|
4659
|
+
* This is the common library pattern for runtime detection:
|
|
4660
|
+
* `const global = globalThis as any`, read only as `global?.process?.env`,
|
|
4661
|
+
* and `const { process, Deno } = globalThis as any`, which binds the
|
|
4662
|
+
* members and not the object. The assertion to `any` is why the
|
|
4461
4663
|
* type question cannot settle these: `globalObjectMayInhabit` has to keep
|
|
4462
4664
|
* answering yes for a top type. The escape question settles them instead.
|
|
4463
4665
|
*
|
|
@@ -4488,8 +4690,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4488
4690
|
if (ts.isExpressionStatement(parent))
|
|
4489
4691
|
return true;
|
|
4490
4692
|
// The TARGET of a direct reflection mutator -- `Object.defineProperty(
|
|
4491
|
-
// globalThis, 'Request', { value })`, which is how
|
|
4492
|
-
// installs
|
|
4693
|
+
// globalThis, 'Request', { value })`, which is how a server adapter
|
|
4694
|
+
// installs a lightweight Request/Response -- does not hand the object
|
|
4493
4695
|
// to code this census cannot see: the mutator branch in `visit` reads
|
|
4494
4696
|
// exactly that call, stamps its keys on the target and files them through
|
|
4495
4697
|
// `taintMutationKeys`, so its effect is modelled where it is spelled. What
|
|
@@ -4497,7 +4699,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4497
4699
|
// expression is the global object in whatever position IT occupies, and
|
|
4498
4700
|
// the answer is that position's. Counting the argument as an escape made
|
|
4499
4701
|
// every unplaced argument in the program a possible global (`error`,
|
|
4500
|
-
// `chunk`, `name`) and stamped
|
|
4702
|
+
// `chunk`, `name`) and stamped a wildcard at each one.
|
|
4501
4703
|
if (ts.isCallExpression(parent) && parent.arguments[0] === node && directMutator(parent.expression) !== null) {
|
|
4502
4704
|
return benignGlobalPosition(parent, seen);
|
|
4503
4705
|
}
|
|
@@ -4615,8 +4817,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4615
4817
|
// Buffer` name -- names a binding without reading or evaluating it:
|
|
4616
4818
|
// no value flows, so nothing escapes. `isProvenGlobalObject` resolves
|
|
4617
4819
|
// the same symbol and type here as it would at a real reference, and
|
|
4618
|
-
// without this guard it answered every one of
|
|
4619
|
-
//
|
|
4820
|
+
// without this guard it answered every one of a host's global and
|
|
4821
|
+
// buffer declaration files' ambient declarations for `Buffer`/`process` as a
|
|
4620
4822
|
// "may be globalThis" ESCAPE -- not because any code ever handed the
|
|
4621
4823
|
// global object anywhere, but because declaring the binding's name
|
|
4622
4824
|
// was mistaken for reading it. That false escape made this
|
|
@@ -4644,8 +4846,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4644
4846
|
}
|
|
4645
4847
|
// A mention inside a TYPE never runs: `typeof globalThis.Response` and
|
|
4646
4848
|
// `globalThis.Buffer` in a type query name the global object to spell a
|
|
4647
|
-
// type, and no value flows.
|
|
4648
|
-
// in those, and
|
|
4849
|
+
// type, and no value flows. A host's global script may be written almost entirely
|
|
4850
|
+
// in those, and library `Response`/`WebSocket` declarations often are too.
|
|
4649
4851
|
if (insideTypeContext(node))
|
|
4650
4852
|
continue;
|
|
4651
4853
|
if (isProvenGlobalObject(node) && !benignGlobalPosition(node, new Set())) {
|
|
@@ -4816,18 +5018,12 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4816
5018
|
return false;
|
|
4817
5019
|
if (incompleteSourceInvocationCalls.has(call) || refusedSourceInvocationCalls.has(call))
|
|
4818
5020
|
return false;
|
|
4819
|
-
//
|
|
4820
|
-
//
|
|
4821
|
-
//
|
|
4822
|
-
//
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
// call closed by this proof kept its authenticated effect even after
|
|
4826
|
-
// reflection broke, so `owner.run(globalThis)` stayed trusted after
|
|
4827
|
-
// `Object.keys = replacement` (`global-this-host-bindings.test.ts`:
|
|
4828
|
-
// "own-key reflection dependencies revoke source slot closure after
|
|
4829
|
-
// method replacement").
|
|
4830
|
-
return sourceInvocationFacts.has(call) && intrinsicReflectionIsIntact();
|
|
5021
|
+
// Legacy checker selection depends on intact reflection. Exact joint
|
|
5022
|
+
// source targets have their own allocation, writer and frame closure;
|
|
5023
|
+
// their registered receipt and final ledger discharge survive an unrelated
|
|
5024
|
+
// intrinsic member replacement without licensing a stale checker body.
|
|
5025
|
+
return (sourceInvocationFacts.has(call) &&
|
|
5026
|
+
(intrinsicReflectionIsIntact() || sourceIntrinsicReplacementCalls.has(call) || sourceJointInvocationIsClosed(call)));
|
|
4831
5027
|
};
|
|
4832
5028
|
const callHasAuthenticatedExternalEffect = (call) => {
|
|
4833
5029
|
if (ts.isCallExpression(call) && (refusedSourceInvocationCalls.has(call) || incompleteSourceInvocationCalls.has(call)))
|
|
@@ -4998,6 +5194,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4998
5194
|
markWildcard(site, unknownReason);
|
|
4999
5195
|
return;
|
|
5000
5196
|
}
|
|
5197
|
+
if (key.kind === 'program-symbol')
|
|
5198
|
+
return;
|
|
5001
5199
|
for (const name of key.kind === 'numeric' ? ['NaN', 'Infinity'] : [key.name]) {
|
|
5002
5200
|
noteWritten(namedKey(name));
|
|
5003
5201
|
for (const id of globalBindingsNamed(name, site))
|
|
@@ -5021,19 +5219,19 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5021
5219
|
return;
|
|
5022
5220
|
}
|
|
5023
5221
|
if (process.env['GEA_DEBUG_GLOBAL_MUTATION'] === 'keys') {
|
|
5024
|
-
debugSite(site, `${reason} [key ${key.kind === 'name' ? key.name : '<numeric>'}]`);
|
|
5222
|
+
debugSite(site, `${reason} [key ${key.kind === 'name' ? key.name : key.kind === 'numeric' ? '<numeric>' : '<program-symbol>'}]`);
|
|
5025
5223
|
}
|
|
5026
5224
|
if (process.env['GEA_PROGRAM_BODY_DEBUG']) {
|
|
5027
5225
|
// A numeric key is a failure clause of its own (`surface:|numeric`), so it
|
|
5028
5226
|
// needs an origin row too; it is spelled the way the clause names it.
|
|
5029
|
-
const name = key.kind === 'name' ? key.name : '|numeric';
|
|
5227
|
+
const name = key.kind === 'name' ? key.name : key.kind === 'numeric' ? '|numeric' : '|program-symbols';
|
|
5030
5228
|
const seen = surfaceKeyOrigins.get(name);
|
|
5031
5229
|
if (seen)
|
|
5032
5230
|
seen.count++;
|
|
5033
5231
|
else {
|
|
5034
5232
|
const file = site.getSourceFile();
|
|
5035
5233
|
const position = file.getLineAndCharacterOfPosition(site.getStart(file));
|
|
5036
|
-
const where = `${file.fileName
|
|
5234
|
+
const where = `${displayPath(file.fileName)}:${position.line + 1}`;
|
|
5037
5235
|
surfaceKeyOrigins.set(name, { count: 1, site: `${where} ${site.getText(file).slice(0, 70).replace(/\s+/g, ' ')}` });
|
|
5038
5236
|
}
|
|
5039
5237
|
}
|
|
@@ -5103,7 +5301,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5103
5301
|
// A checker-selected body is a possible target, not a closed target set.
|
|
5104
5302
|
// Source invocations use the shared proof, including its revocations.
|
|
5105
5303
|
// A call whose callee cell only ever holds `null`/`undefined` throws
|
|
5106
|
-
// before any body runs (
|
|
5304
|
+
// before any body runs (an unset `item.onUpdate( item )` hook): nothing
|
|
5107
5305
|
// receives the arguments, so there is no callee to authenticate.
|
|
5108
5306
|
const asks = directMutator(node.expression) === null &&
|
|
5109
5307
|
(isUntrustedMutator(node.expression) || !callHasAuthenticatedExternalEffect(node)) &&
|
|
@@ -5129,10 +5327,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5129
5327
|
* `Array.prototype` to a callee this census cannot name is itself a possible
|
|
5130
5328
|
* mutation of that prototype. What it stamped was `every`: any key at all.
|
|
5131
5329
|
* That is the right answer for ONE kind of callee and far too strong for the
|
|
5132
|
-
* other, and on
|
|
5133
|
-
* `GEA_NO_WILDCARD=1` cleared both remaining roots and left
|
|
5134
|
-
* blocking anything, so every obligation that program failed,
|
|
5135
|
-
* `every` and on nothing else.
|
|
5330
|
+
* other, and on a real server program the difference was the whole
|
|
5331
|
+
* certificate -- `GEA_NO_WILDCARD=1` cleared both remaining roots and left
|
|
5332
|
+
* ZERO named key blocking anything, so every obligation that program failed,
|
|
5333
|
+
* failed on this `every` and on nothing else.
|
|
5136
5334
|
*
|
|
5137
5335
|
* The argument. Every callee is either a body this compiler compiled or a
|
|
5138
5336
|
* host native behind a bodiless declaration. A COMPILED body's writes are
|
|
@@ -5186,8 +5384,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5186
5384
|
/**
|
|
5187
5385
|
* A reflection mutator with an unplaceable target was a THIRD whole-program
|
|
5188
5386
|
* veto on the narrowing, and it was wrong: it double-counted an event the
|
|
5189
|
-
* census already models exactly, and on
|
|
5190
|
-
*
|
|
5387
|
+
* census already models exactly, and on a real server program it alone
|
|
5388
|
+
* refused every asking call -- the entire narrowing, on a syntactic
|
|
5389
|
+
* property.
|
|
5191
5390
|
*
|
|
5192
5391
|
* `Object.defineProperty( t, 'x', … )`, `Reflect.set( t, 'x', v )` and
|
|
5193
5392
|
* `Object.assign( t, { x } )` are unplaceable-receiver writes with a
|
|
@@ -5353,7 +5552,57 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5353
5552
|
});
|
|
5354
5553
|
return callable ? symbol : null;
|
|
5355
5554
|
};
|
|
5356
|
-
const
|
|
5555
|
+
const ownCallableReadAnswers = new Map();
|
|
5556
|
+
const sourceOwnCallableReadIsClosed = (read) => {
|
|
5557
|
+
if (trustSeed.rejectedCallableProofs.has(read))
|
|
5558
|
+
return false;
|
|
5559
|
+
const known = ownCallableReadAnswers.get(read);
|
|
5560
|
+
if (known !== undefined)
|
|
5561
|
+
return known;
|
|
5562
|
+
const proof = invocationLedger.capture(() => {
|
|
5563
|
+
const owner = sourceCallableObjectOf(checker, flow, read.expression);
|
|
5564
|
+
const key = staticKeyOf(read);
|
|
5565
|
+
if (owner === null || key === null || sourceCallableOwnDataWriteOf(checker, flow, owner, key, read) === null)
|
|
5566
|
+
return false;
|
|
5567
|
+
const values = sourceValueSessionOf(checker, flow).valuesOf(read);
|
|
5568
|
+
return (values !== null &&
|
|
5569
|
+
values.length > 0 &&
|
|
5570
|
+
values.every((value) => isRealCallableDeclaration(value) &&
|
|
5571
|
+
!value.getSourceFile().isDeclarationFile &&
|
|
5572
|
+
value.body !== undefined &&
|
|
5573
|
+
flow.callableBodyIsIndexed(value)));
|
|
5574
|
+
});
|
|
5575
|
+
if (proof.value)
|
|
5576
|
+
invocationRequirements.set(read, proof.requirements);
|
|
5577
|
+
ownCallableReadAnswers.set(read, proof.value);
|
|
5578
|
+
return proof.value;
|
|
5579
|
+
};
|
|
5580
|
+
const untaggedAmbientCallableSymbolOf = (node) => {
|
|
5581
|
+
const read = node.parent;
|
|
5582
|
+
if (ts.isPropertyAccessExpression(read) && read.name === node && sourceOwnCallableReadIsClosed(read))
|
|
5583
|
+
return null;
|
|
5584
|
+
const symbol = actualSymbol(checker.getSymbolAtLocation(node));
|
|
5585
|
+
const element = constDestructuredElementOf(symbol);
|
|
5586
|
+
if (element !== null)
|
|
5587
|
+
return element.name === node ? null : destructuredCallableOf(element);
|
|
5588
|
+
return untaggedAmbientCallableSymbol(symbol, node);
|
|
5589
|
+
};
|
|
5590
|
+
/**
|
|
5591
|
+
* `const { initialize } = peer` binds the member once and never again,
|
|
5592
|
+
* so every mention of the local IS the member: a bare call of it is a
|
|
5593
|
+
* direct call of the ambient callable (stamped as one), and only a mention
|
|
5594
|
+
* in a value position hands the callable out. Judged per mention, like a
|
|
5595
|
+
* spelled `peer.initialize`, rather than as one escape at the pattern.
|
|
5596
|
+
*/
|
|
5597
|
+
const constDestructuredElementOf = (symbol) => {
|
|
5598
|
+
const declaration = symbol?.valueDeclaration;
|
|
5599
|
+
if (!declaration || !ts.isBindingElement(declaration) || !ts.isIdentifier(declaration.name) || declaration.dotDotDotToken)
|
|
5600
|
+
return null;
|
|
5601
|
+
if (!ts.isObjectBindingPattern(declaration.parent) || !ts.isVariableDeclaration(declaration.parent.parent))
|
|
5602
|
+
return null;
|
|
5603
|
+
const list = declaration.parent.parent.parent;
|
|
5604
|
+
return ts.isVariableDeclarationList(list) && (list.flags & ts.NodeFlags.Const) !== 0 ? declaration : null;
|
|
5605
|
+
};
|
|
5357
5606
|
/**
|
|
5358
5607
|
* `resp[ 'text' ]` names the same member as `resp.text` and resolves to no
|
|
5359
5608
|
* symbol at the literal, and `const { text } = resp` extracts the member as
|
|
@@ -5367,8 +5616,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5367
5616
|
*
|
|
5368
5617
|
* "Is the receiver declared in ambient text" was the wrong question:
|
|
5369
5618
|
* `Record< string, HandlerSet >` is an ambient ALIAS over a program value
|
|
5370
|
-
* type, so it answered yes for every
|
|
5371
|
-
*
|
|
5619
|
+
* type, so it answered yes for every read of a router's trie nodes and
|
|
5620
|
+
* nothing else. The question the position actually asks is what the read
|
|
5372
5621
|
* can HAND BACK -- the index-signature value types, or, when the type
|
|
5373
5622
|
* declares none, its properties -- and only an ambient callable there is a
|
|
5374
5623
|
* host function. `Record< string, ProgramType >` answers no.
|
|
@@ -5386,6 +5635,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5386
5635
|
const access = node.parent;
|
|
5387
5636
|
if (!ts.isElementAccessExpression(access) || access.argumentExpression !== node)
|
|
5388
5637
|
return null;
|
|
5638
|
+
if (sourceOwnCallableReadIsClosed(access))
|
|
5639
|
+
return null;
|
|
5389
5640
|
const outer = access.parent;
|
|
5390
5641
|
if ((ts.isCallExpression(outer) || ts.isNewExpression(outer)) && outer.expression === access)
|
|
5391
5642
|
return null;
|
|
@@ -5403,15 +5654,24 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5403
5654
|
const source = ts.isVariableDeclaration(owner) ? owner.initializer : undefined;
|
|
5404
5655
|
if (!source)
|
|
5405
5656
|
return null;
|
|
5657
|
+
// The receiver rule `unknownCalleeStampIsNarrowed` applies to a spelled
|
|
5658
|
+
// `source.member`: a member taken off a value whose provenance is only
|
|
5659
|
+
// program allocations is a program value, whatever the declarations say.
|
|
5660
|
+
// `const { initialize } = optional`, where `optional` only ever holds the
|
|
5661
|
+
// program's own `{ kModuleError }` stub for a types-only peer package.
|
|
5662
|
+
// A source the alias graph never modelled proves nothing either way.
|
|
5663
|
+
const receiver = valueNodes.has(unwrapErasedExpression(source)) ? aliasFacts(source) : null;
|
|
5664
|
+
if (receiver && !receiver.opaque && !receiver.global && !receiver.represented && receiver.prototypes.size === 0)
|
|
5665
|
+
return null;
|
|
5406
5666
|
const name = element.propertyName ?? element.name;
|
|
5407
5667
|
if (!ts.isIdentifier(name) && !ts.isStringLiteralLike(name))
|
|
5408
5668
|
return null;
|
|
5409
5669
|
const property = checker.getTypeAtLocation(source).getProperty(name.text);
|
|
5410
5670
|
// A destructured member is always extracted as a value; there is no
|
|
5411
5671
|
// callee position to exempt.
|
|
5412
|
-
const
|
|
5672
|
+
const sourceType = checker.getTypeAtLocation(source);
|
|
5413
5673
|
if (!property)
|
|
5414
|
-
return unresolvedKeyYieldsAmbientCallable(
|
|
5674
|
+
return unresolvedKeyYieldsAmbientCallable(sourceType) ? (sourceType.getSymbol() ?? null) : null;
|
|
5415
5675
|
return untaggedAmbientCallableSymbol(actualSymbol(property), name);
|
|
5416
5676
|
};
|
|
5417
5677
|
/**
|
|
@@ -5426,8 +5686,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5426
5686
|
* a value handed to code that could call it against a program object --
|
|
5427
5687
|
* `extends` runs it through `super( ... )`, which is a direct callee.
|
|
5428
5688
|
*
|
|
5429
|
-
* Measured: without these three,
|
|
5430
|
-
* one of them a `Symbol.iterator` / `Number.isInteger` / `Array.isArray` /
|
|
5689
|
+
* Measured: without these three, a real server program reported over a
|
|
5690
|
+
* hundred escapes, every one of them a `Symbol.iterator` / `Number.isInteger` / `Array.isArray` /
|
|
5431
5691
|
* `Object.keys` receiver or an `x instanceof Error`, and not one of them a
|
|
5432
5692
|
* callable escaping as a value.
|
|
5433
5693
|
*/
|
|
@@ -5449,6 +5709,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5449
5709
|
return true;
|
|
5450
5710
|
if (ts.isExpressionWithTypeArguments(parent) && ts.isHeritageClause(parent.parent))
|
|
5451
5711
|
return true;
|
|
5712
|
+
// `import { CGRectMake } from '...'` and `export { CGRectMake }` bind a
|
|
5713
|
+
// name; they read nothing. Every mention of the bound name is a node of
|
|
5714
|
+
// its own, judged where it is written.
|
|
5715
|
+
if (ts.isImportSpecifier(parent) || ts.isImportClause(parent) || ts.isNamespaceImport(parent) || ts.isExportSpecifier(parent))
|
|
5716
|
+
return true;
|
|
5452
5717
|
// `encrypted.sort = sort`: a plain store to (or `delete` of) a member
|
|
5453
5718
|
// never performs [[Get]] on it, so the library callable that member names
|
|
5454
5719
|
// on the receiver's type is not read, let alone handed out. A compound or
|
|
@@ -5465,7 +5730,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5465
5730
|
/**
|
|
5466
5731
|
* An ambient declaration whose VALUE is program code.
|
|
5467
5732
|
*
|
|
5468
|
-
*
|
|
5733
|
+
* A host's global script may spell the timers as `const setTimeout: typeof
|
|
5469
5734
|
* import( './timers.js' ).setTimeout` -- an ambient declaration over a
|
|
5470
5735
|
* PROGRAM function that has a body in a source file. Reading the declaration
|
|
5471
5736
|
* alone calls that a host native and stamps `every` on every intrinsic its
|
|
@@ -5493,7 +5758,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5493
5758
|
}));
|
|
5494
5759
|
};
|
|
5495
5760
|
/**
|
|
5496
|
-
*
|
|
5761
|
+
* A library's `export declare interface TypedEventEmitter<E> extends
|
|
5497
5762
|
* EventEmitter { listeners(...): E[K][] }` merged into `export class
|
|
5498
5763
|
* TypedEventEmitter<E> extends EventEmitter {}`. A method signature on an
|
|
5499
5764
|
* interface puts no value anywhere: at run time `emitter.listeners` is
|
|
@@ -5549,14 +5814,15 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5549
5814
|
* denylist answers "this library callable escaped as a VALUE and can install
|
|
5550
5815
|
* a key", and a `ReturnsCallable` row is not a value position at all -- it is
|
|
5551
5816
|
* recorded at a DIRECT CALLEE, whose receiver and result are program code.
|
|
5552
|
-
* `programFn.bind( this )` was classified `lib-mutator` and flipped
|
|
5553
|
-
*
|
|
5817
|
+
* `programFn.bind( this )` was classified `lib-mutator` and flipped a
|
|
5818
|
+
* whole program's verdict on that category error.
|
|
5554
5819
|
*/
|
|
5555
5820
|
const noteHostCallableEscape = (node, symbol, kind) => {
|
|
5556
5821
|
const file = node.getSourceFile();
|
|
5557
5822
|
const at = file.getLineAndCharacterOfPosition(node.getStart(file));
|
|
5558
5823
|
hostCallableEscapes.push({
|
|
5559
|
-
|
|
5824
|
+
source: node,
|
|
5825
|
+
where: `${displayPath(file.fileName)}:${at.line + 1}`,
|
|
5560
5826
|
name: symbol.getName(),
|
|
5561
5827
|
kind,
|
|
5562
5828
|
library: (symbol.declarations ?? []).some((declaration) => isStandardLibraryDeclaration(declaration)),
|
|
@@ -5572,6 +5838,108 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5572
5838
|
* here. Never set it for a kept build.
|
|
5573
5839
|
*/
|
|
5574
5840
|
const ignoresLibraryEscapes = process.env['GEA_HOST_ESCAPE_IGNORE_LIB'] === '1';
|
|
5841
|
+
const retainedLibraryCallableAnswers = new Map();
|
|
5842
|
+
const retainedLibraryCallablePending = new Set();
|
|
5843
|
+
const retainLibrarySourceProtocol = (root) => {
|
|
5844
|
+
const method = standardPrototypeMethodSourceOf(checker, root, isStandardLibraryDeclaration);
|
|
5845
|
+
if (method !== null)
|
|
5846
|
+
return invocationLedger.requirePrototypeKeys(method.intrinsic, { names: [method.key] }, root);
|
|
5847
|
+
if (ts.isCallExpression(root)) {
|
|
5848
|
+
const bound = boundCallableTarget(root);
|
|
5849
|
+
return (bound !== null &&
|
|
5850
|
+
root.arguments.length === 1 &&
|
|
5851
|
+
!root.arguments.some(ts.isSpreadElement) &&
|
|
5852
|
+
retainLibrarySourceProtocol(unwrapErasedExpression(bound.target)) &&
|
|
5853
|
+
retainLibrarySourceProtocol(unwrapErasedExpression(bound.receiver)) &&
|
|
5854
|
+
invocationLedger.requirePrototypeKeys('Function', { names: ['bind'] }, root));
|
|
5855
|
+
}
|
|
5856
|
+
if (!ts.isPropertyAccessExpression(root))
|
|
5857
|
+
return false;
|
|
5858
|
+
const owner = intrinsicConstructorSeedOf(root.expression);
|
|
5859
|
+
const symbol = memberSymbolOf(root);
|
|
5860
|
+
const intrinsic = owner?.getName();
|
|
5861
|
+
if (intrinsic !== 'Object' && intrinsic !== 'Reflect' && intrinsic !== 'JSON')
|
|
5862
|
+
return false;
|
|
5863
|
+
return (owner !== null &&
|
|
5864
|
+
symbol !== null &&
|
|
5865
|
+
isStandardLibrarySymbol(symbol) &&
|
|
5866
|
+
authenticatedCalleeIdentity(root) &&
|
|
5867
|
+
invocationLedger.requireMember(intrinsic, root.name.text, root));
|
|
5868
|
+
};
|
|
5869
|
+
const retainedLibraryCallableIsClosed = (expression) => {
|
|
5870
|
+
const root = unwrapErasedExpression(expression);
|
|
5871
|
+
if (trustSeed.rejectedCallableProofs.has(root) || retainedLibraryCallablePending.has(root))
|
|
5872
|
+
return false;
|
|
5873
|
+
const previous = retainedLibraryCallableAnswers.get(root);
|
|
5874
|
+
if (previous !== undefined) {
|
|
5875
|
+
if (previous.closed)
|
|
5876
|
+
invocationLedger.include(previous.requirements);
|
|
5877
|
+
return previous.closed;
|
|
5878
|
+
}
|
|
5879
|
+
retainedLibraryCallablePending.add(root);
|
|
5880
|
+
let closed = false;
|
|
5881
|
+
let requirements = [];
|
|
5882
|
+
try {
|
|
5883
|
+
const proof = invocationLedger.capture(() => {
|
|
5884
|
+
if (!retainLibrarySourceProtocol(root))
|
|
5885
|
+
return false;
|
|
5886
|
+
const terminal = (reference) => {
|
|
5887
|
+
const current = outermostErasureOf(reference);
|
|
5888
|
+
const value = unwrapErasedExpression(current);
|
|
5889
|
+
const parent = current.parent;
|
|
5890
|
+
if (ts.isVariableDeclaration(parent) && parent.initializer === current) {
|
|
5891
|
+
const values = sourceBindingValuesOf(checker, flow, parent);
|
|
5892
|
+
return values?.length === 1 && values[0] === parent.initializer ? null : false;
|
|
5893
|
+
}
|
|
5894
|
+
if (ts.isCallExpression(parent) && parent.expression === current)
|
|
5895
|
+
return flow.calls.some((site) => site.call === parent) && authenticatedCalleeIdentity(current);
|
|
5896
|
+
// This family is an actual retained Function. A primitive assertion
|
|
5897
|
+
// or checker Never cannot turn its opaque publication into an inert
|
|
5898
|
+
// use before the shared receiver walk sees that transport edge.
|
|
5899
|
+
if (!insideTypeContext(current) && primitiveResult(checker.getTypeAtLocation(current)))
|
|
5900
|
+
return false;
|
|
5901
|
+
const factory = (ts.isPropertyAccessExpression(parent) || ts.isElementAccessExpression(parent)) && parent.expression === current
|
|
5902
|
+
? parent.parent
|
|
5903
|
+
: parent;
|
|
5904
|
+
if (!ts.isCallExpression(factory))
|
|
5905
|
+
return null;
|
|
5906
|
+
const bound = boundCallableTarget(factory);
|
|
5907
|
+
if (bound === null ||
|
|
5908
|
+
factory.arguments.length !== 1 ||
|
|
5909
|
+
factory.arguments.some(ts.isSpreadElement) ||
|
|
5910
|
+
(unwrapErasedExpression(bound.target) !== value && unwrapErasedExpression(bound.receiver) !== value))
|
|
5911
|
+
return null;
|
|
5912
|
+
if (!authenticatedCalleeIdentity(bound.target) ||
|
|
5913
|
+
!receiverHasPublishedRepresentation(bound.receiver) ||
|
|
5914
|
+
!invocationLedger.requirePrototypeKeys('Function', { names: ['bind'] }, factory))
|
|
5915
|
+
return false;
|
|
5916
|
+
return retainedLibraryCallableIsClosed(factory);
|
|
5917
|
+
};
|
|
5918
|
+
return hasClosedValueUses(checker, flow, [root], terminal, publishedTypeAt, (owner) => argumentsUsesByOwner.get(owner));
|
|
5919
|
+
});
|
|
5920
|
+
closed = proof.value;
|
|
5921
|
+
if (closed) {
|
|
5922
|
+
requirements = proof.requirements;
|
|
5923
|
+
retainRequirements(root, proof.requirements);
|
|
5924
|
+
invocationLedger.include(proof.requirements);
|
|
5925
|
+
}
|
|
5926
|
+
return closed;
|
|
5927
|
+
}
|
|
5928
|
+
finally {
|
|
5929
|
+
retainedLibraryCallablePending.delete(root);
|
|
5930
|
+
retainedLibraryCallableAnswers.set(root, { closed, requirements });
|
|
5931
|
+
}
|
|
5932
|
+
};
|
|
5933
|
+
const retainedLibraryEscapeIsClosed = (escape) => {
|
|
5934
|
+
if (!escape.library || !escape.mutator || escape.kind === 'ReturnsCallable')
|
|
5935
|
+
return false;
|
|
5936
|
+
const node = escape.source;
|
|
5937
|
+
if (ts.isIdentifier(node)) {
|
|
5938
|
+
const parent = node.parent;
|
|
5939
|
+
return retainedLibraryCallableIsClosed(ts.isPropertyAccessExpression(parent) && parent.name === node ? parent : node);
|
|
5940
|
+
}
|
|
5941
|
+
return ts.isStringLiteralLike(node) && ts.isElementAccessExpression(node.parent) ? retainedLibraryCallableIsClosed(node.parent) : false;
|
|
5942
|
+
};
|
|
5575
5943
|
let hostCallableEscapeAnswer = null;
|
|
5576
5944
|
const untaggedHostCallableEscapesAsValue = () => {
|
|
5577
5945
|
if (hostCallableEscapeAnswer !== null)
|
|
@@ -5586,6 +5954,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5586
5954
|
continue;
|
|
5587
5955
|
}
|
|
5588
5956
|
if (ts.isBindingElement(node)) {
|
|
5957
|
+
// A const local's mentions are judged one by one below.
|
|
5958
|
+
if (constDestructuredElementOf(actualSymbol(checker.getSymbolAtLocation(node.name))) === node)
|
|
5959
|
+
continue;
|
|
5589
5960
|
const destructured = destructuredCallableOf(node);
|
|
5590
5961
|
if (destructured)
|
|
5591
5962
|
noteHostCallableEscape(node, destructured, 'Destructured');
|
|
@@ -5621,7 +5992,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5621
5992
|
// return `( ...args: A ) => R` -- a concrete function type built from
|
|
5622
5993
|
// type parameters, which no type-parameter or top-type rule can retire
|
|
5623
5994
|
// -- so `.some( ... )` matched an overload the printed `lib.es5.d.ts:357`
|
|
5624
|
-
// row did not even name, and `bind` alone refused every call
|
|
5995
|
+
// row did not even name, and `bind` alone refused every call in a
|
|
5996
|
+
// program that binds its handlers.
|
|
5625
5997
|
if (forwardingLibraryMember(node, symbol))
|
|
5626
5998
|
continue;
|
|
5627
5999
|
if (symbol.declarations?.some(returnHandsBackCallable))
|
|
@@ -5634,15 +6006,15 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5634
6006
|
// decodeURIComponent`, `emitter.on( 'x', console.error )` hand out
|
|
5635
6007
|
// spec-defined functions whose most dangerous power is running program
|
|
5636
6008
|
// code -- censused where that code is written -- not installing a key.
|
|
5637
|
-
const counted = hostCallableEscapes.filter((escape) => (!escape.library || escape.mutator) && !(ignoresLibraryEscapes && escape.library));
|
|
6009
|
+
const counted = hostCallableEscapes.filter((escape) => (!escape.library || escape.mutator) && !(ignoresLibraryEscapes && escape.library) && !retainedLibraryEscapeIsClosed(escape));
|
|
5638
6010
|
hostCallableEscapeAnswer = counted.length > 0;
|
|
5639
6011
|
return hostCallableEscapeAnswer;
|
|
5640
6012
|
};
|
|
5641
6013
|
/**
|
|
5642
6014
|
* Which clause refused the narrowing, counted per call. `objects=0` with no
|
|
5643
6015
|
* per-clause row is unreadable: three whole-program facts and one per-call
|
|
5644
|
-
* one can each veto, and on
|
|
5645
|
-
* admitted ZERO calls with no way to say which of the four did it.
|
|
6016
|
+
* one can each veto, and on a real server program the first landing of
|
|
6017
|
+
* this gate admitted ZERO calls with no way to say which of the four did it.
|
|
5646
6018
|
*/
|
|
5647
6019
|
const argumentStampRefusals = new Map();
|
|
5648
6020
|
const hostNativeCallees = new Map();
|
|
@@ -5681,9 +6053,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5681
6053
|
// it off a host object -- and every host object enters this graph opaque
|
|
5682
6054
|
// (a bodiless call or construction, a declaration-file value, a class
|
|
5683
6055
|
// chain that is not source-owned). A receiver whose provenance is only
|
|
5684
|
-
// program allocations reads program values or library members.
|
|
5685
|
-
// `
|
|
5686
|
-
// declarations, but the value is
|
|
6056
|
+
// program allocations reads program values or library members. A
|
|
6057
|
+
// `peer.instance( ... )` call is typed by a types-only peer package's
|
|
6058
|
+
// declarations, but the value is the program's loader's: the absent
|
|
5687
6059
|
// package's `require` throws, and the `catch` hands back a program proxy.
|
|
5688
6060
|
// Represented and intrinsic receivers keep the declaration's answer.
|
|
5689
6061
|
const calleeRead = unwrapErasedExpression(call.expression);
|
|
@@ -5729,8 +6101,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5729
6101
|
// `visit`'s own mutator branch is the one authority, filing their keys (or
|
|
5730
6102
|
// `every`, for an open key or an unreadable source) into
|
|
5731
6103
|
// `visitWrittenKeys`, which is exactly what the narrowed stamp then reads.
|
|
5732
|
-
// So nothing is lost by narrowing here, and
|
|
5733
|
-
// calls stop stamping `every` on every intrinsic their arguments reach.
|
|
6104
|
+
// So nothing is lost by narrowing here, and most of a server program's
|
|
6105
|
+
// asking calls stop stamping `every` on every intrinsic their arguments reach.
|
|
5734
6106
|
//
|
|
5735
6107
|
// An untagged HOST native keeps `every`: its writes are in no source file,
|
|
5736
6108
|
// so `visitWrittenKeys` bounds nothing about it. That is the whole of the
|
|
@@ -5878,16 +6250,12 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5878
6250
|
* `programBodyOnlyCalls` requires of a program body -- guarded the same
|
|
5879
6251
|
* way that authority is, against a selection the program merely ASSERTED
|
|
5880
6252
|
* rather than one the checker derived from a real declaration.
|
|
5881
|
-
* `
|
|
5882
|
-
* `{start,count}[]` by the checker) and `
|
|
5883
|
-
* (typed `Set<
|
|
6253
|
+
* `ranges.sort(...)` (an unannotated JS parameter's field, typed
|
|
6254
|
+
* `{start,count}[]` by the checker) and `stages.has/add(...)`
|
|
6255
|
+
* (typed `Set<Stage>`) resolve this way without ever getting a
|
|
5884
6256
|
* `publishedRepresentationOf` proof, which is why they reached this
|
|
5885
6257
|
* wildcard at all -- and neither passes through an assertion to get there.
|
|
5886
6258
|
*/
|
|
5887
|
-
// TEMPORARY BISECT SWITCH -- not for landing. Three rules landed together and
|
|
5888
|
-
// one of them clears `entries.has('key')` in the spec suite, which must stay
|
|
5889
|
-
// wildcarded. `GEA_NO_KEYSET_INERT=1` turns this one off so ONE build can
|
|
5890
|
-
// test both arms instead of two.
|
|
5891
6259
|
// DISABLED. This rule cleared the receiver wildcard whenever the CHECKER resolved a
|
|
5892
6260
|
// key-set-inert standard-library method (`sort`/`has`/`add`/`slice`/`subarray`) off the
|
|
5893
6261
|
// receiver's static type. That type can be fabricated: `new (construct as new () =>
|
|
@@ -5895,8 +6263,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5895
6263
|
// receiver that is genuinely unknown at runtime, and the spec test `erased generic
|
|
5896
6264
|
// constructor assertions retain the intrinsic callable identity` requires that call to
|
|
5897
6265
|
// stay wildcarded. Guarding it with `receiverTypeIsAssertionSeeded` did not close the
|
|
5898
|
-
// hole. Kept here, inert, because the shapes it targeted (`
|
|
5899
|
-
// `
|
|
6266
|
+
// hole. Kept here, inert, because the shapes it targeted (`ranges.sort`,
|
|
6267
|
+
// `cache.has/add`) are real.
|
|
5900
6268
|
//
|
|
5901
6269
|
// MEASURED DEAD END (2026-09-15): the obvious repair -- authenticate this leg on a
|
|
5902
6270
|
// representation proof instead of a checker type -- is not merely hard, it is
|
|
@@ -5913,7 +6281,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5913
6281
|
// establishing the receiver's own representation assumes the declared shape matches
|
|
5914
6282
|
// THIS runtime value, which is the same class of error as trusting the fabricated `Map`
|
|
5915
6283
|
// type in the counter-example above. The real fix is to close the opacity upstream --
|
|
5916
|
-
// trace `
|
|
6284
|
+
// trace `ranges`/`attribute` to real allocations across all call sites in the
|
|
5917
6285
|
// parameter-carrier census -- so that `facts.opaque` stops being true here at all.
|
|
5918
6286
|
const keySetInertEnabled = false;
|
|
5919
6287
|
const calleeHasNoKeySetEffect = (callee) => {
|
|
@@ -5929,16 +6297,77 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5929
6297
|
!intrinsicSymbolIsOverwritten(symbol) &&
|
|
5930
6298
|
!receiverTypeIsAssertionSeeded(callee.expression));
|
|
5931
6299
|
};
|
|
6300
|
+
/**
|
|
6301
|
+
* `g.fetch(url)` with `g` the global object, where every global binding the
|
|
6302
|
+
* key names is a bodiless ambient function declaration: unless the program
|
|
6303
|
+
* writes that key, the read yields the host or library function itself, and
|
|
6304
|
+
* calling it through the global object is the bare call `fetch(url)`. A
|
|
6305
|
+
* global operation receives the global object as `this` either way, and a
|
|
6306
|
+
* native host function takes no receiver at all. The arguments were
|
|
6307
|
+
* censused above exactly as for the bare call, so the receiver leg adds
|
|
6308
|
+
* nothing. Whether the program writes the key is known only once the visit
|
|
6309
|
+
* ends (`flushAmbientGlobalFunctionCalls`).
|
|
6310
|
+
*
|
|
6311
|
+
* Only a PROVEN global receiver: for an opaque one the callee itself is
|
|
6312
|
+
* unknown whatever the key names. A key naming anything else -- a `var`, a
|
|
6313
|
+
* program binding, no binding at all -- keeps the unconditional wildcard,
|
|
6314
|
+
* and so does an `Object.prototype` key: lib.dom declares a global
|
|
6315
|
+
* `function toString()`, but the global object inherits that member, and
|
|
6316
|
+
* nothing here proves which object along its chain answers the read. A key
|
|
6317
|
+
* a host accessor owns may run host code on the read itself.
|
|
6318
|
+
*/
|
|
6319
|
+
let objectPrototypeType;
|
|
6320
|
+
const ambientGlobalFunctionKeyOf = (callee) => {
|
|
6321
|
+
const key = staticKeyOf(callee);
|
|
6322
|
+
if (key === null || hostAccessorNames.has(key))
|
|
6323
|
+
return null;
|
|
6324
|
+
if (objectPrototypeType === undefined) {
|
|
6325
|
+
const object = checker.resolveName('Object', undefined, ts.SymbolFlags.Value, false);
|
|
6326
|
+
const prototype = object ? checker.getTypeOfSymbol(object).getProperty('prototype') : undefined;
|
|
6327
|
+
objectPrototypeType = prototype ? checker.getTypeOfSymbol(prototype) : null;
|
|
6328
|
+
}
|
|
6329
|
+
if (objectPrototypeType === null || checker.getPropertyOfType(objectPrototypeType, key) !== undefined)
|
|
6330
|
+
return null;
|
|
6331
|
+
const bound = globalBindingsNamed(key, callee);
|
|
6332
|
+
const symbols = [
|
|
6333
|
+
checker.resolveName(key, undefined, ts.SymbolFlags.Value, false),
|
|
6334
|
+
intrinsicGlobalType ? checker.getPropertyOfType(intrinsicGlobalType, key) : undefined
|
|
6335
|
+
].filter((symbol) => symbol !== undefined);
|
|
6336
|
+
if (symbols.length === 0)
|
|
6337
|
+
return null;
|
|
6338
|
+
const ids = new Set();
|
|
6339
|
+
for (const symbol of symbols) {
|
|
6340
|
+
const declarations = symbol.declarations ?? [];
|
|
6341
|
+
if (declarations.length === 0 || !declarations.every(isBodilessAmbientFunction))
|
|
6342
|
+
return null;
|
|
6343
|
+
const id = identities.symbolValueDeclarationId(symbol, callee);
|
|
6344
|
+
if (id !== null)
|
|
6345
|
+
ids.add(id);
|
|
6346
|
+
}
|
|
6347
|
+
return bound.every((id) => ids.has(id)) ? key : null;
|
|
6348
|
+
};
|
|
6349
|
+
const ambientGlobalFunctionCalls = [];
|
|
6350
|
+
const flushAmbientGlobalFunctionCalls = () => {
|
|
6351
|
+
const written = visitWrittenKeys.surfaceKeys;
|
|
6352
|
+
for (const { call, key } of ambientGlobalFunctionCalls)
|
|
6353
|
+
if (written.every || written.names.has(key))
|
|
6354
|
+
markWildcard(call, 'global method receiver whose key the program writes');
|
|
6355
|
+
};
|
|
5932
6356
|
const visit = (node) => {
|
|
5933
6357
|
if (reachable.memberIsPruned(node))
|
|
5934
6358
|
return;
|
|
5935
6359
|
if ((ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) && isDirectAssignmentTarget(node)) {
|
|
5936
6360
|
const keys = keyReader.keysOfAccess(node);
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
6361
|
+
// An authenticated standard own writable data descriptor intercepts
|
|
6362
|
+
// this exact store. It changes the namespace's own member, not a key on
|
|
6363
|
+
// every prototype reachable from the constructor's public type. All
|
|
6364
|
+
// other stores retain the conservative inherited/opaque effect path.
|
|
6365
|
+
if (!sourceIntrinsicInstallations.has(node))
|
|
6366
|
+
for (const declaration of aliasFacts(node.expression).prototypes)
|
|
6367
|
+
for (const key of keys) {
|
|
6368
|
+
noteWritten(key);
|
|
6369
|
+
tainted.taintObject(declaration, key);
|
|
6370
|
+
}
|
|
5942
6371
|
taintIntrinsicMember(node.expression, keys);
|
|
5943
6372
|
}
|
|
5944
6373
|
if ((ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) && mayAliasGlobal(node.expression)) {
|
|
@@ -5952,6 +6381,29 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5952
6381
|
tainted.add(declaration);
|
|
5953
6382
|
}
|
|
5954
6383
|
if (ts.isCallExpression(node)) {
|
|
6384
|
+
const declaration = callDeclarationAt(node);
|
|
6385
|
+
if (declaration !== undefined &&
|
|
6386
|
+
ts.isMethodSignature(declaration) &&
|
|
6387
|
+
ts.isInterfaceDeclaration(declaration.parent) &&
|
|
6388
|
+
declaration.parent.name.text === 'ObjectConstructor' &&
|
|
6389
|
+
isStandardLibraryDeclaration(declaration) &&
|
|
6390
|
+
ts.isIdentifier(declaration.name) &&
|
|
6391
|
+
declaration.name.text === 'getOwnPropertyDescriptor' &&
|
|
6392
|
+
authenticatedCalleeIdentity(reachableCallOfNode.get(node)?.callable ?? node.expression)) {
|
|
6393
|
+
// This intrinsic reads the target's own descriptor without invoking
|
|
6394
|
+
// its getter, but an unknown target may itself be a Proxy. Callee
|
|
6395
|
+
// integrity does not authenticate the target's operation protocol.
|
|
6396
|
+
//
|
|
6397
|
+
// The first link of an intrinsic accessor-getter chain is exempt: its
|
|
6398
|
+
// target is `Object.getPrototypeOf(<TypedArray>.prototype)`, and the
|
|
6399
|
+
// chain's own authentication (`authenticatedIntrinsicAccessorGetterOf`)
|
|
6400
|
+
// already refuses unless that prototype's [[Prototype]] was never
|
|
6401
|
+
// replaced (`setPrototypeOf` records every key) -- the only way it
|
|
6402
|
+
// could become a Proxy.
|
|
6403
|
+
const target = node.arguments[0];
|
|
6404
|
+
if (target && aliasFacts(target).opaque && !isIntrinsicAccessorGetterDescriptorCall(node))
|
|
6405
|
+
deferredDescriptorTargets.add(target);
|
|
6406
|
+
}
|
|
5955
6407
|
const mutator = directMutator(node.expression);
|
|
5956
6408
|
if (mutator) {
|
|
5957
6409
|
// Reflect.set may define the property on its explicit receiver even
|
|
@@ -6033,10 +6485,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6033
6485
|
// interface, `Array.prototype.push`, `String.prototype.split` and
|
|
6034
6486
|
// their neighbours, with the receiver authenticated by
|
|
6035
6487
|
// `!mayAliasGlobal` -- works on a fixture and clears NOTHING on
|
|
6036
|
-
//
|
|
6488
|
+
// a real server program. The rule's whole population there refuses as
|
|
6037
6489
|
// `not-standard-library`: the calls that actually reach this loop
|
|
6038
6490
|
// are `this.emit( 'error', e )`, `stream.on( 'data', cb )`,
|
|
6039
|
-
// `socket.destroy()` --
|
|
6491
|
+
// `socket.destroy()` -- the program's OWN class methods, whose
|
|
6040
6492
|
// bodies are program bodies. The fix for those is
|
|
6041
6493
|
// `callRunsOnlyProgramBodies` authenticating a closed dispatch
|
|
6042
6494
|
// family, not a wider builtin table here.
|
|
@@ -6050,8 +6502,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6050
6502
|
// names the RULE and `[KEY-BLOCK]` names the blocked object, but
|
|
6051
6503
|
// between them sits the only question left once the rule is known
|
|
6052
6504
|
// -- which of this loop's refused callees reached that object --
|
|
6053
|
-
// and nothing answered it. On
|
|
6054
|
-
// stamped at all, and
|
|
6505
|
+
// and nothing answered it. On a real program a couple of objects
|
|
6506
|
+
// are stamped at all, and dozens of refused calls could have
|
|
6507
|
+
// done it.
|
|
6055
6508
|
if (process.env['GEA_DEBUG_GLOBAL_MUTATION']) {
|
|
6056
6509
|
let callees = everyStampOrigins.get(declaration);
|
|
6057
6510
|
if (!callees)
|
|
@@ -6070,7 +6523,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6070
6523
|
if (process.env['GEA_ARGUMENT_WILDCARD_DEBUG'] && facts) {
|
|
6071
6524
|
const file = argument.getSourceFile();
|
|
6072
6525
|
const position = file.getLineAndCharacterOfPosition(argument.getStart(file));
|
|
6073
|
-
const where = `${file.fileName
|
|
6526
|
+
const where = `${displayPath(file.fileName)}:${position.line + 1}:${position.character + 1}`;
|
|
6074
6527
|
process.stderr.write(`[ARGUMENT] ${where} trips=${containsGlobal(current)} global=${facts.global} opaque=${facts.opaque} ` +
|
|
6075
6528
|
`represented=${facts.represented} published=${publishedRepresentationOf(current)} ` +
|
|
6076
6529
|
`type=${checker.typeToString(checker.getTypeAtLocation(current))} text=${argument.getText(file).slice(0, 80).replace(/\s+/g, ' ')}\n`);
|
|
@@ -6125,10 +6578,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6125
6578
|
// global object, the key would name a host member -- an ambient
|
|
6126
6579
|
// declaration, which disqualifies the call from
|
|
6127
6580
|
// `programBodyOnlyCalls` -- or nothing at all, and the call throws
|
|
6128
|
-
// before any body runs.
|
|
6129
|
-
// through receivers this census cannot place (
|
|
6130
|
-
//
|
|
6131
|
-
//
|
|
6581
|
+
// before any body runs. A large library reaches hundreds of methods
|
|
6582
|
+
// through receivers this census cannot place (class instances
|
|
6583
|
+
// returned by a refused call), and each one was filing `*` for the
|
|
6584
|
+
// whole program.
|
|
6132
6585
|
//
|
|
6133
6586
|
// A callee the checker resolved to a key-set-inert standard-library
|
|
6134
6587
|
// method (`calleeHasNoKeySetEffect`) clears this leg the same way:
|
|
@@ -6172,10 +6625,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6172
6625
|
: 'bodiless-or-unclosed';
|
|
6173
6626
|
const file = node.getSourceFile();
|
|
6174
6627
|
const position = file.getLineAndCharacterOfPosition(node.getStart(file));
|
|
6175
|
-
const where = `${file.fileName
|
|
6628
|
+
const where = `${displayPath(file.fileName)}:${position.line + 1}`;
|
|
6176
6629
|
process.stderr.write(`[RECEIVER-WILDCARD] ${bucket} :: ${where} ${node.getText(file).slice(0, 90).replace(/\s+/g, ' ')}\n`);
|
|
6177
6630
|
}
|
|
6178
|
-
|
|
6631
|
+
const ambientKey = aliasFacts(callee.expression).global ? ambientGlobalFunctionKeyOf(callee) : null;
|
|
6632
|
+
if (ambientKey !== null)
|
|
6633
|
+
ambientGlobalFunctionCalls.push({ call: node, key: ambientKey });
|
|
6634
|
+
else
|
|
6635
|
+
markWildcard(node, 'opaque or global method receiver');
|
|
6179
6636
|
}
|
|
6180
6637
|
}
|
|
6181
6638
|
ts.forEachChild(node, visit);
|
|
@@ -6228,6 +6685,33 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6228
6685
|
const symbol = actualSymbol(checker.getSymbolAtLocation(current.name));
|
|
6229
6686
|
return !!symbol && symbol === expected && !allIntrinsicTrustInvalidated && !intrinsicSymbolIsOverwritten(symbol);
|
|
6230
6687
|
};
|
|
6688
|
+
const jsonSymbol = (() => {
|
|
6689
|
+
const anchor = files[0];
|
|
6690
|
+
const symbol = anchor ? checker.resolveName('JSON', anchor, ts.SymbolFlags.Value, false) : undefined;
|
|
6691
|
+
return symbol && hasStandardLibraryDeclaration(symbol) ? symbol : null;
|
|
6692
|
+
})();
|
|
6693
|
+
/**
|
|
6694
|
+
* `JSON.parse(text)` with no reviver: every object it answers is a fresh
|
|
6695
|
+
* ordinary object or array built by the parser -- never a Proxy, never an
|
|
6696
|
+
* intrinsic, never a value the program held before. A reviver could return
|
|
6697
|
+
* anything, so its form is not a seed.
|
|
6698
|
+
*/
|
|
6699
|
+
const trustedJsonParseWithoutReviver = (call) => {
|
|
6700
|
+
if (call.arguments.length !== 1 || ts.isSpreadElement(call.arguments[0]))
|
|
6701
|
+
return false;
|
|
6702
|
+
const current = unwrapErasedExpression(call.expression);
|
|
6703
|
+
if (!jsonSymbol || !ts.isPropertyAccessExpression(current))
|
|
6704
|
+
return false;
|
|
6705
|
+
if (actualSymbol(checker.getSymbolAtLocation(unwrapErasedExpression(current.expression))) !== jsonSymbol)
|
|
6706
|
+
return false;
|
|
6707
|
+
const expected = actualSymbol(checker.getTypeOfSymbol(jsonSymbol).getProperty('parse'));
|
|
6708
|
+
const symbol = actualSymbol(checker.getSymbolAtLocation(current.name));
|
|
6709
|
+
return (!!symbol &&
|
|
6710
|
+
symbol === expected &&
|
|
6711
|
+
!allIntrinsicTrustInvalidated &&
|
|
6712
|
+
!intrinsicSymbolIsOverwritten(jsonSymbol) &&
|
|
6713
|
+
!intrinsicSymbolIsOverwritten(symbol));
|
|
6714
|
+
};
|
|
6231
6715
|
const neverReassigned = (declaration) => writesOf(declaration).every((write) => write.slot !== 'whole' ||
|
|
6232
6716
|
write.edge === 'declaration-initializer' ||
|
|
6233
6717
|
write.edge === 'call-argument' ||
|
|
@@ -6314,7 +6798,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6314
6798
|
const wellKnown = owner != null &&
|
|
6315
6799
|
hasStandardLibraryDeclaration(owner) &&
|
|
6316
6800
|
(checker.getTypeAtLocation(expression).flags & ts.TypeFlags.UniqueESSymbol) !== 0;
|
|
6317
|
-
if (!wellKnown && !
|
|
6801
|
+
if (!wellKnown && !isProgramSymbolKeyExpression(expression))
|
|
6318
6802
|
every = true;
|
|
6319
6803
|
}
|
|
6320
6804
|
else
|
|
@@ -6523,7 +7007,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6523
7007
|
return refused;
|
|
6524
7008
|
}
|
|
6525
7009
|
if (ts.isCallExpression(current)) {
|
|
6526
|
-
if (trustedObjectStatic(current.expression, 'create'))
|
|
7010
|
+
if (trustedObjectStatic(current.expression, 'create') || trustedJsonParseWithoutReviver(current))
|
|
6527
7011
|
return { seed: true, admitted: true, dependencies: [] };
|
|
6528
7012
|
const target = current.arguments[0];
|
|
6529
7013
|
if (trustedObjectStatic(current.expression, 'assign') && target && !ts.isSpreadElement(target))
|
|
@@ -6539,6 +7023,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6539
7023
|
}
|
|
6540
7024
|
return through(values);
|
|
6541
7025
|
}
|
|
7026
|
+
if (ts.isNewExpression(current) && sourceClassConstructionIsFresh(current))
|
|
7027
|
+
return { seed: true, admitted: true, dependencies: [] };
|
|
6542
7028
|
if (ts.isIdentifier(current)) {
|
|
6543
7029
|
const declaration = bindingOf(current);
|
|
6544
7030
|
if (!declaration || (!ts.isParameter(declaration) && !ts.isVariableDeclaration(declaration)))
|
|
@@ -6547,6 +7033,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6547
7033
|
return through([]);
|
|
6548
7034
|
return through([declaration]);
|
|
6549
7035
|
}
|
|
7036
|
+
// A stock prototype data method is a distinct Function object, not the
|
|
7037
|
+
// intrinsic constructor or prototype it was read from. This is the same
|
|
7038
|
+
// conditional identity used by authenticated receiver continuations.
|
|
7039
|
+
if (standardPrototypeMethodIsDistinct(current))
|
|
7040
|
+
return { seed: true, admitted: true, dependencies: [] };
|
|
6550
7041
|
const stored = storedReads && ts.isPropertyAccessExpression(current) ? valueStoredJustBefore(current) : null;
|
|
6551
7042
|
if (stored)
|
|
6552
7043
|
return through([stored]);
|
|
@@ -6577,6 +7068,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6577
7068
|
visit(statement);
|
|
6578
7069
|
}
|
|
6579
7070
|
flushNarrowedArgumentStamps();
|
|
7071
|
+
flushAmbientGlobalFunctionCalls();
|
|
6580
7072
|
// With '*' every consumer refuses already. Otherwise: no name this run
|
|
6581
7073
|
// trusted may have been written by its own visit; a `for-in` key set holds
|
|
6582
7074
|
// every key Object.prototype may carry; and a key set's intrinsic
|
|
@@ -6586,14 +7078,15 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6586
7078
|
// file their intrinsic requirements with `invocationRequirements`.
|
|
6587
7079
|
const unprovenSurfaceWrite = allIntrinsicTrustInvalidated
|
|
6588
7080
|
? undefined
|
|
6589
|
-
: deferredSurfaceWrites.find((receiver) => freshProgramObjectOrigin(receiver) === 'refused');
|
|
7081
|
+
: [...deferredSurfaceWrites, ...deferredDescriptorTargets].find((receiver) => freshProgramObjectOrigin(receiver) === 'refused');
|
|
6590
7082
|
if (unprovenSurfaceWrite && process.env['GEA_DEBUG_GLOBAL_MUTATION'])
|
|
6591
|
-
debugSite(unprovenSurfaceWrite, '
|
|
7083
|
+
debugSite(unprovenSurfaceWrite, 'intrinsic effect receiver has no complete ordinary origin; invalidates all intrinsic trust');
|
|
6592
7084
|
const written = visitWrittenKeys.surfaceKeys;
|
|
6593
7085
|
const distrusted = [...trustedIntrinsicNames].filter((name) => !trustSeed.names.has(name) && keySetTouches(written, { names: [name] }));
|
|
6594
7086
|
const objectPrototypeKeys = inheritedObjectPrototypeKeys ? objectPrototypeKeysOf(tainted) : trustSeed.objectPrototypeKeys;
|
|
6595
7087
|
const inheritedGrew = (objectPrototypeKeys.every && !trustSeed.objectPrototypeKeys.every) ||
|
|
6596
7088
|
(objectPrototypeKeys.numeric && !trustSeed.objectPrototypeKeys.numeric) ||
|
|
7089
|
+
(objectPrototypeKeys.programSymbols === true && trustSeed.objectPrototypeKeys.programSymbols !== true) ||
|
|
6597
7090
|
[...objectPrototypeKeys.names].some((name) => !trustSeed.objectPrototypeKeys.names.has(name));
|
|
6598
7091
|
const assumptionFailed = computedKeyRequirements.length > 0 &&
|
|
6599
7092
|
failedIntrinsicProtocolRequirements({
|
|
@@ -6603,9 +7096,24 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6603
7096
|
isStandardLibraryDeclaration: (declaration) => isStandardLibraryDeclaration(declaration)
|
|
6604
7097
|
}, computedKeyRequirements).length > 0;
|
|
6605
7098
|
const rejectedCallableProofs = new Set(trustSeed.rejectedCallableProofs);
|
|
6606
|
-
for (const [call, requirements] of invocationRequirements)
|
|
6607
|
-
|
|
7099
|
+
for (const [call, requirements] of invocationRequirements) {
|
|
7100
|
+
const fact = ts.isCallExpression(call) ? sourceInvocationFacts.get(call) : undefined;
|
|
7101
|
+
// A Script Function is also a property of the actual global object.
|
|
7102
|
+
// Binding integrity does not close its callers once that object enters
|
|
7103
|
+
// argument storage: the source reference inventory does not count
|
|
7104
|
+
// calls obtained from those implicit properties. Reject the conditional
|
|
7105
|
+
// frame using the same finalized identity graph that follows arguments
|
|
7106
|
+
// actual arguments, including aliases forwarded through source parameters.
|
|
7107
|
+
// A logical receiver has its own complete receiverUses continuation above;
|
|
7108
|
+
// binding it to a known body is not an argument-storage publication. Its
|
|
7109
|
+
// writes, returns and opaque escapes remain in the receiver alias census.
|
|
7110
|
+
const publishesGlobalCallable = fact !== undefined &&
|
|
7111
|
+
requirements.some((requirement) => requirement.sourceGlobalBinding !== undefined) &&
|
|
7112
|
+
fact.operands.args.some((operand) => aliasFacts(unwrapErasedExpression(operand)).global);
|
|
7113
|
+
if (publishesGlobalCallable ||
|
|
7114
|
+
failedIntrinsicProtocolRequirements({ checker, identities, globalHostMutationTaint: tainted, isStandardLibraryDeclaration }, requirements).length > 0)
|
|
6608
7115
|
rejectedCallableProofs.add(call);
|
|
7116
|
+
}
|
|
6609
7117
|
const invocationFailed = rejectedCallableProofs.size > trustSeed.rejectedCallableProofs.size;
|
|
6610
7118
|
const distrustAll = written.every || unprovenSurfaceWrite !== undefined;
|
|
6611
7119
|
if (distrusted.length > 0 || (distrustAll && !trustSeed.all) || inheritedGrew || assumptionFailed || invocationFailed) {
|
|
@@ -6618,6 +7126,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6618
7126
|
objectPrototypeKeys: {
|
|
6619
7127
|
names: new Set([...trustSeed.objectPrototypeKeys.names, ...objectPrototypeKeys.names]),
|
|
6620
7128
|
numeric: trustSeed.objectPrototypeKeys.numeric || objectPrototypeKeys.numeric,
|
|
7129
|
+
programSymbols: trustSeed.objectPrototypeKeys.programSymbols === true || objectPrototypeKeys.programSymbols === true,
|
|
6621
7130
|
every: trustSeed.objectPrototypeKeys.every || objectPrototypeKeys.every
|
|
6622
7131
|
},
|
|
6623
7132
|
noComputedKeys: trustSeed.noComputedKeys || assumptionFailed,
|