@scriptc/compiler 0.4.2 → 0.4.4
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/scriptc-node-fallback.d.ts +470 -66
- package/dist/backend/cycle-analysis.d.ts +4 -1
- package/dist/backend/cycle-analysis.js +6 -4
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-analysis.test.js +55 -0
- package/dist/backend/cycle-analysis.test.js.map +1 -1
- package/dist/backend/cycle-mutability.d.ts +7 -0
- package/dist/backend/cycle-mutability.js +19 -1
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.js +2 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.d.ts +6 -3
- package/dist/backend/immutability.js +33 -29
- package/dist/backend/immutability.js.map +1 -1
- package/dist/backend/library-pack.js +1 -0
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +16 -1
- package/dist/backend/llvm/alloc.js +54 -4
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/appended-array-literals.d.ts +2 -1
- package/dist/backend/llvm/appended-array-literals.js +44 -36
- package/dist/backend/llvm/appended-array-literals.js.map +1 -1
- package/dist/backend/llvm/appended-array-literals.test.js +4 -3
- package/dist/backend/llvm/appended-array-literals.test.js.map +1 -1
- package/dist/backend/llvm/array-search.d.ts +4 -3
- package/dist/backend/llvm/array-search.js +21 -9
- package/dist/backend/llvm/array-search.js.map +1 -1
- package/dist/backend/llvm/blocks.d.ts +1 -1
- package/dist/backend/llvm/blocks.js +2 -2
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/byte-windows.js +2 -0
- package/dist/backend/llvm/byte-windows.js.map +1 -1
- package/dist/backend/llvm/bytes-alias.d.ts +6 -1
- package/dist/backend/llvm/bytes-alias.js +8 -2
- package/dist/backend/llvm/bytes-alias.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.d.ts +47 -5
- package/dist/backend/llvm/bytes-loop-versions.js +479 -32
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +263 -2
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/checked-value-lifetimes.js +2 -0
- package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +7 -5
- package/dist/backend/llvm/classes.js +44 -20
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +167 -7
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +9 -3
- package/dist/backend/llvm/common.js +9 -3
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.d.ts +2 -1
- package/dist/backend/llvm/constant-callbacks.js +83 -52
- package/dist/backend/llvm/constant-callbacks.js.map +1 -1
- package/dist/backend/llvm/counted-loops.d.ts +7 -0
- package/dist/backend/llvm/counted-loops.js +18 -0
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/debug-info.js +2 -5
- package/dist/backend/llvm/debug-info.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +39 -8
- package/dist/backend/llvm/dense-array-access.js +222 -52
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +36 -0
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.d.ts +17 -1
- package/dist/backend/llvm/dense-array-loops.js +194 -5
- package/dist/backend/llvm/dense-array-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.test.js +90 -1
- package/dist/backend/llvm/dense-array-loops.test.js.map +1 -1
- package/dist/backend/llvm/dyn-handle-tags.test.js +6 -1
- package/dist/backend/llvm/dyn-handle-tags.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +30 -0
- package/dist/backend/llvm/dyn.js +373 -70
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +13 -28
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-journal.d.ts +93 -0
- package/dist/backend/llvm/emit-journal.js +170 -0
- package/dist/backend/llvm/emit-journal.js.map +1 -0
- package/dist/backend/llvm/emit-module.js +211 -33
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-statements.d.ts +0 -4
- package/dist/backend/llvm/emit-statements.js +268 -84
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter-state.d.ts +7 -0
- package/dist/backend/llvm/emitter-state.js +14 -0
- package/dist/backend/llvm/emitter-state.js.map +1 -0
- package/dist/backend/llvm/emitter.d.ts +186 -37
- package/dist/backend/llvm/emitter.js +733 -90
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +65 -7
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +11 -13
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +48 -20
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +47 -0
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +28 -14
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +14 -2
- package/dist/backend/llvm/expr-containers.js +143 -37
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +14 -0
- package/dist/backend/llvm/expr-dynamic.js +18 -11
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +119 -38
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +11 -6
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.d.ts +12 -0
- package/dist/backend/llvm/expr-records.js +106 -0
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.d.ts +2 -2
- package/dist/backend/llvm/expr-stream-bridges.js +210 -69
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +2 -2
- package/dist/backend/llvm/expr-stream-callbacks.js +74 -20
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/int32-kind-loops.d.ts +39 -0
- package/dist/backend/llvm/int32-kind-loops.js +106 -0
- package/dist/backend/llvm/int32-kind-loops.js.map +1 -0
- package/dist/backend/llvm/integer-or-nan-indexes.test.d.ts +1 -0
- package/dist/backend/llvm/integer-or-nan-indexes.test.js +118 -0
- package/dist/backend/llvm/integer-or-nan-indexes.test.js.map +1 -0
- package/dist/backend/llvm/integer-values.d.ts +25 -1
- package/dist/backend/llvm/integer-values.js +95 -0
- package/dist/backend/llvm/integer-values.js.map +1 -1
- package/dist/backend/llvm/js-ic.d.ts +1 -1
- package/dist/backend/llvm/js-ic.js +1 -1
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/key-orders.d.ts +7 -0
- package/dist/backend/llvm/key-orders.js +33 -0
- package/dist/backend/llvm/key-orders.js.map +1 -0
- package/dist/backend/llvm/lib-connect.js +4 -0
- package/dist/backend/llvm/lib-connect.js.map +1 -1
- package/dist/backend/llvm/lib-datagram.js +11 -0
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +213 -5
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +4 -4
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.js +4 -0
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-lookup.js +16 -6
- package/dist/backend/llvm/lib-lookup.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +37 -1
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +94 -2
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +35 -5
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +115 -19
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +14 -0
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/loop-state.d.ts +33 -0
- package/dist/backend/llvm/loop-state.js +42 -0
- package/dist/backend/llvm/loop-state.js.map +1 -0
- package/dist/backend/llvm/map-number-lookup.d.ts +26 -8
- package/dist/backend/llvm/map-number-lookup.js +91 -31
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.js +55 -0
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.js +4 -2
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.d.ts +2 -1
- package/dist/backend/llvm/nullable-unions.js +15 -3
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/publish.d.ts +10 -0
- package/dist/backend/llvm/publish.js +15 -3
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/receivers.js +6 -1
- package/dist/backend/llvm/receivers.js.map +1 -1
- package/dist/backend/llvm/record-results.d.ts +1 -9
- package/dist/backend/llvm/record-results.js +2 -11
- package/dist/backend/llvm/record-results.js.map +1 -1
- package/dist/backend/llvm/reference-effects.js +3 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-writes.d.ts +7 -2
- package/dist/backend/llvm/reference-writes.js +89 -72
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/running-extrema.d.ts +11 -0
- package/dist/backend/llvm/running-extrema.js +115 -0
- package/dist/backend/llvm/running-extrema.js.map +1 -0
- package/dist/backend/llvm/running-extrema.test.d.ts +1 -0
- package/dist/backend/llvm/running-extrema.test.js +89 -0
- package/dist/backend/llvm/running-extrema.test.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +71 -15
- package/dist/backend/llvm/shapes.js +224 -40
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +53 -7
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.d.ts +6 -0
- package/dist/backend/llvm/speculative-integers.js +2 -2
- package/dist/backend/llvm/speculative-integers.js.map +1 -1
- package/dist/backend/llvm/stack-captures.js +1 -5
- package/dist/backend/llvm/stack-captures.js.map +1 -1
- package/dist/backend/llvm/stack-objects.d.ts +3 -2
- package/dist/backend/llvm/stack-objects.js +5 -2
- package/dist/backend/llvm/stack-objects.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +12 -0
- package/dist/backend/llvm/string-reads.js +44 -0
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/union-repr.d.ts +4 -3
- package/dist/backend/llvm/union-repr.js +6 -5
- package/dist/backend/llvm/union-repr.js.map +1 -1
- package/dist/backend/llvm/walk-borrows.d.ts +3 -0
- package/dist/backend/llvm/walk-borrows.js +46 -41
- package/dist/backend/llvm/walk-borrows.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +3 -0
- package/dist/backend/llvm/walkers.js +101 -65
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/llvm/wrapping-sums.d.ts +16 -1
- package/dist/backend/llvm/wrapping-sums.js +126 -0
- package/dist/backend/llvm/wrapping-sums.js.map +1 -1
- package/dist/backend/may-throw.d.ts +8 -10
- package/dist/backend/may-throw.js +14 -10
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +5 -0
- package/dist/backend/native/executable.js +7 -0
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +1 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native-codegen-core.d.ts +5 -3
- package/dist/backend/native-codegen-core.js +13 -6
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.test.js +6 -4
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +4 -0
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/publication.d.ts +12 -1
- package/dist/backend/publication.js +37 -14
- package/dist/backend/publication.js.map +1 -1
- package/dist/backend/publication.test.js +30 -0
- package/dist/backend/publication.test.js.map +1 -1
- package/dist/backend/result-slots.d.ts +16 -0
- package/dist/backend/result-slots.js +23 -0
- package/dist/backend/result-slots.js.map +1 -0
- 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 +1 -0
- package/dist/backend/runtime-pack-core.js +1 -0
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +2 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +2 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/stack-observations.d.ts +2 -1
- package/dist/backend/stack-observations.js +67 -42
- package/dist/backend/stack-observations.js.map +1 -1
- package/dist/backend/target-cpu.d.ts +26 -0
- package/dist/backend/target-cpu.js +98 -0
- package/dist/backend/target-cpu.js.map +1 -0
- package/dist/backend/target-cpu.test.d.ts +1 -0
- package/dist/backend/target-cpu.test.js +38 -0
- package/dist/backend/target-cpu.test.js.map +1 -0
- package/dist/backend/target-diagnostics.js +5 -3
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/warm-cache.js +1 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +20 -1
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/usage.d.ts +4 -1
- package/dist/cli/usage.js +10 -3
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.js +1 -1
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +7 -0
- package/dist/contracts/check.js +4 -3
- package/dist/contracts/check.js.map +1 -1
- package/dist/contracts/int32-elements.js +10 -2
- package/dist/contracts/int32-elements.js.map +1 -1
- package/dist/coverage/report.js +12 -3
- package/dist/coverage/report.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +4 -0
- package/dist/diagnostics/diagnostic.js +1 -1
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +3 -0
- package/dist/diagnostics/envelope.js +1 -0
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +5 -0
- package/dist/executable/executable-cache.js +5 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +3 -0
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/frontend/decl-projection.d.ts +41 -0
- package/dist/frontend/decl-projection.js +949 -0
- package/dist/frontend/decl-projection.js.map +1 -0
- package/dist/frontend/decl-projection.test.d.ts +1 -0
- package/dist/frontend/decl-projection.test.js +30 -0
- package/dist/frontend/decl-projection.test.js.map +1 -0
- package/dist/frontend/dts-paths.d.ts +15 -0
- package/dist/frontend/dts-paths.js +25 -0
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/input-tracker.d.ts +6 -0
- package/dist/frontend/input-tracker.js +51 -28
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +19 -0
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +100 -2
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/builtins/async-context.d.ts +8 -2
- package/dist/frontend/lowering/builtins/async-context.js +62 -3
- package/dist/frontend/lowering/builtins/async-context.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.js +46 -15
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process.js +13 -2
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.js +87 -10
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/dates.js +4 -1
- package/dist/frontend/lowering/builtins/dates.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js +3 -3
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-glob.js +6 -3
- package/dist/frontend/lowering/builtins/fs-glob.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-paths.d.ts +43 -5
- package/dist/frontend/lowering/builtins/fs-paths.js +245 -93
- package/dist/frontend/lowering/builtins/fs-paths.js.map +1 -1
- package/dist/frontend/lowering/builtins/global-namespace-keys.d.ts +3 -0
- package/dist/frontend/lowering/builtins/global-namespace-keys.js +122 -0
- package/dist/frontend/lowering/builtins/global-namespace-keys.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-calls.js +6 -3
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.js +9 -1
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.d.ts +7 -1
- package/dist/frontend/lowering/builtins/promises.js +236 -139
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +5 -1
- package/dist/frontend/lowering/builtins/readline.js +35 -3
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.js +24 -1
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/builtins/webassembly.js +6 -3
- package/dist/frontend/lowering/builtins/webassembly.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.js +0 -1
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- 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.d.ts +32 -0
- package/dist/frontend/lowering/cjs-inline-require.js +307 -4
- package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
- package/dist/frontend/lowering/class-callbacks.d.ts +5 -2
- package/dist/frontend/lowering/class-callbacks.js +82 -12
- package/dist/frontend/lowering/class-callbacks.js.map +1 -1
- package/dist/frontend/lowering/class-construction.d.ts +4 -1
- package/dist/frontend/lowering/class-construction.js +17 -3
- package/dist/frontend/lowering/class-construction.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +49 -2
- package/dist/frontend/lowering/class-dynamic-dispatch.js +880 -108
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +47 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-iterables.d.ts +2 -1
- package/dist/frontend/lowering/class-iterables.js +9 -1
- package/dist/frontend/lowering/class-iterables.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +83 -24
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +25 -0
- package/dist/frontend/lowering/class-protocols.js +183 -1
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.js +31 -2
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-runtime-statics.d.ts +9 -3
- package/dist/frontend/lowering/class-runtime-statics.js +29 -4
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +48 -1
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +91 -1
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/completion-callbacks.d.ts +4 -0
- package/dist/frontend/lowering/completion-callbacks.js +146 -0
- package/dist/frontend/lowering/completion-callbacks.js.map +1 -0
- package/dist/frontend/lowering/containers/array-callback-call.js +2 -2
- package/dist/frontend/lowering/containers/array-callback-call.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +5 -4
- package/dist/frontend/lowering/containers/array-callbacks.js +345 -24
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-concat.js +10 -0
- package/dist/frontend/lowering/containers/array-concat.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +5 -0
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +26 -3
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.js +19 -8
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.d.ts +25 -17
- package/dist/frontend/lowering/containers/bytes.js +455 -46
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +3 -0
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +7 -2
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/filter-predicates.d.ts +6 -0
- package/dist/frontend/lowering/containers/filter-predicates.js +205 -0
- package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -0
- package/dist/frontend/lowering/containers/indexed-objects.d.ts +0 -12
- package/dist/frontend/lowering/containers/indexed-objects.js +46 -7
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.js +55 -9
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +43 -19
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/date-values.d.ts +11 -0
- package/dist/frontend/lowering/date-values.js +207 -0
- package/dist/frontend/lowering/date-values.js.map +1 -0
- package/dist/frontend/lowering/dispatch-sites.js +15 -1
- package/dist/frontend/lowering/dispatch-sites.js.map +1 -1
- package/dist/frontend/lowering/divergences.js +9 -1
- package/dist/frontend/lowering/divergences.js.map +1 -1
- package/dist/frontend/lowering/error-methods.js +47 -2
- package/dist/frontend/lowering/error-methods.js.map +1 -1
- package/dist/frontend/lowering/expressions/array-literals.js +53 -0
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +100 -28
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +169 -13
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +64 -5
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.js +95 -1
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +3 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +10 -0
- package/dist/frontend/lowering/expressions/object-literals.js +138 -51
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +12 -0
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.js +168 -10
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +212 -33
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/typeof.js +6 -0
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-fields.js +4 -0
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +39 -3
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/frozen-records.d.ts +28 -0
- package/dist/frontend/lowering/frozen-records.js +322 -0
- package/dist/frontend/lowering/frozen-records.js.map +1 -0
- package/dist/frontend/lowering/function-returns.js +64 -0
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.js +7 -2
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/indexed-unions.d.ts +54 -0
- package/dist/frontend/lowering/indexed-unions.js +401 -0
- package/dist/frontend/lowering/indexed-unions.js.map +1 -0
- package/dist/frontend/lowering/iterable-values.d.ts +49 -0
- package/dist/frontend/lowering/iterable-values.js +297 -0
- package/dist/frontend/lowering/iterable-values.js.map +1 -0
- package/dist/frontend/lowering/iterator-adapters.js +186 -1
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/js-class-fields.d.ts +8 -0
- package/dist/frontend/lowering/js-class-fields.js +45 -10
- package/dist/frontend/lowering/js-class-fields.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.d.ts +18 -3
- package/dist/frontend/lowering/key-order-witness.js +974 -48
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.test.js +530 -10
- package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +15 -3
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +4 -1
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +7 -0
- package/dist/frontend/lowering/lower-calls.js +462 -44
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +11 -2
- package/dist/frontend/lowering/lower-classes.js +324 -69
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +3 -1
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +215 -3
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.d.ts +11 -0
- package/dist/frontend/lowering/lower-functions.js +83 -0
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +42 -32
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.js +6 -3
- package/dist/frontend/lowering/lower-global-value.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +1 -1
- package/dist/frontend/lowering/lower-inspect.js +53 -17
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +53 -5
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.js +5 -1
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +2 -2
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +5 -0
- package/dist/frontend/lowering/lower-stdlib.js +30 -0
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +23 -0
- package/dist/frontend/lowering/lower-stmts.js +553 -81
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +20 -2
- package/dist/frontend/lowering/lower-stream.js +1483 -156
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +107 -8
- package/dist/frontend/lowering/lowerer.js +381 -36
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/module-namespace-elements.d.ts +11 -1
- package/dist/frontend/lowering/module-namespace-elements.js +82 -5
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/new-target.d.ts +12 -0
- package/dist/frontend/lowering/new-target.js +280 -0
- package/dist/frontend/lowering/new-target.js.map +1 -0
- package/dist/frontend/lowering/object-factory-new.d.ts +5 -0
- package/dist/frontend/lowering/object-factory-new.js +20 -6
- package/dist/frontend/lowering/object-factory-new.js.map +1 -1
- package/dist/frontend/lowering/overload-choice.d.ts +33 -0
- package/dist/frontend/lowering/overload-choice.js +190 -0
- package/dist/frontend/lowering/overload-choice.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +3 -0
- package/dist/frontend/lowering/surfaces.js +73 -8
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/undefined-index.d.ts +27 -0
- package/dist/frontend/lowering/undefined-index.js +82 -0
- package/dist/frontend/lowering/undefined-index.js.map +1 -0
- package/dist/frontend/lowering/var-hoisting.js +29 -13
- package/dist/frontend/lowering/var-hoisting.js.map +1 -1
- package/dist/frontend/lowering/width-lift.d.ts +18 -0
- package/dist/frontend/npm-static-bundled-chunks.js +9 -11
- package/dist/frontend/npm-static-bundled-chunks.js.map +1 -1
- package/dist/frontend/npm-static-bundled-chunks.test.js +6 -5
- package/dist/frontend/npm-static-bundled-chunks.test.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +9 -1
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/npm-static.js +4 -20
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/package-shims.d.ts +3 -0
- package/dist/frontend/package-shims.js +71 -8
- package/dist/frontend/package-shims.js.map +1 -1
- package/dist/frontend/pipeline.js +19 -11
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/process-fork.d.ts +25 -0
- package/dist/frontend/process-fork.js +2 -0
- package/dist/frontend/process-fork.js.map +1 -0
- package/dist/frontend/program-analysis.d.ts +5 -1
- package/dist/frontend/program-analysis.js +5 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program.d.ts +21 -6
- package/dist/frontend/program.js +681 -83
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +43 -3
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/token-equivalence.d.ts +3 -0
- package/dist/frontend/token-equivalence.js +409 -0
- package/dist/frontend/token-equivalence.js.map +1 -0
- package/dist/frontend/token-equivalence.test.d.ts +1 -0
- package/dist/frontend/token-equivalence.test.js +67 -0
- package/dist/frontend/token-equivalence.test.js.map +1 -0
- package/dist/frontend/ts7/ast-node.d.ts +22 -0
- package/dist/frontend/ts7/ast-node.js +1048 -103
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +24 -0
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.d.ts +4 -3
- package/dist/frontend/ts7/ast-wire.js +34 -24
- package/dist/frontend/ts7/ast-wire.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.test.js +23 -0
- package/dist/frontend/ts7/ast-wire.test.js.map +1 -1
- package/dist/frontend/ts7/checker-backend.d.ts +3 -4
- package/dist/frontend/ts7/checker-backend.js +2 -2
- package/dist/frontend/ts7/checker-backend.js.map +1 -1
- package/dist/frontend/ts7/checker-backend.test.js +5 -9
- package/dist/frontend/ts7/checker-backend.test.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +4 -0
- package/dist/frontend/ts7/checker.js +7 -0
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/lib-diagnostics.d.ts +24 -0
- package/dist/frontend/ts7/lib-diagnostics.js +307 -0
- package/dist/frontend/ts7/lib-diagnostics.js.map +1 -0
- package/dist/frontend/ts7/lib-diagnostics.test.d.ts +1 -0
- package/dist/frontend/ts7/lib-diagnostics.test.js +199 -0
- package/dist/frontend/ts7/lib-diagnostics.test.js.map +1 -0
- package/dist/frontend/ts7/program-host.d.ts +7 -0
- package/dist/frontend/ts7/program-host.js +25 -2
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.d.ts +3 -0
- package/dist/frontend/ts7/semantic-model.js +5 -0
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.test.js +6 -1
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-types.d.ts +1 -1
- package/dist/frontend/ts7/semantic-types.js +1 -1
- package/dist/frontend/ts7/semantic-types.js.map +1 -1
- package/dist/frontend/ts7/session.d.ts +14 -1
- package/dist/frontend/ts7/session.js +22 -0
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +13 -1
- package/dist/frontend/type-mapper.js +229 -20
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +46 -4
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.js +5 -3
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/array-length-stability.d.ts +4 -0
- package/dist/ir/array-length-stability.js +19 -6
- package/dist/ir/array-length-stability.js.map +1 -1
- package/dist/ir/array-length-stability.test.js +24 -0
- package/dist/ir/array-length-stability.test.js.map +1 -1
- package/dist/ir/builtin-effects.d.ts +7 -0
- package/dist/ir/builtin-effects.js +60 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +6 -4
- package/dist/ir/builtin-signatures.js +222 -13
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/callback-specialization.d.ts +2 -1
- package/dist/ir/callback-specialization.js +23 -18
- package/dist/ir/callback-specialization.js.map +1 -1
- package/dist/ir/char-unit-locals.d.ts +19 -0
- package/dist/ir/char-unit-locals.js +185 -0
- package/dist/ir/char-unit-locals.js.map +1 -0
- package/dist/ir/char-unit-locals.test.d.ts +1 -0
- package/dist/ir/char-unit-locals.test.js +94 -0
- package/dist/ir/char-unit-locals.test.js.map +1 -0
- package/dist/ir/final-fields.d.ts +2 -1
- package/dist/ir/final-fields.js +14 -16
- package/dist/ir/final-fields.js.map +1 -1
- package/dist/ir/function-references.d.ts +2 -0
- package/dist/ir/function-references.js +2 -0
- package/dist/ir/function-references.js.map +1 -1
- package/dist/ir/function-references.test.js +3 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/initializer-bindings.d.ts +2 -1
- package/dist/ir/initializer-bindings.js +27 -20
- package/dist/ir/initializer-bindings.js.map +1 -1
- package/dist/ir/int32-arrays.d.ts +108 -0
- package/dist/ir/int32-arrays.js +831 -0
- package/dist/ir/int32-arrays.js.map +1 -0
- package/dist/ir/int32-slots.d.ts +24 -2
- package/dist/ir/int32-slots.js +266 -57
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +33 -0
- package/dist/ir/int32-slots.test.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +3 -3
- package/dist/ir/integer-loops.js +28 -10
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +10 -0
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +5 -0
- package/dist/ir/integer-ranges.js +125 -12
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +30 -0
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/ir.d.ts +83 -10
- package/dist/ir/ir.js +77 -6
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +23 -2
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/js-ic.d.ts +4 -0
- package/dist/ir/js-ic.js +17 -1
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +46 -0
- package/dist/ir/js-ic.test.js.map +1 -1
- package/dist/ir/node-index.d.ts +57 -0
- package/dist/ir/node-index.js +215 -0
- package/dist/ir/node-index.js.map +1 -0
- package/dist/ir/paired-while-loops.d.ts +25 -0
- package/dist/ir/paired-while-loops.js +335 -0
- package/dist/ir/paired-while-loops.js.map +1 -0
- package/dist/ir/paired-while-loops.test.d.ts +1 -0
- package/dist/ir/paired-while-loops.test.js +163 -0
- package/dist/ir/paired-while-loops.test.js.map +1 -0
- package/dist/ir/parameter-versions.d.ts +25 -0
- package/dist/ir/parameter-versions.js +300 -0
- package/dist/ir/parameter-versions.js.map +1 -0
- package/dist/ir/runtime-features.d.ts +34 -13
- package/dist/ir/runtime-features.js +177 -39
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/serialize.d.ts +12 -2
- package/dist/ir/serialize.js +16 -3
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.js +17 -0
- package/dist/ir/serialize.test.js.map +1 -1
- package/dist/ir/traverse.js +18 -6
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +167 -40
- package/dist/ir/validate.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.d.ts +6 -1
- package/dist/native/cache.js +28 -5
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cache.test.js +16 -2
- package/dist/native/cache.test.js.map +1 -1
- package/dist/native/cli.js +21 -1
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +8 -6
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/executable-cache.d.ts +1 -1
- package/dist/native/executable-cache.js +2 -2
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/prepare.d.ts +4 -2
- package/dist/native/prepare.js +130 -32
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +96 -20
- package/dist/native/prepare.test.js.map +1 -1
- package/dist/native/sanitizer.test.js +2 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/text-file.d.ts +13 -3
- package/dist/native/text-file.js +63 -9
- package/dist/native/text-file.js.map +1 -1
- package/dist/native/text-file.test.d.ts +1 -0
- package/dist/native/text-file.test.js +49 -0
- package/dist/native/text-file.test.js.map +1 -0
- package/dist/native/toolchain.js +4 -4
- package/dist/native/toolchain.js.map +1 -1
- package/dist/native/toolchain.test.js +3 -3
- package/dist/native/toolchain.test.js.map +1 -1
- package/package.json +21 -21
- package/shims/chalk/v5.ts +688 -0
- package/shims/hono-node-server/v2.ts +645 -0
- package/shims/hot-shots/client.ts +1126 -0
- package/shims/hot-shots/v8-unix-dgram.ts +8 -0
- package/shims/hot-shots/v8.ts +8 -0
- package/surface-manifest.json +27 -7
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { isDeclBoundaryFile } from "../decl-projection.js";
|
|
1
2
|
import { relieveHeapPressure } from "../../heap-pressure.js";
|
|
3
|
+
import { moduleNamespaceObject } from "./module-namespace-elements.js";
|
|
2
4
|
import { keyedHelperName } from "./stable-names.js";
|
|
3
5
|
import { positionTag, StructuralPositions } from "./structural-positions.js";
|
|
4
6
|
import { onlyForwarded, stripTypeWrappers } from "./typed-arguments.js";
|
|
@@ -12,6 +14,7 @@ import { internTableType, lowerInternTableCall, lowerInternTableNew } from "./in
|
|
|
12
14
|
import { lowerThreadSlotsCall, lowerThreadSlotsNew, threadSlotsType } from "./thread-slots.js";
|
|
13
15
|
import { isExperimentalDeclarationFile } from "../experimental-import.js";
|
|
14
16
|
import { checkCycleBindingAccesses, refuseUncheckedCycleReads, } from "./cycle-initialization.js";
|
|
17
|
+
import { bindCompletionCallbacks } from "./completion-callbacks.js";
|
|
15
18
|
import { isJsonRequireDecl } from "./json-require.js";
|
|
16
19
|
import { checkRequireBindingAccesses, } from "./require-initialization.js";
|
|
17
20
|
import { identityPreservingWidening } from "./coercions/identity.js";
|
|
@@ -39,6 +42,7 @@ import { valueStreamOf } from "./builtins/hash-stream.js";
|
|
|
39
42
|
import { lowerNetAddressCall, lowerNetAddressNew } from "./builtins/net-address.js";
|
|
40
43
|
import { dynUndefinedExpr, nodeThrowExpr, numLit, varRef } from "../../ir/build.js";
|
|
41
44
|
import { iteratorSlotAdapter } from "./iterator-adapters.js";
|
|
45
|
+
import { iterableSlotValue } from "./iterable-values.js";
|
|
42
46
|
import { lowerBuiltinCall } from "./builtin-calls.js";
|
|
43
47
|
import { CoercionState } from "./coercions/state.js";
|
|
44
48
|
import { widthLiftPlan, unitOnlyElem, recordWidthPlan, describeRecordWidthBlocker, objToRecordPlan, recordToClassPlan, } from "./coercions/structural-plans.js";
|
|
@@ -66,9 +70,11 @@ import { bindingInContext, captureContextBinding, declareContextLocal, declareCo
|
|
|
66
70
|
import { InternalCompilerError } from "../../errors.js";
|
|
67
71
|
import { defaultAfterUndefined, lowerStaticallyUndefinedArgument } from "./optional-arguments.js";
|
|
68
72
|
import {} from "./class-protocol-dispatch.js";
|
|
69
|
-
import { ClassDynamicDispatch, trackClassFieldCreation } from "./class-dynamic-dispatch.js";
|
|
73
|
+
import { ClassDynamicDispatch, boxClassInstancesExactly, trackClassFieldCreation, } from "./class-dynamic-dispatch.js";
|
|
70
74
|
import { guardClassAttributeWrites } from "./class-attributes.js";
|
|
75
|
+
import { guardFrozenWrites, markSloppyRecordWrites } from "./frozen-records.js";
|
|
71
76
|
import { applyHandleProperties } from "./handle-properties.js";
|
|
77
|
+
import { installBufferValue } from "./containers/bytes.js";
|
|
72
78
|
import { ClassProtocols } from "./class-protocols.js";
|
|
73
79
|
import { earlyReadVarSymbols } from "./var-hoisting.js";
|
|
74
80
|
import { recordTextCodecClass } from "../../ir/ir.js";
|
|
@@ -97,14 +103,14 @@ export { newFnCtx } from "./function-context.js";
|
|
|
97
103
|
*/
|
|
98
104
|
import { dirname, relative, resolve } from "node:path";
|
|
99
105
|
import { bindingSource } from "../binding-source.js";
|
|
100
|
-
import { tsgoPath } from "../dts-paths.js";
|
|
106
|
+
import { compilerOwnedFileName, tsgoPath } from "../dts-paths.js";
|
|
101
107
|
import * as ts from "../ts7/adapter.js";
|
|
102
108
|
import { isBundledShimForwarder } from "../package-shims.js";
|
|
103
109
|
import { erasedTypeOnlyImport } from "../type-only-imports.js";
|
|
104
110
|
import { literalValues } from "../literal-values.js";
|
|
105
111
|
import { discriminantOwners, literalUnionArm } from "../union-discriminants.js";
|
|
106
112
|
import { unsupportedAnyOperationDiag, blockedBindingUseDiag, checkerPanicDiag, componentTypeDiag, isCheckerPanic, genericSignatureTypeDiag, indexSignatureTypeDiag, intersectionTypeDiag, noLoweringDiag, overloadedSignatureTypeDiag, recordShapeMismatchDiag, unsupportedNativeApiDiag, unsupportedPackageValueDiag, unionMismatchDiag, UNSUPPORTED, unsupportedDiag, unsupportedTypeDiag, } from "../../diagnostics/diagnostic.js";
|
|
107
|
-
import { arrayOf, BOOL, canAdaptDynFuncTo, canDynCheckTo, canConvertToDyn, DYN, DYN_HANDLE_KINDS, F64, isDynTypedRefType, isJsonSafeType, isJsonStringifySafeType, isPrimitiveCollectionKey, isSupportedMapKey, isSupportedMapValue, isUndefinedArmedUnion, isUnitType, NULL_T, RUNTIME_ERROR_CLASSES, STRING, typeEquals, UNDEFINED_T, VOID, } from "../../ir/ir.js";
|
|
113
|
+
import { arrayOf, BOOL, canAdaptDynFuncTo, canBoxFuncIntoDyn, canDynCheckTo, canConvertToDyn, DYN, DYN_HANDLE_KINDS, F64, isDynTypedRefType, isJsonSafeType, isJsonStringifySafeType, isPrimitiveCollectionKey, isSupportedMapKey, isSupportedMapValue, isUndefinedArmedUnion, isUnitType, NULL_T, RUNTIME_ERROR_CLASSES, STRING, typeEquals, UNDEFINED_T, VOID, } from "../../ir/ir.js";
|
|
108
114
|
import { provenanceActive } from "../provenance-registry.js";
|
|
109
115
|
import { ambientDtsPath, canonicalBuiltinModule, cjsExportAssignmentOf, cjsExportDiscardReason, fallbackDtsPath, isCheckedJsSourceFile, isCjsExportTableLiteral, isCjsJsFile, isJsSourceFile, isNodeEsmFile, isNodeTypesPath, locOf, orderedImportsOf, overridesDtsPath, npmStaticDepSf7, requireSpecOf, resolveImport, workspacePackageOfPath, } from "../program.js";
|
|
110
116
|
import { containsRecord, containsUnion, describeComponentBlocker, describeRecordMemberBlocker, erasedOverloadMemberType, formatIrType, FETCH_AMBIENT_TYPES, isOsConstantsSymbol, isOverloadedCallableMemberType, isUnitOnlyTsType, isWorkerHandleType, isFetchHandleType, jsOpenObjectType, mapType, ShapeRegistry, typeKey, UnionRegistry, withUndefinedArm as withUndefinedArmCanonical, } from "../type-mapper.js";
|
|
@@ -112,7 +118,7 @@ import { builtinConstLit, builtinModuleConstOf, builtinModulesArrayLit, builtinF
|
|
|
112
118
|
import { builtinClassAliasOf, runtimeClassValueOfType, } from "./builtins/class-values.js";
|
|
113
119
|
import { splitFiles, collectProgram, collectNpmImports, collectJsonImports, moduleArtifacts, collectGlobals, declSymbolOf, defaultExportSymbolOf, lowerFileInit, lowerDefaultExport, buildMain, appendDynamicImportModules, appendForkModules, appendWorkerModules, } from "./lower-modules.js";
|
|
114
120
|
import { prepareCjsModuleGraph, usesCjsTopLevelThis } from "./lower-node-module.js";
|
|
115
|
-
import { cjsNamespaceModule, cjsWholeExportValueOf, inlineNamespaceRequireOf, inlineProgramRequireOf, } from "./cjs-inline-require.js";
|
|
121
|
+
import { cjsNamespaceModule, cjsWholeExportValueOf, inlineNamespaceRequireOf, inlineProgramRequireOf, splitRequireBindingOf, splitWholeExportAliasTargetOf, } from "./cjs-inline-require.js";
|
|
116
122
|
import { tscInteropModuleOf } from "./cjs-tsc-interop.js";
|
|
117
123
|
import { usesCjsExportsIdentity } from "./cjs-exports-object.js";
|
|
118
124
|
import { registerBuiltinEventTargetClasses } from "./lower-event-target.js";
|
|
@@ -120,6 +126,7 @@ import { registerBuiltinErrorClasses, defineClassValueConstruct, runtimeClassCon
|
|
|
120
126
|
import { mixinCallClassInfoOf, mixinIntersectionInstanceType, } from "./lower-mixins.js";
|
|
121
127
|
import { tryLowerExpression } from "./expressions/try-lower-expression.js";
|
|
122
128
|
import { funcTypeFromParamShapes, isThisParameter, paramShape, paramShapes, checkDefaultParamBodyType, requireExactArityValue, collectSignature, collectSignatureInner, lambdaSignature, } from "./call-signatures.js";
|
|
129
|
+
import { dynamicOverloadChoice, guessedOverloadIdentifier } from "./overload-choice.js";
|
|
123
130
|
import { implicitAnyParamSymbolsOf, implicitLocalFnNodeOf, implicitMonoFile, collectGenericSignature, genericFnOf, lowerGenericCall, lowerGenericFnValue, inferTypeParamBindings, lowerGenericInstance, genericLocalClassBinding, } from "./generic-functions.js";
|
|
124
131
|
import { bindingNeverReassigned } from "./binding-analysis.js";
|
|
125
132
|
import { bodyReadsArguments } from "../arguments-usage.js";
|
|
@@ -127,7 +134,7 @@ import { completeArgs, wrappedUndefined, undefinedArgFor } from "./call-argument
|
|
|
127
134
|
import { bodyReturnType, declaredReturnType } from "./function-returns.js";
|
|
128
135
|
import { lowerCall, lowerPromiseMethodCall, lowerFilterNarrowCall } from "./lower-calls.js";
|
|
129
136
|
import { lowerFfiCall, validateFfiImports } from "./native-ffi.js";
|
|
130
|
-
import { isTopLevelFnSymbol, lowerNestedFunctionDecl, lowerLambda, lowerFunction, } from "./lower-functions.js";
|
|
137
|
+
import { isTopLevelFnSymbol, lowerNestedFunctionDecl, lowerLambda, lowerFunction, blockedBodyDiagnostics, } from "./lower-functions.js";
|
|
131
138
|
import { lowerArrayMethodCall } from "./containers/array-methods.js";
|
|
132
139
|
import { fuseArrayPipelines } from "./containers/array-pipelines.js";
|
|
133
140
|
import { lowerMapMethodCall, lowerMapForEachCall, lowerSetMethodCall, lowerSetForEachCall, } from "./containers/collection-methods.js";
|
|
@@ -152,7 +159,7 @@ import { lowerBuiltinExtraProperty } from "./builtins/properties.js";
|
|
|
152
159
|
import { registerPromisifiedBuiltinDecl } from "./builtins/callable-aliases.js";
|
|
153
160
|
import { lowerExecFileAsyncCall } from "./builtins/child-process-async.js";
|
|
154
161
|
import { lowerStringDecoderMethodCall, lowerTextCodecCall } from "./builtins/text-codecs.js";
|
|
155
|
-
import { lowerReadlineMethodCall } from "./builtins/readline.js";
|
|
162
|
+
import { isOptionalReadlineCursorRead, lowerReadlineMethodCall } from "./builtins/readline.js";
|
|
156
163
|
import { lowerDiagnosticsChannelMethodCall, lowerDiagnosticsChannelProperty, lowerAsyncLocalStorageMethodCall, lowerTracingChannelMethodCall, lowerTracingChannelProperty, } from "./builtins/async-context.js";
|
|
157
164
|
import { lowerDisposableStackNew } from "./builtins/disposable-stack.js";
|
|
158
165
|
import { lowerErrorCodeProperty, lowerErrorFunctionCall } from "./builtins/errors.js";
|
|
@@ -165,7 +172,7 @@ import { dateJsonType, isDateJsonSource, lowerDateCall } from "./builtins/dates.
|
|
|
165
172
|
import { fsConstantMemberRead, fsConstantsObject, lowerFsConstantsProperty, lowerBuiltinConstantsProperty, builtinConstantBindingOf, builtinConstantsDestructureDecl, } from "./builtins/constants.js";
|
|
166
173
|
import { lowerStringStaticCall, lowerStringLastIndexOfCall } from "./builtins/strings.js";
|
|
167
174
|
import { lowerPromiseStaticCall } from "./builtins/promises.js";
|
|
168
|
-
import { fenceFetchObjectAssignment, fenceFetchObjectBinding, fenceStaticAbortControllerMemberRead, fenceStaticHeadersIteration, fenceStaticHeadersMember, fenceStaticReadableStreamMember, fenceStaticResponseMember, fenceUnsupportedFetchConstructorMember, refuseUnsupportedApi, stdlibGlobalFnOf, lowerAbortControllerNew, lowerEventTargetNew, lowerLiveWebValue, lowerDynamicImportCall, lowerFetchCall, lowerFetchElementMethodCall, lowerResponseNew, lowerFetchWebNew, lowerStaticFetchCompanionCall, lowerStaticAbortControllerCall, lowerStaticAbortSignalListenerCall, lowerStaticReadableStreamCancelCall, lowerStaticReadableStreamControllerCall, lowerStaticReadableStreamNew, lowerStaticReadableStreamReaderCall, lowerStaticResponseCall, lowerStdlibMethodCall, lowerMathProperty, npmPackageOf, npmMemberFence, npmPackageOfSymbol, } from "./lower-stdlib.js";
|
|
175
|
+
import { fenceFetchObjectAssignment, fenceFetchObjectBinding, fenceStaticAbortControllerMemberRead, fenceStaticHeadersIteration, fenceStaticHeadersMember, fenceStaticReadableStreamMember, fenceStaticResponseMember, fenceUnsupportedFetchConstructorMember, refuseUnsupportedApi, stdlibGlobalFnOf, lowerAbortControllerNew, lowerEventTargetNew, lowerLiveWebValue, lowerDynamicImportCall, lowerFetchCall, lowerFetchElementMethodCall, lowerResponseNew, lowerFetchWebNew, lowerStaticFetchCompanionCall, lowerStaticAbortControllerCall, lowerStaticAbortSignalListenerCall, lowerStaticReadableStreamCancelCall, lowerStaticReadableStreamControllerCall, lowerStaticReadableStreamNew, lowerStaticTransformStreamNew, lowerStaticReadableStreamReaderCall, lowerStaticResponseCall, lowerStdlibMethodCall, lowerMathProperty, npmPackageOf, npmMemberFence, npmPackageOfSymbol, } from "./lower-stdlib.js";
|
|
169
176
|
import { lowerHttpHeadersElement, lowerNetModuleCall, lowerServerMethodCall, lowerServerProperty, lowerTlsRootCertificates, } from "./lower-server.js";
|
|
170
177
|
import { lowerDgramDnsModuleCall, lowerDgramMethodCall } from "./lower-dgram.js";
|
|
171
178
|
import { lowerNodeTestModuleCall, lowerTestDirectCall, lowerTestMethodCall, lowerTestCtxProperty, } from "./lower-test.js";
|
|
@@ -173,7 +180,7 @@ import { lowerAssertModuleCall, lowerAssertDirectCall } from "./lower-assert.js"
|
|
|
173
180
|
import { lowerUtilModuleCall } from "./lower-inspect.js";
|
|
174
181
|
import { lowerSystemErrorMapValue } from "./lower-system-errors.js";
|
|
175
182
|
import { lowerComptime, comptimeBakeable, rejectComptimeCaptures, comptimeValueToIr, } from "./lower-comptime.js";
|
|
176
|
-
import { lowerStmts, hasJsTypeAnnotation, noteBlockedBindings, isBlockedBinding, lowerScopedBlock, predeclareForwardCapture, predeclareForwardFnDecl, predeclareForwardVar, lowerStmt, lowerVarStatement, lowerDestructuringDecl, lowerDestructuringAssignParts, lowerBindingPattern, checkBindingElement, bindPatternTarget, isParseArgsDynCheckerType, lowerVarDeclList, lowerVarDecl, lowerSwitch, lowerTry, lowerExprStatement, lowerForOf, lowerForStatement, matchGroupsPatternSource, isGuardedRecordRead, } from "./lower-stmts.js";
|
|
183
|
+
import { lowerStmts, hasJsTypeAnnotation, noteBlockedBindings, isBlockedBinding, lowerScopedBlock, predeclareForwardCapture, predeclareForwardFnDecl, predeclareForwardVar, lowerStmt, lowerVarStatement, lowerDestructuringDecl, lowerDestructuringAssignParts, lowerBindingPattern, checkBindingElement, bindPatternTarget, isParseArgsDynCheckerType, lowerVarDeclList, lowerVarDecl, lowerSwitch, lowerTry, lowerExprStatement, lowerForOf, lowerForStatement, matchGroupsPatternSource, isGuardedRecordRead, holdsEvolvingArray, } from "./lower-stmts.js";
|
|
177
184
|
import { lowerExpr, maybeNarrow, lowerUnitComparison, lowerNullishCoalesce, lowerCondition, ensureBool, requireTruthyUnion, eqComparableUnion, lowerIntrinsicProperty, lowerArrayLiteral, lowerElementAccess, lowerElementWrite, lowerRecordKeyRead, ensureString, lowerTemplate, lowerAsExpression, lowerPrefixUnary, lowerBinary, lowerCaughtTypeofTest, caughtRead, caughtLocalOf, caughtToString, lowerInstanceOf, lowerRegexLiteral, lowerFieldRead, lowerUnionProperty, fieldTarget, fieldGetExpr, fieldSetStmt, lowerFieldCompound, uniqueSymbolKeyOf, matchCallbackParamGroupsOf, } from "./lower-exprs.js";
|
|
178
185
|
import { finishOptionalChain, isOptionalChainTail, lowerOptionalChain, } from "./expressions/optional-chains.js";
|
|
179
186
|
import { foldedStringKeyOf, lowerDynObjectLiteral, lowerObjectLiteral, lowerShorthandValue, rejectThisInObjectMethod, } from "./expressions/object-literals.js";
|
|
@@ -629,6 +636,7 @@ export function lowerToIr(program, entry, moduleOrder, options = {}) {
|
|
|
629
636
|
// travel with them: a failed statement is never left unexplained.
|
|
630
637
|
const covered = {
|
|
631
638
|
...result,
|
|
639
|
+
diagnostics: [...result.diagnostics, ...remainder.reachedBlockedBodyDiagnostics],
|
|
632
640
|
stats: { ...result.stats, statementsDynamic },
|
|
633
641
|
unreached: {
|
|
634
642
|
diagnostics: rem.diagnostics,
|
|
@@ -1156,6 +1164,9 @@ export class Lowerer {
|
|
|
1156
1164
|
/** Identifiers by spelling, per file, for the generic bindings' use
|
|
1157
1165
|
* ordering (runsAfterDeclaration). */
|
|
1158
1166
|
bindingIdentifiers = new Map();
|
|
1167
|
+
/** Per JavaScript file, the declarations of the bindings it assigns an
|
|
1168
|
+
* own `toString` (jsAssignsOwnToString in lower-calls.ts). */
|
|
1169
|
+
ownToStringTargets = new Map();
|
|
1159
1170
|
/** Per-symbol result of the never-reassigned file scan
|
|
1160
1171
|
* (bindingNeverReassigned — object-literal generic-method receivers). */
|
|
1161
1172
|
neverReassignedCache = new Map();
|
|
@@ -1414,6 +1425,9 @@ export class Lowerer {
|
|
|
1414
1425
|
* and erased instances). */
|
|
1415
1426
|
erasingDepth = 0;
|
|
1416
1427
|
localClassInstantiations = [];
|
|
1428
|
+
/** The function-local classes of the program with an `extends` clause, whether lowering collected
|
|
1429
|
+
* them yet or not (new-target.ts); found on first use. */
|
|
1430
|
+
functionLocalSubclasses = undefined;
|
|
1417
1431
|
/** Instance types (by checker type id) of the local classes generic
|
|
1418
1432
|
* factory calls return, and the per-instance class each names. */
|
|
1419
1433
|
localClassInstanceTypes = new Map();
|
|
@@ -1508,6 +1522,14 @@ export class Lowerer {
|
|
|
1508
1522
|
/** Per CommonJS file using top-level `this`: the global holding the
|
|
1509
1523
|
* object that stands for its original exports (lowerCjsTopLevelThis). */
|
|
1510
1524
|
cjsExportsThis = new Map();
|
|
1525
|
+
/** `var m; m = require("./x")` alias bindings (cjs-inline-require.ts).
|
|
1526
|
+
* Null entries cache declarations that keep ordinary storage. */
|
|
1527
|
+
cjsSplitRequireBindings = new Map();
|
|
1528
|
+
/** Per-module whole-export symbol (cjs-inline-require.ts). Null means the
|
|
1529
|
+
* module's exports are a table. */
|
|
1530
|
+
cjsWholeExportSymbols = new Map();
|
|
1531
|
+
/** Per-module live member-export classification (cjs-inline-require.ts). */
|
|
1532
|
+
cjsLiveMemberExports = new Map();
|
|
1511
1533
|
/** Inline program-module require calls whose %init the enclosing member
|
|
1512
1534
|
* read or member call is already sequencing (cjs-inline-require.ts). */
|
|
1513
1535
|
inlineRequireInitDone = new Set();
|
|
@@ -1558,6 +1580,10 @@ export class Lowerer {
|
|
|
1558
1580
|
runtimeOptionalFields = new Set();
|
|
1559
1581
|
/** Bindings initialized by a Date's `toJSON()` (analyzeDateJsonResults). */
|
|
1560
1582
|
dateJsonBindings = new Set();
|
|
1583
|
+
/** isTimeValueDateDeclaration's answers, and the locals that hold a
|
|
1584
|
+
* Date's time value instead of a Date object (date-values.ts). */
|
|
1585
|
+
timeValueDateDecisions = new Map();
|
|
1586
|
+
timeValueDateLocals = new Set();
|
|
1561
1587
|
/** Record bindings whose flow class reaches storage outside the class:
|
|
1562
1588
|
* they keep the declared layout, so an initializer from unchecked reads
|
|
1563
1589
|
* converts once instead of the binding adopting the widened variant. */
|
|
@@ -1631,6 +1657,47 @@ export class Lowerer {
|
|
|
1631
1657
|
}
|
|
1632
1658
|
return fallback ?? null;
|
|
1633
1659
|
}
|
|
1660
|
+
/** A fresh TypeScript data literal (`{ message: "m" }`) passed to a
|
|
1661
|
+
* checked-dynamic parameter of a callee implemented in JavaScript, whose
|
|
1662
|
+
* contract lets it reshape the object: a call through an untyped value, an
|
|
1663
|
+
* untyped parameter of a JavaScript function, or a package-declared
|
|
1664
|
+
* parameter type (a non-library `.d.ts`) that makes one of the literal's
|
|
1665
|
+
* properties optional (zod's `normalizeParams` deletes `params.message`).
|
|
1666
|
+
* No typed alias of a fresh literal exists, so it is built as the plain
|
|
1667
|
+
* object the callee receives instead of a view whose record layout refuses
|
|
1668
|
+
* that delete. Standard-library and TypeScript callees, and literals with
|
|
1669
|
+
* methods or accessors, keep their native storage. */
|
|
1670
|
+
reshapeableContextualLiteral(literal, contextual) {
|
|
1671
|
+
const call = literal.parent;
|
|
1672
|
+
if (call === undefined ||
|
|
1673
|
+
!(ts.isCallExpression(call) || ts.isNewExpression(call)) ||
|
|
1674
|
+
!call.arguments?.nodes.includes(literal) ||
|
|
1675
|
+
literal.properties.nodes.length === 0 ||
|
|
1676
|
+
!literal.properties.nodes.every((prop) => (ts.isPropertyAssignment(prop) || ts.isShorthandPropertyAssignment(prop)) &&
|
|
1677
|
+
(ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name))))
|
|
1678
|
+
return false;
|
|
1679
|
+
const declaration = this.checker.getResolvedSignature(call)?.declaration;
|
|
1680
|
+
const file = declaration ? ts.getSourceFileOfNode(declaration) : undefined;
|
|
1681
|
+
const untyped = contextual.some((part) => part.flags & ts.TypeFlags.Any);
|
|
1682
|
+
if (file === undefined)
|
|
1683
|
+
return untyped;
|
|
1684
|
+
if (isJsSourceFile(file))
|
|
1685
|
+
return untyped;
|
|
1686
|
+
if (!file.isDeclarationFile || this.isStdlibFile(file))
|
|
1687
|
+
return false;
|
|
1688
|
+
if (untyped)
|
|
1689
|
+
return true;
|
|
1690
|
+
const objects = contextual.filter((part) => part.flags & ts.TypeFlags.Object);
|
|
1691
|
+
if (objects.length === 0)
|
|
1692
|
+
return false;
|
|
1693
|
+
return literal.properties.nodes.some((prop) => {
|
|
1694
|
+
const name = prop.name.text;
|
|
1695
|
+
return objects.every((part) => {
|
|
1696
|
+
const symbol = this.checker.getPropertyOfType(part, name);
|
|
1697
|
+
return symbol !== undefined && (symbol.flags & ts.SymbolFlags.Optional) !== 0;
|
|
1698
|
+
});
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1634
1701
|
/** A TypeScript object literal handed to a JavaScript checked-value
|
|
1635
1702
|
* parameter whose inferred type is open (`constructor({ factory, ...options
|
|
1636
1703
|
* } = {})` — the rest element admits any property): the literal names a
|
|
@@ -1964,6 +2031,8 @@ export class Lowerer {
|
|
|
1964
2031
|
/** Parameters read as `any` in the error-path copy of an error-first
|
|
1965
2032
|
* callback. */
|
|
1966
2033
|
anySymbols = new Set();
|
|
2034
|
+
/** overload-choice's answers per call, binding and function. */
|
|
2035
|
+
dynamicOverloadAnswers = new Map();
|
|
1967
2036
|
/** Error parameters of an error-first callback with a known value in
|
|
1968
2037
|
* the copy being lowered: true while it holds an Error, false while it
|
|
1969
2038
|
* holds null (staticCondition folds conditions on them). */
|
|
@@ -2038,6 +2107,9 @@ export class Lowerer {
|
|
|
2038
2107
|
/** util.inspect's per-type traversal helpers (%util.insp.N), interned
|
|
2039
2108
|
* by typeKey — the assertHelpers pattern with its own namespace. */
|
|
2040
2109
|
inspectHelpers = new Map();
|
|
2110
|
+
/** Indexed-union safe-read helpers mapped to their numeric twins, for the
|
|
2111
|
+
* fusion of an immediate ToNumber (tryLowerNumericIndexRead). */
|
|
2112
|
+
indexedUnionNumericTwins = new Map();
|
|
2041
2113
|
unionLiteralOwners = new Map();
|
|
2042
2114
|
strippedUndefinedArms = new Map();
|
|
2043
2115
|
addedUndefinedArms = new Map();
|
|
@@ -2068,6 +2140,10 @@ export class Lowerer {
|
|
|
2068
2140
|
* checks resolve through this map (stdlibGlobalNameOf), declarations
|
|
2069
2141
|
* emit nothing. */
|
|
2070
2142
|
stdlibGlobalAliases = new Map();
|
|
2143
|
+
/** The stdlibGlobalAliases bound through a cast of the global object
|
|
2144
|
+
* (`(globalThis as { Buffer?: B }).Buffer`). Their static type is the
|
|
2145
|
+
* cast's, so their value reads are refused (identifiers.ts). */
|
|
2146
|
+
castGlobalAliases = new Set();
|
|
2071
2147
|
/** CJS export-table ACCESSORS (`module.exports = { get path() {...} }`),
|
|
2072
2148
|
* lifted lazily as module-level functions and interned per accessor
|
|
2073
2149
|
* declaration: member reads call the getter (lower-exprs). */
|
|
@@ -2142,10 +2218,32 @@ export class Lowerer {
|
|
|
2142
2218
|
/** Named method slots observed before class collection need a callable
|
|
2143
2219
|
* ABI and shared prototype descriptors instead of call-site specialization. */
|
|
2144
2220
|
prototypeMethodAccesses = new Map();
|
|
2221
|
+
/** Every site the census found for a name in prototypeMethodAccesses (which
|
|
2222
|
+
* keeps one): reads of the method and writes that may replace it. The
|
|
2223
|
+
* key-order witness asks which replacements can return records. */
|
|
2224
|
+
methodAccessSites = new Map();
|
|
2225
|
+
/** Marks `name` as a method the program may read or replace at `site`. */
|
|
2226
|
+
noteMethodAccess(name, site) {
|
|
2227
|
+
this.prototypeMethodAccesses.set(name, site);
|
|
2228
|
+
this.noteMethodSite(name, site);
|
|
2229
|
+
}
|
|
2230
|
+
/** Records a site for `name` without changing its prototypeMethodAccesses entry. */
|
|
2231
|
+
noteMethodSite(name, site) {
|
|
2232
|
+
const sites = this.methodAccessSites.get(name);
|
|
2233
|
+
if (sites === undefined)
|
|
2234
|
+
this.methodAccessSites.set(name, [site]);
|
|
2235
|
+
else
|
|
2236
|
+
sites.push(site);
|
|
2237
|
+
}
|
|
2145
2238
|
/** Whether the program reads `Error.prototype`, the checked-dynamic
|
|
2146
|
-
* object an ES5 constructor function can inherit from
|
|
2147
|
-
*
|
|
2239
|
+
* object an ES5 constructor function can inherit from, or has a class
|
|
2240
|
+
* whose heritage is evaluated at run time (`extends (Base ?? Error)`):
|
|
2241
|
+
* only then can a value that is not an Error instance be
|
|
2242
|
+
* `instanceof Error`. */
|
|
2148
2243
|
errorPrototypeValues = false;
|
|
2244
|
+
/** The property names the program assigns on the global object
|
|
2245
|
+
* (property-access.ts), collected on first use. */
|
|
2246
|
+
globalThisWrittenNames = null;
|
|
2149
2247
|
/** Well-known symbol methods (`sym:iterator`) the program may replace
|
|
2150
2248
|
* through a symbol-keyed write: an instance or prototype property, or a
|
|
2151
2249
|
* reflection call. */
|
|
@@ -2218,8 +2316,13 @@ export class Lowerer {
|
|
|
2218
2316
|
* (builtins/fs-paths.ts): each lowers to the hidden local that holds its
|
|
2219
2317
|
* value, which is null until the path's lowering has saved it. */
|
|
2220
2318
|
stagedArguments = new Map();
|
|
2221
|
-
/**
|
|
2222
|
-
|
|
2319
|
+
/** What each fs path argument of a URL-path call lowers to (the plans
|
|
2320
|
+
* of builtins/fs-paths.ts). */
|
|
2321
|
+
fsPathPlans = new Map();
|
|
2322
|
+
/** The existsSync/fs.promises calls whose converted URL paths are being
|
|
2323
|
+
* lowered into the call itself (lowerFallibleFsUrlCall). A call may be
|
|
2324
|
+
* lowered more than once, and each lowering converts again. */
|
|
2325
|
+
fallibleFsCalls = new Set();
|
|
2223
2326
|
moduleNsParamOverrides = new Map();
|
|
2224
2327
|
/** File → qualifier prefix: "" for the entry, "%mI." otherwise. */
|
|
2225
2328
|
fileTag = new Map();
|
|
@@ -2333,6 +2436,12 @@ export class Lowerer {
|
|
|
2333
2436
|
// Stack of function contexts (bottom = the function being declared at
|
|
2334
2437
|
// top level, top = the innermost nested function currently lowering).
|
|
2335
2438
|
fnStack = [];
|
|
2439
|
+
/** Source ranges of record writes in sloppy-mode code, and of the
|
|
2440
|
+
* absent-state writes of `delete r.f` (markSloppyRecordWrites). */
|
|
2441
|
+
sloppyRecordWrites = new Set();
|
|
2442
|
+
recordFieldDeletes = new Set();
|
|
2443
|
+
/** typeKeys of the array types the program may freeze (IrModule.freezableArrays). */
|
|
2444
|
+
freezableArrays = new Set();
|
|
2336
2445
|
liftedFns = [];
|
|
2337
2446
|
/** The first lifted function of each name (liftedFnNamed), for the
|
|
2338
2447
|
* liftedFns indexed so far. liftedFns only grows. */
|
|
@@ -2345,15 +2454,21 @@ export class Lowerer {
|
|
|
2345
2454
|
* dispatch revision needs no weak-key identity or process-global state. */
|
|
2346
2455
|
errorMethodDispatchRevision = null;
|
|
2347
2456
|
errorPropertyDispatchRevision = null;
|
|
2457
|
+
/** The program defines properties by reflection on an untyped or
|
|
2458
|
+
* Error-shaped target, so an own accessor may replace an error's `name`
|
|
2459
|
+
* or `message`: typed reads and writes of those slots check for one.
|
|
2460
|
+
* Holds the first such call's location. */
|
|
2461
|
+
errorAccessorReflection = null;
|
|
2348
2462
|
/** Structural source positions (structural-positions.ts) for names that
|
|
2349
2463
|
* stay the same when unrelated code moves. */
|
|
2350
2464
|
/** Files are named by their path relative to the entry's directory, so
|
|
2351
|
-
* names do not depend on where the program sits,
|
|
2352
|
-
*
|
|
2353
|
-
* directories
|
|
2465
|
+
* names do not depend on where the program sits, default library files
|
|
2466
|
+
* by their base name (two checkers install them in different
|
|
2467
|
+
* directories), and the files scriptc ships by their name inside scriptc,
|
|
2468
|
+
* so names do not depend on where scriptc is installed either. */
|
|
2354
2469
|
positions = new StructuralPositions((sf) => this.program.isSourceFileDefaultLibrary(sf)
|
|
2355
2470
|
? `lib:${sf.fileName.slice(sf.fileName.lastIndexOf("/") + 1)}`
|
|
2356
|
-
: relative(dirname(this.entry.fileName), sf.fileName));
|
|
2471
|
+
: (compilerOwnedFileName(sf.fileName) ?? relative(dirname(this.entry.fileName), sf.fileName)));
|
|
2357
2472
|
/** The outermost node whose token span is exactly `loc`, or null. */
|
|
2358
2473
|
nodeAtLoc(loc) {
|
|
2359
2474
|
const sf = this.program.getSourceFile(loc.file);
|
|
@@ -2381,7 +2496,9 @@ export class Lowerer {
|
|
|
2381
2496
|
* before it. */
|
|
2382
2497
|
closureName(loc, suffix = "", prefix = "%fn") {
|
|
2383
2498
|
const node = this.nodeAtLoc(loc);
|
|
2384
|
-
const where = node === null
|
|
2499
|
+
const where = node === null
|
|
2500
|
+
? `${compilerOwnedFileName(loc.file) ?? loc.file}:${loc.start}:${loc.end}`
|
|
2501
|
+
: this.positions.of(node);
|
|
2385
2502
|
const key = `${prefix}|${this.closureRoot}|${where}|${suffix}`;
|
|
2386
2503
|
const first = keyedHelperName(this, prefix, key);
|
|
2387
2504
|
const seen = this.closureNameCounts.get(first) ?? 0;
|
|
@@ -2443,6 +2560,9 @@ export class Lowerer {
|
|
|
2443
2560
|
* the class and constructed-class counts, it tells caches over the class
|
|
2444
2561
|
* graph when the graph changed. */
|
|
2445
2562
|
subclassLinks = 0;
|
|
2563
|
+
/** Function-local classes by the class node they extend, built on first
|
|
2564
|
+
* use (localSubclassesOf in lower-classes.ts). */
|
|
2565
|
+
localSubclassIndex = null;
|
|
2446
2566
|
/** Set while a subclass constructor's super() call notes its base
|
|
2447
2567
|
* constructor edge: that edge does not instantiate the base exactly. */
|
|
2448
2568
|
superConstructorEdge = false;
|
|
@@ -2508,7 +2628,20 @@ export class Lowerer {
|
|
|
2508
2628
|
if (this.sharedHelpers.size === 0)
|
|
2509
2629
|
return;
|
|
2510
2630
|
const shared = new Map([...this.sharedHelpers].map((fn) => [fn.name, fn]));
|
|
2511
|
-
|
|
2631
|
+
// Files scriptc ships compare by their name inside scriptc, so the
|
|
2632
|
+
// choice does not depend on where scriptc is installed.
|
|
2633
|
+
const fileKeys = new Map();
|
|
2634
|
+
const fileKey = (file) => {
|
|
2635
|
+
let key = fileKeys.get(file);
|
|
2636
|
+
if (key === undefined)
|
|
2637
|
+
fileKeys.set(file, (key = compilerOwnedFileName(file) ?? file));
|
|
2638
|
+
return key;
|
|
2639
|
+
};
|
|
2640
|
+
const earlier = (left, right) => {
|
|
2641
|
+
if (left.file === right.file)
|
|
2642
|
+
return left.start < right.start;
|
|
2643
|
+
return fileKey(left.file) < fileKey(right.file);
|
|
2644
|
+
};
|
|
2512
2645
|
// The earliest use of each shared helper outside the shared helpers, and
|
|
2513
2646
|
// which shared helpers each shared helper uses.
|
|
2514
2647
|
const uses = new Map();
|
|
@@ -2705,6 +2838,20 @@ export class Lowerer {
|
|
|
2705
2838
|
else if (kind === "failed")
|
|
2706
2839
|
s.failed += 1;
|
|
2707
2840
|
}
|
|
2841
|
+
/** The program holds the declaration-typed boundary's projection
|
|
2842
|
+
* (decl-projection.ts): user-file record and array values crossing into
|
|
2843
|
+
* dynamic slots (package parameters) box as live capsules, so a value
|
|
2844
|
+
* that comes back through a boundary cast keeps its identity. */
|
|
2845
|
+
declBoundaryMemo = null;
|
|
2846
|
+
get declBoundary() {
|
|
2847
|
+
this.declBoundaryMemo ??= this.program
|
|
2848
|
+
.getSourceFiles()
|
|
2849
|
+
.some((sf) => isDeclBoundaryFile(sf.fileName));
|
|
2850
|
+
return this.declBoundaryMemo;
|
|
2851
|
+
}
|
|
2852
|
+
/** Tracked classes' bag initializers over a typed `this`
|
|
2853
|
+
* (class-dynamic-dispatch.ts recordBagInitializers). */
|
|
2854
|
+
classBagInitializers = new Map();
|
|
2708
2855
|
constructor(program, entry, moduleOrder, mode = {}) {
|
|
2709
2856
|
this.program = program;
|
|
2710
2857
|
this.entry = entry;
|
|
@@ -2808,7 +2955,10 @@ export class Lowerer {
|
|
|
2808
2955
|
classImplementedProtocol: (type) => this.classImplementedProtocol(type),
|
|
2809
2956
|
isStdlibFile: this.isStdlibFile,
|
|
2810
2957
|
isNpmFile: this.isNpmFile,
|
|
2811
|
-
|
|
2958
|
+
// The declaration-typed boundary's generated types (decl-projection.ts)
|
|
2959
|
+
// describe data, like an explicitly mapped external type surface.
|
|
2960
|
+
isExternalTypeFile: (sf) => this.externalTypeSpecifiersByFile.has(tsgoPath(resolve(sf.fileName))) ||
|
|
2961
|
+
isDeclBoundaryFile(sf.fileName),
|
|
2812
2962
|
typeMemo: this.typeMemo,
|
|
2813
2963
|
...(this.generalNodeStreams ? { generalNodeStreams: true } : {}),
|
|
2814
2964
|
...(this.dynNodeStreams ? { dynNodeStreams: true } : {}),
|
|
@@ -3076,6 +3226,12 @@ export class Lowerer {
|
|
|
3076
3226
|
const cjsValue = this.cjsExportValueSymbol(symbol);
|
|
3077
3227
|
if (cjsValue)
|
|
3078
3228
|
symbol = cjsValue;
|
|
3229
|
+
// `var m; m = require("./x"); module.exports = m` over a whole-export
|
|
3230
|
+
// target: TS types the wrapper's export= as `any`, so reconnect it to
|
|
3231
|
+
// the target's value symbol explicitly.
|
|
3232
|
+
const splitAlias = splitWholeExportAliasTargetOf(this, symbol);
|
|
3233
|
+
if (splitAlias)
|
|
3234
|
+
symbol = splitAlias;
|
|
3079
3235
|
this.flushDeferred(symbol);
|
|
3080
3236
|
return symbol;
|
|
3081
3237
|
}
|
|
@@ -3189,7 +3345,7 @@ export class Lowerer {
|
|
|
3189
3345
|
// exact mappings, while star exports resolve to the mapped declaration
|
|
3190
3346
|
// owner through externalTypeSpecifiersByFile.
|
|
3191
3347
|
const moduleSymbol = this.checker.getSymbolAtLocation(sf);
|
|
3192
|
-
const exported = moduleSymbol?.getExports().get(exportName);
|
|
3348
|
+
const exported = moduleSymbol?.getExports().get(ts.escapedSymbolName(exportName));
|
|
3193
3349
|
return this.externalTypeSpecifierOfSymbol(exported, seenSymbols, seenExports);
|
|
3194
3350
|
}
|
|
3195
3351
|
externalTypeSpecifierOfNamespaceMember(expr, member) {
|
|
@@ -3330,7 +3486,7 @@ export class Lowerer {
|
|
|
3330
3486
|
cjsModuleExportSymbol(sf, name) {
|
|
3331
3487
|
const moduleSym = this.checker.getSymbolAtLocation(sf);
|
|
3332
3488
|
const exports = moduleSym?.getExports();
|
|
3333
|
-
const direct = exports?.get(name);
|
|
3489
|
+
const direct = exports?.get(ts.escapedSymbolName(name));
|
|
3334
3490
|
if (direct)
|
|
3335
3491
|
return direct;
|
|
3336
3492
|
// tsgo represents `module.exports = { ... }` as one `export=` symbol
|
|
@@ -3480,8 +3636,10 @@ export class Lowerer {
|
|
|
3480
3636
|
return null;
|
|
3481
3637
|
if (ts.isImportClause(decl))
|
|
3482
3638
|
return this.cjsDefaultImportDepOf(decl);
|
|
3483
|
-
if (!ts.isVariableDeclaration(decl) || !ts.isIdentifier(decl.name)
|
|
3639
|
+
if (!ts.isVariableDeclaration(decl) || !ts.isIdentifier(decl.name))
|
|
3484
3640
|
return null;
|
|
3641
|
+
if (decl.initializer === undefined)
|
|
3642
|
+
return splitRequireBindingOf(this, decl)?.dep ?? null;
|
|
3485
3643
|
{
|
|
3486
3644
|
const interop = tscInteropModuleOf(this, expr);
|
|
3487
3645
|
if (interop !== null)
|
|
@@ -3584,6 +3742,10 @@ export class Lowerer {
|
|
|
3584
3742
|
if (!ts.isIdentifier(expr))
|
|
3585
3743
|
return this.cjsModuleRefDepOf(expr) !== null;
|
|
3586
3744
|
const sym = this.checker.getSymbolAtLocation(expr);
|
|
3745
|
+
const splitDecl = sym?.declarations.find(ts.isVariableDeclaration);
|
|
3746
|
+
const split = splitDecl === undefined ? null : splitRequireBindingOf(this, splitDecl);
|
|
3747
|
+
if (split !== null)
|
|
3748
|
+
return cjsNamespaceModule(this, split.dep);
|
|
3587
3749
|
if (this.localModuleBindingDepOf(expr) === null)
|
|
3588
3750
|
return false;
|
|
3589
3751
|
if (this.createRequireWholeExportSymbolOf(expr) !== null)
|
|
@@ -3891,6 +4053,9 @@ export class Lowerer {
|
|
|
3891
4053
|
* their external dependencies by name). Null for everything else
|
|
3892
4054
|
* (builtins load nothing; the rest kept its preflight fence). */
|
|
3893
4055
|
requireInitStmt(spec, node) {
|
|
4056
|
+
if (this.inlineRequireCycleCalls.has(node)) {
|
|
4057
|
+
this.unsupported("SC1090", node, `require() of '${spec}' while it is still evaluating (a require cycle: Node answers its partial exports, which the static export table does not model)`);
|
|
4058
|
+
}
|
|
3894
4059
|
if (canonicalBuiltinModule(spec) === "punycode")
|
|
3895
4060
|
return this.punycodeRequireWarning(node);
|
|
3896
4061
|
// Project requires resolve within the program; another bare require can
|
|
@@ -4551,6 +4716,8 @@ export class Lowerer {
|
|
|
4551
4716
|
return true;
|
|
4552
4717
|
if (ts.isPropertyAccessExpression(e) && isOptionalProcessStreamProperty(this, e))
|
|
4553
4718
|
return true;
|
|
4719
|
+
if (ts.isPropertyAccessExpression(e) && isOptionalReadlineCursorRead(this, e))
|
|
4720
|
+
return true;
|
|
4554
4721
|
if (isOptionalProcessVersionsRead(this, e))
|
|
4555
4722
|
return true;
|
|
4556
4723
|
if (ts.isPropertyAccessExpression(e) && isSettledIteratorValueRead(this, e))
|
|
@@ -5732,7 +5899,10 @@ export class Lowerer {
|
|
|
5732
5899
|
}
|
|
5733
5900
|
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)) {
|
|
5734
5901
|
const callbackIndices = hofCallbackIndices(node.expression.name.text, node.arguments.nodes.length >= 2);
|
|
5735
|
-
|
|
5902
|
+
// `xs.map(((x) => x))`: the parenthesized callback is the arrow.
|
|
5903
|
+
let callback = node.arguments.nodes[0];
|
|
5904
|
+
while (callback !== undefined && ts.isParenthesizedExpression(callback))
|
|
5905
|
+
callback = callback.expression;
|
|
5736
5906
|
if (callbackIndices !== null && callback !== undefined && !ts.isSpreadElement(callback)) {
|
|
5737
5907
|
const receiverNode = node.expression.expression;
|
|
5738
5908
|
const receiverTs = this.typeOf(receiverNode);
|
|
@@ -5783,12 +5953,26 @@ export class Lowerer {
|
|
|
5783
5953
|
presentSites.set(node, elementsPresent && !reduce);
|
|
5784
5954
|
if (elementsPresent && reduce && retypeInlineCallback(callback, callbackIndices))
|
|
5785
5955
|
changed = true;
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5956
|
+
// The accumulator holds undefined when the callback can return
|
|
5957
|
+
// it, when an initial value can be missing, or when elements can
|
|
5958
|
+
// be absent and there is no initial value. It holds another
|
|
5959
|
+
// primitive when the callback's result can be one at run time
|
|
5960
|
+
// (`missing[0] ?? "fallback"`).
|
|
5961
|
+
const initial = node.arguments.nodes[1];
|
|
5962
|
+
const optional = (!elementsPresent && initial === undefined) ||
|
|
5963
|
+
(initial !== undefined && !ts.isSpreadElement(initial) && mayBeOptional(initial)) ||
|
|
5964
|
+
callbackReturnsOptional(callback);
|
|
5965
|
+
const arithmetic = reduce && (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback))
|
|
5966
|
+
? lambdaArithmeticReturn(callback)
|
|
5967
|
+
: null;
|
|
5968
|
+
if (reduce && (optional || arithmetic !== null)) {
|
|
5969
|
+
if (optional && promoteHofCallback(callback, [0, 1]))
|
|
5790
5970
|
changed = true;
|
|
5791
|
-
|
|
5971
|
+
let result = this.irTypeOf(node);
|
|
5972
|
+
if (arithmetic !== null)
|
|
5973
|
+
result = joinPrimitiveTypes([result, arithmetic]) ?? result;
|
|
5974
|
+
if (optional)
|
|
5975
|
+
result = this.runtimeOptionalType(result);
|
|
5792
5976
|
siteDependencies?.read(node);
|
|
5793
5977
|
const previous = this.runtimeOptionalReduceTypes.get(node);
|
|
5794
5978
|
if (!previous || !typeEquals(previous, result)) {
|
|
@@ -6563,8 +6747,11 @@ export class Lowerer {
|
|
|
6563
6747
|
const fn = this.lowerFunction(decl);
|
|
6564
6748
|
if (fn)
|
|
6565
6749
|
functions.push(fn);
|
|
6566
|
-
else if (this.countsSkips())
|
|
6750
|
+
else if (this.countsSkips()) {
|
|
6567
6751
|
this.countSkippedBody(decl);
|
|
6752
|
+
if (this.remainder)
|
|
6753
|
+
this.reportBlockedBody(decl);
|
|
6754
|
+
}
|
|
6568
6755
|
}
|
|
6569
6756
|
for (const decl of fp.classDecls) {
|
|
6570
6757
|
const info = this.classes.get(this.classNamer(decl));
|
|
@@ -6687,8 +6874,11 @@ export class Lowerer {
|
|
|
6687
6874
|
finalizeClassMethodValues(this, functions);
|
|
6688
6875
|
finalizePrivateBrands(this, functions);
|
|
6689
6876
|
trackClassFieldCreation(this, functions);
|
|
6877
|
+
boxClassInstancesExactly(this, functions);
|
|
6690
6878
|
guardClassAttributeWrites(this, functions);
|
|
6879
|
+
guardFrozenWrites(this, functions);
|
|
6691
6880
|
applyHandleProperties(this, functions);
|
|
6881
|
+
installBufferValue(functions);
|
|
6692
6882
|
// Globals typed by a class that never REGISTERED (a JS class whose
|
|
6693
6883
|
// collection fenced — Symbol-keyed fields, an unsupported base): the
|
|
6694
6884
|
// declaration statement and every use compiled to runtime fences, but
|
|
@@ -6790,9 +6980,13 @@ export class Lowerer {
|
|
|
6790
6980
|
entry: ENTRY_NAME,
|
|
6791
6981
|
...(this.usesWorkers ? { workers: true } : {}),
|
|
6792
6982
|
...(this.usesLifetimeRegions ? { lifetimeRegions: true } : {}),
|
|
6983
|
+
...(this.declBoundary ? { declBoundary: true } : {}),
|
|
6793
6984
|
...(this.threadSlotKeys.size > 0
|
|
6794
6985
|
? { threadSlotKeys: [...this.threadSlotKeys].sort() }
|
|
6795
6986
|
: {}),
|
|
6987
|
+
...(this.freezableArrays.size > 0
|
|
6988
|
+
? { freezableArrays: [...this.freezableArrays].sort() }
|
|
6989
|
+
: {}),
|
|
6796
6990
|
...(isNodeEsmFile(this.entry, this.program) ? {} : { commonJsEntry: true }),
|
|
6797
6991
|
...(this.ffiImports.length > 0 ? { ffiImports: [...this.ffiImports] } : {}),
|
|
6798
6992
|
};
|
|
@@ -6800,6 +6994,8 @@ export class Lowerer {
|
|
|
6800
6994
|
sanitizeUnregisteredClassTypes(module, (name) => this.classes.has(name));
|
|
6801
6995
|
if (module)
|
|
6802
6996
|
checkCycleBindingAccesses(this, module);
|
|
6997
|
+
if (module)
|
|
6998
|
+
bindCompletionCallbacks(module);
|
|
6803
6999
|
// Execution tiers from the final bodies (ir/tiers.ts). Assigned with or
|
|
6804
7000
|
// without a module: coverage reports the dynamic tier of programs that
|
|
6805
7001
|
// still have blockers.
|
|
@@ -6893,6 +7089,20 @@ export class Lowerer {
|
|
|
6893
7089
|
this.bumpFileStat(file, "failed");
|
|
6894
7090
|
}
|
|
6895
7091
|
}
|
|
7092
|
+
/** Coverage remainder: the body diagnostics of a function whose
|
|
7093
|
+
* signature blocked (blockedBodyDiagnostics). A function reachable emit
|
|
7094
|
+
* reached (its signature's diagnostics flushed there) reports them with
|
|
7095
|
+
* the reached diagnostics; any other reports them as unreached. */
|
|
7096
|
+
reachedBlockedBodyDiagnostics = [];
|
|
7097
|
+
reportBlockedBody(decl) {
|
|
7098
|
+
const diags = blockedBodyDiagnostics(this, decl);
|
|
7099
|
+
const symbol = declSymbolOf(this, decl);
|
|
7100
|
+
if (symbol && this.alreadyFlushed.has(symbol))
|
|
7101
|
+
this.reachedBlockedBodyDiagnostics.push(...diags);
|
|
7102
|
+
else
|
|
7103
|
+
for (const d of diags)
|
|
7104
|
+
this.pushDiag(d);
|
|
7105
|
+
}
|
|
6896
7106
|
/** Whether run() counts a signature-blocked declaration in
|
|
6897
7107
|
* stats.functionsSkipped: whole-program passes and the coverage
|
|
6898
7108
|
* remainder do; an externally-gated emit pass leaves the counting to the
|
|
@@ -7763,6 +7973,16 @@ export class Lowerer {
|
|
|
7763
7973
|
typeOf(node) {
|
|
7764
7974
|
if (this.anySymbols.size > 0 && this.readsAnySymbol(node))
|
|
7765
7975
|
return this.checker.getAnyType();
|
|
7976
|
+
// A checked-dynamic argument that another overload could take at run
|
|
7977
|
+
// time leaves the resolved overload's return a guess, and JS bindings
|
|
7978
|
+
// initialized with that result hold whatever it was.
|
|
7979
|
+
if ((ts.isCallExpression(node) || ts.isNewExpression(node)) &&
|
|
7980
|
+
dynamicOverloadChoice(this, node))
|
|
7981
|
+
return this.checker.getAnyType();
|
|
7982
|
+
if (ts.isIdentifier(node) &&
|
|
7983
|
+
isJsSourceFile(ts.getSourceFileOfNode(node)) &&
|
|
7984
|
+
guessedOverloadIdentifier(this, node))
|
|
7985
|
+
return this.checker.getAnyType();
|
|
7766
7986
|
if (ts.isPropertyAccessExpression(node) && isJsSourceFile(ts.getSourceFileOfNode(node))) {
|
|
7767
7987
|
const receiver = node.expression.kind === ts.SyntaxKind.ThisKeyword && this.fnStack.length > 0
|
|
7768
7988
|
? this.resolveThis()?.type
|
|
@@ -8190,6 +8410,22 @@ export class Lowerer {
|
|
|
8190
8410
|
* type-mapper.ts's chalk-shape mapping — call paths and func-slot coercions
|
|
8191
8411
|
* share it. */
|
|
8192
8412
|
hybridCallUnwrap(expr) {
|
|
8413
|
+
// A callable CLASS instance: a class whose merged interface carries a
|
|
8414
|
+
// call signature stores its call behavior in a `%call` field (the
|
|
8415
|
+
// chalk package shim's builder). Calls read the field.
|
|
8416
|
+
if (expr.type.kind === "object") {
|
|
8417
|
+
const callType = this.classes.get(expr.type.className)?.fields.get("%call");
|
|
8418
|
+
if (callType === undefined || callType.kind !== "func")
|
|
8419
|
+
return expr;
|
|
8420
|
+
return {
|
|
8421
|
+
kind: "fieldGet",
|
|
8422
|
+
obj: expr,
|
|
8423
|
+
className: expr.type.className,
|
|
8424
|
+
field: "%call",
|
|
8425
|
+
type: callType,
|
|
8426
|
+
loc: expr.loc,
|
|
8427
|
+
};
|
|
8428
|
+
}
|
|
8193
8429
|
if (expr.type.kind !== "record")
|
|
8194
8430
|
return expr;
|
|
8195
8431
|
const shape = this.shapes.get(expr.type.shapeId);
|
|
@@ -8272,6 +8508,20 @@ export class Lowerer {
|
|
|
8272
8508
|
}
|
|
8273
8509
|
if (expr.type.kind === "void" && expected.kind !== "void" && this.neverValued.has(expr))
|
|
8274
8510
|
return this.divergentValue(expr, expected);
|
|
8511
|
+
// A builtin error constructor global stored in a slot of its class value
|
|
8512
|
+
// type (`{ Parent: Error }`): the class value itself, which a checked
|
|
8513
|
+
// cast of the dynamic constructor value could not produce.
|
|
8514
|
+
if (expected.kind === "classval" &&
|
|
8515
|
+
expr.kind === "libCall" &&
|
|
8516
|
+
expr.fn === "dyn.globalConstructor" &&
|
|
8517
|
+
expr.args[0]?.kind === "strLit" &&
|
|
8518
|
+
`%${expr.args[0].value}` === expected.className) {
|
|
8519
|
+
const info = this.classes.get(expected.className);
|
|
8520
|
+
if (info?.builtinError && info.valueCtorParams !== undefined) {
|
|
8521
|
+
this.defineClassValueConstruct(info);
|
|
8522
|
+
return { kind: "classRef", className: info.def.name, type: expected, loc: expr.loc };
|
|
8523
|
+
}
|
|
8524
|
+
}
|
|
8275
8525
|
// process.stdout/stderr into a general Writable slot (general-streams.ts).
|
|
8276
8526
|
const stdioStream = stdioIntoGeneralStream(this, expr, expected);
|
|
8277
8527
|
if (stdioStream)
|
|
@@ -8283,6 +8533,12 @@ export class Lowerer {
|
|
|
8283
8533
|
if (adapted)
|
|
8284
8534
|
return adapted;
|
|
8285
8535
|
}
|
|
8536
|
+
// Iterable-typed slots: other iterators enter the generator arm.
|
|
8537
|
+
if (expected.kind === "union" && !typeEquals(expr.type, expected)) {
|
|
8538
|
+
const iterable = iterableSlotValue(this, expr, expected);
|
|
8539
|
+
if (iterable)
|
|
8540
|
+
return iterable;
|
|
8541
|
+
}
|
|
8286
8542
|
// an any-typed slot marshals implicitly (tsc allows the assignment;
|
|
8287
8543
|
// the marshal is where its semantics live). OUT: an 'any' value
|
|
8288
8544
|
// flowing into a typed slot compiles to a VALIDATED exit — like every
|
|
@@ -8363,6 +8619,11 @@ export class Lowerer {
|
|
|
8363
8619
|
// constructor. `require("events")` is the EventEmitter class itself,
|
|
8364
8620
|
// so its module binding is too (`ReleaseEmitter = EventEmitter` over
|
|
8365
8621
|
// `const EventEmitter = require("events")`).
|
|
8622
|
+
if (expr.type.kind === "moduleNs" && isJsSourceFileName(expr.loc.file)) {
|
|
8623
|
+
const object = moduleNamespaceObject(this, expr);
|
|
8624
|
+
if (object)
|
|
8625
|
+
return object;
|
|
8626
|
+
}
|
|
8366
8627
|
if (expr.type.kind === "moduleNs" &&
|
|
8367
8628
|
expr.type.moduleId === "builtin:events" &&
|
|
8368
8629
|
isJsSourceFileName(expr.loc.file)) {
|
|
@@ -8470,10 +8731,19 @@ export class Lowerer {
|
|
|
8470
8731
|
// A HYBRID (function-with-properties) record flowing into a plain
|
|
8471
8732
|
// func slot extracts its reserved %call field — the chalk shape's
|
|
8472
8733
|
// "the value IS callable" half (type-mapper.ts's hybrid mapping).
|
|
8473
|
-
if (expected.kind === "func" && expr.type.kind === "record") {
|
|
8734
|
+
if (expected.kind === "func" && (expr.type.kind === "record" || expr.type.kind === "object")) {
|
|
8474
8735
|
const un = this.hybridCallUnwrap(expr);
|
|
8475
8736
|
if (un !== expr && typeEquals(un.type, expected))
|
|
8476
8737
|
return un;
|
|
8738
|
+
// A callable class instance (the chalk shim's variadic builder) in a
|
|
8739
|
+
// narrower function slot: its call closure crosses the checked
|
|
8740
|
+
// function boundary, which adapts the arity.
|
|
8741
|
+
if (un !== expr &&
|
|
8742
|
+
expr.type.kind === "object" &&
|
|
8743
|
+
un.type.kind === "func" &&
|
|
8744
|
+
canBoxFuncIntoDyn(un.type, (id) => this.shapes.get(id), (id) => this.unions.get(id))) {
|
|
8745
|
+
return this.coerceToExpected({ kind: "dynFrom", value: un, type: DYN, loc: un.loc }, expected);
|
|
8746
|
+
}
|
|
8477
8747
|
}
|
|
8478
8748
|
// A zero-param function whose RETURN is a wider record array than the
|
|
8479
8749
|
// slot's (`getRoutes: () => cachedRoutes` against `() => Narrow[]`):
|
|
@@ -9170,6 +9440,40 @@ export class Lowerer {
|
|
|
9170
9440
|
}
|
|
9171
9441
|
return this.coerceInto(node, value, expected);
|
|
9172
9442
|
}
|
|
9443
|
+
/** The right side of a write to a member of a typed view of the global
|
|
9444
|
+
* object (`(globalThis as typeof globalThis & { k?: T }).k = value`, also
|
|
9445
|
+
* through `??=` and `||=`) that is `value` itself or wraps only it in
|
|
9446
|
+
* parentheses or `satisfies`; null when `value` is not in such a write. */
|
|
9447
|
+
globalViewSlot(value) {
|
|
9448
|
+
let operand = value;
|
|
9449
|
+
while (operand.parent !== undefined &&
|
|
9450
|
+
(ts.isParenthesizedExpression(operand.parent) || ts.isSatisfiesExpression(operand.parent)))
|
|
9451
|
+
operand = operand.parent;
|
|
9452
|
+
const write = operand.parent;
|
|
9453
|
+
if (write === undefined ||
|
|
9454
|
+
!ts.isBinaryExpression(write) ||
|
|
9455
|
+
write.right !== operand ||
|
|
9456
|
+
(write.operatorToken.kind !== ts.SyntaxKind.EqualsToken &&
|
|
9457
|
+
write.operatorToken.kind !== ts.SyntaxKind.QuestionQuestionEqualsToken &&
|
|
9458
|
+
write.operatorToken.kind !== ts.SyntaxKind.BarBarEqualsToken))
|
|
9459
|
+
return null;
|
|
9460
|
+
let target = write.left;
|
|
9461
|
+
while (ts.isParenthesizedExpression(target))
|
|
9462
|
+
target = target.expression;
|
|
9463
|
+
if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target))
|
|
9464
|
+
return null;
|
|
9465
|
+
const receiver = this.typeOf(target.expression);
|
|
9466
|
+
const isGlobal = (type) => {
|
|
9467
|
+
const symbol = type.getSymbol();
|
|
9468
|
+
return (symbol !== undefined &&
|
|
9469
|
+
ts.symbolName(symbol) === "globalThis" &&
|
|
9470
|
+
symbol.declarations.length === 0);
|
|
9471
|
+
};
|
|
9472
|
+
return isGlobal(receiver) ||
|
|
9473
|
+
(receiver.isIntersectionType() && ts.constituentTypes(receiver).some(isGlobal))
|
|
9474
|
+
? operand
|
|
9475
|
+
: null;
|
|
9476
|
+
}
|
|
9173
9477
|
/** Lower for a known destination, then apply ordinary value coercion.
|
|
9174
9478
|
* Fresh arrays and records use the destination layout directly. */
|
|
9175
9479
|
lowerExprExpecting(node, expected) {
|
|
@@ -9237,6 +9541,20 @@ export class Lowerer {
|
|
|
9237
9541
|
// belong to the array the program keeps, rather than a typed snapshot.
|
|
9238
9542
|
if (ts.isArrayLiteralExpression(x) &&
|
|
9239
9543
|
x.elements.nodes.every((element) => !ts.isSpreadElement(element) && !ts.isOmittedExpression(element))) {
|
|
9544
|
+
// A checked slot that the program declares as a native array (a
|
|
9545
|
+
// member of a typed view of the global object, `typeof globalThis &
|
|
9546
|
+
// { cache?: number[] }`) is read back through that declaration. Build
|
|
9547
|
+
// the native array and store it boxed: every typed read then extracts
|
|
9548
|
+
// that same array (a dynamic literal would be copied on each read,
|
|
9549
|
+
// losing writes such as push).
|
|
9550
|
+
const slot = this.globalViewSlot(x);
|
|
9551
|
+
const slotType = slot ? this.checker.getContextualType(slot) : undefined;
|
|
9552
|
+
const declared = slotType && this.checker.getNonNullableType(slotType);
|
|
9553
|
+
const native = declared && !(declared.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown))
|
|
9554
|
+
? this.mapTypeOf(declared)
|
|
9555
|
+
: null;
|
|
9556
|
+
if (native?.kind === "array")
|
|
9557
|
+
return this.coerceInto(node, this.lowerArrayLiteral(x, native), DYN);
|
|
9240
9558
|
return {
|
|
9241
9559
|
kind: "dynArrLit",
|
|
9242
9560
|
elems: x.elements.nodes.map((element) => this.lowerExprExpecting(element, DYN)),
|
|
@@ -9263,7 +9581,9 @@ export class Lowerer {
|
|
|
9263
9581
|
builtinOption("UrlObject") ||
|
|
9264
9582
|
builtinOption("URLFormatOptions") ||
|
|
9265
9583
|
!this.mapTypeOf(this.typeOf(x)) ||
|
|
9266
|
-
this.excessJsContextualProperty(x, parts)
|
|
9584
|
+
this.excessJsContextualProperty(x, parts) ||
|
|
9585
|
+
this.reshapeableContextualLiteral(x, parts) ||
|
|
9586
|
+
holdsEvolvingArray(this, x)) {
|
|
9267
9587
|
return lowerDynObjectLiteral(this, x);
|
|
9268
9588
|
}
|
|
9269
9589
|
}
|
|
@@ -9442,8 +9762,27 @@ export class Lowerer {
|
|
|
9442
9762
|
// must not force an intermediate record with incompatible field slots.
|
|
9443
9763
|
if (this.returnsLiteralIntoDyn(node, expected))
|
|
9444
9764
|
return this.lowerExprExpecting(node, expected);
|
|
9765
|
+
if (this.returnsFreshCollection(node) && expected.kind !== "void")
|
|
9766
|
+
return this.lowerExprExpecting(node, expected);
|
|
9445
9767
|
return this.asyncReturnValueOf(node, this.lowerExpr(node), expected);
|
|
9446
9768
|
}
|
|
9769
|
+
/** An array literal or a `new Map(...)`, `new Set(...)` or `new
|
|
9770
|
+
* Array(...)` of the builtins: a fresh collection, never a thenable, so
|
|
9771
|
+
* an async return takes the declared result type as its construction
|
|
9772
|
+
* layout the way a synchronous return does (`return []` in a function
|
|
9773
|
+
* whose inferred result is `Promise<string[]>`). */
|
|
9774
|
+
returnsFreshCollection(node) {
|
|
9775
|
+
let e = node;
|
|
9776
|
+
while (ts.isParenthesizedExpression(e))
|
|
9777
|
+
e = e.expression;
|
|
9778
|
+
if (ts.isArrayLiteralExpression(e))
|
|
9779
|
+
return true;
|
|
9780
|
+
return (ts.isNewExpression(e) &&
|
|
9781
|
+
ts.isIdentifier(e.expression) &&
|
|
9782
|
+
(this.isStdlibGlobal(e.expression, "Map") ||
|
|
9783
|
+
this.isStdlibGlobal(e.expression, "Set") ||
|
|
9784
|
+
this.isStdlibGlobal(e.expression, "Array")));
|
|
9785
|
+
}
|
|
9447
9786
|
/** A fresh JS object literal returned into a checked-native (dyn) result,
|
|
9448
9787
|
* which lowers straight into that storage. */
|
|
9449
9788
|
returnsLiteralIntoDyn(node, expected) {
|
|
@@ -9569,7 +9908,9 @@ export class Lowerer {
|
|
|
9569
9908
|
loc,
|
|
9570
9909
|
};
|
|
9571
9910
|
}
|
|
9572
|
-
if (this.adoptsReturnedPromise() &&
|
|
9911
|
+
if (this.adoptsReturnedPromise() &&
|
|
9912
|
+
!this.returnsLiteralIntoDyn(node, expected) &&
|
|
9913
|
+
!this.returnsFreshCollection(node)) {
|
|
9573
9914
|
// The async return lowers its operand untyped first (a promise
|
|
9574
9915
|
// adopts before its payload converts); a maybe-promise union needs
|
|
9575
9916
|
// the statement form, which branches between adoption and fulfillment.
|
|
@@ -9955,8 +10296,8 @@ export class Lowerer {
|
|
|
9955
10296
|
throw e;
|
|
9956
10297
|
}
|
|
9957
10298
|
}
|
|
9958
|
-
lowerClassExpression(expr) {
|
|
9959
|
-
return lowerClassExpression(this, expr);
|
|
10299
|
+
lowerClassExpression(expr, binding) {
|
|
10300
|
+
return lowerClassExpression(this, expr, binding);
|
|
9960
10301
|
}
|
|
9961
10302
|
/* ── the class graph (single inheritance) ─────────────────────────── */
|
|
9962
10303
|
findMethodOn(info, name) {
|
|
@@ -11055,7 +11396,7 @@ export class Lowerer {
|
|
|
11055
11396
|
return lowerRecordKeyRead(this, expr, shapeId, shape, includeUndefined);
|
|
11056
11397
|
}
|
|
11057
11398
|
lowerElementWrite(expr) {
|
|
11058
|
-
return lowerElementWrite(this, expr);
|
|
11399
|
+
return markSloppyRecordWrites(this, lowerElementWrite(this, expr), expr);
|
|
11059
11400
|
}
|
|
11060
11401
|
lowerLiveWebValue(node) {
|
|
11061
11402
|
return lowerLiveWebValue(this, node);
|
|
@@ -11354,7 +11695,7 @@ export class Lowerer {
|
|
|
11354
11695
|
: null;
|
|
11355
11696
|
}
|
|
11356
11697
|
fieldSetStmt(target, value, loc, blame) {
|
|
11357
|
-
return fieldSetStmt(this, target, value, loc, blame);
|
|
11698
|
+
return markSloppyRecordWrites(this, fieldSetStmt(this, target, value, loc, blame), blame);
|
|
11358
11699
|
}
|
|
11359
11700
|
lowerFieldCompound(access, op, rhsNode, loc) {
|
|
11360
11701
|
return lowerFieldCompound(this, access, op, rhsNode, loc);
|
|
@@ -11384,6 +11725,7 @@ export class Lowerer {
|
|
|
11384
11725
|
lowerBlobNew(this, expr) ??
|
|
11385
11726
|
lowerNetAddressNew(this, expr) ??
|
|
11386
11727
|
lowerStaticReadableStreamNew(this, expr) ??
|
|
11728
|
+
lowerStaticTransformStreamNew(this, expr) ??
|
|
11387
11729
|
lowerConsoleNew(this, expr);
|
|
11388
11730
|
return (builtin ?? this.withRuntimeOptionalClassValue(expr.expression, () => lowerNew(this, expr)));
|
|
11389
11731
|
}
|
|
@@ -11796,6 +12138,9 @@ export class Lowerer {
|
|
|
11796
12138
|
loc,
|
|
11797
12139
|
};
|
|
11798
12140
|
}
|
|
12141
|
+
// The buffer module's Buffer is the global constructor's value.
|
|
12142
|
+
if (bi.module === "buffer" && bi.member === "Buffer")
|
|
12143
|
+
return { kind: "libCall", fn: "buffer.constructor", args: [], type: DYN, loc };
|
|
11799
12144
|
if (bi.module === "fs" && (bi.member === "realpathSync" || bi.member === "realpathSync.native"))
|
|
11800
12145
|
return fsRealpathValue(this, bi.member === "realpathSync.native", loc);
|
|
11801
12146
|
const fn = builtinModuleFnOf(this, bi.module, bi.member);
|