@scriptc/compiler 0.4.6 → 0.4.7
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/ambient/node-fallback/events.d.ts +6 -1
- package/ambient/node-fallback/fs-promises.d.ts +1 -1
- package/ambient/node-fallback/fs.d.ts +54 -10
- package/ambient/node-fallback/http.d.ts +3 -1
- package/ambient/node-fallback/net.d.ts +19 -0
- package/ambient/node-fallback/querystring.d.ts +3 -3
- package/ambient/scriptc-node-fallback.d.ts +58 -13
- package/dist/backend/executable-features.js +13 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.d.ts +12 -1
- package/dist/backend/immutability.js +50 -4
- package/dist/backend/immutability.js.map +1 -1
- package/dist/backend/immutability.test.js +95 -1
- package/dist/backend/immutability.test.js.map +1 -1
- package/dist/backend/library-pack.js +2 -0
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/linker.d.ts +11 -0
- package/dist/backend/linker.js +31 -3
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/lld.d.ts +7 -2
- package/dist/backend/lld.js +5 -3
- package/dist/backend/lld.js.map +1 -1
- package/dist/backend/lld.test.js +10 -4
- package/dist/backend/lld.test.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.test.js +50 -1
- package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
- package/dist/backend/llvm/cpu-dispatch.js +6 -5
- package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +53 -1
- package/dist/backend/llvm/dyn.js +221 -9
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +1 -1
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-module.js +148 -50
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-statements.js +39 -19
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +29 -2
- package/dist/backend/llvm/emitter.js +86 -7
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +4 -1
- package/dist/backend/llvm/expr-calls.js +20 -4
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +209 -16
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +94 -11
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.d.ts +8 -0
- package/dist/backend/llvm/expr-stream-bridges.js +42 -2
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +16 -0
- package/dist/backend/llvm/expr-stream-callbacks.js +206 -20
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/integer-values.d.ts +2 -0
- package/dist/backend/llvm/integer-values.js +6 -0
- package/dist/backend/llvm/integer-values.js.map +1 -1
- package/dist/backend/llvm/js-ic.d.ts +38 -0
- package/dist/backend/llvm/js-ic.js +295 -1
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +20 -0
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +116 -11
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +136 -24
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +70 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +67 -0
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/loop-entry-versions.d.ts +2 -2
- package/dist/backend/llvm/loop-entry-versions.js +43 -21
- package/dist/backend/llvm/loop-entry-versions.js.map +1 -1
- package/dist/backend/llvm/loop-state.d.ts +7 -1
- package/dist/backend/llvm/loop-state.js +20 -2
- package/dist/backend/llvm/loop-state.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +3 -1
- package/dist/backend/llvm/map-number-lookup.js +7 -3
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.js +52 -11
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
- package/dist/backend/llvm/receiver-brackets.test.d.ts +1 -0
- package/dist/backend/llvm/receiver-brackets.test.js +68 -0
- package/dist/backend/llvm/receiver-brackets.test.js.map +1 -0
- package/dist/backend/llvm/record-views.d.ts +22 -2
- package/dist/backend/llvm/record-views.js +139 -10
- package/dist/backend/llvm/record-views.js.map +1 -1
- package/dist/backend/llvm/record-views.test.js +76 -0
- package/dist/backend/llvm/record-views.test.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +1 -0
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +3 -0
- package/dist/backend/llvm/shapes.js +18 -3
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +4 -0
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.d.ts +10 -1
- package/dist/backend/llvm/speculative-integers.js +59 -8
- package/dist/backend/llvm/speculative-integers.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.d.ts +3 -3
- package/dist/backend/llvm/unwind-abi.js +8 -3
- package/dist/backend/llvm/unwind-abi.js.map +1 -1
- package/dist/backend/llvm/walkers.js +1 -1
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +54 -0
- package/dist/backend/native/executable.js +87 -5
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/library.js +1 -1
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native/runtime-inputs.js +5 -1
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native/vendor.js +1 -1
- package/dist/backend/native/vendor.js.map +1 -1
- package/dist/backend/native-codegen.js +3 -0
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +43 -0
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-link-info.js +1 -0
- package/dist/backend/native-link-info.js.map +1 -1
- package/dist/backend/native-profile.d.ts +4 -1
- package/dist/backend/native-profile.js +12 -1
- package/dist/backend/native-profile.js.map +1 -1
- package/dist/backend/native-profile.test.js +10 -0
- package/dist/backend/native-profile.test.js.map +1 -1
- package/dist/backend/publication.d.ts +4 -1
- package/dist/backend/publication.js +4 -2
- package/dist/backend/publication.js.map +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-core.d.ts +31 -7
- package/dist/backend/runtime-pack-core.js +21 -1
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-native.d.ts +18 -1
- package/dist/backend/runtime-pack-native.js +138 -29
- package/dist/backend/runtime-pack-native.js.map +1 -1
- package/dist/backend/runtime-pack-native.test.js +166 -4
- package/dist/backend/runtime-pack-native.test.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +3 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.d.ts +7 -0
- package/dist/backend/runtime-pack.js +25 -3
- package/dist/backend/runtime-pack.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +3 -11
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/vendor-archives.d.ts +4 -1
- package/dist/backend/vendor-archives.js +264 -3
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +36 -0
- package/dist/backend/vendor-inputs.js +42 -0
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/vendor-inputs.test.js +28 -1
- package/dist/backend/vendor-inputs.test.js.map +1 -1
- package/dist/backend/warm-cache.js +2 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +7 -1
- package/dist/compat/fetch-profile.js +23 -10
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +7 -0
- package/dist/contracts/check.d.ts +3 -0
- package/dist/contracts/check.js +18 -5
- package/dist/contracts/check.js.map +1 -1
- package/dist/coverage/surface-manifest.js +1 -1
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/codes.d.ts +6 -0
- package/dist/diagnostics/codes.js +6 -0
- package/dist/diagnostics/codes.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +50 -0
- package/dist/diagnostics/diagnostic.js +142 -3
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/dynamic-tier.js +3 -1
- package/dist/diagnostics/dynamic-tier.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +29 -0
- package/dist/executable/executable-cache.js +18 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +5 -1
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.d.ts +13 -3
- package/dist/executable/prepare.js +271 -18
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/early-errors.d.ts +14 -0
- package/dist/frontend/early-errors.js +305 -0
- package/dist/frontend/early-errors.js.map +1 -0
- package/dist/frontend/early-errors.test.d.ts +1 -0
- package/dist/frontend/early-errors.test.js +42 -0
- package/dist/frontend/early-errors.test.js.map +1 -0
- package/dist/frontend/inferred-js-diagnostics.test.js +23 -0
- package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
- package/dist/frontend/input-tracker.d.ts +47 -0
- package/dist/frontend/input-tracker.js +173 -36
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +86 -2
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/js-inference.d.ts +2 -0
- package/dist/frontend/js-inference.js +18 -0
- package/dist/frontend/js-inference.js.map +1 -0
- package/dist/frontend/lowering/binding-analysis.d.ts +2 -1
- package/dist/frontend/lowering/binding-analysis.js +65 -1
- package/dist/frontend/lowering/binding-analysis.js.map +1 -1
- package/dist/frontend/lowering/builtin-calls.js +9 -0
- package/dist/frontend/lowering/builtin-calls.js.map +1 -1
- package/dist/frontend/lowering/builtin-namespaces.d.ts +1 -1
- package/dist/frontend/lowering/builtin-namespaces.js +19 -2
- package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.d.ts +7 -0
- package/dist/frontend/lowering/builtins/child-process-methods.js +50 -10
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process.js +5 -1
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
- package/dist/frontend/lowering/builtins/dates.d.ts +1 -1
- package/dist/frontend/lowering/builtins/dates.js +23 -1
- package/dist/frontend/lowering/builtins/dates.js.map +1 -1
- package/dist/frontend/lowering/builtins/environment.d.ts +55 -0
- package/dist/frontend/lowering/builtins/environment.js +213 -2
- package/dist/frontend/lowering/builtins/environment.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js +47 -16
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem.d.ts +25 -7
- package/dist/frontend/lowering/builtins/filesystem.js +185 -16
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-calls.js +39 -2
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +8 -0
- package/dist/frontend/lowering/builtins/module-resolution.js +31 -5
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/operating-system.d.ts +3 -2
- package/dist/frontend/lowering/builtins/operating-system.js +5 -4
- package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.d.ts +17 -1
- package/dist/frontend/lowering/builtins/process.js +285 -19
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/querystring.d.ts +8 -0
- package/dist/frontend/lowering/builtins/querystring.js +202 -18
- package/dist/frontend/lowering/builtins/querystring.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.js +21 -3
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/reflection.js +60 -1
- package/dist/frontend/lowering/builtins/reflection.js.map +1 -1
- package/dist/frontend/lowering/builtins/text-codecs.js +208 -59
- package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.js +20 -1
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/builtins/v8.d.ts +5 -5
- package/dist/frontend/lowering/builtins/v8.js +7 -5
- package/dist/frontend/lowering/builtins/v8.js.map +1 -1
- package/dist/frontend/lowering/builtins/web-streams-dyn.d.ts +17 -2
- package/dist/frontend/lowering/builtins/web-streams-dyn.js +97 -9
- package/dist/frontend/lowering/builtins/web-streams-dyn.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.js +77 -0
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/cjs-exports-object.d.ts +3 -0
- package/dist/frontend/lowering/cjs-exports-object.js +1 -1
- package/dist/frontend/lowering/cjs-exports-object.js.map +1 -1
- package/dist/frontend/lowering/cjs-inline-require.js +5 -0
- package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +5 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +114 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.js +59 -10
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/class-runtime-statics.js +15 -0
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
- package/dist/frontend/lowering/class-views.d.ts +13 -0
- package/dist/frontend/lowering/class-views.js +51 -0
- package/dist/frontend/lowering/class-views.js.map +1 -0
- package/dist/frontend/lowering/coercions/function-adapters.d.ts +15 -1
- package/dist/frontend/lowering/coercions/function-adapters.js +54 -10
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +7 -0
- package/dist/frontend/lowering/coercions/state.js +7 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +60 -3
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +29 -1
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +8 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +132 -28
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +16 -5
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +16 -0
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +4 -0
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.d.ts +11 -0
- package/dist/frontend/lowering/containers/callback-arguments.js +53 -0
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/filter-predicates.d.ts +10 -0
- package/dist/frontend/lowering/containers/filter-predicates.js +69 -3
- package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +46 -2
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/expressions/array-literals.d.ts +14 -0
- package/dist/frontend/lowering/expressions/array-literals.js +26 -10
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +104 -12
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +121 -4
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +143 -3
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/keyed-field-targets.d.ts +11 -1
- package/dist/frontend/lowering/expressions/keyed-field-targets.js +22 -1
- package/dist/frontend/lowering/expressions/keyed-field-targets.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.js +25 -1
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +5 -1
- package/dist/frontend/lowering/expressions/object-literals.js +778 -229
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +66 -20
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +31 -0
- package/dist/frontend/lowering/expressions/property-access.js +796 -12
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +29 -1
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/typeof.js +17 -0
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +132 -17
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/frozen-records.d.ts +6 -0
- package/dist/frontend/lowering/frozen-records.js +10 -4
- package/dist/frontend/lowering/frozen-records.js.map +1 -1
- package/dist/frontend/lowering/frozen-records.test.d.ts +1 -0
- package/dist/frontend/lowering/frozen-records.test.js +44 -0
- package/dist/frontend/lowering/frozen-records.test.js.map +1 -0
- package/dist/frontend/lowering/function-names.d.ts +9 -0
- package/dist/frontend/lowering/function-names.js +95 -0
- package/dist/frontend/lowering/function-names.js.map +1 -0
- package/dist/frontend/lowering/function-returns.js +5 -3
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +49 -0
- package/dist/frontend/lowering/generic-functions.js +365 -7
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/global-values.d.ts +9 -0
- package/dist/frontend/lowering/global-values.js +44 -0
- package/dist/frontend/lowering/global-values.js.map +1 -1
- package/dist/frontend/lowering/handle-properties.js +34 -1
- package/dist/frontend/lowering/handle-properties.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.d.ts +54 -0
- package/dist/frontend/lowering/key-order-witness.js +546 -5
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.js +14 -0
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +110 -1
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.d.ts +36 -6
- package/dist/frontend/lowering/lower-builtin-values.js +332 -58
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +22 -1
- package/dist/frontend/lowering/lower-calls.js +427 -48
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.test.d.ts +1 -0
- package/dist/frontend/lowering/lower-calls.test.js +78 -0
- package/dist/frontend/lowering/lower-calls.test.js.map +1 -0
- package/dist/frontend/lowering/lower-classes.d.ts +16 -5
- package/dist/frontend/lowering/lower-classes.js +168 -51
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.d.ts +9 -0
- package/dist/frontend/lowering/lower-event-emitter.js +383 -41
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +14 -0
- package/dist/frontend/lowering/lower-exprs.js +25 -0
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +2 -0
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +80 -33
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +87 -25
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-node-island.d.ts +35 -4
- package/dist/frontend/lowering/lower-node-island.js +456 -61
- package/dist/frontend/lowering/lower-node-island.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +160 -9
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-shared-modules.js +13 -1
- package/dist/frontend/lowering/lower-shared-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +3 -2
- package/dist/frontend/lowering/lower-stdlib.js +32 -18
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +21 -4
- package/dist/frontend/lowering/lower-stmts.js +580 -103
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +126 -8
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +133 -21
- package/dist/frontend/lowering/lower-timers.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +139 -3
- package/dist/frontend/lowering/lowerer.js +579 -43
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +1 -1
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/module-namespace-elements.js +15 -0
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/new-target.js +2 -2
- package/dist/frontend/lowering/nullish-empty-pattern.d.ts +17 -0
- package/dist/frontend/lowering/nullish-empty-pattern.js +118 -0
- package/dist/frontend/lowering/nullish-empty-pattern.js.map +1 -0
- package/dist/frontend/lowering/partial-assertions.d.ts +39 -0
- package/dist/frontend/lowering/partial-assertions.js +195 -0
- package/dist/frontend/lowering/partial-assertions.js.map +1 -0
- package/dist/frontend/lowering/primitive-wrappers.d.ts +34 -0
- package/dist/frontend/lowering/primitive-wrappers.js +220 -0
- package/dist/frontend/lowering/primitive-wrappers.js.map +1 -0
- package/dist/frontend/lowering/private-statics.d.ts +46 -0
- package/dist/frontend/lowering/private-statics.js +322 -0
- package/dist/frontend/lowering/private-statics.js.map +1 -0
- package/dist/frontend/lowering/record-sources.d.ts +12 -1
- package/dist/frontend/lowering/record-sources.js +60 -0
- package/dist/frontend/lowering/record-sources.js.map +1 -1
- package/dist/frontend/lowering/strict-equality.d.ts +4 -0
- package/dist/frontend/lowering/strict-equality.js +14 -0
- package/dist/frontend/lowering/strict-equality.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +27 -0
- package/dist/frontend/lowering/surfaces.js +135 -62
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/unit-journal.d.ts +128 -17
- package/dist/frontend/lowering/unit-journal.js +310 -53
- package/dist/frontend/lowering/unit-journal.js.map +1 -1
- package/dist/frontend/lowering/unit-journal.test.js +91 -3
- package/dist/frontend/lowering/unit-journal.test.js.map +1 -1
- package/dist/frontend/lowering/unit-reuse.d.ts +92 -0
- package/dist/frontend/lowering/unit-reuse.js +1008 -0
- package/dist/frontend/lowering/unit-reuse.js.map +1 -0
- package/dist/frontend/lowering/width-lift.d.ts +12 -0
- package/dist/frontend/npm-file-import.test.d.ts +1 -0
- package/dist/frontend/npm-file-import.test.js +76 -0
- package/dist/frontend/npm-file-import.test.js.map +1 -0
- package/dist/frontend/npm-static.js +17 -2
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +9 -0
- package/dist/frontend/npm.js +82 -0
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/pipeline-native.js +2 -1
- package/dist/frontend/pipeline-native.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +4 -0
- package/dist/frontend/pipeline.js +68 -7
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program-node.d.ts +3 -0
- package/dist/frontend/program-node.js +13 -6
- package/dist/frontend/program-node.js.map +1 -1
- package/dist/frontend/program.d.ts +9 -0
- package/dist/frontend/program.js +159 -7
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/provenance-core.js +4 -0
- package/dist/frontend/provenance-core.js.map +1 -1
- package/dist/frontend/services.d.ts +14 -0
- package/dist/frontend/services.js +52 -2
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/services.test.js +61 -1
- package/dist/frontend/services.test.js.map +1 -1
- package/dist/frontend/shape-inference/analyze.d.ts +5 -0
- package/dist/frontend/shape-inference/analyze.js +104 -4
- package/dist/frontend/shape-inference/analyze.js.map +1 -1
- package/dist/frontend/shape-inference/domain.js +0 -1
- package/dist/frontend/shape-inference/domain.js.map +1 -1
- package/dist/frontend/shape-inference/index.js +5 -1
- package/dist/frontend/shape-inference/index.js.map +1 -1
- package/dist/frontend/shape-inference/memo.d.ts +2 -1
- package/dist/frontend/shape-inference/memo.js +6 -2
- package/dist/frontend/shape-inference/memo.js.map +1 -1
- package/dist/frontend/shape-inference/overlay.d.ts +1 -1
- package/dist/frontend/shape-inference/overlay.js +116 -2
- package/dist/frontend/shape-inference/overlay.js.map +1 -1
- package/dist/frontend/shape-inference/static-objects.js +11 -6
- package/dist/frontend/shape-inference/static-objects.js.map +1 -1
- package/dist/frontend/source-phase-imports.test.d.ts +1 -0
- package/dist/frontend/source-phase-imports.test.js +37 -0
- package/dist/frontend/source-phase-imports.test.js.map +1 -0
- package/dist/frontend/ts7/ast-node.d.ts +6 -1
- package/dist/frontend/ts7/ast-node.js +12 -0
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-wire-protocols.test.js +11 -3
- package/dist/frontend/ts7/ast-wire-protocols.test.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.js +3 -5
- package/dist/frontend/ts7/ast-wire.js.map +1 -1
- package/dist/frontend/ts7/checker-backend.d.ts +13 -0
- package/dist/frontend/ts7/checker-backend.js +84 -2
- package/dist/frontend/ts7/checker-backend.js.map +1 -1
- package/dist/frontend/ts7/checker-backend.test.js +126 -2
- package/dist/frontend/ts7/checker-backend.test.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +22 -1
- package/dist/frontend/ts7/program-host.js +49 -4
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/program-host.test.js +83 -0
- package/dist/frontend/ts7/program-host.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-process.d.ts +16 -1
- package/dist/frontend/ts7/rpc-process.js +170 -92
- package/dist/frontend/ts7/rpc-process.js.map +1 -1
- package/dist/frontend/ts7/rpc-process.test.js +49 -21
- package/dist/frontend/ts7/rpc-process.test.js.map +1 -1
- package/dist/frontend/tsc-codes.js +70 -0
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +7 -2
- package/dist/frontend/type-mapper.js +148 -1
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +152 -8
- package/dist/index.js.map +1 -1
- package/dist/ir/api.d.ts +1 -1
- package/dist/ir/api.js +1 -1
- package/dist/ir/api.js.map +1 -1
- package/dist/ir/build.d.ts +3 -2
- package/dist/ir/build.js +4 -2
- package/dist/ir/build.js.map +1 -1
- package/dist/ir/builtin-effects.js +53 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +211 -10
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/codec.d.ts +82 -0
- package/dist/ir/codec.generated.d.ts +13 -0
- package/dist/ir/codec.generated.js +5274 -0
- package/dist/ir/codec.generated.js.map +1 -0
- package/dist/ir/codec.js +325 -0
- package/dist/ir/codec.js.map +1 -0
- package/dist/ir/codec.test.d.ts +1 -0
- package/dist/ir/codec.test.js +225 -0
- package/dist/ir/codec.test.js.map +1 -0
- package/dist/ir/fields.generated.d.ts +20 -10
- package/dist/ir/fields.generated.js +1031 -11
- package/dist/ir/fields.generated.js.map +1 -1
- package/dist/ir/fields.test.js +46 -2
- package/dist/ir/fields.test.js.map +1 -1
- package/dist/ir/function-references.d.ts +5 -4
- package/dist/ir/function-references.js +8 -4
- package/dist/ir/function-references.js.map +1 -1
- package/dist/ir/function-references.test.js +7 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/inline-array-sources.js +4 -1
- package/dist/ir/inline-array-sources.js.map +1 -1
- package/dist/ir/inline-array-views.d.ts +13 -0
- package/dist/ir/inline-array-views.js +944 -0
- package/dist/ir/inline-array-views.js.map +1 -0
- package/dist/ir/inline-arrays.d.ts +7 -0
- package/dist/ir/inline-arrays.js +190 -55
- package/dist/ir/inline-arrays.js.map +1 -1
- package/dist/ir/inline-arrays.test.js +140 -2
- package/dist/ir/inline-arrays.test.js.map +1 -1
- package/dist/ir/integer-ranges.js +16 -6
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/ir.d.ts +75 -44
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/js-ic.d.ts +10 -9
- package/dist/ir/js-ic.js +28 -20
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +10 -2
- package/dist/ir/js-ic.test.js.map +1 -1
- package/dist/ir/jsval.js +374 -63
- package/dist/ir/jsval.js.map +1 -1
- package/dist/ir/jsval.test.js +96 -2
- package/dist/ir/jsval.test.js.map +1 -1
- package/dist/ir/loop-entry-ranges.js +112 -9
- package/dist/ir/loop-entry-ranges.js.map +1 -1
- package/dist/ir/loop-entry-ranges.test.js +40 -0
- package/dist/ir/loop-entry-ranges.test.js.map +1 -1
- package/dist/ir/parameter-versions.d.ts +2 -1
- package/dist/ir/parameter-versions.js +3 -1
- package/dist/ir/parameter-versions.js.map +1 -1
- package/dist/ir/receiver-readers.js +58 -2
- package/dist/ir/receiver-readers.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +60 -1
- package/dist/ir/runtime-features.js +277 -2
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/runtime-features.test.js +165 -1
- package/dist/ir/runtime-features.test.js.map +1 -1
- package/dist/ir/saturating-loop-jams.d.ts +8 -1
- package/dist/ir/saturating-loop-jams.js +46 -7
- package/dist/ir/saturating-loop-jams.js.map +1 -1
- package/dist/ir/saturating-loop-jams.test.js +39 -1
- package/dist/ir/saturating-loop-jams.test.js.map +1 -1
- package/dist/ir/self-captures.js +8 -1
- package/dist/ir/self-captures.js.map +1 -1
- package/dist/ir/self-captures.test.js +15 -0
- package/dist/ir/self-captures.test.js.map +1 -1
- package/dist/ir/serialize.d.ts +3 -2
- package/dist/ir/serialize.js +6 -2
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/validate.js +82 -4
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +46 -0
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/ir-policy.js +3 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/native/cache.js +2 -0
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cli.js +2 -0
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +8 -2
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/prepare.js +32 -3
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.js +53 -3
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +88 -2
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/toolchain.js +9 -2
- package/dist/native/toolchain.js.map +1 -1
- package/dist/node-islands/boundary.d.ts +25 -1
- package/dist/node-islands/boundary.js +28 -2
- package/dist/node-islands/boundary.js.map +1 -1
- package/dist/node-islands/detect.d.ts +18 -1
- package/dist/node-islands/detect.js +365 -40
- package/dist/node-islands/detect.js.map +1 -1
- package/dist/node-islands/detect.test.js +151 -4
- package/dist/node-islands/detect.test.js.map +1 -1
- package/dist/node-islands/effect-gate.js +30 -20
- package/dist/node-islands/effect-gate.js.map +1 -1
- package/dist/node-islands/effect-gate.test.js +4 -1
- package/dist/node-islands/effect-gate.test.js.map +1 -1
- package/dist/node-islands/libnode.d.ts +1 -1
- package/dist/node-islands/libnode.js +1 -1
- package/dist/node-islands/libnode.js.map +1 -1
- package/dist/node-islands/modules.d.ts +28 -0
- package/dist/node-islands/modules.js +156 -0
- package/dist/node-islands/modules.js.map +1 -1
- package/dist/node-islands/modules.test.js +105 -1
- package/dist/node-islands/modules.test.js.map +1 -1
- package/dist/node-islands/policy.js +2 -3
- package/dist/node-islands/policy.js.map +1 -1
- package/dist/node-islands/probe-recorder.d.ts +1 -0
- package/dist/node-islands/probe-recorder.js +596 -0
- package/dist/node-islands/probe-recorder.js.map +1 -0
- package/dist/node-islands/probe-recorder.test.d.ts +1 -0
- package/dist/node-islands/probe-recorder.test.js +80 -0
- package/dist/node-islands/probe-recorder.test.js.map +1 -0
- package/dist/node-islands/report.test.js +2 -0
- package/dist/node-islands/report.test.js.map +1 -1
- package/dist/node-islands/rules.js +4 -0
- package/dist/node-islands/rules.js.map +1 -1
- package/dist/node-islands/scan.d.ts +7 -1
- package/dist/node-islands/scan.js +51 -2
- package/dist/node-islands/scan.js.map +1 -1
- package/dist/node-islands/snapshot.d.ts +38 -1
- package/dist/node-islands/snapshot.js +165 -161
- package/dist/node-islands/snapshot.js.map +1 -1
- package/dist/node-islands/snapshot.test.js +63 -2
- package/dist/node-islands/snapshot.test.js.map +1 -1
- package/dist/node-islands/summary.js +8 -0
- package/dist/node-islands/summary.js.map +1 -1
- package/dist/node-islands/type-strip.d.ts +11 -0
- package/dist/node-islands/type-strip.js +157 -0
- package/dist/node-islands/type-strip.js.map +1 -0
- package/dist/node-islands/type-strip.test.d.ts +1 -0
- package/dist/node-islands/type-strip.test.js +31 -0
- package/dist/node-islands/type-strip.test.js.map +1 -0
- package/dist/project-config.d.ts +4 -0
- package/dist/project-config.js +19 -0
- package/dist/project-config.js.map +1 -1
- package/dist/project-config.test.js +10 -0
- package/dist/project-config.test.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +43 -11
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { programCreatesWrappers } from "./primitive-wrappers.js";
|
|
1
2
|
import { arrayClassMemberOwner, arrayClassReceiver, lowerArrayClassStaticCall, } from "./builtins/array-classes.js";
|
|
2
3
|
import { structuralCallInstance } from "./structural-instances.js";
|
|
4
|
+
import { classViewOf } from "./class-views.js";
|
|
3
5
|
import { checkedPrivateMethodReceiver, privateNameClass } from "./private-brands.js";
|
|
6
|
+
import { lowerStaticPrivateCall } from "./private-statics.js";
|
|
4
7
|
import { assertFunctionAliasOf } from "./lower-assert.js";
|
|
5
8
|
import { keyedHelperName } from "./stable-names.js";
|
|
6
9
|
import { perKeyOrder } from "./key-order-witness.js";
|
|
@@ -38,7 +41,7 @@ import { lowerClassSymbolMethodCall } from "./symbol-methods.js";
|
|
|
38
41
|
import { lowerReadlineDisposeCall } from "./builtins/readline.js";
|
|
39
42
|
import { errorToStringCall } from "./error-methods.js";
|
|
40
43
|
import { lowerClassPrototypeAssign, lowerClassPrototypeDescriptors } from "./class-prototypes.js";
|
|
41
|
-
import { BYTES_ELEMENT_NAME, BYTES_U8, BIGINT_T, BOOL, CAUGHT, DYN, DYN_HANDLE_KINDS, F64, NULL_T, STRING, SYMBOL_T, UNDEFINED_T, VOID, arrayOf, canBoxFuncIntoDyn, canConvertToDyn, canDynCheckTo, funcOf, isDynTypedRefType, isUnitType, shapeHasAccessorSlots, shapeKeyOrders, typeEquals, RUNTIME_EMITTER_CLASS, } from "../../ir/ir.js";
|
|
44
|
+
import { BYTES_ELEMENT_NAME, BYTES_U8, BIGINT_T, BOOL, CAUGHT, DYN, DYN_HANDLE_KINDS, F64, NULL_T, STRING, SYMBOL_T, UNDEFINED_T, VOID, arrayOf, canBoxFuncIntoDyn, canConvertToDyn, canDynCheckTo, funcOf, isDynTypedRefType, isUnitType, recordTextCodecClass, shapeHasAccessorSlots, shapeKeyOrders, typeEquals, RUNTIME_EMITTER_CLASS, } from "../../ir/ir.js";
|
|
42
45
|
import { lowerProtocolMethodCall } from "./class-protocol-dispatch.js";
|
|
43
46
|
import { isJsSourceFile, locOf, requireSpecOf } from "../program.js";
|
|
44
47
|
import { isPackageShimFile, isShimIntrinsicName } from "../package-shims.js";
|
|
@@ -56,6 +59,7 @@ import { lowerGeneratorHelperCall, lowerHelperReturnCall, lowerIteratorFromCall,
|
|
|
56
59
|
import { lowerObjectAssignIndexShape, lowerObjectConstructor, lowerObjectFromEntriesCall, lowerObjectIterOverIndexShape, } from "./containers/indexed-objects.js";
|
|
57
60
|
import { lowerTupleReadMethodCall } from "./containers/array-methods.js";
|
|
58
61
|
import { tryFuseIndexRead } from "./array-values.js";
|
|
62
|
+
import { isPrimitivePrototypeRead } from "./expressions/property-access.js";
|
|
59
63
|
import { lowerBufferConstruct, lowerBytesPrototypeSetCall, lowerBytesStaticCall, } from "./containers/bytes.js";
|
|
60
64
|
import { lowerRegexMethodCall, lowerStringIndexCall, lowerStringMethodCall, lowerStringPaddingCall, lowerStringSplitCall, isDynPrimitiveKindMethod, lowerDynPrimitiveMethodCall, lowerExtraNumberMethodCall, } from "./containers/string-and-regexp.js";
|
|
61
65
|
import { createRequireSpecOf } from "./builtins/module-bindings.js";
|
|
@@ -69,7 +73,7 @@ import { lowerDirentMethodCall, lowerFileHandleMethodCall, lowerDirMethodCall, l
|
|
|
69
73
|
import { fencePerfEntryKeyWalk, isPerfEntryType, lowerHistogramMethodCall, lowerPerfHooksCall, perfEntryTag, } from "./builtins/performance.js";
|
|
70
74
|
import { fenceX509KeyWalk } from "./builtins/x509.js";
|
|
71
75
|
import { lowerProcStreamMethodCall, lowerProcessBuiltinModuleNamespace, } from "./builtins/process.js";
|
|
72
|
-
import { recordMayKeepSource, throughRecordSource } from "./record-sources.js";
|
|
76
|
+
import { recordMayKeepSource, recordSourceTest, throughRecordSource } from "./record-sources.js";
|
|
73
77
|
import { lowerReflectCall } from "./builtins/reflection.js";
|
|
74
78
|
import { lowerAbsenceProbe, v8CalleeText, lowerPromiseAllTupleCall, lowerPromiseRejectCall, lowerToNumberArgument, stringWrapperToString, symbolFieldInfo, templateRawTextOf, primitiveCtorClosure, } from "./lower-exprs.js";
|
|
75
79
|
import { isSafeToDiscard } from "./expressions/evaluation-safety.js";
|
|
@@ -88,7 +92,8 @@ import { lowerConsoleInstanceCall, lowerConsoleMethodCall, lowerConsoleOutput, }
|
|
|
88
92
|
import { STREAM_API_MEMBERS, STREAM_OPERATORS, lowerStreamMethodCall, lowerStreamStaticCall, streamSidesOf, } from "./lower-stream.js";
|
|
89
93
|
import { ambientNsRootOf, ambientUndefReadType, ambientUndefVarRootOf, ambientUndefinedFnSymbolOf, contextualUndefReadType, fenceEarlyAliasUse, fenceEarlyNsMemberRef, nsMemberIdentOf, nsUndefRead, } from "./lower-namespaces.js";
|
|
90
94
|
import { expandoMemberRead } from "./lower-expando.js";
|
|
91
|
-
import { fenceNodeModuleMutationCall, lowerRequireCacheKeys } from "./lower-node-module.js";
|
|
95
|
+
import { fenceNodeModuleMutationCall, isCjsRequireGlobal, lowerRequireCacheKeys, } from "./lower-node-module.js";
|
|
96
|
+
import { pathModuleValue } from "./lower-builtin-values.js";
|
|
92
97
|
import { defaultAfterUndefined, lowerOptionalArgument, lowerStaticallyUndefinedArgument, positionNumber, } from "./optional-arguments.js";
|
|
93
98
|
import { fenceSymbolFieldCopy } from "./symbol-fields.js";
|
|
94
99
|
import { lowerClassDataDescriptor, lowerClassDescriptorRead } from "./class-descriptors.js";
|
|
@@ -106,6 +111,7 @@ import { maybePromiseReturnStmt, promiseArmedUnionOf, promiseOrUnitUnionOf, } fr
|
|
|
106
111
|
import { requireObjLitGenericReceiver, objLitGenericFnNodeOf, objLitGenericFnInfoOf, genericCallInstance, } from "./generic-functions.js";
|
|
107
112
|
import { codeGenerationCalleeOf, lowerCodeGenerationCall } from "./code-generation.js";
|
|
108
113
|
import { lowerRecordInheritedCall } from "./record-inherited.js";
|
|
114
|
+
import { fenceDatePrototypeWriteCall } from "./expressions/property-access.js";
|
|
109
115
|
const ZLIB_STREAM_METHODS = new Set(["flush", "params", "close", "reset"]);
|
|
110
116
|
/** The node:util member a `(0, member)` callee names, or null. */
|
|
111
117
|
function indirectUtilCalleeOf(lowerer, callee) {
|
|
@@ -269,6 +275,20 @@ export function lowerCall(lowerer, expr) {
|
|
|
269
275
|
if (inlineValue)
|
|
270
276
|
return inlineValue;
|
|
271
277
|
}
|
|
278
|
+
// `require("path/posix")` of a builtin as a value: the module's
|
|
279
|
+
// namespace, as a `const posix = require("path/posix")` binding is.
|
|
280
|
+
if (ts.isIdentifier(expr.expression) &&
|
|
281
|
+
expr.expression.text === "require" &&
|
|
282
|
+
isCjsRequireGlobal(lowerer, expr.expression)) {
|
|
283
|
+
const module = lowerer.builtinNamespaceModuleOf(expr);
|
|
284
|
+
// The platform namespaces are the path module objects.
|
|
285
|
+
if (module === "path/posix" || module === "path/win32")
|
|
286
|
+
return pathModuleValue(lowerer, module, loc);
|
|
287
|
+
if (module !== null && module !== "constants") {
|
|
288
|
+
const moduleId = `builtin:${module}`;
|
|
289
|
+
return { kind: "moduleNsRef", moduleId, type: { kind: "moduleNs", moduleId }, loc };
|
|
290
|
+
}
|
|
291
|
+
}
|
|
272
292
|
// A call whose chain ROOTS at an ambient-undefined name (`declare
|
|
273
293
|
// const value: Y | undefined; value?.foo("a")`, `declare function
|
|
274
294
|
// chain...; chain(o).mapValues(f).value()`, a trap binding's read):
|
|
@@ -441,6 +461,9 @@ export function lowerCall(lowerer, expr) {
|
|
|
441
461
|
if (ts.isPropertyAccessExpression(expr.expression) &&
|
|
442
462
|
ts.isPrivateIdentifier(expr.expression.name) &&
|
|
443
463
|
!expr.expression.questionDotToken) {
|
|
464
|
+
const staticPrivate = lowerStaticPrivateCall(lowerer, expr, expr.expression);
|
|
465
|
+
if (staticPrivate)
|
|
466
|
+
return staticPrivate;
|
|
444
467
|
const privateCall = lowerCheckedPrivateMethodCall(lowerer, expr, expr.expression);
|
|
445
468
|
if (privateCall)
|
|
446
469
|
return privateCall;
|
|
@@ -1561,6 +1584,11 @@ export function lowerCall(lowerer, expr) {
|
|
|
1561
1584
|
lowerer.unsupported("SC1090", expr, `calls of the generic method '${expr.expression.name.text}' through this receiver (no compiled declaration with a body resolves statically here — ambient 'declare class' and interface-only methods are signature-only, and only class, static, and object-literal generic methods with bodies monomorphize)`);
|
|
1562
1585
|
}
|
|
1563
1586
|
}
|
|
1587
|
+
{
|
|
1588
|
+
const unionCall = lowerUnionReceiverMethodCall(lowerer, expr, expr.expression);
|
|
1589
|
+
if (unionCall)
|
|
1590
|
+
return unionCall;
|
|
1591
|
+
}
|
|
1564
1592
|
lowerer.unsupported("SC1090", expr, `method calls like '${ts.getTextOfNode(expr.expression)}'`);
|
|
1565
1593
|
}
|
|
1566
1594
|
// `s[Symbol.iterator]()` on a string: the string iterator as a value.
|
|
@@ -1753,7 +1781,7 @@ function callableInstanceStringCall(lowerer, expr, callee, loc) {
|
|
|
1753
1781
|
}
|
|
1754
1782
|
/** A call through an evaluated callee value: checked-dynamic callees,
|
|
1755
1783
|
* function unions, typed-rest and runtime-arity closures. */
|
|
1756
|
-
function lowerCallThroughValue(lowerer, expr, callee, loc) {
|
|
1784
|
+
export function lowerCallThroughValue(lowerer, expr, callee, loc) {
|
|
1757
1785
|
// A CHECKED-DYNAMIC callee — `fn(a, b)` where fn is an implicit-any
|
|
1758
1786
|
// JS binding (the mustCall body's `fn(...args)`), a dyn capture, or a
|
|
1759
1787
|
// keyed read off a dyn value: the dynCall boundary. Arguments convert
|
|
@@ -2283,8 +2311,12 @@ function objectToStringTag(lowerer, type) {
|
|
|
2283
2311
|
return "Symbol";
|
|
2284
2312
|
case "array":
|
|
2285
2313
|
return "Array";
|
|
2286
|
-
case "record":
|
|
2287
|
-
|
|
2314
|
+
case "record": {
|
|
2315
|
+
// TextEncoder and TextDecoder define Symbol.toStringTag on their
|
|
2316
|
+
// prototypes.
|
|
2317
|
+
const shape = lowerer.shapes.get(type.shapeId);
|
|
2318
|
+
return (shape && recordTextCodecClass(shape)) ?? "Object";
|
|
2319
|
+
}
|
|
2288
2320
|
case "func":
|
|
2289
2321
|
case "classval":
|
|
2290
2322
|
return "Function";
|
|
@@ -2393,6 +2425,29 @@ function immediateObjectTagReceiver(lowerer, node) {
|
|
|
2393
2425
|
}
|
|
2394
2426
|
return null;
|
|
2395
2427
|
}
|
|
2428
|
+
/** Array.prototype methods whose `.<name>.call(receiver, ...)` form the
|
|
2429
|
+
* array-like unit runs generically when `receiver` is not a native array:
|
|
2430
|
+
* the rest of the prototype's methods besides the invoke unit's own set
|
|
2431
|
+
* (at, slice, indexOf, lastIndexOf, includes and the higher-order
|
|
2432
|
+
* callbacks). */
|
|
2433
|
+
const ARRAY_LIKE_BORROW_METHODS = new Set([
|
|
2434
|
+
"concat",
|
|
2435
|
+
"copyWithin",
|
|
2436
|
+
"fill",
|
|
2437
|
+
"flat",
|
|
2438
|
+
"flatMap",
|
|
2439
|
+
"join",
|
|
2440
|
+
"pop",
|
|
2441
|
+
"push",
|
|
2442
|
+
"reverse",
|
|
2443
|
+
"shift",
|
|
2444
|
+
"splice",
|
|
2445
|
+
"toReversed",
|
|
2446
|
+
"toSorted",
|
|
2447
|
+
"toSpliced",
|
|
2448
|
+
"unshift",
|
|
2449
|
+
"with",
|
|
2450
|
+
]);
|
|
2396
2451
|
const ARRAY_BORROW_METHODS = new Set([
|
|
2397
2452
|
"at",
|
|
2398
2453
|
"every",
|
|
@@ -2421,7 +2476,7 @@ function lowerArrayPrototypeBorrowCall(lowerer, call, access) {
|
|
|
2421
2476
|
return null;
|
|
2422
2477
|
const method = access.expression;
|
|
2423
2478
|
if (method.questionDotToken ||
|
|
2424
|
-
!ARRAY_BORROW_METHODS.has(method.name.text) ||
|
|
2479
|
+
!(ARRAY_BORROW_METHODS.has(method.name.text) || ARRAY_LIKE_BORROW_METHODS.has(method.name.text)) ||
|
|
2425
2480
|
!ts.isPropertyAccessExpression(method.expression) ||
|
|
2426
2481
|
method.expression.questionDotToken ||
|
|
2427
2482
|
method.expression.name.text !== "prototype" ||
|
|
@@ -2435,7 +2490,12 @@ function lowerArrayPrototypeBorrowCall(lowerer, call, access) {
|
|
|
2435
2490
|
const args = call.arguments.nodes.slice(1).map((arg) => lowerer.lowerExprExpecting(arg, DYN));
|
|
2436
2491
|
return {
|
|
2437
2492
|
kind: "libCall",
|
|
2438
|
-
|
|
2493
|
+
// The array-like unit runs an extended method's algorithm over a
|
|
2494
|
+
// receiver that is not a native array and delegates the rest to the
|
|
2495
|
+
// invoke unit's dispatch.
|
|
2496
|
+
fn: ARRAY_LIKE_BORROW_METHODS.has(method.name.text)
|
|
2497
|
+
? "dyn.arrayLikeProtoCall"
|
|
2498
|
+
: "dyn.arrayProtoCall",
|
|
2439
2499
|
args: [
|
|
2440
2500
|
receiver,
|
|
2441
2501
|
{ kind: "strLit", value: method.name.text, type: STRING, loc },
|
|
@@ -3062,6 +3122,57 @@ function isFreshCallResult(node) {
|
|
|
3062
3122
|
e = e.expression;
|
|
3063
3123
|
return ts.isCallExpression(e);
|
|
3064
3124
|
}
|
|
3125
|
+
/** A METHOD call on a union receiver whose arms declare the member with
|
|
3126
|
+
* DIFFERENT signatures (`OAuthAuth | ApiKeyAuth` both declare `login`, one
|
|
3127
|
+
* with an options parameter): no single static signature picks an arm, and
|
|
3128
|
+
* JavaScript does not pick one either — it reads the property off the value
|
|
3129
|
+
* and calls it. Box the receiver into the checked-dynamic value and lower
|
|
3130
|
+
* the read and the call dynamically, so the member lookup and the call stay
|
|
3131
|
+
* checked (a missing member throws V8's own TypeError) and the result
|
|
3132
|
+
* crosses back through the expected type's checked conversion. Null when
|
|
3133
|
+
* the receiver is not a union of object/record arms with a dyn-safe layout,
|
|
3134
|
+
* leaving the method-call fence in place. */
|
|
3135
|
+
function lowerUnionReceiverMethodCall(lowerer, call, access) {
|
|
3136
|
+
if (access.questionDotToken || call.questionDotToken)
|
|
3137
|
+
return null;
|
|
3138
|
+
if (call.arguments.nodes.some(ts.isSpreadElement))
|
|
3139
|
+
return null;
|
|
3140
|
+
const value = tryLowerExpression(lowerer, access.expression);
|
|
3141
|
+
if (value?.type.kind !== "union")
|
|
3142
|
+
return null;
|
|
3143
|
+
const union = lowerer.unions.get(value.type.unionId);
|
|
3144
|
+
if (!union || !union.arms.every((arm) => arm.kind === "object" || arm.kind === "record")) {
|
|
3145
|
+
return null;
|
|
3146
|
+
}
|
|
3147
|
+
if (!lowerer.dynConvertible(value.type))
|
|
3148
|
+
return null;
|
|
3149
|
+
const loc = locOf(call);
|
|
3150
|
+
const boxed = lowerer.coerceToExpected(value, DYN);
|
|
3151
|
+
const local = lowerer.declareHiddenLocal("%unionReceiver", DYN);
|
|
3152
|
+
const receiver = { kind: "varRef", localId: local.id, type: DYN, loc };
|
|
3153
|
+
const member = {
|
|
3154
|
+
kind: "dynKeyGet",
|
|
3155
|
+
value: receiver,
|
|
3156
|
+
key: { kind: "strLit", value: access.name.text, type: STRING, loc },
|
|
3157
|
+
type: DYN,
|
|
3158
|
+
loc,
|
|
3159
|
+
};
|
|
3160
|
+
return {
|
|
3161
|
+
kind: "seqExpr",
|
|
3162
|
+
stmts: [{ kind: "varDecl", localId: local.id, init: boxed, loc }],
|
|
3163
|
+
result: {
|
|
3164
|
+
kind: "dynCall",
|
|
3165
|
+
callee: member,
|
|
3166
|
+
receiver,
|
|
3167
|
+
calleeName: ts.getTextOfNode(access),
|
|
3168
|
+
args: call.arguments.nodes.map((arg) => lowerer.lowerExprExpecting(arg, DYN)),
|
|
3169
|
+
type: DYN,
|
|
3170
|
+
loc,
|
|
3171
|
+
},
|
|
3172
|
+
type: DYN,
|
|
3173
|
+
loc,
|
|
3174
|
+
};
|
|
3175
|
+
}
|
|
3065
3176
|
/** METHOD calls on dyn receivers (`pkg.name.replace(...)`, `rawName.split`,
|
|
3066
3177
|
* `ws.packages.filter(...)` — JSON.parse-derived values): validate the
|
|
3067
3178
|
* receiver's dyn kind, extract, and ride the STATIC method machinery — the
|
|
@@ -3277,6 +3388,12 @@ function lowerDynReceiverMethodCall(lowerer, call, access, boxTypedTemporary = f
|
|
|
3277
3388
|
recv = lowerer.coerceToExpected(recv, DYN);
|
|
3278
3389
|
if (recv.type.kind !== "dyn")
|
|
3279
3390
|
return null;
|
|
3391
|
+
// `Number.prototype.m(...)` reads the prototype OBJECT, whose `m` is its
|
|
3392
|
+
// own member, so every primitive specialization below — which assumes a
|
|
3393
|
+
// primitive receiver and coerces the value it is given — would be wrong.
|
|
3394
|
+
// The shared dispatch reads the member and calls it with the prototype as
|
|
3395
|
+
// `this`, which is Node's answer for the wrapper around +0 / false.
|
|
3396
|
+
const prototypeReceiver = isPrimitivePrototypeRead(lowerer, access.expression);
|
|
3280
3397
|
if (access.name.text === "normalize" &&
|
|
3281
3398
|
call.arguments.nodes.length <= 1 &&
|
|
3282
3399
|
!call.arguments.nodes.some(ts.isSpreadElement)) {
|
|
@@ -3383,7 +3500,7 @@ function lowerDynReceiverMethodCall(lowerer, call, access, boxTypedTemporary = f
|
|
|
3383
3500
|
// prototype declares (Array carries includes/indexOf/slice too), so no
|
|
3384
3501
|
// other kind inherits them. Shared names would need a receiver-kind
|
|
3385
3502
|
// dispatch — they keep the fence.
|
|
3386
|
-
if (DYN_STRING_ONLY_METHODS.has(access.name.text) && !ownCallable) {
|
|
3503
|
+
if (DYN_STRING_ONLY_METHODS.has(access.name.text) && !ownCallable && !prototypeReceiver) {
|
|
3387
3504
|
// A checked-dynamic object can still carry its OWN member of that
|
|
3388
3505
|
// name: zod's schemas assign `trim`, `toLowerCase` and `startsWith`
|
|
3389
3506
|
// in their constructors (`z.string().trim().min(1)`), an object's
|
|
@@ -3394,9 +3511,10 @@ function lowerDynReceiverMethodCall(lowerer, call, access, boxTypedTemporary = f
|
|
|
3394
3511
|
// receiver's runtime kind: a string runs the string lowering, anything
|
|
3395
3512
|
// else calls its member as Node does.
|
|
3396
3513
|
if ((checkerUntyped ||
|
|
3397
|
-
(lowerer.typeOf(access).flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) !== 0
|
|
3398
|
-
|
|
3399
|
-
|
|
3514
|
+
(lowerer.typeOf(access).flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) !== 0 ||
|
|
3515
|
+
// A receiver of the boxed String type may be a wrapper object.
|
|
3516
|
+
(lowerer.createsWrappers ??= programCreatesWrappers(lowerer))) &&
|
|
3517
|
+
!lowerer.chainBlocked(call, access) &&
|
|
3400
3518
|
!call.arguments.nodes.some(ts.isSpreadElement))
|
|
3401
3519
|
return lowerStringOrMemberCall(lowerer, call, access, recv);
|
|
3402
3520
|
const checked = () => dynStringReceiver(lowerer, recv, access);
|
|
@@ -3408,8 +3526,7 @@ function lowerDynReceiverMethodCall(lowerer, call, access, boxTypedTemporary = f
|
|
|
3408
3526
|
// or number receiver runs the typed lowering, every other kind keeps the
|
|
3409
3527
|
// runtime dispatch.
|
|
3410
3528
|
if (!ownCallable &&
|
|
3411
|
-
!
|
|
3412
|
-
!access.questionDotToken &&
|
|
3529
|
+
!prototypeReceiver &&
|
|
3413
3530
|
isDynPrimitiveKindMethod(access.name.text) &&
|
|
3414
3531
|
!lowerer.chainBlocked(access, call)) {
|
|
3415
3532
|
const primitive = lowerDynPrimitiveMethodCall(lowerer, call, access.name.text, ts.getTextOfNode(access), recv);
|
|
@@ -3423,6 +3540,7 @@ function lowerDynReceiverMethodCall(lowerer, call, access, boxTypedTemporary = f
|
|
|
3423
3540
|
if (access.name.text === "toString" &&
|
|
3424
3541
|
call.arguments.nodes.length <= 1 &&
|
|
3425
3542
|
!ownCallable &&
|
|
3543
|
+
!prototypeReceiver &&
|
|
3426
3544
|
!(checkerUntyped && jsAssignsOwnToString(lowerer, access.expression))) {
|
|
3427
3545
|
const argument = call.arguments.nodes[0];
|
|
3428
3546
|
return {
|
|
@@ -3440,7 +3558,7 @@ function lowerDynReceiverMethodCall(lowerer, call, access, boxTypedTemporary = f
|
|
|
3440
3558
|
// Every dyn kind's prototype chain declares valueOf, and the runtime
|
|
3441
3559
|
// answers each kind's own: primitives and plain objects themselves, a
|
|
3442
3560
|
// Date its time value, an own or inherited valueOf member its result.
|
|
3443
|
-
if (access.name.text === "valueOf" && call.arguments.nodes.length === 0) {
|
|
3561
|
+
if (access.name.text === "valueOf" && call.arguments.nodes.length === 0 && !prototypeReceiver) {
|
|
3444
3562
|
const webAssembly = lowerWebAssemblyValueOf(lowerer, access.expression, recv, locOf(call));
|
|
3445
3563
|
if (webAssembly !== null)
|
|
3446
3564
|
return webAssembly;
|
|
@@ -3537,9 +3655,13 @@ function lowerDynReceiverMethodCall(lowerer, call, access, boxTypedTemporary = f
|
|
|
3537
3655
|
!ownToString &&
|
|
3538
3656
|
!stringOnlyName)
|
|
3539
3657
|
return null;
|
|
3540
|
-
//
|
|
3541
|
-
// machinery's short-circuit semantics
|
|
3542
|
-
|
|
3658
|
+
// An UNHANDLED `?.` step (`obj.cb?.()`, `obj?.cb()`) belongs to the chain
|
|
3659
|
+
// machinery's short-circuit semantics. Inside the guarded body of a chain
|
|
3660
|
+
// the active lowering has ALREADY proven the receiver present, so the
|
|
3661
|
+
// step is a plain read-and-call there — the same "read the member, call
|
|
3662
|
+
// it" shape below, with `dynCall` throwing Node's catchable
|
|
3663
|
+
// "obj.cb is not a function" for a present but non-callable member.
|
|
3664
|
+
if (lowerer.chainBlocked(call, access))
|
|
3543
3665
|
return null;
|
|
3544
3666
|
const loc = locOf(call);
|
|
3545
3667
|
const receiverLocal = lowerer.declareHiddenLocal("%dynCallReceiver", DYN);
|
|
@@ -3604,7 +3726,24 @@ function lowerStringOrMemberCall(lowerer, call, access, recv) {
|
|
|
3604
3726
|
const loc = locOf(call);
|
|
3605
3727
|
const receiverLocal = lowerer.declareHiddenLocal("%dynCallReceiver", DYN);
|
|
3606
3728
|
const receiver = varRef(receiverLocal.id, DYN, loc);
|
|
3607
|
-
const
|
|
3729
|
+
const nameLit = { kind: "strLit", value: access.name.text, type: STRING, loc };
|
|
3730
|
+
const receiverIsString = {
|
|
3731
|
+
kind: "dynTest",
|
|
3732
|
+
test: "string",
|
|
3733
|
+
value: receiver,
|
|
3734
|
+
type: BOOL,
|
|
3735
|
+
loc,
|
|
3736
|
+
};
|
|
3737
|
+
// In a program that creates wrapper objects, a receiver whose member is
|
|
3738
|
+
// the builtin String.prototype method runs the string lowering on
|
|
3739
|
+
// ToString of the receiver, after the arguments, as the builtin does.
|
|
3740
|
+
// The member is read once: the check inspects the value the call read.
|
|
3741
|
+
const wrappers = (lowerer.createsWrappers ??= programCreatesWrappers(lowerer));
|
|
3742
|
+
const builtinLocal = wrappers ? lowerer.declareHiddenLocal("%dynCallStringMethod", BOOL) : null;
|
|
3743
|
+
const isString = builtinLocal
|
|
3744
|
+
? { kind: "varRef", localId: builtinLocal.id, type: BOOL, loc }
|
|
3745
|
+
: receiverIsString;
|
|
3746
|
+
const stringLocal = wrappers ? lowerer.declareHiddenLocal("%dynCallString", DYN) : null;
|
|
3608
3747
|
const calleeLocal = lowerer.declareHiddenLocal("%dynCallCallee", DYN);
|
|
3609
3748
|
const callee = varRef(calleeLocal.id, DYN, loc);
|
|
3610
3749
|
const stmts = [
|
|
@@ -3614,7 +3753,7 @@ function lowerStringOrMemberCall(lowerer, call, access, recv) {
|
|
|
3614
3753
|
localId: calleeLocal.id,
|
|
3615
3754
|
init: {
|
|
3616
3755
|
kind: "ternary",
|
|
3617
|
-
cond:
|
|
3756
|
+
cond: receiverIsString,
|
|
3618
3757
|
then: dynUndefinedExpr(loc),
|
|
3619
3758
|
else_: {
|
|
3620
3759
|
kind: "dynKeyGet",
|
|
@@ -3628,16 +3767,52 @@ function lowerStringOrMemberCall(lowerer, call, access, recv) {
|
|
|
3628
3767
|
},
|
|
3629
3768
|
loc,
|
|
3630
3769
|
},
|
|
3770
|
+
...(builtinLocal
|
|
3771
|
+
? [
|
|
3772
|
+
{
|
|
3773
|
+
kind: "varDecl",
|
|
3774
|
+
localId: builtinLocal.id,
|
|
3775
|
+
init: {
|
|
3776
|
+
kind: "logical",
|
|
3777
|
+
op: "||",
|
|
3778
|
+
left: receiverIsString,
|
|
3779
|
+
right: {
|
|
3780
|
+
kind: "libCall",
|
|
3781
|
+
fn: "wrapper.isStringMethod",
|
|
3782
|
+
args: [callee, nameLit],
|
|
3783
|
+
type: BOOL,
|
|
3784
|
+
loc,
|
|
3785
|
+
},
|
|
3786
|
+
type: BOOL,
|
|
3787
|
+
loc,
|
|
3788
|
+
},
|
|
3789
|
+
loc,
|
|
3790
|
+
},
|
|
3791
|
+
]
|
|
3792
|
+
: []),
|
|
3631
3793
|
];
|
|
3632
3794
|
const args = call.arguments.nodes.map((node) => {
|
|
3633
|
-
const
|
|
3795
|
+
const lowered = lowerer.lowerExpr(node);
|
|
3796
|
+
// A unit-typed argument (`f()` of a void function, a literal undefined
|
|
3797
|
+
// or null) has no local storage of its own: hold it as the dynamic
|
|
3798
|
+
// value both branches receive.
|
|
3799
|
+
const value = lowered.type.kind === "void" ||
|
|
3800
|
+
lowered.type.kind === "undefinedT" ||
|
|
3801
|
+
lowered.type.kind === "nullT"
|
|
3802
|
+
? lowerer.coerceToExpected(lowered, DYN)
|
|
3803
|
+
: lowered;
|
|
3634
3804
|
const local = lowerer.declareHiddenLocal("%dynCallArg", value.type);
|
|
3635
3805
|
stmts.push({ kind: "varDecl", localId: local.id, init: value, loc: value.loc });
|
|
3636
3806
|
return { node, value: varRef(local.id, value.type, value.loc) };
|
|
3637
3807
|
});
|
|
3638
3808
|
// String.prototype methods ignore arguments past the ones they read.
|
|
3639
3809
|
const arity = DYN_STRING_ONLY_ARITY[access.name.text] ?? call.arguments.nodes.length;
|
|
3640
|
-
const stringReceiver = () => ({
|
|
3810
|
+
const stringReceiver = () => ({
|
|
3811
|
+
kind: "dynCheck",
|
|
3812
|
+
value: stringLocal ? varRef(stringLocal.id, DYN, loc) : receiver,
|
|
3813
|
+
type: STRING,
|
|
3814
|
+
loc,
|
|
3815
|
+
});
|
|
3641
3816
|
const lowerString = () => (call.arguments.nodes.length <= arity
|
|
3642
3817
|
? lowerRegexMethodCall(lowerer, call, access, stringReceiver)
|
|
3643
3818
|
: null) ??
|
|
@@ -3659,7 +3834,35 @@ function lowerStringOrMemberCall(lowerer, call, access, recv) {
|
|
|
3659
3834
|
kind: "ternary",
|
|
3660
3835
|
cond: isString,
|
|
3661
3836
|
then: stringCall
|
|
3662
|
-
?
|
|
3837
|
+
? stringLocal
|
|
3838
|
+
? {
|
|
3839
|
+
kind: "seqExpr",
|
|
3840
|
+
stmts: [
|
|
3841
|
+
{
|
|
3842
|
+
kind: "varDecl",
|
|
3843
|
+
localId: stringLocal.id,
|
|
3844
|
+
init: {
|
|
3845
|
+
kind: "ternary",
|
|
3846
|
+
cond: receiverIsString,
|
|
3847
|
+
then: receiver,
|
|
3848
|
+
else_: {
|
|
3849
|
+
kind: "libCall",
|
|
3850
|
+
fn: "wrapper.thisString",
|
|
3851
|
+
args: [receiver, nameLit],
|
|
3852
|
+
type: DYN,
|
|
3853
|
+
loc,
|
|
3854
|
+
},
|
|
3855
|
+
type: DYN,
|
|
3856
|
+
loc,
|
|
3857
|
+
},
|
|
3858
|
+
loc,
|
|
3859
|
+
},
|
|
3860
|
+
],
|
|
3861
|
+
result: lowerer.coerceToExpected(stringCall, DYN),
|
|
3862
|
+
type: DYN,
|
|
3863
|
+
loc,
|
|
3864
|
+
}
|
|
3865
|
+
: lowerer.coerceToExpected(stringCall, DYN)
|
|
3663
3866
|
: nodeThrowExpr(0, "SC1090", `method calls like '${ts.getTextOfNode(access)}' on a string are not supported yet [SC1090 at ${ts.getSourceFileOfNode(call).fileName}:${ts.getLineAndCharacterOfPosition(ts.getSourceFileOfNode(call), ts.tokenStartOfNode(call)).line + 1}]`, DYN, loc),
|
|
3664
3867
|
else_: memberCall,
|
|
3665
3868
|
type: DYN,
|
|
@@ -4713,17 +4916,57 @@ function lowerPrimitiveProtoCall(lowerer, call, recv, name, memberSym) {
|
|
|
4713
4916
|
}
|
|
4714
4917
|
// Number.prototype.toLocaleString("en-US") — the spec makes it
|
|
4715
4918
|
// NumberFormat(locale).format(this), so the en-US embedded formatter
|
|
4716
|
-
// answers exactly.
|
|
4717
|
-
//
|
|
4718
|
-
//
|
|
4919
|
+
// answers exactly. Without a locale (or with `undefined`) the DEFAULT
|
|
4920
|
+
// locale answers, over the ICU data scr_intl.c loads; other locales and
|
|
4921
|
+
// options bags stay fenced.
|
|
4719
4922
|
if (name === "toLocaleString" && recvKind === "f64") {
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4923
|
+
// Exactly undefined (or void): what the absent form means. A union that
|
|
4924
|
+
// merely includes undefined may hold a locale at run time and falls
|
|
4925
|
+
// through to the refusal below.
|
|
4926
|
+
const isUndefined = (node) => {
|
|
4927
|
+
const flags = lowerer.typeOf(node).flags;
|
|
4928
|
+
return flags === ts.TypeFlags.Undefined || flags === ts.TypeFlags.Void;
|
|
4929
|
+
};
|
|
4930
|
+
const defaultLocale = call.arguments.nodes.length === 0 ||
|
|
4931
|
+
(call.arguments.nodes.length === 1 &&
|
|
4932
|
+
!ts.isSpreadElement(call.arguments.nodes[0]) &&
|
|
4933
|
+
isUndefined(call.arguments.nodes[0]));
|
|
4934
|
+
if (defaultLocale) {
|
|
4935
|
+
const operand = lowerer.lowerExpr(recv);
|
|
4936
|
+
if (operand.type.kind !== "f64")
|
|
4937
|
+
return null;
|
|
4938
|
+
const stmts = [];
|
|
4939
|
+
let formatted = operand;
|
|
4940
|
+
if (call.arguments.nodes.length === 1) {
|
|
4941
|
+
// An explicit undefined may be any expression that evaluates to it
|
|
4942
|
+
// (a call, a variable), so it still runs, after the receiver and
|
|
4943
|
+
// before the formatting: the receiver's value is read first, so an
|
|
4944
|
+
// argument that writes it does not change the number formatted. Its
|
|
4945
|
+
// unit value has no standalone representation, so it is coerced
|
|
4946
|
+
// into the dynamic slot every argument occupies.
|
|
4947
|
+
const receiver = lowerer.declareHiddenLocal("%localeReceiver", F64);
|
|
4948
|
+
stmts.push({ kind: "varDecl", localId: receiver.id, init: operand, loc });
|
|
4949
|
+
formatted = varRef(receiver.id, F64, loc);
|
|
4950
|
+
const arg = call.arguments.nodes[0];
|
|
4951
|
+
const value = lowerer.lowerExpr(arg);
|
|
4952
|
+
stmts.push({
|
|
4953
|
+
kind: "exprStmt",
|
|
4954
|
+
expr: value.type.kind === "void" ? value : lowerer.coerceInto(arg, value, DYN),
|
|
4955
|
+
loc,
|
|
4956
|
+
});
|
|
4957
|
+
}
|
|
4958
|
+
const call_ = {
|
|
4959
|
+
kind: "libCall",
|
|
4960
|
+
fn: "icu.numFormatDefault",
|
|
4961
|
+
args: [formatted],
|
|
4962
|
+
type: STRING,
|
|
4963
|
+
loc,
|
|
4964
|
+
};
|
|
4965
|
+
return stmts.length ? { kind: "seqExpr", stmts, result: call_, type: STRING, loc } : call_;
|
|
4723
4966
|
}
|
|
4724
4967
|
if (call.arguments.nodes.length > 1) {
|
|
4725
|
-
lowerer.noLowering("Number.prototype.toLocaleString with an options bag", call, "
|
|
4726
|
-
|
|
4968
|
+
lowerer.noLowering("Number.prototype.toLocaleString with an options bag", call, "what lowers is the DEFAULT options shape (decimal notation, up to 3 fraction digits, " +
|
|
4969
|
+
"grouping) at the default locale or at en-US — omit the options bag");
|
|
4727
4970
|
}
|
|
4728
4971
|
const locNode = call.arguments.nodes[0];
|
|
4729
4972
|
if (ts.isSpreadElement(locNode) ||
|
|
@@ -4731,8 +4974,8 @@ function lowerPrimitiveProtoCall(lowerer, call, recv, name, memberSym) {
|
|
|
4731
4974
|
locNode.text !== "en-US") {
|
|
4732
4975
|
lowerer.noLowering(!ts.isSpreadElement(locNode) && ts.isStringLiteralLike(locNode)
|
|
4733
4976
|
? `Number.prototype.toLocaleString at locale "${locNode.text}"`
|
|
4734
|
-
: "Number.prototype.toLocaleString with a non-literal locale", locNode,
|
|
4735
|
-
"
|
|
4977
|
+
: "Number.prototype.toLocaleString with a non-literal locale", locNode, "what lowers is the default locale (no argument) and the composed en-US form — " +
|
|
4978
|
+
"other locales are ICU data the binary does not negotiate yet");
|
|
4736
4979
|
}
|
|
4737
4980
|
const operand = lowerer.lowerExpr(recv);
|
|
4738
4981
|
if (operand.type.kind !== "f64")
|
|
@@ -6506,6 +6749,33 @@ export function recordKeysArrayCall(lowerer, receiver, argIr, shape, loc) {
|
|
|
6506
6749
|
}
|
|
6507
6750
|
body.push(...perKeyOrder(current, ref, walks, loc));
|
|
6508
6751
|
body.push({ kind: "return", value: outRef, loc });
|
|
6752
|
+
// A record that kept undeclared keys answers for-in through its live
|
|
6753
|
+
// kept view, exactly as Object.keys does at its call site. Gated on
|
|
6754
|
+
// the shape being one a kept width spread builds (a shape that keeps
|
|
6755
|
+
// no source stays byte-identical to main) and on the shape holding a
|
|
6756
|
+
// source at all.
|
|
6757
|
+
if (lowerer.keyOrder.keptSourceShapes.has(argIr.shapeId) &&
|
|
6758
|
+
recordMayKeepSource(lowerer, argIr)) {
|
|
6759
|
+
body.unshift({
|
|
6760
|
+
kind: "if",
|
|
6761
|
+
cond: recordSourceTest(ref, loc),
|
|
6762
|
+
then: [
|
|
6763
|
+
{
|
|
6764
|
+
kind: "return",
|
|
6765
|
+
value: {
|
|
6766
|
+
kind: "libCall",
|
|
6767
|
+
fn: "dyn.objKeyStrings",
|
|
6768
|
+
args: [{ kind: "dynFrom", value: ref, liveRef: true, type: DYN, loc }],
|
|
6769
|
+
type: resultT,
|
|
6770
|
+
loc,
|
|
6771
|
+
},
|
|
6772
|
+
loc,
|
|
6773
|
+
},
|
|
6774
|
+
],
|
|
6775
|
+
else_: null,
|
|
6776
|
+
loc,
|
|
6777
|
+
});
|
|
6778
|
+
}
|
|
6509
6779
|
fn.body = body;
|
|
6510
6780
|
};
|
|
6511
6781
|
finalize();
|
|
@@ -6567,6 +6837,35 @@ export function recordHasOwnHelper(lowerer, shapeId, loc) {
|
|
|
6567
6837
|
body,
|
|
6568
6838
|
loc,
|
|
6569
6839
|
});
|
|
6840
|
+
// A record that kept undeclared keys answers an undeclared key through
|
|
6841
|
+
// its kept view: the declared branches above stay exact (the table's
|
|
6842
|
+
// placeholders only fill declared names the record owns), and the
|
|
6843
|
+
// closed-shape `false` fallback becomes the view's own-key test when a
|
|
6844
|
+
// kept width spread builds this shape.
|
|
6845
|
+
if (!shape.indexValue && recordMayKeepSource(lowerer, recT)) {
|
|
6846
|
+
const fn = lowerer.liftedFns[lowerer.liftedFns.length - 1];
|
|
6847
|
+
lowerer.shapeOrderHelperFinalizers.push(() => {
|
|
6848
|
+
if (!lowerer.keyOrder.keptSourceShapes.has(shapeId))
|
|
6849
|
+
return;
|
|
6850
|
+
const last = fn.body[fn.body.length - 1];
|
|
6851
|
+
if (last.kind !== "return")
|
|
6852
|
+
return;
|
|
6853
|
+
last.value = {
|
|
6854
|
+
kind: "logical",
|
|
6855
|
+
op: "&&",
|
|
6856
|
+
left: recordSourceTest(rRef, loc),
|
|
6857
|
+
right: {
|
|
6858
|
+
kind: "libCall",
|
|
6859
|
+
fn: "dyn.hasOwn",
|
|
6860
|
+
args: [{ kind: "dynFrom", value: rRef, liveRef: true, type: DYN, loc }, kRef],
|
|
6861
|
+
type: BOOL,
|
|
6862
|
+
loc,
|
|
6863
|
+
},
|
|
6864
|
+
type: BOOL,
|
|
6865
|
+
loc,
|
|
6866
|
+
};
|
|
6867
|
+
});
|
|
6868
|
+
}
|
|
6570
6869
|
return helper;
|
|
6571
6870
|
}
|
|
6572
6871
|
/** Whether `Object.assign(instance, record)` can copy every field of the
|
|
@@ -6839,6 +7138,44 @@ function isDynEntryPairsType(lowerer, t) {
|
|
|
6839
7138
|
const field = (name) => shape.fields.find((f) => f.name === name)?.type;
|
|
6840
7139
|
return field("0")?.kind === "string" && field("1")?.kind === "dyn";
|
|
6841
7140
|
}
|
|
7141
|
+
/** True when the expression is statically a PLAIN OBJECT at runtime: a dyn
|
|
7142
|
+
* object literal, or a record (a literal, a clone, or any expression of a
|
|
7143
|
+
* record type, which dynFrom boxes field by field). Both build an ordinary
|
|
7144
|
+
* object whose fields are own data properties, which the plain-object
|
|
7145
|
+
* descriptor reader answers exactly. Every other expression (a variable of
|
|
7146
|
+
* any other type, a call, an array, a function) may be an object of any
|
|
7147
|
+
* kind with inherited fields, so it takes the entry points whose
|
|
7148
|
+
* ToPropertyDescriptor reads every object kind (dyn.definePropertyShapes
|
|
7149
|
+
* and its siblings). */
|
|
7150
|
+
export function isPlainObjectLiteral(expr) {
|
|
7151
|
+
if (expr.kind === "dynObjLit")
|
|
7152
|
+
return true;
|
|
7153
|
+
if (expr.kind !== "dynFrom")
|
|
7154
|
+
return false;
|
|
7155
|
+
const value = expr.value;
|
|
7156
|
+
return value.kind === "dynObjLit" || value.type.kind === "record";
|
|
7157
|
+
}
|
|
7158
|
+
/** True when the expression is a plain property-descriptor map for
|
|
7159
|
+
* Object.defineProperties or Object.create: a plain object
|
|
7160
|
+
* (isPlainObjectLiteral) whose every field is a plain object too. A dyn
|
|
7161
|
+
* literal's field values are checked with isPlainObjectLiteral and a
|
|
7162
|
+
* record's fields by their types, since dynFrom boxes a record-typed field
|
|
7163
|
+
* into an ordinary object. A map with any other field (`{ a: view }`, where
|
|
7164
|
+
* `view` is a DataView or an array) takes the any-object entry points. */
|
|
7165
|
+
export function isPlainDescriptorMap(expr, getRecord) {
|
|
7166
|
+
if (!isPlainObjectLiteral(expr))
|
|
7167
|
+
return false;
|
|
7168
|
+
const literal = expr.kind === "dynFrom" ? expr.value : expr;
|
|
7169
|
+
if (literal.kind === "dynObjLit")
|
|
7170
|
+
return (literal.fields ?? []).every((field) => isPlainObjectLiteral(field.value));
|
|
7171
|
+
if (literal.type.kind !== "record")
|
|
7172
|
+
return false;
|
|
7173
|
+
const shape = getRecord(literal.type.shapeId);
|
|
7174
|
+
return (shape !== undefined &&
|
|
7175
|
+
!shape.tuple &&
|
|
7176
|
+
shape.indexValue === undefined &&
|
|
7177
|
+
shape.fields.every((field) => field.type.kind === "record"));
|
|
7178
|
+
}
|
|
6842
7179
|
function lowerObjectStaticCall(lowerer, call, access) {
|
|
6843
7180
|
if (call.questionDotToken || access.questionDotToken)
|
|
6844
7181
|
return null;
|
|
@@ -6883,6 +7220,16 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6883
7220
|
object.type.kind === "bool" ||
|
|
6884
7221
|
isUnitType(object.type))
|
|
6885
7222
|
object = { kind: "dynFrom", value: object, type: DYN, loc: locOf(call) };
|
|
7223
|
+
// An array or class instance reflects through its own checked-dynamic
|
|
7224
|
+
// view (own fields and elements, in property order). A record keeps its
|
|
7225
|
+
// static key walk below when it has one — `getOwnPropertyNames` over a
|
|
7226
|
+
// fixed record is exactly Object.keys' construction, and boxing a typed
|
|
7227
|
+
// record would link the dynamic tier into a program that needs none of
|
|
7228
|
+
// it. The descriptor and symbol forms have no static walk, so a record
|
|
7229
|
+
// takes the view there.
|
|
7230
|
+
const staticWalk = member === "getOwnPropertyNames" && object.type.kind === "record";
|
|
7231
|
+
if (!staticWalk && object.type.kind !== "dyn" && lowerer.dynConvertible(object.type))
|
|
7232
|
+
object = lowerer.coerceToExpected(object, DYN);
|
|
6886
7233
|
if (object.type.kind === "dyn")
|
|
6887
7234
|
return {
|
|
6888
7235
|
kind: "libCall",
|
|
@@ -7133,7 +7480,12 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
7133
7480
|
if (descriptors.type.kind === "dyn")
|
|
7134
7481
|
return {
|
|
7135
7482
|
kind: "libCall",
|
|
7136
|
-
|
|
7483
|
+
// A descriptor map built by an expression, or a literal map with a
|
|
7484
|
+
// descriptor built by one, may hold an array, a function or an
|
|
7485
|
+
// object with inherited fields.
|
|
7486
|
+
fn: isPlainDescriptorMap(descriptors, (id) => lowerer.shapes.get(id))
|
|
7487
|
+
? "dyn.objCreateWithProperties"
|
|
7488
|
+
: "dyn.objCreateWithPropertiesShapes",
|
|
7137
7489
|
args: [proto, descriptors],
|
|
7138
7490
|
type: DYN,
|
|
7139
7491
|
loc,
|
|
@@ -7147,6 +7499,9 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
7147
7499
|
const prototype = lowerClassPrototypeAssign(lowerer, call);
|
|
7148
7500
|
if (prototype)
|
|
7149
7501
|
return prototype;
|
|
7502
|
+
// A standard-library prototype value as the target is a write through it.
|
|
7503
|
+
if (call.arguments.nodes.length > 0)
|
|
7504
|
+
fenceDatePrototypeWriteCall(lowerer, call.arguments.nodes[0]);
|
|
7150
7505
|
if (isJsSourceFile(ts.getSourceFileOfNode(call)) &&
|
|
7151
7506
|
call.arguments.nodes.length > 0 &&
|
|
7152
7507
|
!call.arguments.nodes.some(ts.isSpreadElement)) {
|
|
@@ -7220,8 +7575,14 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
7220
7575
|
const sProbe = tryLowerExpression(lowerer, call.arguments.nodes[1]);
|
|
7221
7576
|
// CHECKED-DYNAMIC target and source (the JS file-scope
|
|
7222
7577
|
// object-literal identity story): the runtime dyn copy — own
|
|
7223
|
-
// members of the source land on the target, which returns.
|
|
7224
|
-
|
|
7578
|
+
// members of the source land on the target, which returns. A
|
|
7579
|
+
// CLASS-INSTANCE target joins them when the call's own RESULT type
|
|
7580
|
+
// is checked-dynamic: that is the `C & { extra }` intersection
|
|
7581
|
+
// (mapClassExpandoIntersection), whose value IS the instance, so
|
|
7582
|
+
// the same dyn copy writes the expando members onto its view and
|
|
7583
|
+
// answers the instance — identity and prototype intact.
|
|
7584
|
+
if (tProbe?.type.kind === "dyn" ||
|
|
7585
|
+
(tProbe?.type.kind === "object" && lowerer.mapTypeOf(lowerer.typeOf(call))?.kind === "dyn")) {
|
|
7225
7586
|
const loc = locOf(call);
|
|
7226
7587
|
const target = lowerer.lowerExpr(call.arguments.nodes[0]);
|
|
7227
7588
|
const rawSource = lowerer.lowerExpr(call.arguments.nodes[1]);
|
|
@@ -7232,8 +7593,9 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
7232
7593
|
if (ts.isObjectLiteralExpression(targetNode))
|
|
7233
7594
|
fenceClassCopyIntoFreshObject(lowerer, call, call.arguments.nodes[1], rawSource);
|
|
7234
7595
|
const source = lowerer.coerceToExpected(rawSource, DYN);
|
|
7235
|
-
|
|
7236
|
-
|
|
7596
|
+
const dynTarget = target.type.kind === "dyn" ? target : lowerer.coerceToExpected(target, DYN);
|
|
7597
|
+
if (dynTarget.type.kind === "dyn" && source.type.kind === "dyn") {
|
|
7598
|
+
return { kind: "libCall", fn: "dyn.assign", args: [dynTarget, source], type: DYN, loc };
|
|
7237
7599
|
}
|
|
7238
7600
|
}
|
|
7239
7601
|
// A CLASS-INSTANCE target and a plain record source whose fields are
|
|
@@ -7439,8 +7801,14 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
7439
7801
|
(member === "getOwnPropertyDescriptor" && call.arguments.nodes.length === 2)) {
|
|
7440
7802
|
if (call.arguments.nodes.some((a) => ts.isSpreadElement(a)))
|
|
7441
7803
|
return null;
|
|
7442
|
-
let target = tryLowerExpression(lowerer, call.arguments.nodes[0]);
|
|
7443
7804
|
const targetNode = call.arguments.nodes[0];
|
|
7805
|
+
// Object.defineProperty/defineProperties over a standard-library prototype
|
|
7806
|
+
// value: a typed Date never observes a dynamic definition there, so the
|
|
7807
|
+
// write keeps the fence it reached before the value existed. The
|
|
7808
|
+
// descriptor READ below is not a write and stays open.
|
|
7809
|
+
if (member === "defineProperty")
|
|
7810
|
+
fenceDatePrototypeWriteCall(lowerer, targetNode);
|
|
7811
|
+
let target = tryLowerExpression(lowerer, targetNode);
|
|
7444
7812
|
// The checker gives C.prototype the instance type, but its lowered
|
|
7445
7813
|
// value is the shared prototype table, not an instance to unbox.
|
|
7446
7814
|
const prototypeTarget = ts.isPropertyAccessExpression(targetNode) &&
|
|
@@ -7517,7 +7885,10 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
7517
7885
|
return null;
|
|
7518
7886
|
return {
|
|
7519
7887
|
kind: "libCall",
|
|
7520
|
-
|
|
7888
|
+
// A descriptor built by an expression may be an array, a function or an
|
|
7889
|
+
// object with inherited fields, which only the any-object entry point
|
|
7890
|
+
// reads; a plain object literal keeps the plain-object reader.
|
|
7891
|
+
fn: isPlainObjectLiteral(descriptor) ? "dyn.defineProperty" : "dyn.definePropertyShapes",
|
|
7521
7892
|
args: [target, key, descriptor],
|
|
7522
7893
|
type: DYN,
|
|
7523
7894
|
loc: locOf(call),
|
|
@@ -7533,6 +7904,10 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
7533
7904
|
if (member === "defineProperties" &&
|
|
7534
7905
|
call.arguments.nodes.length === 2 &&
|
|
7535
7906
|
!call.arguments.nodes.some((a) => ts.isSpreadElement(a))) {
|
|
7907
|
+
// A standard-library prototype value as the target is a write through it,
|
|
7908
|
+
// exactly like the defineProperty form above: a typed Date never observes
|
|
7909
|
+
// a definition made on the dynamic prototype object.
|
|
7910
|
+
fenceDatePrototypeWriteCall(lowerer, call.arguments.nodes[0]);
|
|
7536
7911
|
const prototype = lowerClassPrototypeDescriptors(lowerer, call, member);
|
|
7537
7912
|
if (prototype)
|
|
7538
7913
|
return prototype;
|
|
@@ -7573,7 +7948,12 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
7573
7948
|
if (descs.type.kind === "dyn") {
|
|
7574
7949
|
return {
|
|
7575
7950
|
kind: "libCall",
|
|
7576
|
-
|
|
7951
|
+
// As for Object.create above: a descriptor map built by an
|
|
7952
|
+
// expression, or a literal map with a descriptor built by one, takes
|
|
7953
|
+
// the any-object entry point.
|
|
7954
|
+
fn: isPlainDescriptorMap(descs, (id) => lowerer.shapes.get(id))
|
|
7955
|
+
? "dyn.defineProps"
|
|
7956
|
+
: "dyn.definePropsShapes",
|
|
7577
7957
|
args: [target, descs],
|
|
7578
7958
|
type: DYN,
|
|
7579
7959
|
loc: locOf(call),
|
|
@@ -9959,7 +10339,8 @@ function maybePromiseHandlerResult(lowerer, call, value, R) {
|
|
|
9959
10339
|
}
|
|
9960
10340
|
return stmt;
|
|
9961
10341
|
}
|
|
9962
|
-
/** `view.m(args)` where `view` is a `Pick<C, K>` / `Omit<C, K>` view
|
|
10342
|
+
/** `view.m(args)` where `view` is a `Pick<C, K>` / `Omit<C, K>` view (inline
|
|
10343
|
+
* or through type aliases, classViewOf) of a
|
|
9963
10344
|
* program class C and `m` is one of C's GENERIC methods (its overloads
|
|
9964
10345
|
* included): generic methods have no dispatchable method value, so the
|
|
9965
10346
|
* view's live receiver is extracted as the C instance it holds (a checked
|
|
@@ -9967,12 +10348,10 @@ function maybePromiseHandlerResult(lowerer, call, value, R) {
|
|
|
9967
10348
|
* text naming C) and the call monomorphizes statically against C, the
|
|
9968
10349
|
* same lowering a C-typed receiver gets. Null for other receivers. */
|
|
9969
10350
|
function pickViewGenericMethodCall(lowerer, call, access, recvTs) {
|
|
9970
|
-
const
|
|
9971
|
-
if (
|
|
9972
|
-
return null;
|
|
9973
|
-
if (!alias.declarations.every((d) => ts.getSourceFileOfNode(d).isDeclarationFile))
|
|
10351
|
+
const view = classViewOf(lowerer.checker, recvTs);
|
|
10352
|
+
if (view === null)
|
|
9974
10353
|
return null;
|
|
9975
|
-
const source =
|
|
10354
|
+
const source = view.source;
|
|
9976
10355
|
const symbol = source?.getSymbol();
|
|
9977
10356
|
const info = symbol ? lowerer.classBySymbol.get(symbol) : undefined;
|
|
9978
10357
|
if (!info || call.questionDotToken || access.questionDotToken)
|
|
@@ -9989,7 +10368,7 @@ function pickViewGenericMethodCall(lowerer, call, access, recvTs) {
|
|
|
9989
10368
|
if (lowered.type.kind === "object" &&
|
|
9990
10369
|
lowered.type.className !== info.def.name &&
|
|
9991
10370
|
!lowerer.isSubclassOf(lowered.type.className, info.def.name)) {
|
|
9992
|
-
lowerer.unsupported("SC1090", access, `calling the generic method '${access.name.text}' through a '${
|
|
10371
|
+
lowerer.unsupported("SC1090", access, `calling the generic method '${access.name.text}' through a '${view.name}' view of '${info.def.name}' that holds a '${lowerer.fmt(lowered.type)}'`);
|
|
9993
10372
|
}
|
|
9994
10373
|
const receiver = lowered.type.kind === "object"
|
|
9995
10374
|
? lowered
|