@scriptc/compiler 0.4.2 → 0.4.3
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 +397 -37
- 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 +473 -32
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +258 -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/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 +26 -0
- package/dist/backend/llvm/dyn.js +352 -61
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +11 -20
- 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 +195 -27
- 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 +176 -37
- package/dist/backend/llvm/emitter.js +724 -85
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +54 -5
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +34 -12
- 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 +129 -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 +100 -28
- 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 +194 -65
- 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 +20 -1
- package/dist/backend/llvm/integer-values.js +71 -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 +80 -2
- 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-shared.js +73 -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 +12 -0
- 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-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 +222 -33
- 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-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/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 +88 -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-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-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/usage.d.ts +1 -1
- package/dist/cli/usage.js +3 -3
- package/dist/compat/fetch-profile.js +1 -1
- package/dist/compat/fetch-profile.js.map +1 -1
- 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.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 +2 -0
- package/dist/executable/executable-cache.js +1 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +1 -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 +854 -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/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 +84 -9
- package/dist/frontend/lowering/builtins/crypto.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/numbers.js +9 -1
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.d.ts +6 -0
- package/dist/frontend/lowering/builtins/promises.js +88 -2
- 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/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 +39 -2
- package/dist/frontend/lowering/class-dynamic-dispatch.js +766 -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 +32 -9
- package/dist/frontend/lowering/class-method-mutations.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/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.js +338 -18
- 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-methods.js +15 -0
- 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.js +2 -1
- 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/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 +47 -0
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +36 -2
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +90 -13
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +33 -4
- 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 +113 -11
- 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/union-fields.js +4 -0
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +22 -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 +49 -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/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 +770 -22
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.test.js +428 -8
- package/dist/frontend/lowering/key-order-witness.test.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 +443 -41
- 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 +302 -22
- 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 +10 -2
- 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 +41 -31
- 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.js +18 -6
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +32 -0
- 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 +454 -48
- 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 +77 -6
- package/dist/frontend/lowering/lowerer.js +313 -29
- 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/surfaces.d.ts +3 -0
- package/dist/frontend/lowering/surfaces.js +18 -6
- 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 +18 -10
- 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.d.ts +8 -1
- package/dist/frontend/program.js +484 -69
- 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/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 +191 -11
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +34 -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 +52 -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 +166 -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 +259 -57
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +3 -3
- package/dist/ir/integer-loops.js +14 -6
- 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 +70 -7
- package/dist/ir/ir.js +58 -1
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +21 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/js-ic.d.ts +19 -2
- package/dist/ir/js-ic.js +95 -11
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +188 -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 +152 -38
- 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 +122 -36
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/ir-policy.js +2 -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 +3 -1
- package/dist/native/prepare.js +119 -31
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +78 -18
- 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 +26 -4
|
@@ -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";
|
|
@@ -39,6 +41,7 @@ import { valueStreamOf } from "./builtins/hash-stream.js";
|
|
|
39
41
|
import { lowerNetAddressCall, lowerNetAddressNew } from "./builtins/net-address.js";
|
|
40
42
|
import { dynUndefinedExpr, nodeThrowExpr, numLit, varRef } from "../../ir/build.js";
|
|
41
43
|
import { iteratorSlotAdapter } from "./iterator-adapters.js";
|
|
44
|
+
import { iterableSlotValue } from "./iterable-values.js";
|
|
42
45
|
import { lowerBuiltinCall } from "./builtin-calls.js";
|
|
43
46
|
import { CoercionState } from "./coercions/state.js";
|
|
44
47
|
import { widthLiftPlan, unitOnlyElem, recordWidthPlan, describeRecordWidthBlocker, objToRecordPlan, recordToClassPlan, } from "./coercions/structural-plans.js";
|
|
@@ -68,6 +71,7 @@ import { defaultAfterUndefined, lowerStaticallyUndefinedArgument } from "./optio
|
|
|
68
71
|
import {} from "./class-protocol-dispatch.js";
|
|
69
72
|
import { ClassDynamicDispatch, trackClassFieldCreation } from "./class-dynamic-dispatch.js";
|
|
70
73
|
import { guardClassAttributeWrites } from "./class-attributes.js";
|
|
74
|
+
import { guardFrozenWrites, markSloppyRecordWrites } from "./frozen-records.js";
|
|
71
75
|
import { applyHandleProperties } from "./handle-properties.js";
|
|
72
76
|
import { ClassProtocols } from "./class-protocols.js";
|
|
73
77
|
import { earlyReadVarSymbols } from "./var-hoisting.js";
|
|
@@ -97,14 +101,14 @@ export { newFnCtx } from "./function-context.js";
|
|
|
97
101
|
*/
|
|
98
102
|
import { dirname, relative, resolve } from "node:path";
|
|
99
103
|
import { bindingSource } from "../binding-source.js";
|
|
100
|
-
import { tsgoPath } from "../dts-paths.js";
|
|
104
|
+
import { compilerOwnedFileName, tsgoPath } from "../dts-paths.js";
|
|
101
105
|
import * as ts from "../ts7/adapter.js";
|
|
102
106
|
import { isBundledShimForwarder } from "../package-shims.js";
|
|
103
107
|
import { erasedTypeOnlyImport } from "../type-only-imports.js";
|
|
104
108
|
import { literalValues } from "../literal-values.js";
|
|
105
109
|
import { discriminantOwners, literalUnionArm } from "../union-discriminants.js";
|
|
106
110
|
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";
|
|
111
|
+
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
112
|
import { provenanceActive } from "../provenance-registry.js";
|
|
109
113
|
import { ambientDtsPath, canonicalBuiltinModule, cjsExportAssignmentOf, cjsExportDiscardReason, fallbackDtsPath, isCheckedJsSourceFile, isCjsExportTableLiteral, isCjsJsFile, isJsSourceFile, isNodeEsmFile, isNodeTypesPath, locOf, orderedImportsOf, overridesDtsPath, npmStaticDepSf7, requireSpecOf, resolveImport, workspacePackageOfPath, } from "../program.js";
|
|
110
114
|
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";
|
|
@@ -127,7 +131,7 @@ import { completeArgs, wrappedUndefined, undefinedArgFor } from "./call-argument
|
|
|
127
131
|
import { bodyReturnType, declaredReturnType } from "./function-returns.js";
|
|
128
132
|
import { lowerCall, lowerPromiseMethodCall, lowerFilterNarrowCall } from "./lower-calls.js";
|
|
129
133
|
import { lowerFfiCall, validateFfiImports } from "./native-ffi.js";
|
|
130
|
-
import { isTopLevelFnSymbol, lowerNestedFunctionDecl, lowerLambda, lowerFunction, } from "./lower-functions.js";
|
|
134
|
+
import { isTopLevelFnSymbol, lowerNestedFunctionDecl, lowerLambda, lowerFunction, blockedBodyDiagnostics, } from "./lower-functions.js";
|
|
131
135
|
import { lowerArrayMethodCall } from "./containers/array-methods.js";
|
|
132
136
|
import { fuseArrayPipelines } from "./containers/array-pipelines.js";
|
|
133
137
|
import { lowerMapMethodCall, lowerMapForEachCall, lowerSetMethodCall, lowerSetForEachCall, } from "./containers/collection-methods.js";
|
|
@@ -152,7 +156,7 @@ import { lowerBuiltinExtraProperty } from "./builtins/properties.js";
|
|
|
152
156
|
import { registerPromisifiedBuiltinDecl } from "./builtins/callable-aliases.js";
|
|
153
157
|
import { lowerExecFileAsyncCall } from "./builtins/child-process-async.js";
|
|
154
158
|
import { lowerStringDecoderMethodCall, lowerTextCodecCall } from "./builtins/text-codecs.js";
|
|
155
|
-
import { lowerReadlineMethodCall } from "./builtins/readline.js";
|
|
159
|
+
import { isOptionalReadlineCursorRead, lowerReadlineMethodCall } from "./builtins/readline.js";
|
|
156
160
|
import { lowerDiagnosticsChannelMethodCall, lowerDiagnosticsChannelProperty, lowerAsyncLocalStorageMethodCall, lowerTracingChannelMethodCall, lowerTracingChannelProperty, } from "./builtins/async-context.js";
|
|
157
161
|
import { lowerDisposableStackNew } from "./builtins/disposable-stack.js";
|
|
158
162
|
import { lowerErrorCodeProperty, lowerErrorFunctionCall } from "./builtins/errors.js";
|
|
@@ -165,7 +169,7 @@ import { dateJsonType, isDateJsonSource, lowerDateCall } from "./builtins/dates.
|
|
|
165
169
|
import { fsConstantMemberRead, fsConstantsObject, lowerFsConstantsProperty, lowerBuiltinConstantsProperty, builtinConstantBindingOf, builtinConstantsDestructureDecl, } from "./builtins/constants.js";
|
|
166
170
|
import { lowerStringStaticCall, lowerStringLastIndexOfCall } from "./builtins/strings.js";
|
|
167
171
|
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";
|
|
172
|
+
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
173
|
import { lowerHttpHeadersElement, lowerNetModuleCall, lowerServerMethodCall, lowerServerProperty, lowerTlsRootCertificates, } from "./lower-server.js";
|
|
170
174
|
import { lowerDgramDnsModuleCall, lowerDgramMethodCall } from "./lower-dgram.js";
|
|
171
175
|
import { lowerNodeTestModuleCall, lowerTestDirectCall, lowerTestMethodCall, lowerTestCtxProperty, } from "./lower-test.js";
|
|
@@ -173,7 +177,7 @@ import { lowerAssertModuleCall, lowerAssertDirectCall } from "./lower-assert.js"
|
|
|
173
177
|
import { lowerUtilModuleCall } from "./lower-inspect.js";
|
|
174
178
|
import { lowerSystemErrorMapValue } from "./lower-system-errors.js";
|
|
175
179
|
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";
|
|
180
|
+
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
181
|
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
182
|
import { finishOptionalChain, isOptionalChainTail, lowerOptionalChain, } from "./expressions/optional-chains.js";
|
|
179
183
|
import { foldedStringKeyOf, lowerDynObjectLiteral, lowerObjectLiteral, lowerShorthandValue, rejectThisInObjectMethod, } from "./expressions/object-literals.js";
|
|
@@ -629,6 +633,7 @@ export function lowerToIr(program, entry, moduleOrder, options = {}) {
|
|
|
629
633
|
// travel with them: a failed statement is never left unexplained.
|
|
630
634
|
const covered = {
|
|
631
635
|
...result,
|
|
636
|
+
diagnostics: [...result.diagnostics, ...remainder.reachedBlockedBodyDiagnostics],
|
|
632
637
|
stats: { ...result.stats, statementsDynamic },
|
|
633
638
|
unreached: {
|
|
634
639
|
diagnostics: rem.diagnostics,
|
|
@@ -1156,6 +1161,9 @@ export class Lowerer {
|
|
|
1156
1161
|
/** Identifiers by spelling, per file, for the generic bindings' use
|
|
1157
1162
|
* ordering (runsAfterDeclaration). */
|
|
1158
1163
|
bindingIdentifiers = new Map();
|
|
1164
|
+
/** Per JavaScript file, the declarations of the bindings it assigns an
|
|
1165
|
+
* own `toString` (jsAssignsOwnToString in lower-calls.ts). */
|
|
1166
|
+
ownToStringTargets = new Map();
|
|
1159
1167
|
/** Per-symbol result of the never-reassigned file scan
|
|
1160
1168
|
* (bindingNeverReassigned — object-literal generic-method receivers). */
|
|
1161
1169
|
neverReassignedCache = new Map();
|
|
@@ -1414,6 +1422,9 @@ export class Lowerer {
|
|
|
1414
1422
|
* and erased instances). */
|
|
1415
1423
|
erasingDepth = 0;
|
|
1416
1424
|
localClassInstantiations = [];
|
|
1425
|
+
/** The function-local classes of the program with an `extends` clause, whether lowering collected
|
|
1426
|
+
* them yet or not (new-target.ts); found on first use. */
|
|
1427
|
+
functionLocalSubclasses = undefined;
|
|
1417
1428
|
/** Instance types (by checker type id) of the local classes generic
|
|
1418
1429
|
* factory calls return, and the per-instance class each names. */
|
|
1419
1430
|
localClassInstanceTypes = new Map();
|
|
@@ -1631,6 +1642,47 @@ export class Lowerer {
|
|
|
1631
1642
|
}
|
|
1632
1643
|
return fallback ?? null;
|
|
1633
1644
|
}
|
|
1645
|
+
/** A fresh TypeScript data literal (`{ message: "m" }`) passed to a
|
|
1646
|
+
* checked-dynamic parameter of a callee implemented in JavaScript, whose
|
|
1647
|
+
* contract lets it reshape the object: a call through an untyped value, an
|
|
1648
|
+
* untyped parameter of a JavaScript function, or a package-declared
|
|
1649
|
+
* parameter type (a non-library `.d.ts`) that makes one of the literal's
|
|
1650
|
+
* properties optional (zod's `normalizeParams` deletes `params.message`).
|
|
1651
|
+
* No typed alias of a fresh literal exists, so it is built as the plain
|
|
1652
|
+
* object the callee receives instead of a view whose record layout refuses
|
|
1653
|
+
* that delete. Standard-library and TypeScript callees, and literals with
|
|
1654
|
+
* methods or accessors, keep their native storage. */
|
|
1655
|
+
reshapeableContextualLiteral(literal, contextual) {
|
|
1656
|
+
const call = literal.parent;
|
|
1657
|
+
if (call === undefined ||
|
|
1658
|
+
!(ts.isCallExpression(call) || ts.isNewExpression(call)) ||
|
|
1659
|
+
!call.arguments?.nodes.includes(literal) ||
|
|
1660
|
+
literal.properties.nodes.length === 0 ||
|
|
1661
|
+
!literal.properties.nodes.every((prop) => (ts.isPropertyAssignment(prop) || ts.isShorthandPropertyAssignment(prop)) &&
|
|
1662
|
+
(ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name))))
|
|
1663
|
+
return false;
|
|
1664
|
+
const declaration = this.checker.getResolvedSignature(call)?.declaration;
|
|
1665
|
+
const file = declaration ? ts.getSourceFileOfNode(declaration) : undefined;
|
|
1666
|
+
const untyped = contextual.some((part) => part.flags & ts.TypeFlags.Any);
|
|
1667
|
+
if (file === undefined)
|
|
1668
|
+
return untyped;
|
|
1669
|
+
if (isJsSourceFile(file))
|
|
1670
|
+
return untyped;
|
|
1671
|
+
if (!file.isDeclarationFile || this.isStdlibFile(file))
|
|
1672
|
+
return false;
|
|
1673
|
+
if (untyped)
|
|
1674
|
+
return true;
|
|
1675
|
+
const objects = contextual.filter((part) => part.flags & ts.TypeFlags.Object);
|
|
1676
|
+
if (objects.length === 0)
|
|
1677
|
+
return false;
|
|
1678
|
+
return literal.properties.nodes.some((prop) => {
|
|
1679
|
+
const name = prop.name.text;
|
|
1680
|
+
return objects.every((part) => {
|
|
1681
|
+
const symbol = this.checker.getPropertyOfType(part, name);
|
|
1682
|
+
return symbol !== undefined && (symbol.flags & ts.SymbolFlags.Optional) !== 0;
|
|
1683
|
+
});
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1634
1686
|
/** A TypeScript object literal handed to a JavaScript checked-value
|
|
1635
1687
|
* parameter whose inferred type is open (`constructor({ factory, ...options
|
|
1636
1688
|
* } = {})` — the rest element admits any property): the literal names a
|
|
@@ -2142,10 +2194,32 @@ export class Lowerer {
|
|
|
2142
2194
|
/** Named method slots observed before class collection need a callable
|
|
2143
2195
|
* ABI and shared prototype descriptors instead of call-site specialization. */
|
|
2144
2196
|
prototypeMethodAccesses = new Map();
|
|
2197
|
+
/** Every site the census found for a name in prototypeMethodAccesses (which
|
|
2198
|
+
* keeps one): reads of the method and writes that may replace it. The
|
|
2199
|
+
* key-order witness asks which replacements can return records. */
|
|
2200
|
+
methodAccessSites = new Map();
|
|
2201
|
+
/** Marks `name` as a method the program may read or replace at `site`. */
|
|
2202
|
+
noteMethodAccess(name, site) {
|
|
2203
|
+
this.prototypeMethodAccesses.set(name, site);
|
|
2204
|
+
this.noteMethodSite(name, site);
|
|
2205
|
+
}
|
|
2206
|
+
/** Records a site for `name` without changing its prototypeMethodAccesses entry. */
|
|
2207
|
+
noteMethodSite(name, site) {
|
|
2208
|
+
const sites = this.methodAccessSites.get(name);
|
|
2209
|
+
if (sites === undefined)
|
|
2210
|
+
this.methodAccessSites.set(name, [site]);
|
|
2211
|
+
else
|
|
2212
|
+
sites.push(site);
|
|
2213
|
+
}
|
|
2145
2214
|
/** Whether the program reads `Error.prototype`, the checked-dynamic
|
|
2146
|
-
* object an ES5 constructor function can inherit from
|
|
2147
|
-
*
|
|
2215
|
+
* object an ES5 constructor function can inherit from, or has a class
|
|
2216
|
+
* whose heritage is evaluated at run time (`extends (Base ?? Error)`):
|
|
2217
|
+
* only then can a value that is not an Error instance be
|
|
2218
|
+
* `instanceof Error`. */
|
|
2148
2219
|
errorPrototypeValues = false;
|
|
2220
|
+
/** The property names the program assigns on the global object
|
|
2221
|
+
* (property-access.ts), collected on first use. */
|
|
2222
|
+
globalThisWrittenNames = null;
|
|
2149
2223
|
/** Well-known symbol methods (`sym:iterator`) the program may replace
|
|
2150
2224
|
* through a symbol-keyed write: an instance or prototype property, or a
|
|
2151
2225
|
* reflection call. */
|
|
@@ -2333,6 +2407,12 @@ export class Lowerer {
|
|
|
2333
2407
|
// Stack of function contexts (bottom = the function being declared at
|
|
2334
2408
|
// top level, top = the innermost nested function currently lowering).
|
|
2335
2409
|
fnStack = [];
|
|
2410
|
+
/** Source ranges of record writes in sloppy-mode code, and of the
|
|
2411
|
+
* absent-state writes of `delete r.f` (markSloppyRecordWrites). */
|
|
2412
|
+
sloppyRecordWrites = new Set();
|
|
2413
|
+
recordFieldDeletes = new Set();
|
|
2414
|
+
/** typeKeys of the array types the program may freeze (IrModule.freezableArrays). */
|
|
2415
|
+
freezableArrays = new Set();
|
|
2336
2416
|
liftedFns = [];
|
|
2337
2417
|
/** The first lifted function of each name (liftedFnNamed), for the
|
|
2338
2418
|
* liftedFns indexed so far. liftedFns only grows. */
|
|
@@ -2345,15 +2425,21 @@ export class Lowerer {
|
|
|
2345
2425
|
* dispatch revision needs no weak-key identity or process-global state. */
|
|
2346
2426
|
errorMethodDispatchRevision = null;
|
|
2347
2427
|
errorPropertyDispatchRevision = null;
|
|
2428
|
+
/** The program defines properties by reflection on an untyped or
|
|
2429
|
+
* Error-shaped target, so an own accessor may replace an error's `name`
|
|
2430
|
+
* or `message`: typed reads and writes of those slots check for one.
|
|
2431
|
+
* Holds the first such call's location. */
|
|
2432
|
+
errorAccessorReflection = null;
|
|
2348
2433
|
/** Structural source positions (structural-positions.ts) for names that
|
|
2349
2434
|
* stay the same when unrelated code moves. */
|
|
2350
2435
|
/** 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
|
|
2436
|
+
* names do not depend on where the program sits, default library files
|
|
2437
|
+
* by their base name (two checkers install them in different
|
|
2438
|
+
* directories), and the files scriptc ships by their name inside scriptc,
|
|
2439
|
+
* so names do not depend on where scriptc is installed either. */
|
|
2354
2440
|
positions = new StructuralPositions((sf) => this.program.isSourceFileDefaultLibrary(sf)
|
|
2355
2441
|
? `lib:${sf.fileName.slice(sf.fileName.lastIndexOf("/") + 1)}`
|
|
2356
|
-
: relative(dirname(this.entry.fileName), sf.fileName));
|
|
2442
|
+
: (compilerOwnedFileName(sf.fileName) ?? relative(dirname(this.entry.fileName), sf.fileName)));
|
|
2357
2443
|
/** The outermost node whose token span is exactly `loc`, or null. */
|
|
2358
2444
|
nodeAtLoc(loc) {
|
|
2359
2445
|
const sf = this.program.getSourceFile(loc.file);
|
|
@@ -2381,7 +2467,9 @@ export class Lowerer {
|
|
|
2381
2467
|
* before it. */
|
|
2382
2468
|
closureName(loc, suffix = "", prefix = "%fn") {
|
|
2383
2469
|
const node = this.nodeAtLoc(loc);
|
|
2384
|
-
const where = node === null
|
|
2470
|
+
const where = node === null
|
|
2471
|
+
? `${compilerOwnedFileName(loc.file) ?? loc.file}:${loc.start}:${loc.end}`
|
|
2472
|
+
: this.positions.of(node);
|
|
2385
2473
|
const key = `${prefix}|${this.closureRoot}|${where}|${suffix}`;
|
|
2386
2474
|
const first = keyedHelperName(this, prefix, key);
|
|
2387
2475
|
const seen = this.closureNameCounts.get(first) ?? 0;
|
|
@@ -2443,6 +2531,9 @@ export class Lowerer {
|
|
|
2443
2531
|
* the class and constructed-class counts, it tells caches over the class
|
|
2444
2532
|
* graph when the graph changed. */
|
|
2445
2533
|
subclassLinks = 0;
|
|
2534
|
+
/** Function-local classes by the class node they extend, built on first
|
|
2535
|
+
* use (localSubclassesOf in lower-classes.ts). */
|
|
2536
|
+
localSubclassIndex = null;
|
|
2446
2537
|
/** Set while a subclass constructor's super() call notes its base
|
|
2447
2538
|
* constructor edge: that edge does not instantiate the base exactly. */
|
|
2448
2539
|
superConstructorEdge = false;
|
|
@@ -2508,7 +2599,20 @@ export class Lowerer {
|
|
|
2508
2599
|
if (this.sharedHelpers.size === 0)
|
|
2509
2600
|
return;
|
|
2510
2601
|
const shared = new Map([...this.sharedHelpers].map((fn) => [fn.name, fn]));
|
|
2511
|
-
|
|
2602
|
+
// Files scriptc ships compare by their name inside scriptc, so the
|
|
2603
|
+
// choice does not depend on where scriptc is installed.
|
|
2604
|
+
const fileKeys = new Map();
|
|
2605
|
+
const fileKey = (file) => {
|
|
2606
|
+
let key = fileKeys.get(file);
|
|
2607
|
+
if (key === undefined)
|
|
2608
|
+
fileKeys.set(file, (key = compilerOwnedFileName(file) ?? file));
|
|
2609
|
+
return key;
|
|
2610
|
+
};
|
|
2611
|
+
const earlier = (left, right) => {
|
|
2612
|
+
if (left.file === right.file)
|
|
2613
|
+
return left.start < right.start;
|
|
2614
|
+
return fileKey(left.file) < fileKey(right.file);
|
|
2615
|
+
};
|
|
2512
2616
|
// The earliest use of each shared helper outside the shared helpers, and
|
|
2513
2617
|
// which shared helpers each shared helper uses.
|
|
2514
2618
|
const uses = new Map();
|
|
@@ -2705,6 +2809,20 @@ export class Lowerer {
|
|
|
2705
2809
|
else if (kind === "failed")
|
|
2706
2810
|
s.failed += 1;
|
|
2707
2811
|
}
|
|
2812
|
+
/** The program holds the declaration-typed boundary's projection
|
|
2813
|
+
* (decl-projection.ts): user-file record and array values crossing into
|
|
2814
|
+
* dynamic slots (package parameters) box as live capsules, so a value
|
|
2815
|
+
* that comes back through a boundary cast keeps its identity. */
|
|
2816
|
+
declBoundaryMemo = null;
|
|
2817
|
+
get declBoundary() {
|
|
2818
|
+
this.declBoundaryMemo ??= this.program
|
|
2819
|
+
.getSourceFiles()
|
|
2820
|
+
.some((sf) => isDeclBoundaryFile(sf.fileName));
|
|
2821
|
+
return this.declBoundaryMemo;
|
|
2822
|
+
}
|
|
2823
|
+
/** Tracked classes' bag initializers over a typed `this`
|
|
2824
|
+
* (class-dynamic-dispatch.ts recordBagInitializers). */
|
|
2825
|
+
classBagInitializers = new Map();
|
|
2708
2826
|
constructor(program, entry, moduleOrder, mode = {}) {
|
|
2709
2827
|
this.program = program;
|
|
2710
2828
|
this.entry = entry;
|
|
@@ -2808,7 +2926,10 @@ export class Lowerer {
|
|
|
2808
2926
|
classImplementedProtocol: (type) => this.classImplementedProtocol(type),
|
|
2809
2927
|
isStdlibFile: this.isStdlibFile,
|
|
2810
2928
|
isNpmFile: this.isNpmFile,
|
|
2811
|
-
|
|
2929
|
+
// The declaration-typed boundary's generated types (decl-projection.ts)
|
|
2930
|
+
// describe data, like an explicitly mapped external type surface.
|
|
2931
|
+
isExternalTypeFile: (sf) => this.externalTypeSpecifiersByFile.has(tsgoPath(resolve(sf.fileName))) ||
|
|
2932
|
+
isDeclBoundaryFile(sf.fileName),
|
|
2812
2933
|
typeMemo: this.typeMemo,
|
|
2813
2934
|
...(this.generalNodeStreams ? { generalNodeStreams: true } : {}),
|
|
2814
2935
|
...(this.dynNodeStreams ? { dynNodeStreams: true } : {}),
|
|
@@ -4551,6 +4672,8 @@ export class Lowerer {
|
|
|
4551
4672
|
return true;
|
|
4552
4673
|
if (ts.isPropertyAccessExpression(e) && isOptionalProcessStreamProperty(this, e))
|
|
4553
4674
|
return true;
|
|
4675
|
+
if (ts.isPropertyAccessExpression(e) && isOptionalReadlineCursorRead(this, e))
|
|
4676
|
+
return true;
|
|
4554
4677
|
if (isOptionalProcessVersionsRead(this, e))
|
|
4555
4678
|
return true;
|
|
4556
4679
|
if (ts.isPropertyAccessExpression(e) && isSettledIteratorValueRead(this, e))
|
|
@@ -5732,7 +5855,10 @@ export class Lowerer {
|
|
|
5732
5855
|
}
|
|
5733
5856
|
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)) {
|
|
5734
5857
|
const callbackIndices = hofCallbackIndices(node.expression.name.text, node.arguments.nodes.length >= 2);
|
|
5735
|
-
|
|
5858
|
+
// `xs.map(((x) => x))`: the parenthesized callback is the arrow.
|
|
5859
|
+
let callback = node.arguments.nodes[0];
|
|
5860
|
+
while (callback !== undefined && ts.isParenthesizedExpression(callback))
|
|
5861
|
+
callback = callback.expression;
|
|
5736
5862
|
if (callbackIndices !== null && callback !== undefined && !ts.isSpreadElement(callback)) {
|
|
5737
5863
|
const receiverNode = node.expression.expression;
|
|
5738
5864
|
const receiverTs = this.typeOf(receiverNode);
|
|
@@ -5783,12 +5909,26 @@ export class Lowerer {
|
|
|
5783
5909
|
presentSites.set(node, elementsPresent && !reduce);
|
|
5784
5910
|
if (elementsPresent && reduce && retypeInlineCallback(callback, callbackIndices))
|
|
5785
5911
|
changed = true;
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5912
|
+
// The accumulator holds undefined when the callback can return
|
|
5913
|
+
// it, when an initial value can be missing, or when elements can
|
|
5914
|
+
// be absent and there is no initial value. It holds another
|
|
5915
|
+
// primitive when the callback's result can be one at run time
|
|
5916
|
+
// (`missing[0] ?? "fallback"`).
|
|
5917
|
+
const initial = node.arguments.nodes[1];
|
|
5918
|
+
const optional = (!elementsPresent && initial === undefined) ||
|
|
5919
|
+
(initial !== undefined && !ts.isSpreadElement(initial) && mayBeOptional(initial)) ||
|
|
5920
|
+
callbackReturnsOptional(callback);
|
|
5921
|
+
const arithmetic = reduce && (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback))
|
|
5922
|
+
? lambdaArithmeticReturn(callback)
|
|
5923
|
+
: null;
|
|
5924
|
+
if (reduce && (optional || arithmetic !== null)) {
|
|
5925
|
+
if (optional && promoteHofCallback(callback, [0, 1]))
|
|
5790
5926
|
changed = true;
|
|
5791
|
-
|
|
5927
|
+
let result = this.irTypeOf(node);
|
|
5928
|
+
if (arithmetic !== null)
|
|
5929
|
+
result = joinPrimitiveTypes([result, arithmetic]) ?? result;
|
|
5930
|
+
if (optional)
|
|
5931
|
+
result = this.runtimeOptionalType(result);
|
|
5792
5932
|
siteDependencies?.read(node);
|
|
5793
5933
|
const previous = this.runtimeOptionalReduceTypes.get(node);
|
|
5794
5934
|
if (!previous || !typeEquals(previous, result)) {
|
|
@@ -6563,8 +6703,11 @@ export class Lowerer {
|
|
|
6563
6703
|
const fn = this.lowerFunction(decl);
|
|
6564
6704
|
if (fn)
|
|
6565
6705
|
functions.push(fn);
|
|
6566
|
-
else if (this.countsSkips())
|
|
6706
|
+
else if (this.countsSkips()) {
|
|
6567
6707
|
this.countSkippedBody(decl);
|
|
6708
|
+
if (this.remainder)
|
|
6709
|
+
this.reportBlockedBody(decl);
|
|
6710
|
+
}
|
|
6568
6711
|
}
|
|
6569
6712
|
for (const decl of fp.classDecls) {
|
|
6570
6713
|
const info = this.classes.get(this.classNamer(decl));
|
|
@@ -6688,6 +6831,7 @@ export class Lowerer {
|
|
|
6688
6831
|
finalizePrivateBrands(this, functions);
|
|
6689
6832
|
trackClassFieldCreation(this, functions);
|
|
6690
6833
|
guardClassAttributeWrites(this, functions);
|
|
6834
|
+
guardFrozenWrites(this, functions);
|
|
6691
6835
|
applyHandleProperties(this, functions);
|
|
6692
6836
|
// Globals typed by a class that never REGISTERED (a JS class whose
|
|
6693
6837
|
// collection fenced — Symbol-keyed fields, an unsupported base): the
|
|
@@ -6790,9 +6934,13 @@ export class Lowerer {
|
|
|
6790
6934
|
entry: ENTRY_NAME,
|
|
6791
6935
|
...(this.usesWorkers ? { workers: true } : {}),
|
|
6792
6936
|
...(this.usesLifetimeRegions ? { lifetimeRegions: true } : {}),
|
|
6937
|
+
...(this.declBoundary ? { declBoundary: true } : {}),
|
|
6793
6938
|
...(this.threadSlotKeys.size > 0
|
|
6794
6939
|
? { threadSlotKeys: [...this.threadSlotKeys].sort() }
|
|
6795
6940
|
: {}),
|
|
6941
|
+
...(this.freezableArrays.size > 0
|
|
6942
|
+
? { freezableArrays: [...this.freezableArrays].sort() }
|
|
6943
|
+
: {}),
|
|
6796
6944
|
...(isNodeEsmFile(this.entry, this.program) ? {} : { commonJsEntry: true }),
|
|
6797
6945
|
...(this.ffiImports.length > 0 ? { ffiImports: [...this.ffiImports] } : {}),
|
|
6798
6946
|
};
|
|
@@ -6893,6 +7041,20 @@ export class Lowerer {
|
|
|
6893
7041
|
this.bumpFileStat(file, "failed");
|
|
6894
7042
|
}
|
|
6895
7043
|
}
|
|
7044
|
+
/** Coverage remainder: the body diagnostics of a function whose
|
|
7045
|
+
* signature blocked (blockedBodyDiagnostics). A function reachable emit
|
|
7046
|
+
* reached (its signature's diagnostics flushed there) reports them with
|
|
7047
|
+
* the reached diagnostics; any other reports them as unreached. */
|
|
7048
|
+
reachedBlockedBodyDiagnostics = [];
|
|
7049
|
+
reportBlockedBody(decl) {
|
|
7050
|
+
const diags = blockedBodyDiagnostics(this, decl);
|
|
7051
|
+
const symbol = declSymbolOf(this, decl);
|
|
7052
|
+
if (symbol && this.alreadyFlushed.has(symbol))
|
|
7053
|
+
this.reachedBlockedBodyDiagnostics.push(...diags);
|
|
7054
|
+
else
|
|
7055
|
+
for (const d of diags)
|
|
7056
|
+
this.pushDiag(d);
|
|
7057
|
+
}
|
|
6896
7058
|
/** Whether run() counts a signature-blocked declaration in
|
|
6897
7059
|
* stats.functionsSkipped: whole-program passes and the coverage
|
|
6898
7060
|
* remainder do; an externally-gated emit pass leaves the counting to the
|
|
@@ -8190,6 +8352,22 @@ export class Lowerer {
|
|
|
8190
8352
|
* type-mapper.ts's chalk-shape mapping — call paths and func-slot coercions
|
|
8191
8353
|
* share it. */
|
|
8192
8354
|
hybridCallUnwrap(expr) {
|
|
8355
|
+
// A callable CLASS instance: a class whose merged interface carries a
|
|
8356
|
+
// call signature stores its call behavior in a `%call` field (the
|
|
8357
|
+
// chalk package shim's builder). Calls read the field.
|
|
8358
|
+
if (expr.type.kind === "object") {
|
|
8359
|
+
const callType = this.classes.get(expr.type.className)?.fields.get("%call");
|
|
8360
|
+
if (callType === undefined || callType.kind !== "func")
|
|
8361
|
+
return expr;
|
|
8362
|
+
return {
|
|
8363
|
+
kind: "fieldGet",
|
|
8364
|
+
obj: expr,
|
|
8365
|
+
className: expr.type.className,
|
|
8366
|
+
field: "%call",
|
|
8367
|
+
type: callType,
|
|
8368
|
+
loc: expr.loc,
|
|
8369
|
+
};
|
|
8370
|
+
}
|
|
8193
8371
|
if (expr.type.kind !== "record")
|
|
8194
8372
|
return expr;
|
|
8195
8373
|
const shape = this.shapes.get(expr.type.shapeId);
|
|
@@ -8272,6 +8450,20 @@ export class Lowerer {
|
|
|
8272
8450
|
}
|
|
8273
8451
|
if (expr.type.kind === "void" && expected.kind !== "void" && this.neverValued.has(expr))
|
|
8274
8452
|
return this.divergentValue(expr, expected);
|
|
8453
|
+
// A builtin error constructor global stored in a slot of its class value
|
|
8454
|
+
// type (`{ Parent: Error }`): the class value itself, which a checked
|
|
8455
|
+
// cast of the dynamic constructor value could not produce.
|
|
8456
|
+
if (expected.kind === "classval" &&
|
|
8457
|
+
expr.kind === "libCall" &&
|
|
8458
|
+
expr.fn === "dyn.globalConstructor" &&
|
|
8459
|
+
expr.args[0]?.kind === "strLit" &&
|
|
8460
|
+
`%${expr.args[0].value}` === expected.className) {
|
|
8461
|
+
const info = this.classes.get(expected.className);
|
|
8462
|
+
if (info?.builtinError && info.valueCtorParams !== undefined) {
|
|
8463
|
+
this.defineClassValueConstruct(info);
|
|
8464
|
+
return { kind: "classRef", className: info.def.name, type: expected, loc: expr.loc };
|
|
8465
|
+
}
|
|
8466
|
+
}
|
|
8275
8467
|
// process.stdout/stderr into a general Writable slot (general-streams.ts).
|
|
8276
8468
|
const stdioStream = stdioIntoGeneralStream(this, expr, expected);
|
|
8277
8469
|
if (stdioStream)
|
|
@@ -8283,6 +8475,12 @@ export class Lowerer {
|
|
|
8283
8475
|
if (adapted)
|
|
8284
8476
|
return adapted;
|
|
8285
8477
|
}
|
|
8478
|
+
// Iterable-typed slots: other iterators enter the generator arm.
|
|
8479
|
+
if (expected.kind === "union" && !typeEquals(expr.type, expected)) {
|
|
8480
|
+
const iterable = iterableSlotValue(this, expr, expected);
|
|
8481
|
+
if (iterable)
|
|
8482
|
+
return iterable;
|
|
8483
|
+
}
|
|
8286
8484
|
// an any-typed slot marshals implicitly (tsc allows the assignment;
|
|
8287
8485
|
// the marshal is where its semantics live). OUT: an 'any' value
|
|
8288
8486
|
// flowing into a typed slot compiles to a VALIDATED exit — like every
|
|
@@ -8363,6 +8561,11 @@ export class Lowerer {
|
|
|
8363
8561
|
// constructor. `require("events")` is the EventEmitter class itself,
|
|
8364
8562
|
// so its module binding is too (`ReleaseEmitter = EventEmitter` over
|
|
8365
8563
|
// `const EventEmitter = require("events")`).
|
|
8564
|
+
if (expr.type.kind === "moduleNs" && isJsSourceFileName(expr.loc.file)) {
|
|
8565
|
+
const object = moduleNamespaceObject(this, expr);
|
|
8566
|
+
if (object)
|
|
8567
|
+
return object;
|
|
8568
|
+
}
|
|
8366
8569
|
if (expr.type.kind === "moduleNs" &&
|
|
8367
8570
|
expr.type.moduleId === "builtin:events" &&
|
|
8368
8571
|
isJsSourceFileName(expr.loc.file)) {
|
|
@@ -8470,10 +8673,19 @@ export class Lowerer {
|
|
|
8470
8673
|
// A HYBRID (function-with-properties) record flowing into a plain
|
|
8471
8674
|
// func slot extracts its reserved %call field — the chalk shape's
|
|
8472
8675
|
// "the value IS callable" half (type-mapper.ts's hybrid mapping).
|
|
8473
|
-
if (expected.kind === "func" && expr.type.kind === "record") {
|
|
8676
|
+
if (expected.kind === "func" && (expr.type.kind === "record" || expr.type.kind === "object")) {
|
|
8474
8677
|
const un = this.hybridCallUnwrap(expr);
|
|
8475
8678
|
if (un !== expr && typeEquals(un.type, expected))
|
|
8476
8679
|
return un;
|
|
8680
|
+
// A callable class instance (the chalk shim's variadic builder) in a
|
|
8681
|
+
// narrower function slot: its call closure crosses the checked
|
|
8682
|
+
// function boundary, which adapts the arity.
|
|
8683
|
+
if (un !== expr &&
|
|
8684
|
+
expr.type.kind === "object" &&
|
|
8685
|
+
un.type.kind === "func" &&
|
|
8686
|
+
canBoxFuncIntoDyn(un.type, (id) => this.shapes.get(id), (id) => this.unions.get(id))) {
|
|
8687
|
+
return this.coerceToExpected({ kind: "dynFrom", value: un, type: DYN, loc: un.loc }, expected);
|
|
8688
|
+
}
|
|
8477
8689
|
}
|
|
8478
8690
|
// A zero-param function whose RETURN is a wider record array than the
|
|
8479
8691
|
// slot's (`getRoutes: () => cachedRoutes` against `() => Narrow[]`):
|
|
@@ -9170,6 +9382,40 @@ export class Lowerer {
|
|
|
9170
9382
|
}
|
|
9171
9383
|
return this.coerceInto(node, value, expected);
|
|
9172
9384
|
}
|
|
9385
|
+
/** The right side of a write to a member of a typed view of the global
|
|
9386
|
+
* object (`(globalThis as typeof globalThis & { k?: T }).k = value`, also
|
|
9387
|
+
* through `??=` and `||=`) that is `value` itself or wraps only it in
|
|
9388
|
+
* parentheses or `satisfies`; null when `value` is not in such a write. */
|
|
9389
|
+
globalViewSlot(value) {
|
|
9390
|
+
let operand = value;
|
|
9391
|
+
while (operand.parent !== undefined &&
|
|
9392
|
+
(ts.isParenthesizedExpression(operand.parent) || ts.isSatisfiesExpression(operand.parent)))
|
|
9393
|
+
operand = operand.parent;
|
|
9394
|
+
const write = operand.parent;
|
|
9395
|
+
if (write === undefined ||
|
|
9396
|
+
!ts.isBinaryExpression(write) ||
|
|
9397
|
+
write.right !== operand ||
|
|
9398
|
+
(write.operatorToken.kind !== ts.SyntaxKind.EqualsToken &&
|
|
9399
|
+
write.operatorToken.kind !== ts.SyntaxKind.QuestionQuestionEqualsToken &&
|
|
9400
|
+
write.operatorToken.kind !== ts.SyntaxKind.BarBarEqualsToken))
|
|
9401
|
+
return null;
|
|
9402
|
+
let target = write.left;
|
|
9403
|
+
while (ts.isParenthesizedExpression(target))
|
|
9404
|
+
target = target.expression;
|
|
9405
|
+
if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target))
|
|
9406
|
+
return null;
|
|
9407
|
+
const receiver = this.typeOf(target.expression);
|
|
9408
|
+
const isGlobal = (type) => {
|
|
9409
|
+
const symbol = type.getSymbol();
|
|
9410
|
+
return (symbol !== undefined &&
|
|
9411
|
+
ts.symbolName(symbol) === "globalThis" &&
|
|
9412
|
+
symbol.declarations.length === 0);
|
|
9413
|
+
};
|
|
9414
|
+
return isGlobal(receiver) ||
|
|
9415
|
+
(receiver.isIntersectionType() && ts.constituentTypes(receiver).some(isGlobal))
|
|
9416
|
+
? operand
|
|
9417
|
+
: null;
|
|
9418
|
+
}
|
|
9173
9419
|
/** Lower for a known destination, then apply ordinary value coercion.
|
|
9174
9420
|
* Fresh arrays and records use the destination layout directly. */
|
|
9175
9421
|
lowerExprExpecting(node, expected) {
|
|
@@ -9237,6 +9483,20 @@ export class Lowerer {
|
|
|
9237
9483
|
// belong to the array the program keeps, rather than a typed snapshot.
|
|
9238
9484
|
if (ts.isArrayLiteralExpression(x) &&
|
|
9239
9485
|
x.elements.nodes.every((element) => !ts.isSpreadElement(element) && !ts.isOmittedExpression(element))) {
|
|
9486
|
+
// A checked slot that the program declares as a native array (a
|
|
9487
|
+
// member of a typed view of the global object, `typeof globalThis &
|
|
9488
|
+
// { cache?: number[] }`) is read back through that declaration. Build
|
|
9489
|
+
// the native array and store it boxed: every typed read then extracts
|
|
9490
|
+
// that same array (a dynamic literal would be copied on each read,
|
|
9491
|
+
// losing writes such as push).
|
|
9492
|
+
const slot = this.globalViewSlot(x);
|
|
9493
|
+
const slotType = slot ? this.checker.getContextualType(slot) : undefined;
|
|
9494
|
+
const declared = slotType && this.checker.getNonNullableType(slotType);
|
|
9495
|
+
const native = declared && !(declared.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown))
|
|
9496
|
+
? this.mapTypeOf(declared)
|
|
9497
|
+
: null;
|
|
9498
|
+
if (native?.kind === "array")
|
|
9499
|
+
return this.coerceInto(node, this.lowerArrayLiteral(x, native), DYN);
|
|
9240
9500
|
return {
|
|
9241
9501
|
kind: "dynArrLit",
|
|
9242
9502
|
elems: x.elements.nodes.map((element) => this.lowerExprExpecting(element, DYN)),
|
|
@@ -9263,7 +9523,9 @@ export class Lowerer {
|
|
|
9263
9523
|
builtinOption("UrlObject") ||
|
|
9264
9524
|
builtinOption("URLFormatOptions") ||
|
|
9265
9525
|
!this.mapTypeOf(this.typeOf(x)) ||
|
|
9266
|
-
this.excessJsContextualProperty(x, parts)
|
|
9526
|
+
this.excessJsContextualProperty(x, parts) ||
|
|
9527
|
+
this.reshapeableContextualLiteral(x, parts) ||
|
|
9528
|
+
holdsEvolvingArray(this, x)) {
|
|
9267
9529
|
return lowerDynObjectLiteral(this, x);
|
|
9268
9530
|
}
|
|
9269
9531
|
}
|
|
@@ -9442,8 +9704,27 @@ export class Lowerer {
|
|
|
9442
9704
|
// must not force an intermediate record with incompatible field slots.
|
|
9443
9705
|
if (this.returnsLiteralIntoDyn(node, expected))
|
|
9444
9706
|
return this.lowerExprExpecting(node, expected);
|
|
9707
|
+
if (this.returnsFreshCollection(node) && expected.kind !== "void")
|
|
9708
|
+
return this.lowerExprExpecting(node, expected);
|
|
9445
9709
|
return this.asyncReturnValueOf(node, this.lowerExpr(node), expected);
|
|
9446
9710
|
}
|
|
9711
|
+
/** An array literal or a `new Map(...)`, `new Set(...)` or `new
|
|
9712
|
+
* Array(...)` of the builtins: a fresh collection, never a thenable, so
|
|
9713
|
+
* an async return takes the declared result type as its construction
|
|
9714
|
+
* layout the way a synchronous return does (`return []` in a function
|
|
9715
|
+
* whose inferred result is `Promise<string[]>`). */
|
|
9716
|
+
returnsFreshCollection(node) {
|
|
9717
|
+
let e = node;
|
|
9718
|
+
while (ts.isParenthesizedExpression(e))
|
|
9719
|
+
e = e.expression;
|
|
9720
|
+
if (ts.isArrayLiteralExpression(e))
|
|
9721
|
+
return true;
|
|
9722
|
+
return (ts.isNewExpression(e) &&
|
|
9723
|
+
ts.isIdentifier(e.expression) &&
|
|
9724
|
+
(this.isStdlibGlobal(e.expression, "Map") ||
|
|
9725
|
+
this.isStdlibGlobal(e.expression, "Set") ||
|
|
9726
|
+
this.isStdlibGlobal(e.expression, "Array")));
|
|
9727
|
+
}
|
|
9447
9728
|
/** A fresh JS object literal returned into a checked-native (dyn) result,
|
|
9448
9729
|
* which lowers straight into that storage. */
|
|
9449
9730
|
returnsLiteralIntoDyn(node, expected) {
|
|
@@ -9569,7 +9850,9 @@ export class Lowerer {
|
|
|
9569
9850
|
loc,
|
|
9570
9851
|
};
|
|
9571
9852
|
}
|
|
9572
|
-
if (this.adoptsReturnedPromise() &&
|
|
9853
|
+
if (this.adoptsReturnedPromise() &&
|
|
9854
|
+
!this.returnsLiteralIntoDyn(node, expected) &&
|
|
9855
|
+
!this.returnsFreshCollection(node)) {
|
|
9573
9856
|
// The async return lowers its operand untyped first (a promise
|
|
9574
9857
|
// adopts before its payload converts); a maybe-promise union needs
|
|
9575
9858
|
// the statement form, which branches between adoption and fulfillment.
|
|
@@ -9955,8 +10238,8 @@ export class Lowerer {
|
|
|
9955
10238
|
throw e;
|
|
9956
10239
|
}
|
|
9957
10240
|
}
|
|
9958
|
-
lowerClassExpression(expr) {
|
|
9959
|
-
return lowerClassExpression(this, expr);
|
|
10241
|
+
lowerClassExpression(expr, binding) {
|
|
10242
|
+
return lowerClassExpression(this, expr, binding);
|
|
9960
10243
|
}
|
|
9961
10244
|
/* ── the class graph (single inheritance) ─────────────────────────── */
|
|
9962
10245
|
findMethodOn(info, name) {
|
|
@@ -11055,7 +11338,7 @@ export class Lowerer {
|
|
|
11055
11338
|
return lowerRecordKeyRead(this, expr, shapeId, shape, includeUndefined);
|
|
11056
11339
|
}
|
|
11057
11340
|
lowerElementWrite(expr) {
|
|
11058
|
-
return lowerElementWrite(this, expr);
|
|
11341
|
+
return markSloppyRecordWrites(this, lowerElementWrite(this, expr), expr);
|
|
11059
11342
|
}
|
|
11060
11343
|
lowerLiveWebValue(node) {
|
|
11061
11344
|
return lowerLiveWebValue(this, node);
|
|
@@ -11354,7 +11637,7 @@ export class Lowerer {
|
|
|
11354
11637
|
: null;
|
|
11355
11638
|
}
|
|
11356
11639
|
fieldSetStmt(target, value, loc, blame) {
|
|
11357
|
-
return fieldSetStmt(this, target, value, loc, blame);
|
|
11640
|
+
return markSloppyRecordWrites(this, fieldSetStmt(this, target, value, loc, blame), blame);
|
|
11358
11641
|
}
|
|
11359
11642
|
lowerFieldCompound(access, op, rhsNode, loc) {
|
|
11360
11643
|
return lowerFieldCompound(this, access, op, rhsNode, loc);
|
|
@@ -11384,6 +11667,7 @@ export class Lowerer {
|
|
|
11384
11667
|
lowerBlobNew(this, expr) ??
|
|
11385
11668
|
lowerNetAddressNew(this, expr) ??
|
|
11386
11669
|
lowerStaticReadableStreamNew(this, expr) ??
|
|
11670
|
+
lowerStaticTransformStreamNew(this, expr) ??
|
|
11387
11671
|
lowerConsoleNew(this, expr);
|
|
11388
11672
|
return (builtin ?? this.withRuntimeOptionalClassValue(expr.expression, () => lowerNew(this, expr)));
|
|
11389
11673
|
}
|