@scriptc/compiler 0.4.1 → 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 +977 -113
- package/dist/backend/cycle-analysis.d.ts +5 -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 +9 -1
- package/dist/backend/cycle-mutability.js +21 -3
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.js +6 -1
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.d.ts +7 -3
- package/dist/backend/immutability.js +33 -29
- package/dist/backend/immutability.js.map +1 -1
- package/dist/backend/library-pack.js +5 -0
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +23 -4
- package/dist/backend/llvm/alloc.js +61 -8
- 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 +23 -10
- 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 +70 -7
- package/dist/backend/llvm/bytes-loop-versions.js +567 -30
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +389 -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 +74 -1
- package/dist/backend/llvm/classes.js +364 -54
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +384 -17
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +10 -6
- package/dist/backend/llvm/common.js +10 -6
- 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 +91 -56
- package/dist/backend/llvm/constant-callbacks.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.test.js +4 -4
- package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
- package/dist/backend/llvm/counted-loops.d.ts +11 -1
- package/dist/backend/llvm/counted-loops.js +80 -23
- 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 +35 -16
- package/dist/backend/llvm/dense-array-loops.js +237 -12
- package/dist/backend/llvm/dense-array-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.test.js +140 -15
- 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 +51 -1
- package/dist/backend/llvm/dyn.js +683 -69
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +33 -26
- 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 +208 -34
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-statements.d.ts +0 -27
- package/dist/backend/llvm/emit-statements.js +577 -93
- 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 +314 -49
- package/dist/backend/llvm/emitter.js +1241 -129
- 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-async.js +19 -0
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +5 -2
- package/dist/backend/llvm/expr-bytes.js +144 -52
- 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.d.ts +1 -1
- package/dist/backend/llvm/expr-calls.js +62 -36
- 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 +148 -40
- 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-control.js +2 -3
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +71 -16
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +126 -36
- 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 +225 -64
- 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 +200 -50
- 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 +90 -2
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +65 -4
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.d.ts +4 -0
- package/dist/backend/llvm/lib-http2.js +24 -17
- 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 +65 -14
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +126 -3
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +97 -30
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-tls.js +23 -0
- package/dist/backend/llvm/lib-tls.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +181 -64
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +28 -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 +18 -1
- package/dist/backend/llvm/publish.js +76 -25
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/publish.test.js +3 -0
- package/dist/backend/llvm/publish.test.js.map +1 -1
- package/dist/backend/llvm/receivers.js +7 -2
- 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 +91 -72
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.js +161 -14
- package/dist/backend/llvm/regex-matchers.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.test.js +18 -0
- package/dist/backend/llvm/regex-matchers.test.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 +79 -21
- package/dist/backend/llvm/shapes.js +233 -42
- 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-lifetimes.test.js +2 -1
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +15 -0
- package/dist/backend/llvm/string-reads.js +128 -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/wasm-modules.d.ts +6 -5
- package/dist/backend/llvm/wasm-modules.js +32 -9
- package/dist/backend/llvm/wasm-modules.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/mangle.d.ts +3 -0
- package/dist/backend/mangle.js +5 -0
- package/dist/backend/mangle.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 +27 -4
- package/dist/backend/native/executable.js +31 -8
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/library.js +1 -0
- package/dist/backend/native/library.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.d.ts +11 -6
- package/dist/backend/native-codegen.js +36 -9
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +0 -23
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +18 -4
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/optimization.d.ts +2 -2
- 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 +2 -1
- package/dist/backend/runtime-pack-core.js +2 -1
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +5 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.d.ts +0 -21
- package/dist/backend/runtime-pack.js +0 -29
- package/dist/backend/runtime-pack.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +10 -69
- 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 +33 -1
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/warm-cache.js +4 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +26 -6
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/usage.d.ts +5 -1
- package/dist/cli/usage.js +10 -5
- 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/contracts/check.js +5 -4
- 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.d.ts +7 -2
- package/dist/coverage/report.js +30 -3
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +1 -0
- package/dist/coverage/verdict-cache.js +4 -0
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/coverage/verdict-semantic.js +4 -0
- package/dist/coverage/verdict-semantic.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +4 -0
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/dynamic-tier.d.ts +40 -0
- package/dist/diagnostics/dynamic-tier.js +57 -0
- package/dist/diagnostics/dynamic-tier.js.map +1 -0
- package/dist/diagnostics/envelope.d.ts +5 -1
- package/dist/diagnostics/envelope.js +6 -2
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +25 -1
- package/dist/executable/executable-cache.js +60 -7
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +46 -3
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +3 -1
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +1 -0
- package/dist/frontend/analysis.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/dispose-hook.d.ts +2 -0
- package/dist/frontend/dispose-hook.js +14 -0
- package/dist/frontend/dispose-hook.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/jsx-entities.d.ts +4 -0
- package/dist/frontend/jsx-entities.js +259 -0
- package/dist/frontend/jsx-entities.js.map +1 -0
- package/dist/frontend/jsx-source.d.ts +71 -0
- package/dist/frontend/jsx-source.js +781 -0
- package/dist/frontend/jsx-source.js.map +1 -0
- package/dist/frontend/jsx-source.test.d.ts +1 -0
- package/dist/frontend/jsx-source.test.js +200 -0
- package/dist/frontend/jsx-source.test.js.map +1 -0
- package/dist/frontend/literal-values.test.js +8 -9
- package/dist/frontend/literal-values.test.js.map +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.js +2 -1
- package/dist/frontend/lowering/array-indexed-mutation.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +103 -4
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/binding-analysis.d.ts +1 -1
- package/dist/frontend/lowering/binding-analysis.js +2 -2
- package/dist/frontend/lowering/binding-analysis.js.map +1 -1
- package/dist/frontend/lowering/builtins/arguments.d.ts +3 -0
- package/dist/frontend/lowering/builtins/arguments.js +30 -15
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/atomics.js +10 -6
- package/dist/frontend/lowering/builtins/atomics.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-async.js +2 -1
- package/dist/frontend/lowering/builtins/child-process-async.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-sync.js +2 -1
- package/dist/frontend/lowering/builtins/child-process-sync.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.d.ts +4 -2
- package/dist/frontend/lowering/builtins/crypto.js +136 -5
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/date-classes.d.ts +46 -0
- package/dist/frontend/lowering/builtins/date-classes.js +477 -0
- package/dist/frontend/lowering/builtins/date-classes.js.map +1 -0
- package/dist/frontend/lowering/builtins/dates.d.ts +11 -1
- package/dist/frontend/lowering/builtins/dates.js +55 -26
- package/dist/frontend/lowering/builtins/dates.js.map +1 -1
- package/dist/frontend/lowering/builtins/dh.d.ts +15 -0
- package/dist/frontend/lowering/builtins/dh.js +151 -0
- package/dist/frontend/lowering/builtins/dh.js.map +1 -0
- package/dist/frontend/lowering/builtins/disposable-stack.js +2 -1
- package/dist/frontend/lowering/builtins/disposable-stack.js.map +1 -1
- package/dist/frontend/lowering/builtins/ecdh.d.ts +12 -1
- package/dist/frontend/lowering/builtins/ecdh.js +7 -7
- package/dist/frontend/lowering/builtins/ecdh.js.map +1 -1
- package/dist/frontend/lowering/builtins/errors.d.ts +15 -0
- package/dist/frontend/lowering/builtins/errors.js +110 -0
- package/dist/frontend/lowering/builtins/errors.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js +23 -17
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem.js +6 -4
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-paths.d.ts +15 -0
- package/dist/frontend/lowering/builtins/fs-paths.js +209 -0
- package/dist/frontend/lowering/builtins/fs-paths.js.map +1 -0
- 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/hash-stream.d.ts +16 -4
- package/dist/frontend/lowering/builtins/hash-stream.js +86 -23
- package/dist/frontend/lowering/builtins/hash-stream.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +2 -1
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/key-object.d.ts +2 -1
- package/dist/frontend/lowering/builtins/key-object.js +20 -7
- package/dist/frontend/lowering/builtins/key-object.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-calls.js +11 -4
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.js +18 -6
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/operating-system.js +4 -3
- package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
- package/dist/frontend/lowering/builtins/performance.js +3 -2
- package/dist/frontend/lowering/builtins/performance.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.js +3 -2
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.d.ts +6 -0
- package/dist/frontend/lowering/builtins/promises.js +91 -4
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/promisify-callback.js +2 -1
- package/dist/frontend/lowering/builtins/promisify-callback.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +7 -2
- package/dist/frontend/lowering/builtins/readline.js +58 -9
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/strings.js +13 -5
- package/dist/frontend/lowering/builtins/strings.js.map +1 -1
- package/dist/frontend/lowering/builtins/text-codecs.js +2 -1
- package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
- package/dist/frontend/lowering/builtins/timers.js +1 -1
- package/dist/frontend/lowering/builtins/timers.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.js +28 -4
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/builtins/v8.js +2 -1
- package/dist/frontend/lowering/builtins/v8.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/builtins/webcrypto.js +39 -20
- package/dist/frontend/lowering/builtins/webcrypto.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.js +2 -1
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.js +13 -6
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/caught-value-dispatch.d.ts +18 -1
- package/dist/frontend/lowering/caught-value-dispatch.js +201 -32
- package/dist/frontend/lowering/caught-value-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-assertions.js +3 -2
- package/dist/frontend/lowering/class-assertions.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 +6 -2
- package/dist/frontend/lowering/class-construction.js +25 -16
- package/dist/frontend/lowering/class-construction.js.map +1 -1
- package/dist/frontend/lowering/class-descriptors.js +1 -1
- package/dist/frontend/lowering/class-descriptors.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +73 -2
- package/dist/frontend/lowering/class-dynamic-dispatch.js +1334 -259
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +124 -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 +35 -9
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-method-values.js +1 -1
- package/dist/frontend/lowering/class-method-values.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +7 -0
- package/dist/frontend/lowering/class-protocols.js +64 -4
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.d.ts +5 -0
- package/dist/frontend/lowering/class-prototypes.js +67 -5
- 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/class-to-primitive.js +25 -5
- package/dist/frontend/lowering/class-to-primitive.js.map +1 -1
- package/dist/frontend/lowering/class-unions.js +2 -1
- package/dist/frontend/lowering/class-unions.js.map +1 -1
- package/dist/frontend/lowering/coercions/function-adapters.js +6 -5
- package/dist/frontend/lowering/coercions/function-adapters.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 +99 -8
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.js +8 -7
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/collection-ingestion.js +2 -1
- package/dist/frontend/lowering/collection-ingestion.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.d.ts +7 -0
- package/dist/frontend/lowering/containers/array-callbacks.js +352 -31
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-concat.js +12 -1
- package/dist/frontend/lowering/containers/array-concat.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +25 -4
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +21 -5
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.js +21 -9
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.d.ts +1 -1
- package/dist/frontend/lowering/containers/bytes.js +131 -29
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +55 -2
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-grouping.js +3 -2
- package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +15 -9
- 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 +54 -14
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/iterator-helpers.d.ts +32 -1
- package/dist/frontend/lowering/containers/iterator-helpers.js +6 -5
- package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.js +87 -14
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +45 -20
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/cycle-initialization.js +25 -4
- package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.d.ts +18 -1
- package/dist/frontend/lowering/deferred-module-initializers.js +226 -115
- package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.test.js +28 -0
- package/dist/frontend/lowering/deferred-module-initializers.test.js.map +1 -1
- package/dist/frontend/lowering/dispatch-sites.d.ts +59 -0
- package/dist/frontend/lowering/dispatch-sites.js +218 -0
- package/dist/frontend/lowering/dispatch-sites.js.map +1 -0
- package/dist/frontend/lowering/dispatch-sites.test.d.ts +1 -0
- package/dist/frontend/lowering/dispatch-sites.test.js +59 -0
- package/dist/frontend/lowering/dispatch-sites.test.js.map +1 -0
- package/dist/frontend/lowering/divergences.js +9 -1
- package/dist/frontend/lowering/divergences.js.map +1 -1
- package/dist/frontend/lowering/dyn-streams.d.ts +3 -0
- package/dist/frontend/lowering/dyn-streams.js +1 -1
- package/dist/frontend/lowering/dyn-streams.js.map +1 -1
- package/dist/frontend/lowering/dynamic-tier.d.ts +25 -0
- package/dist/frontend/lowering/dynamic-tier.js +327 -0
- package/dist/frontend/lowering/dynamic-tier.js.map +1 -0
- package/dist/frontend/lowering/error-methods.js +51 -2
- package/dist/frontend/lowering/error-methods.js.map +1 -1
- package/dist/frontend/lowering/expressions/array-literals.js +62 -0
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +81 -5
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +107 -14
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +79 -11
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.js +130 -6
- 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 -3
- package/dist/frontend/lowering/expressions/object-literals.js +164 -56
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +17 -5
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +0 -4
- package/dist/frontend/lowering/expressions/property-access.js +211 -17
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +267 -30
- 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 +85 -12
- 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/generator-dynamic-dispatch.d.ts +6 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +20 -30
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +42 -1
- package/dist/frontend/lowering/generic-functions.js +455 -20
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/intern-tables.js +2 -1
- package/dist/frontend/lowering/intern-tables.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 +195 -9
- 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/js-dynamic-objects.js +3 -2
- package/dist/frontend/lowering/js-dynamic-objects.js.map +1 -1
- package/dist/frontend/lowering/json-require.js +2 -1
- package/dist/frontend/lowering/json-require.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.d.ts +24 -4
- package/dist/frontend/lowering/key-order-witness.js +790 -25
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.test.js +466 -10
- package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
- package/dist/frontend/lowering/lifetime-regions.js +2 -1
- package/dist/frontend/lowering/lifetime-regions.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +6 -5
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +7 -2
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +11 -0
- package/dist/frontend/lowering/lower-calls.js +776 -126
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +29 -2
- package/dist/frontend/lowering/lower-classes.js +581 -46
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +6 -3
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.d.ts +14 -0
- package/dist/frontend/lowering/lower-event-emitter.js +267 -20
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +19 -2
- package/dist/frontend/lowering/lower-exprs.js +126 -13
- 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 +387 -72
- 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 +28 -12
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +2 -1
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-mock.js +2 -1
- package/dist/frontend/lowering/lower-mock.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +47 -5
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.js +2 -2
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +2 -1
- package/dist/frontend/lowering/lower-namespaces.js +9 -4
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +10 -0
- package/dist/frontend/lowering/lower-server.js +239 -61
- 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 +42 -10
- 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 +622 -68
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +20 -2
- package/dist/frontend/lowering/lower-stream.js +2055 -318
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +4 -3
- package/dist/frontend/lowering/lower-timers.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +197 -29
- package/dist/frontend/lowering/lowerer.js +862 -84
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +21 -9
- package/dist/frontend/lowering/lowerer.test.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/narrowing-stability.js +5 -0
- package/dist/frontend/lowering/narrowing-stability.js.map +1 -1
- package/dist/frontend/lowering/native-ffi.js +1 -1
- package/dist/frontend/lowering/native-ffi.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-enumeration-receiver.js +2 -1
- package/dist/frontend/lowering/object-enumeration-receiver.js.map +1 -1
- package/dist/frontend/lowering/pairs-snapshot.js +2 -1
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
- package/dist/frontend/lowering/private-brands.d.ts +9 -0
- package/dist/frontend/lowering/private-brands.js +66 -15
- package/dist/frontend/lowering/private-brands.js.map +1 -1
- package/dist/frontend/lowering/promise-executor-adapter.js +2 -1
- package/dist/frontend/lowering/promise-executor-adapter.js.map +1 -1
- package/dist/frontend/lowering/require-initialization.js +2 -1
- package/dist/frontend/lowering/require-initialization.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-elements.d.ts +5 -0
- package/dist/frontend/lowering/runtime-optional-elements.js +17 -1
- package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-records.d.ts +2 -0
- package/dist/frontend/lowering/runtime-optional-records.js +18 -5
- package/dist/frontend/lowering/runtime-optional-records.js.map +1 -1
- package/dist/frontend/lowering/site-dependencies.d.ts +35 -0
- package/dist/frontend/lowering/site-dependencies.js +84 -0
- package/dist/frontend/lowering/site-dependencies.js.map +1 -0
- package/dist/frontend/lowering/site-dependencies.test.d.ts +1 -0
- package/dist/frontend/lowering/site-dependencies.test.js +53 -0
- package/dist/frontend/lowering/site-dependencies.test.js.map +1 -0
- package/dist/frontend/lowering/stable-names.d.ts +11 -0
- package/dist/frontend/lowering/stable-names.js +35 -0
- package/dist/frontend/lowering/stable-names.js.map +1 -0
- package/dist/frontend/lowering/static-typeof.d.ts +2 -2
- package/dist/frontend/lowering/static-typeof.js +42 -3
- package/dist/frontend/lowering/static-typeof.js.map +1 -1
- package/dist/frontend/lowering/strict-equality.js +2 -1
- package/dist/frontend/lowering/strict-equality.js.map +1 -1
- package/dist/frontend/lowering/structural-positions.d.ts +32 -0
- package/dist/frontend/lowering/structural-positions.js +108 -0
- package/dist/frontend/lowering/structural-positions.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +3 -0
- package/dist/frontend/lowering/surfaces.js +60 -32
- 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 +66 -16
- 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-tsc-helpers.d.ts +5 -0
- package/dist/frontend/npm-static-tsc-helpers.js +106 -0
- package/dist/frontend/npm-static-tsc-helpers.js.map +1 -0
- package/dist/frontend/npm-static-tsc-helpers.test.d.ts +1 -0
- package/dist/frontend/npm-static-tsc-helpers.test.js +58 -0
- package/dist/frontend/npm-static-tsc-helpers.test.js.map +1 -0
- package/dist/frontend/npm-static-type-exports-host.d.ts +8 -0
- package/dist/frontend/npm-static-type-exports-host.js +214 -0
- package/dist/frontend/npm-static-type-exports-host.js.map +1 -0
- package/dist/frontend/npm-static-type-exports-host.test.d.ts +1 -0
- package/dist/frontend/npm-static-type-exports-host.test.js +53 -0
- package/dist/frontend/npm-static-type-exports-host.test.js.map +1 -0
- package/dist/frontend/npm-static-type-exports.d.ts +52 -0
- package/dist/frontend/npm-static-type-exports.js +261 -0
- package/dist/frontend/npm-static-type-exports.js.map +1 -0
- package/dist/frontend/npm-static-type-exports.test.d.ts +1 -0
- package/dist/frontend/npm-static-type-exports.test.js +103 -0
- package/dist/frontend/npm-static-type-exports.test.js.map +1 -0
- package/dist/frontend/npm-static-umd.d.ts +6 -0
- package/dist/frontend/npm-static-umd.js +203 -0
- package/dist/frontend/npm-static-umd.js.map +1 -0
- package/dist/frontend/npm-static-umd.test.d.ts +1 -0
- package/dist/frontend/npm-static-umd.test.js +105 -0
- package/dist/frontend/npm-static-umd.test.js.map +1 -0
- package/dist/frontend/npm-static.d.ts +8 -0
- package/dist/frontend/npm-static.js +51 -22
- 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 +21 -1
- package/dist/frontend/program.js +586 -74
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +44 -4
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/services.d.ts +6 -0
- package/dist/frontend/services.js +18 -0
- package/dist/frontend/services.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 +43 -7
- package/dist/frontend/ts7/ast-node.js +1176 -129
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +84 -0
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.d.ts +29 -3
- package/dist/frontend/ts7/ast-wire.js +144 -31
- 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/ast.d.ts +23 -2
- package/dist/frontend/ts7/ast.js +143 -2
- package/dist/frontend/ts7/ast.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 +17 -1
- package/dist/frontend/ts7/checker.js +82 -1
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.js +9 -6
- package/dist/frontend/ts7/checker.test.js.map +1 -1
- package/dist/frontend/ts7/enums.d.ts +3 -3
- package/dist/frontend/ts7/enums.generated.d.ts +10 -0
- package/dist/frontend/ts7/enums.generated.js +21 -0
- package/dist/frontend/ts7/enums.generated.js.map +1 -1
- package/dist/frontend/ts7/enums.js +19 -0
- package/dist/frontend/ts7/enums.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 +30 -4
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.d.ts +10 -0
- package/dist/frontend/ts7/semantic-checker.js +25 -20
- package/dist/frontend/ts7/semantic-checker.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.d.ts +13 -0
- package/dist/frontend/ts7/semantic-json.js +146 -0
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.test.js +57 -1
- package/dist/frontend/ts7/semantic-json.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.d.ts +15 -0
- package/dist/frontend/ts7/semantic-model.js +67 -19
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.test.js +3 -2
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -1
- package/dist/frontend/ts7/session.d.ts +14 -1
- package/dist/frontend/ts7/session.js +23 -1
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/tsc-codes.d.ts +1 -1
- package/dist/frontend/tsc-codes.js +7 -0
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +51 -7
- package/dist/frontend/type-mapper.js +456 -43
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-mapper.test.js +1 -1
- package/dist/frontend/type-mapper.test.js.map +1 -1
- package/dist/frontend-process-args.d.ts +4 -0
- package/dist/frontend-process-args.js +52 -0
- package/dist/frontend-process-args.js.map +1 -0
- package/dist/frontend-process-args.test.d.ts +1 -0
- package/dist/frontend-process-args.test.js +47 -0
- package/dist/frontend-process-args.test.js.map +1 -0
- package/dist/frontend-process.d.ts +1 -0
- package/dist/frontend-process.js +23 -0
- package/dist/frontend-process.js.map +1 -0
- package/dist/heap-collection.d.ts +16 -0
- package/dist/heap-collection.js +42 -0
- package/dist/heap-collection.js.map +1 -0
- package/dist/heap-collection.test.d.ts +1 -0
- package/dist/heap-collection.test.js +59 -0
- package/dist/heap-collection.test.js.map +1 -0
- package/dist/heap-pressure.d.ts +2 -0
- package/dist/heap-pressure.js +12 -0
- package/dist/heap-pressure.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +435 -89
- 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 +26 -6
- package/dist/ir/array-length-stability.js.map +1 -1
- package/dist/ir/array-length-stability.test.js +49 -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 +80 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +7 -1
- package/dist/ir/builtin-signatures.js +303 -21
- 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 +3 -1
- package/dist/ir/final-fields.js +15 -17
- 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 +5 -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 +36 -6
- package/dist/ir/int32-slots.js +370 -171
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +3 -1
- package/dist/ir/int32-slots.test.js.map +1 -1
- package/dist/ir/integer-loop-facts.d.ts +9 -4
- package/dist/ir/integer-loop-facts.js +93 -18
- package/dist/ir/integer-loop-facts.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +49 -0
- package/dist/ir/integer-loops.js +202 -40
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +211 -1
- 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 +94 -0
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/ir.d.ts +87 -9
- package/dist/ir/ir.js +61 -2
- 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 +60 -15
- package/dist/ir/runtime-features.js +276 -35
- 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/tiers.js +1 -0
- package/dist/ir/tiers.js.map +1 -1
- package/dist/ir/traverse.d.ts +2 -0
- package/dist/ir/traverse.js +29 -5
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +171 -45
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/ir-policy.js +12 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/library/library-cache.d.ts +2 -0
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/prepare.js +2 -0
- package/dist/library/prepare.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 +26 -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 +123 -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 +6 -1
- 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/dist/startup-cache.d.ts +1 -0
- package/dist/startup-cache.js +1 -0
- package/dist/startup-cache.js.map +1 -1
- package/dist/text-parts.d.ts +7 -0
- package/dist/text-parts.js +44 -0
- package/dist/text-parts.js.map +1 -1
- package/dist/text-parts.test.d.ts +1 -0
- package/dist/text-parts.test.js +46 -0
- package/dist/text-parts.test.js.map +1 -0
- package/dist/timing.d.ts +9 -2
- package/dist/timing.js +7 -4
- package/dist/timing.js.map +1 -1
- package/dist/wasm/translate.d.ts +4 -0
- package/dist/wasm/translate.js +2 -2
- package/dist/wasm/translate.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/shims/undici/core/client.ts +4 -4
- package/surface-manifest.json +44 -52
|
@@ -2,7 +2,8 @@ import { lowerTupleAliasDecl, stripTypeWrappers } from "./typed-arguments.js";
|
|
|
2
2
|
import { declaredMemberOf, isPromisePrototypeRead } from "./expressions/property-access.js";
|
|
3
3
|
import { hostsAll } from "./expressions/hosted-narrowing.js";
|
|
4
4
|
import { requestGeneralStreamSurface } from "./general-streams.js";
|
|
5
|
-
import { lowerForAwaitDynStream } from "./dyn-streams.js";
|
|
5
|
+
import { lowerForAwaitDynStream, nodeStreamInterfaceSide } from "./dyn-streams.js";
|
|
6
|
+
import { lowerForAwaitValueStream } from "./builtins/hash-stream.js";
|
|
6
7
|
import { lowerChildPropertyWrite } from "./handle-properties.js";
|
|
7
8
|
import { matchAllRowsReadByElements, storedMatchAllRowsReadByElements, } from "./containers/match-row-uses.js";
|
|
8
9
|
import { dynUndefinedExpr, nodeThrowExpr, numLit, varRef } from "../../ir/build.js";
|
|
@@ -21,6 +22,7 @@ import { InternalCompilerError } from "../../errors.js";
|
|
|
21
22
|
* flow (if/while/for/for-of/do, switch, try/catch, abrupt completions),
|
|
22
23
|
* explicit resource management, and blocked-binding poisoning. */
|
|
23
24
|
import * as ts from "../ts7/adapter.js";
|
|
25
|
+
import { lowerOptionalIndex } from "./undefined-index.js";
|
|
24
26
|
import { processDataMemberValue, programReadsExitCode } from "./builtins/process.js";
|
|
25
27
|
import { requireInitFlagStmt } from "./require-initialization.js";
|
|
26
28
|
import { isJsonRequireDecl } from "./json-require.js";
|
|
@@ -32,12 +34,13 @@ import { isDeadTscHelperDecl, tscInteropBindingOfDecl } from "./cjs-tsc-interop.
|
|
|
32
34
|
import { arrayValueRead, arrayValueStore, arrayValueType, unionArrayValueRead, lowerSafeIndexRead, } from "./array-values.js";
|
|
33
35
|
import { lowerForAwaitGenerator, lowerForOfGenerator, lowerYieldStarStatement, } from "./lower-generators.js";
|
|
34
36
|
import { classAsyncGeneratorIterator, lowerForAwaitBuiltin } from "./lower-async-iteration.js";
|
|
35
|
-
import { BOOL, BYTES_U8, CAUGHT, DYN, F64, STRING, UNDEFINED_T, VOID, arrayOf, isDynTypedRefType, isUnitType, shapeHasAccessorSlots, typeEquals, } from "../../ir/ir.js";
|
|
37
|
+
import { BOOL, BYTES_U8, CAUGHT, DYN, F64, SEARCH_PARAMS_T, STRING, UNDEFINED_T, VOID, arrayOf, isDynTypedRefType, isUnitType, shapeHasAccessorSlots, typeEquals, } from "../../ir/ir.js";
|
|
36
38
|
import { PoisonError, boundIdentifiersOf, dynFallbackType, neverTaintedJsType, staticImportNamespaceType, } from "./lowerer.js";
|
|
37
39
|
import { enforceLibBoundary, lowerSurplusCalls } from "./lib-boundary.js";
|
|
38
40
|
import { cjsExportAssignmentOf, cjsExportChainOf, cjsVoidInitPreambleReals, cjsExportDiscardReason, cjsExportTargetLiteral, isCjsJsFile, isEsModuleStamp, isJsSourceFile, locOf, requireEarlyReference, requireSpecOf, } from "../program.js";
|
|
39
41
|
import { isStrictCode } from "./strict-mode.js";
|
|
40
|
-
import {
|
|
42
|
+
import { markSloppyRecordWrites } from "./frozen-records.js";
|
|
43
|
+
import { COMPOUND_ASSIGN_OPS, STR_METHODS, NARROW_FIRST, UNSUPPORTED_STMT, isStdlibMember, sideEffectFreeOptionValue, stdlibGlobalAliasDecl, stdlibGlobalAliasNameOf, bufferNamespaceMember, stdlibGlobalNameOf, } from "./surfaces.js";
|
|
41
44
|
import { isNativeBuiltinValueInitializer } from "./lower-builtin-values.js";
|
|
42
45
|
import { isProvenanceSourceFile } from "../provenance-registry.js";
|
|
43
46
|
import { ambientUndefVarRootOf, lowerImportEquals, nsUndefRead, nsWritableTarget, trapDeclRootOf, } from "./lower-namespaces.js";
|
|
@@ -46,7 +49,7 @@ import { lowerForOfArrayIter, lowerForOfMap, lowerForOfSearchParams, lowerForOfS
|
|
|
46
49
|
import { lowerForOfHelperChain } from "./containers/iterator-helpers.js";
|
|
47
50
|
import { objectIterOverIndexShape } from "./containers/indexed-objects.js";
|
|
48
51
|
import { strCharsCall } from "./containers/array-construction.js";
|
|
49
|
-
import { bindingContextualGenericFnNodeOf, bindingGenericFnAliasInfoOf, bindingGenericFnInfoOf, bindingGenericFnNodeOf, implicitLocalFnInfoOf, implicitLocalFnNodeOf, implicitMethodCallInfersReturn, genericLocalClassBinding, } from "./generic-functions.js";
|
|
52
|
+
import { bindingContextualGenericFnNodeOf, bindingGenericFnAliasInfoOf, bindingGenericFnInfoOf, bindingGenericFnNodeOf, genericBindingPresenceStore, genericBindingStoredValue, implicitLocalFnInfoOf, implicitLocalFnNodeOf, implicitMethodCallInfersReturn, genericLocalClassBinding, } from "./generic-functions.js";
|
|
50
53
|
import { bindingNeverReassigned, deadUnmappableBinding, nullishExprUnitOf, nullishGenericBindingUnitOf, } from "./binding-analysis.js";
|
|
51
54
|
import { hasExplicitJsDocReturn } from "./function-returns.js";
|
|
52
55
|
import { recordKeysArrayCall } from "./lower-calls.js";
|
|
@@ -57,8 +60,8 @@ import { classStaticDataFor } from "./class-static-data.js";
|
|
|
57
60
|
import { objectFactorySignature } from "./object-factory-new.js";
|
|
58
61
|
import { isClassCallback, lowerClassCallbackAssign } from "./class-callbacks.js";
|
|
59
62
|
import { classForInHasKey, classPropertiesHelper } from "./class-dynamic-dispatch.js";
|
|
60
|
-
import { genericIfaceBindingKeepsClass } from "./lower-classes.js";
|
|
61
|
-
import { lowerStreamUnderscoreAssign, streamClassAliasDecl } from "./lower-stream.js";
|
|
63
|
+
import { genericIfaceBindingKeepsClass, superConditionLead } from "./lower-classes.js";
|
|
64
|
+
import { lowerStreamUnderscoreAssign, streamClassAliasDecl, streamSidesOf, } from "./lower-stream.js";
|
|
62
65
|
import { staticAssertInstanceDecl } from "./assert-instances.js";
|
|
63
66
|
import { lowerHttpResPropertyAssignment, lowerHttpServerTimeoutAssignment, lowerNetServerMaxConnectionsAssignment, lowerServerCloseOverrideAssignment, } from "./lower-server.js";
|
|
64
67
|
import { lowerUrlAssignment } from "./builtins/url.js";
|
|
@@ -69,7 +72,7 @@ import { lowerNodeModuleCall } from "./builtins/module-resolution.js";
|
|
|
69
72
|
import { registerBuiltinCallableAlias } from "./builtins/callable-aliases.js";
|
|
70
73
|
import { builtinClassAliasOwnsNoSlot, registerBuiltinClassAlias } from "./builtins/class-values.js";
|
|
71
74
|
import { lowerEnumDeclaration } from "./lower-enums.js";
|
|
72
|
-
import { abstractPropertyDeclOf, aliasTypeofNarrows, isMatchSliceType, lowerAbsenceProbe, lowerCompoundValueToTarget, lowerElementCompoundStatement, lowerIncDec, lowerIncDecTarget,
|
|
75
|
+
import { abstractPropertyDeclOf, aliasTypeofNarrows, isMatchSliceType, lowerAbsenceProbe, lowerCompoundValueToTarget, lowerElementCompoundStatement, lowerIncDec, lowerIncDecTarget, lowerGroupsProjection, matchResultNamedGroupsOf, runtimeOptionalGuardIds, runtimeOptionalTrueIds, symbolFieldInfo, withRuntimeOptionalNarrowed, } from "./lower-exprs.js";
|
|
73
76
|
import { globalSymbolKey } from "./expressions/global-symbols.js";
|
|
74
77
|
import { identifiersNamed } from "./identifier-uses.js";
|
|
75
78
|
import { lowerShortCircuitAssignment } from "./expressions/nullish-assignment.js";
|
|
@@ -88,6 +91,7 @@ import { npmStaticPackageOfPath } from "../npm-static.js";
|
|
|
88
91
|
import { fenceNodeModuleMutation } from "./lower-node-module.js";
|
|
89
92
|
import { fencePerfEntryKeyWalk } from "./builtins/performance.js";
|
|
90
93
|
import { classGeneratorIterable } from "./class-iterables.js";
|
|
94
|
+
import { iterableUnionOf, lowerForOfIterable } from "./iterable-values.js";
|
|
91
95
|
/** An opted package's directly-returned empty array may take the function's
|
|
92
96
|
* explicit static return element type. This is the common JS accumulator
|
|
93
97
|
* shape (`const result = []; result.push(value); return result`) and is
|
|
@@ -807,6 +811,46 @@ export function predeclareForwardCapture(lowerer, symbol) {
|
|
|
807
811
|
}
|
|
808
812
|
return false;
|
|
809
813
|
}
|
|
814
|
+
/** The CLASS-DECLARATION twin of predeclareForwardCapture: a function
|
|
815
|
+
* hoisted above a local `class D` (`function make() { return new D(); }`
|
|
816
|
+
* reached through an earlier function) captures the class binding, which
|
|
817
|
+
* is in its temporal dead zone until the class statement runs. The class
|
|
818
|
+
* cannot be collected yet (its heritage may name bindings declared between
|
|
819
|
+
* here and the statement), so the binding is pre-declared as a TDZ box
|
|
820
|
+
* holding the class as a checked-dynamic constructor; the class statement
|
|
821
|
+
* later initializes it, and every reference reads it from there. */
|
|
822
|
+
export function predeclareForwardClass(lowerer, symbol) {
|
|
823
|
+
const decl = symbol.valueDeclaration;
|
|
824
|
+
if (!decl || !ts.isClassDeclaration(decl) || decl.name === undefined)
|
|
825
|
+
return false;
|
|
826
|
+
if (!isJsSourceFile(ts.getSourceFileOfNode(decl)))
|
|
827
|
+
return false;
|
|
828
|
+
for (let i = lowerer.activeStmtLists.length - 1; i >= 0; i--) {
|
|
829
|
+
const entry = lowerer.activeStmtLists[i];
|
|
830
|
+
const idx = entry.stmts.indexOf(decl);
|
|
831
|
+
if (idx < 0)
|
|
832
|
+
continue;
|
|
833
|
+
if (idx < entry.index || entry.ctx === lowerer.ctx || entry.ctx.tdzPredeclared.has(symbol))
|
|
834
|
+
return false;
|
|
835
|
+
const name = decl.name.text;
|
|
836
|
+
const count = entry.ctx.localCounters.get(name) ?? 0;
|
|
837
|
+
entry.ctx.localCounters.set(name, count + 1);
|
|
838
|
+
const local = {
|
|
839
|
+
id: `${name}.${count}`,
|
|
840
|
+
name,
|
|
841
|
+
type: DYN,
|
|
842
|
+
mutable: false,
|
|
843
|
+
boxed: true,
|
|
844
|
+
tdz: true,
|
|
845
|
+
};
|
|
846
|
+
entry.ctx.locals.push(local);
|
|
847
|
+
entry.frame.set(symbol, local);
|
|
848
|
+
entry.out.push({ kind: "varDecl", localId: local.id, init: null, loc: locOf(decl) });
|
|
849
|
+
entry.ctx.tdzPredeclared.set(symbol, local);
|
|
850
|
+
return true;
|
|
851
|
+
}
|
|
852
|
+
return false;
|
|
853
|
+
}
|
|
810
854
|
/** The FUNCTION-DECLARATION twin of predeclareForwardCapture: JS hoists a
|
|
811
855
|
* nested `function f() {}` to scope entry — the binding is LIVE from the
|
|
812
856
|
* first statement, so a reference lexically above the declaration in the
|
|
@@ -998,6 +1042,32 @@ function lowerJsVarFromExisting(lowerer, decl, symbol) {
|
|
|
998
1042
|
loc: locOf(decl),
|
|
999
1043
|
};
|
|
1000
1044
|
}
|
|
1045
|
+
/** Whether a JavaScript declaration's object value changes shape after its
|
|
1046
|
+
* initializer (jsOpenObjectType, jsObjectBindingExpands) or carries
|
|
1047
|
+
* methods, so only the checked-dynamic representation holds it.
|
|
1048
|
+
* `inferred` is the declaration's mapped checker type. */
|
|
1049
|
+
function jsDeclarationExpandsObject(lowerer, decl, inferred) {
|
|
1050
|
+
const arms = inferred?.kind === "union"
|
|
1051
|
+
? (lowerer.unions.get(inferred.unionId)?.arms ?? [])
|
|
1052
|
+
: inferred
|
|
1053
|
+
? [inferred]
|
|
1054
|
+
: [];
|
|
1055
|
+
return ((!decl.type &&
|
|
1056
|
+
!hasJsTypeAnnotation(decl) &&
|
|
1057
|
+
inferred !== null &&
|
|
1058
|
+
jsOpenObjectType(decl, inferred, lowerer.shapes, lowerer.unions).kind === "dyn") ||
|
|
1059
|
+
arms.some((arm) => arm.kind === "record" && jsObjectBindingExpands(lowerer, decl, arm)) ||
|
|
1060
|
+
(isJsSourceFile(ts.getSourceFileOfNode(decl)) &&
|
|
1061
|
+
!decl.type &&
|
|
1062
|
+
!hasJsTypeAnnotation(decl) &&
|
|
1063
|
+
decl.initializer !== undefined &&
|
|
1064
|
+
ts.isObjectLiteralExpression(decl.initializer) &&
|
|
1065
|
+
decl.initializer.properties.nodes.some((property) => ts.isMethodDeclaration(property) ||
|
|
1066
|
+
ts.isAccessor(property) ||
|
|
1067
|
+
(ts.isPropertyAssignment(property) &&
|
|
1068
|
+
(ts.isFunctionExpression(property.initializer) ||
|
|
1069
|
+
ts.isArrowFunction(property.initializer))))));
|
|
1070
|
+
}
|
|
1001
1071
|
/** The `var` symbol's function-scoped binding TYPE — the declared type at
|
|
1002
1072
|
* the binding name, with the JS-source fallbacks every mutable binding
|
|
1003
1073
|
* takes (an empty-object-literal type is checked-dynamic because tsc
|
|
@@ -1029,6 +1099,17 @@ function varBindingType(lowerer, nameNode) {
|
|
|
1029
1099
|
}
|
|
1030
1100
|
if (!type || type.kind === "void")
|
|
1031
1101
|
return null;
|
|
1102
|
+
// A JavaScript `var` holds whatever its writes store, as a `let` does:
|
|
1103
|
+
// the checker types it by its initializer and checks no later write
|
|
1104
|
+
// (`var fraction = 0;`, later `fraction = match[7].slice(0, 3)`), and an
|
|
1105
|
+
// object it holds may gain members (`mark.snippet = snippet(mark)`).
|
|
1106
|
+
if (type.kind !== "dyn" &&
|
|
1107
|
+
ts.isVariableDeclaration(nameNode.parent) &&
|
|
1108
|
+
nameNode.parent.name === nameNode &&
|
|
1109
|
+
isJsSourceFile(ts.getSourceFileOfNode(nameNode)) &&
|
|
1110
|
+
(jsBindingHasOpenWrites(lowerer, nameNode.parent) ||
|
|
1111
|
+
jsDeclarationExpandsObject(lowerer, nameNode.parent, type)))
|
|
1112
|
+
return DYN;
|
|
1032
1113
|
// A binding readable before its first store holds undefined until then.
|
|
1033
1114
|
return lowerer.runtimeOptionalBindingType(nameNode, type);
|
|
1034
1115
|
}
|
|
@@ -1298,8 +1379,24 @@ export function lowerStmt(lowerer, stmt) {
|
|
|
1298
1379
|
if (!stmt.name)
|
|
1299
1380
|
lowerer.unsupported("SC1090", stmt, "anonymous local class declarations");
|
|
1300
1381
|
const info = lowerer.lowerClassExpressionInfo(stmt);
|
|
1382
|
+
// An earlier hoisted function captured the class: its TDZ box exists.
|
|
1383
|
+
const symbol = lowerer.checker.getSymbolAtLocation(stmt.name);
|
|
1384
|
+
const pre = symbol ? lowerer.ctx.tdzPredeclared.get(symbol) : undefined;
|
|
1385
|
+
if (pre) {
|
|
1386
|
+
lowerer.ctx.tdzPredeclared.delete(symbol);
|
|
1387
|
+
const value = lowerer.coerceToExpected(lowerer.lowerClassExpression(stmt), DYN);
|
|
1388
|
+
return { kind: "assign", localId: pre.id, value, initializes: true, loc: locOf(stmt) };
|
|
1389
|
+
}
|
|
1301
1390
|
const type = { kind: "classval", className: info.def.name };
|
|
1302
1391
|
const local = lowerer.declareLocal(stmt.name, stmt.name.text, type, true);
|
|
1392
|
+
// Static members of a function-local class run while the class value is
|
|
1393
|
+
// built and may read the class by name: the class value assigns the
|
|
1394
|
+
// binding before them.
|
|
1395
|
+
if (info.localClass && (info.runtimeStatics || info.runtimePrototypeMembers))
|
|
1396
|
+
return [
|
|
1397
|
+
{ kind: "varDecl", localId: local.id, init: null, loc: locOf(stmt) },
|
|
1398
|
+
{ kind: "exprStmt", expr: lowerer.lowerClassExpression(stmt, local), loc: locOf(stmt) },
|
|
1399
|
+
];
|
|
1303
1400
|
const init = lowerer.lowerClassExpression(stmt);
|
|
1304
1401
|
return { kind: "varDecl", localId: local.id, init, loc: locOf(stmt) };
|
|
1305
1402
|
}
|
|
@@ -1319,33 +1416,40 @@ export function lowerStmt(lowerer, stmt) {
|
|
|
1319
1416
|
return lowerer.lowerDefaultExport(stmt);
|
|
1320
1417
|
}
|
|
1321
1418
|
if (ts.isIfStatement(stmt)) {
|
|
1322
|
-
|
|
1419
|
+
// `if (super(), test)`: the super call runs as a statement, then the
|
|
1420
|
+
// test decides.
|
|
1421
|
+
const lead = superConditionLead(stmt.expression);
|
|
1422
|
+
const leading = lead ? lowerer.lowerExprStatement(lead.left) : null;
|
|
1423
|
+
const test = lead ? lead.right : stmt.expression;
|
|
1424
|
+
const cond = lowerer.lowerCondition(test);
|
|
1323
1425
|
// A global-detection condition (static-typeof.ts) folds; its untaken
|
|
1324
1426
|
// arm is code Node never runs and does not lower, unless it declares a
|
|
1325
1427
|
// hoisted binding.
|
|
1326
|
-
const decided = staticCondition(lowerer,
|
|
1428
|
+
const decided = staticCondition(lowerer, test);
|
|
1327
1429
|
if (decided !== null) {
|
|
1328
1430
|
const taken = decided ? stmt.thenStatement : stmt.elseStatement;
|
|
1329
1431
|
const untaken = decided ? stmt.elseStatement : stmt.thenStatement;
|
|
1330
1432
|
if (untaken === undefined || !declaresHoistedBinding(untaken)) {
|
|
1331
1433
|
const arm = taken === undefined ? [] : lowerer.lowerScopedBlock(taken);
|
|
1332
|
-
|
|
1434
|
+
const folded = decided
|
|
1333
1435
|
? { kind: "if", cond, then: arm, else_: null, loc: locOf(stmt) }
|
|
1334
1436
|
: { kind: "if", cond, then: [], else_: arm, loc: locOf(stmt) };
|
|
1437
|
+
return leading ? { kind: "block", body: [leading, folded], loc: locOf(stmt) } : folded;
|
|
1335
1438
|
}
|
|
1336
1439
|
}
|
|
1337
1440
|
// Aliased-typeof narrows (ms's `var type = typeof val` guard): the
|
|
1338
1441
|
// then-branch lowers under what a TRUE condition proves, the
|
|
1339
1442
|
// else-branch under a FALSE one — the var/let alias narrowing the
|
|
1340
1443
|
// checker only performs for consts (aliasTypeofNarrows).
|
|
1341
|
-
const then = lowerer.narrowingAliases(aliasTypeofNarrows(lowerer,
|
|
1444
|
+
const then = lowerer.narrowingAliases(aliasTypeofNarrows(lowerer, test, true), () => withRuntimeOptionalNarrowed(lowerer, runtimeOptionalTrueIds(lowerer, test), () => lowerer.lowerScopedBlock(stmt.thenStatement)));
|
|
1342
1445
|
const else_ = stmt.elseStatement
|
|
1343
|
-
? lowerer.narrowingAliases(aliasTypeofNarrows(lowerer,
|
|
1446
|
+
? lowerer.narrowingAliases(aliasTypeofNarrows(lowerer, test, false), () => withRuntimeOptionalNarrowed(lowerer, runtimeOptionalGuardIds(lowerer, test, false), () => lowerer.lowerScopedBlock(stmt.elseStatement)))
|
|
1344
1447
|
: null;
|
|
1345
1448
|
for (const local of falsyExitRuntimeOptionalLocals(lowerer, stmt)) {
|
|
1346
1449
|
lowerer.runtimeOptionalLocals.delete(lowerer.runtimeOptionalRootOf(local));
|
|
1347
1450
|
}
|
|
1348
|
-
|
|
1451
|
+
const lowered = { kind: "if", cond, then, else_, loc: locOf(stmt) };
|
|
1452
|
+
return leading ? { kind: "block", body: [leading, lowered], loc: locOf(stmt) } : lowered;
|
|
1349
1453
|
}
|
|
1350
1454
|
if (ts.isWhileStatement(stmt)) {
|
|
1351
1455
|
const labels = lowerer.takeLabels();
|
|
@@ -2710,6 +2814,18 @@ export function lowerBindingPattern(lowerer, pattern, srcRef, srcType, isLet, ou
|
|
|
2710
2814
|
lowerModuleNamespacePattern(lowerer, pattern, nsSource, isLet, out);
|
|
2711
2815
|
return;
|
|
2712
2816
|
}
|
|
2817
|
+
if (srcType.kind === "url") {
|
|
2818
|
+
lowerUrlObjectPattern(lowerer, pattern, srcRef, isLet, out);
|
|
2819
|
+
return;
|
|
2820
|
+
}
|
|
2821
|
+
if (srcType.kind === "union" &&
|
|
2822
|
+
!isJsSourceFile(ts.getSourceFileOfNode(pattern)) &&
|
|
2823
|
+
lowerer.unions
|
|
2824
|
+
.get(srcType.unionId)
|
|
2825
|
+
?.arms.every((arm) => arm.kind === "record" || arm.kind === "object")) {
|
|
2826
|
+
lowerUnionObjectPattern(lowerer, pattern, srcRef, srcType, isLet, out);
|
|
2827
|
+
return;
|
|
2828
|
+
}
|
|
2713
2829
|
if (srcType.kind !== "record") {
|
|
2714
2830
|
lowerer.unsupported("SC1031", pattern, srcType.kind === "object"
|
|
2715
2831
|
? "object destructuring of class instances (read the fields directly — accessors make the desugar observable)"
|
|
@@ -2892,7 +3008,10 @@ function patternSourceValue(lowerer, value, arrayPattern, out, loc, spelling) {
|
|
|
2892
3008
|
if (!arms ||
|
|
2893
3009
|
!present?.length ||
|
|
2894
3010
|
present.length === arms.length ||
|
|
2895
|
-
(present.length > 1 &&
|
|
3011
|
+
(present.length > 1 &&
|
|
3012
|
+
!(arrayPattern
|
|
3013
|
+
? present.every((arm) => arm.kind === "array")
|
|
3014
|
+
: present.every((arm) => arm.kind === "record" || arm.kind === "object"))))
|
|
2896
3015
|
return value;
|
|
2897
3016
|
for (const [tag, arm] of arms.entries()) {
|
|
2898
3017
|
if (!isUnitType(arm))
|
|
@@ -2986,6 +3105,122 @@ function lowerModuleNamespacePattern(lowerer, pattern, source, isLet, out) {
|
|
|
2986
3105
|
lowerer.bindPatternTarget(el.name, value, isLet, out);
|
|
2987
3106
|
}
|
|
2988
3107
|
}
|
|
3108
|
+
/** The URL getters an object pattern reads (`const { protocol, hostname }
|
|
3109
|
+
* = new URL(text)`), each a read of the URL's current serialization. */
|
|
3110
|
+
const URL_PATTERN_GETTERS = {
|
|
3111
|
+
href: "url.href",
|
|
3112
|
+
origin: "url.origin",
|
|
3113
|
+
protocol: "url.protocol",
|
|
3114
|
+
username: "url.username",
|
|
3115
|
+
password: "url.password",
|
|
3116
|
+
host: "url.host",
|
|
3117
|
+
hostname: "url.hostname",
|
|
3118
|
+
port: "url.port",
|
|
3119
|
+
pathname: "url.pathname",
|
|
3120
|
+
search: "url.search",
|
|
3121
|
+
hash: "url.hash",
|
|
3122
|
+
};
|
|
3123
|
+
/** An object pattern over a URL: each element reads its getter in pattern
|
|
3124
|
+
* order, as `url.name` does; `searchParams` binds the URL's live view.
|
|
3125
|
+
* Methods and rest elements stay fenced. */
|
|
3126
|
+
function lowerUrlObjectPattern(lowerer, pattern, srcRef, isLet, out) {
|
|
3127
|
+
for (const el of pattern.elements.nodes) {
|
|
3128
|
+
if (el.name === undefined)
|
|
3129
|
+
continue;
|
|
3130
|
+
if (el.dotDotDotToken) {
|
|
3131
|
+
lowerer.unsupported("SC1031", el, "rest bindings over URL sources (a URL's properties are prototype getters, which rest elements do not copy)");
|
|
3132
|
+
}
|
|
3133
|
+
const prop = el.propertyName ?? el.name;
|
|
3134
|
+
const propName = ts.isIdentifier(prop) ||
|
|
3135
|
+
ts.isComputedPropertyName(prop) ||
|
|
3136
|
+
ts.isStringLiteralLike(prop) ||
|
|
3137
|
+
ts.isNumericLiteral(prop)
|
|
3138
|
+
? patternKeyNameOf(lowerer, prop)
|
|
3139
|
+
: null;
|
|
3140
|
+
const loc = locOf(el);
|
|
3141
|
+
let value;
|
|
3142
|
+
if (propName !== null && Object.hasOwn(URL_PATTERN_GETTERS, propName)) {
|
|
3143
|
+
value = {
|
|
3144
|
+
kind: "libCall",
|
|
3145
|
+
fn: URL_PATTERN_GETTERS[propName],
|
|
3146
|
+
args: [srcRef()],
|
|
3147
|
+
type: STRING,
|
|
3148
|
+
loc,
|
|
3149
|
+
};
|
|
3150
|
+
}
|
|
3151
|
+
else if (propName === "searchParams") {
|
|
3152
|
+
value = {
|
|
3153
|
+
kind: "libCall",
|
|
3154
|
+
fn: "url.searchParams",
|
|
3155
|
+
args: [srcRef()],
|
|
3156
|
+
type: SEARCH_PARAMS_T,
|
|
3157
|
+
loc,
|
|
3158
|
+
};
|
|
3159
|
+
}
|
|
3160
|
+
else {
|
|
3161
|
+
lowerer.unsupported("SC1031", el, propName === null
|
|
3162
|
+
? "destructuring with computed keys that do not fold to one property name"
|
|
3163
|
+
: `destructuring '${propName}' from a URL (${Object.keys(URL_PATTERN_GETTERS).join(", ")} and searchParams are the supported URL properties)`);
|
|
3164
|
+
}
|
|
3165
|
+
if (el.initializer)
|
|
3166
|
+
value = applyBindingDefault(lowerer, el, value);
|
|
3167
|
+
lowerer.bindPatternTarget(el.name, value, isLet, out);
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
/** An object pattern over a union of records and class instances
|
|
3171
|
+
* (`function f({ kind, path }: Add | Remove)`): each element reads a data
|
|
3172
|
+
* field every arm declares with one type, through the runtime tag, as
|
|
3173
|
+
* `value.field` does. Rest elements and fields the arms type differently
|
|
3174
|
+
* stay fenced. */
|
|
3175
|
+
function lowerUnionObjectPattern(lowerer, pattern, srcRef, srcType, isLet, out) {
|
|
3176
|
+
const arms = lowerer.unions.get(srcType.unionId)?.arms ?? [];
|
|
3177
|
+
for (const el of pattern.elements.nodes) {
|
|
3178
|
+
if (el.name === undefined)
|
|
3179
|
+
continue;
|
|
3180
|
+
if (el.dotDotDotToken) {
|
|
3181
|
+
lowerer.unsupported("SC1031", el, `rest bindings over union sources (${NARROW_FIRST})`);
|
|
3182
|
+
}
|
|
3183
|
+
const prop = el.propertyName ?? el.name;
|
|
3184
|
+
const propName = ts.isIdentifier(prop) ||
|
|
3185
|
+
ts.isComputedPropertyName(prop) ||
|
|
3186
|
+
ts.isStringLiteralLike(prop) ||
|
|
3187
|
+
ts.isNumericLiteral(prop)
|
|
3188
|
+
? patternKeyNameOf(lowerer, prop)
|
|
3189
|
+
: null;
|
|
3190
|
+
if (propName === null) {
|
|
3191
|
+
lowerer.unsupported("SC1031", el, "destructuring with computed keys that do not fold to one property name");
|
|
3192
|
+
}
|
|
3193
|
+
let common = null;
|
|
3194
|
+
for (const arm of arms) {
|
|
3195
|
+
let ft;
|
|
3196
|
+
if (arm.kind === "record") {
|
|
3197
|
+
ft = lowerer.shapes.get(arm.shapeId)?.fields.find((f) => f.name === propName)?.type;
|
|
3198
|
+
}
|
|
3199
|
+
else if (arm.kind === "object") {
|
|
3200
|
+
ft = lowerer.classes.get(arm.className)?.fields.get(propName);
|
|
3201
|
+
}
|
|
3202
|
+
if (!ft || ft.kind === "void" || isUnitType(ft) || (common && !typeEquals(common, ft))) {
|
|
3203
|
+
common = null;
|
|
3204
|
+
break;
|
|
3205
|
+
}
|
|
3206
|
+
common = ft;
|
|
3207
|
+
}
|
|
3208
|
+
if (common === null) {
|
|
3209
|
+
lowerer.unsupported("SC1031", el, `destructuring '${propName}' from a union whose arms type it differently (every arm must be a record or class with a same-typed field '${propName}' — ${NARROW_FIRST})`);
|
|
3210
|
+
}
|
|
3211
|
+
let value = {
|
|
3212
|
+
kind: "unionDisc",
|
|
3213
|
+
unionId: srcType.unionId,
|
|
3214
|
+
field: propName,
|
|
3215
|
+
value: srcRef(),
|
|
3216
|
+
type: common,
|
|
3217
|
+
loc: locOf(el),
|
|
3218
|
+
};
|
|
3219
|
+
if (el.initializer)
|
|
3220
|
+
value = applyBindingDefault(lowerer, el, value);
|
|
3221
|
+
lowerer.bindPatternTarget(el.name, value, isLet, out);
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
2989
3224
|
/** Whether a pattern's first element has a computed key that does not
|
|
2990
3225
|
* fold to one property name, so the key evaluates at run time. */
|
|
2991
3226
|
function startsWithRuntimeKey(lowerer, pattern) {
|
|
@@ -3270,6 +3505,10 @@ function stdlibGlobalTokenDestructure(lowerer, decl, isLet) {
|
|
|
3270
3505
|
const globalName = stdlibGlobalNameOf(lowerer, decl.initializer);
|
|
3271
3506
|
if (globalName === null)
|
|
3272
3507
|
return null;
|
|
3508
|
+
// `workerData` is a value (the data the worker was started with), not an
|
|
3509
|
+
// API surface: its members destructure as any untyped value's do.
|
|
3510
|
+
if (globalName === "workerData")
|
|
3511
|
+
return null;
|
|
3273
3512
|
if (!ts.isObjectBindingPattern(decl.name)) {
|
|
3274
3513
|
lowerer.unsupported("SC1031", decl.name, `array destructuring of the builtin global '${globalName}' (builtin globals are not iterable)`);
|
|
3275
3514
|
}
|
|
@@ -3314,9 +3553,13 @@ function stdlibGlobalTokenDestructure(lowerer, decl, isLet) {
|
|
|
3314
3553
|
const canonical = ts.symbolName(member) === "global" ? "globalThis" : ts.symbolName(member);
|
|
3315
3554
|
token = `[builtin ${canonical}]`;
|
|
3316
3555
|
alias = canonical;
|
|
3317
|
-
// Builtin constructors read as their interned function values,
|
|
3318
|
-
// same values the bare and
|
|
3319
|
-
|
|
3556
|
+
// Builtin constructors read as their interned function values, and
|
|
3557
|
+
// crypto as the WebCrypto object: the same values the bare and
|
|
3558
|
+
// `globalThis.X` spellings read.
|
|
3559
|
+
value =
|
|
3560
|
+
canonical === "crypto"
|
|
3561
|
+
? { kind: "libCall", fn: "webcrypto.object", args: [], type: DYN, loc: locOf(el) }
|
|
3562
|
+
: builtinGlobalValue(canonical, locOf(el), true);
|
|
3320
3563
|
}
|
|
3321
3564
|
else if (globalName === "console" && !CONSOLE_CALL_MEMBERS.has(propName)) {
|
|
3322
3565
|
token = `[builtin console.${propName}]`;
|
|
@@ -3865,11 +4108,15 @@ export function bindPatternTarget(lowerer, name, value, isLet, out, allowDynObje
|
|
|
3865
4108
|
}
|
|
3866
4109
|
// Preserve checked-value pattern bindings when the inferred type
|
|
3867
4110
|
// cannot represent them without a refusal or an alias-breaking copy.
|
|
4111
|
+
// A name destructured from a container of an evolving array
|
|
4112
|
+
// (evolvingArrayHold) may hold the array, which the checker types by
|
|
4113
|
+
// the elements written before it.
|
|
3868
4114
|
const dynStays = value.type.kind === "dyn" &&
|
|
3869
|
-
(() => {
|
|
4115
|
+
((() => {
|
|
3870
4116
|
const mapped = lowerer.mapTypeOf(lowerer.typeOf(name));
|
|
3871
4117
|
return mapped === null || jsBindingKeepsCheckedObject(lowerer, name, mapped);
|
|
3872
|
-
})()
|
|
4118
|
+
})() ||
|
|
4119
|
+
readsHeldEvolvingArray(lowerer, name));
|
|
3873
4120
|
let type = dynStays
|
|
3874
4121
|
? DYN
|
|
3875
4122
|
: (lowerer.runtimeOptionalBindingType(name, lowerer.irTypeOf(name)) ??
|
|
@@ -3953,9 +4200,10 @@ export function lowerVarDeclList(lowerer, list) {
|
|
|
3953
4200
|
* `never[]` or `any[]` and each later read by the elements written before
|
|
3954
4201
|
* it, and reads inside closures as the unsettled array. When every read
|
|
3955
4202
|
* with a settled element type maps to the same array type, the binding has
|
|
3956
|
-
* that type. When reads disagree
|
|
3957
|
-
*
|
|
3958
|
-
*
|
|
4203
|
+
* that type. When reads disagree, a write (`xs.push(v)`, `xs.unshift(v)`,
|
|
4204
|
+
* `xs.push(...values)`, `xs[i] = v`) stores a value that type's element does
|
|
4205
|
+
* not hold, or the binding is reassigned, it is checked-dynamic, as the same
|
|
4206
|
+
* binding is at module scope. Null for other bindings. */
|
|
3959
4207
|
function evolvingArrayType(lowerer, decl) {
|
|
3960
4208
|
if (!ts.isIdentifier(decl.name) || decl.initializer === undefined)
|
|
3961
4209
|
return null;
|
|
@@ -3983,13 +4231,19 @@ function evolvingArrayType(lowerer, decl) {
|
|
|
3983
4231
|
};
|
|
3984
4232
|
const scope = owner(decl);
|
|
3985
4233
|
let result = null;
|
|
4234
|
+
// The values the binding's writes store, checked against the element
|
|
4235
|
+
// type once the reads settle it.
|
|
4236
|
+
const written = [];
|
|
3986
4237
|
// The file's identifiers are indexed by name once (identifiersNamed), so
|
|
3987
|
-
// each binding resolves only the uses spelled like it.
|
|
4238
|
+
// each binding resolves only the uses spelled like it. A shorthand
|
|
4239
|
+
// property (`{ xs }`) is a use too.
|
|
3988
4240
|
for (const node of identifiersNamed(lowerer, ts.getSourceFileOfNode(decl), decl.name.text)) {
|
|
3989
4241
|
if (node === decl.name ||
|
|
3990
4242
|
node.pos < scope.pos ||
|
|
3991
4243
|
node.end > scope.end ||
|
|
3992
|
-
|
|
4244
|
+
(ts.isShorthandPropertyAssignment(node.parent) && node.parent.name === node
|
|
4245
|
+
? lowerer.checker.getShorthandAssignmentValueSymbol(node.parent)
|
|
4246
|
+
: lowerer.checker.getSymbolAtLocation(node)) !== symbol)
|
|
3993
4247
|
continue;
|
|
3994
4248
|
let target = node;
|
|
3995
4249
|
while (ts.isParenthesizedExpression(target.parent))
|
|
@@ -4001,6 +4255,18 @@ function evolvingArrayType(lowerer, decl) {
|
|
|
4001
4255
|
parent.operatorToken.kind <= ts.SyntaxKind.LastAssignment;
|
|
4002
4256
|
if (reassigned)
|
|
4003
4257
|
return DYN;
|
|
4258
|
+
if (ts.isPropertyAccessExpression(parent) &&
|
|
4259
|
+
parent.expression === target &&
|
|
4260
|
+
(parent.name.text === "push" || parent.name.text === "unshift") &&
|
|
4261
|
+
ts.isCallExpression(parent.parent) &&
|
|
4262
|
+
parent.parent.expression === parent)
|
|
4263
|
+
written.push(...parent.parent.arguments.nodes);
|
|
4264
|
+
else if (ts.isElementAccessExpression(parent) &&
|
|
4265
|
+
parent.expression === target &&
|
|
4266
|
+
ts.isBinaryExpression(parent.parent) &&
|
|
4267
|
+
parent.parent.left === parent &&
|
|
4268
|
+
parent.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken)
|
|
4269
|
+
written.push(parent.parent.right);
|
|
4004
4270
|
const t = lowerer.typeOf(node);
|
|
4005
4271
|
if (unsettled(t))
|
|
4006
4272
|
continue;
|
|
@@ -4009,7 +4275,132 @@ function evolvingArrayType(lowerer, decl) {
|
|
|
4009
4275
|
return DYN;
|
|
4010
4276
|
result = mapped;
|
|
4011
4277
|
}
|
|
4012
|
-
|
|
4278
|
+
if (result === null || result.kind !== "array")
|
|
4279
|
+
return DYN;
|
|
4280
|
+
// The element types a write stores: its value's, or for a spread
|
|
4281
|
+
// (`xs.push(...values)`) the source array's element or tuple's elements.
|
|
4282
|
+
// Another spread source stores elements this check cannot see.
|
|
4283
|
+
const storedTypes = (value) => {
|
|
4284
|
+
if (!ts.isSpreadElement(value))
|
|
4285
|
+
return [lowerer.typeOf(value)];
|
|
4286
|
+
const source = lowerer.typeOf(value.expression);
|
|
4287
|
+
if (lowerer.checker.isArrayType(source) || lowerer.checker.isTupleType(source))
|
|
4288
|
+
return [...lowerer.checker.getTypeArguments(source)];
|
|
4289
|
+
return null;
|
|
4290
|
+
};
|
|
4291
|
+
for (const value of written) {
|
|
4292
|
+
const stored = storedTypes(value);
|
|
4293
|
+
if (stored === null)
|
|
4294
|
+
return DYN;
|
|
4295
|
+
for (const type of stored) {
|
|
4296
|
+
const t = lowerer.mapTypeOf(lowerer.checker.getBaseTypeOfLiteralType(type));
|
|
4297
|
+
if (!t || (!typeEquals(t, result.elem) && lowerer.widthLiftPlan(t, result.elem) === null))
|
|
4298
|
+
return DYN;
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
return result;
|
|
4302
|
+
}
|
|
4303
|
+
/** How a TypeScript expression holds an evolving array binding whose reads
|
|
4304
|
+
* disagree (evolvingArrayType answers checked-dynamic): "evolving" for the
|
|
4305
|
+
* binding itself, "alias" for an unannotated binding initialized with it or
|
|
4306
|
+
* with an alias of it (`const alias = xs`), and "container" for an object or
|
|
4307
|
+
* array literal with it as a property, element or spread source at any
|
|
4308
|
+
* depth (`{ items: xs }`, `[xs]`), an unannotated binding initialized with
|
|
4309
|
+
* or destructured from such a literal, and a property or element read of a
|
|
4310
|
+
* container (`box.items`). The checker types an alias or container by the
|
|
4311
|
+
* elements written before it was taken, but it holds the same array. Null
|
|
4312
|
+
* for other expressions. */
|
|
4313
|
+
function evolvingArrayHold(lowerer, expr, depth = 0) {
|
|
4314
|
+
while (ts.isParenthesizedExpression(expr))
|
|
4315
|
+
expr = expr.expression;
|
|
4316
|
+
if (depth >= 8)
|
|
4317
|
+
return null;
|
|
4318
|
+
const binding = (symbol) => {
|
|
4319
|
+
const source = symbol?.valueDeclaration;
|
|
4320
|
+
// A name destructured from a container (`const { items } = box`) may
|
|
4321
|
+
// be the array or another container.
|
|
4322
|
+
if (source !== undefined && ts.isBindingElement(source) && ts.isIdentifier(source.name)) {
|
|
4323
|
+
const host = hostVariableDeclarationOf(source.name);
|
|
4324
|
+
return host !== null &&
|
|
4325
|
+
!host.type &&
|
|
4326
|
+
host.initializer !== undefined &&
|
|
4327
|
+
evolvingArrayHold(lowerer, host.initializer, depth + 1) === "container"
|
|
4328
|
+
? "container"
|
|
4329
|
+
: null;
|
|
4330
|
+
}
|
|
4331
|
+
if (source === undefined || !ts.isVariableDeclaration(source) || source.type)
|
|
4332
|
+
return null;
|
|
4333
|
+
const evolved = evolvingArrayType(lowerer, source);
|
|
4334
|
+
if (evolved !== null)
|
|
4335
|
+
return evolved.kind === "dyn" ? "evolving" : null;
|
|
4336
|
+
if (source.initializer === undefined)
|
|
4337
|
+
return null;
|
|
4338
|
+
const held = evolvingArrayHold(lowerer, source.initializer, depth + 1);
|
|
4339
|
+
return held === "evolving" ? "alias" : held;
|
|
4340
|
+
};
|
|
4341
|
+
if (ts.isIdentifier(expr))
|
|
4342
|
+
return binding(lowerer.checker.getSymbolAtLocation(expr));
|
|
4343
|
+
if (ts.isPropertyAccessExpression(expr) || ts.isElementAccessExpression(expr))
|
|
4344
|
+
return evolvingArrayHold(lowerer, expr.expression, depth + 1) === "container"
|
|
4345
|
+
? "container"
|
|
4346
|
+
: null;
|
|
4347
|
+
// A spread of the array itself (`{ ...xs }`, `[...xs]`) copies its
|
|
4348
|
+
// elements, as in Node; a spread of a container copies its references.
|
|
4349
|
+
if (ts.isObjectLiteralExpression(expr)) {
|
|
4350
|
+
for (const property of expr.properties.nodes) {
|
|
4351
|
+
const held = ts.isPropertyAssignment(property)
|
|
4352
|
+
? evolvingArrayHold(lowerer, property.initializer, depth + 1)
|
|
4353
|
+
: ts.isShorthandPropertyAssignment(property)
|
|
4354
|
+
? binding(lowerer.checker.getShorthandAssignmentValueSymbol(property))
|
|
4355
|
+
: ts.isSpreadAssignment(property) &&
|
|
4356
|
+
evolvingArrayHold(lowerer, property.expression, depth + 1) === "container"
|
|
4357
|
+
? "container"
|
|
4358
|
+
: null;
|
|
4359
|
+
if (held !== null)
|
|
4360
|
+
return "container";
|
|
4361
|
+
}
|
|
4362
|
+
return null;
|
|
4363
|
+
}
|
|
4364
|
+
if (ts.isArrayLiteralExpression(expr)) {
|
|
4365
|
+
for (const element of expr.elements.nodes) {
|
|
4366
|
+
const held = ts.isSpreadElement(element)
|
|
4367
|
+
? evolvingArrayHold(lowerer, element.expression, depth + 1) === "container"
|
|
4368
|
+
? "container"
|
|
4369
|
+
: null
|
|
4370
|
+
: evolvingArrayHold(lowerer, element, depth + 1);
|
|
4371
|
+
if (held !== null)
|
|
4372
|
+
return "container";
|
|
4373
|
+
}
|
|
4374
|
+
}
|
|
4375
|
+
return null;
|
|
4376
|
+
}
|
|
4377
|
+
/** Whether a TypeScript expression is an alias or container of an evolving
|
|
4378
|
+
* array binding whose reads disagree (evolvingArrayHold). Its value is
|
|
4379
|
+
* checked-dynamic, and the checker's type for it lists only the elements
|
|
4380
|
+
* written before it was taken, so element reads through it stay
|
|
4381
|
+
* checked-dynamic instead of checking against that type. */
|
|
4382
|
+
export function readsHeldEvolvingArray(lowerer, expr) {
|
|
4383
|
+
if (isJsSourceFile(ts.getSourceFileOfNode(expr)))
|
|
4384
|
+
return false;
|
|
4385
|
+
const held = evolvingArrayHold(lowerer, expr);
|
|
4386
|
+
return held === "alias" || held === "container";
|
|
4387
|
+
}
|
|
4388
|
+
/** Whether a TypeScript object or array literal holds an evolving array
|
|
4389
|
+
* binding whose reads disagree (evolvingArrayHold), so it builds as a
|
|
4390
|
+
* checked-dynamic literal that keeps the array. */
|
|
4391
|
+
export function holdsEvolvingArray(lowerer, expr) {
|
|
4392
|
+
if (isJsSourceFile(ts.getSourceFileOfNode(expr)))
|
|
4393
|
+
return false;
|
|
4394
|
+
return evolvingArrayHold(lowerer, expr) === "container";
|
|
4395
|
+
}
|
|
4396
|
+
/** An unannotated binding initialized with an evolving array binding whose
|
|
4397
|
+
* reads disagree, or with an alias or container of one (evolvingArrayHold):
|
|
4398
|
+
* it takes the array's checked-dynamic type, so it sees the later writes.
|
|
4399
|
+
* Null for other bindings. */
|
|
4400
|
+
function evolvingArrayHolderType(lowerer, decl) {
|
|
4401
|
+
if (decl.initializer === undefined)
|
|
4402
|
+
return null;
|
|
4403
|
+
return evolvingArrayHold(lowerer, decl.initializer) === null ? null : DYN;
|
|
4013
4404
|
}
|
|
4014
4405
|
/** A single static type for an initializer-less JavaScript `let` whose
|
|
4015
4406
|
* later plain writes all agree. An evolving JS local reads as `undefined`
|
|
@@ -4248,8 +4639,19 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4248
4639
|
{
|
|
4249
4640
|
const gfnNode = bindingGenericFnNodeOf(decl) ?? bindingContextualGenericFnNodeOf(lowerer, decl);
|
|
4250
4641
|
if (gfnNode) {
|
|
4251
|
-
bindingGenericFnInfoOf(lowerer, decl, gfnNode);
|
|
4252
|
-
|
|
4642
|
+
const info = bindingGenericFnInfoOf(lowerer, decl, gfnNode);
|
|
4643
|
+
// A nested function that lowered before this declaration read the
|
|
4644
|
+
// binding as an ordinary TDZ box (predeclareForwardCapture); the
|
|
4645
|
+
// declaration initializes it, so those reads see the function once
|
|
4646
|
+
// it runs and a ReferenceError before.
|
|
4647
|
+
const symbol = lowerer.checker.getSymbolAtLocation(decl.name);
|
|
4648
|
+
const pre = symbol ? lowerer.ctx.tdzPredeclared.get(symbol) : undefined;
|
|
4649
|
+
if (pre) {
|
|
4650
|
+
lowerer.ctx.tdzPredeclared.delete(symbol);
|
|
4651
|
+
const value = genericBindingStoredValue(lowerer, decl, info);
|
|
4652
|
+
return { kind: "assign", localId: pre.id, value, initializes: true, loc: locOf(decl) };
|
|
4653
|
+
}
|
|
4654
|
+
return genericBindingPresenceStore(info, decl);
|
|
4253
4655
|
}
|
|
4254
4656
|
}
|
|
4255
4657
|
// `const h = id` — an ALIAS of a generic function: the alias's symbol
|
|
@@ -4461,20 +4863,7 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4461
4863
|
: inferredObjectType
|
|
4462
4864
|
? [inferredObjectType]
|
|
4463
4865
|
: [];
|
|
4464
|
-
const expandsObject = (
|
|
4465
|
-
!hasJsTypeAnnotation(decl) &&
|
|
4466
|
-
inferredObjectType !== null &&
|
|
4467
|
-
jsOpenObjectType(decl, inferredObjectType, lowerer.shapes, lowerer.unions).kind === "dyn") ||
|
|
4468
|
-
inferredObjectArms.some((arm) => arm.kind === "record" && jsObjectBindingExpands(lowerer, decl, arm)) ||
|
|
4469
|
-
(isJsSourceFile(ts.getSourceFileOfNode(decl)) &&
|
|
4470
|
-
!decl.type &&
|
|
4471
|
-
!hasJsTypeAnnotation(decl) &&
|
|
4472
|
-
ts.isObjectLiteralExpression(decl.initializer) &&
|
|
4473
|
-
decl.initializer.properties.nodes.some((property) => ts.isMethodDeclaration(property) ||
|
|
4474
|
-
ts.isAccessor(property) ||
|
|
4475
|
-
(ts.isPropertyAssignment(property) &&
|
|
4476
|
-
(ts.isFunctionExpression(property.initializer) ||
|
|
4477
|
-
ts.isArrowFunction(property.initializer)))));
|
|
4866
|
+
const expandsObject = jsDeclarationExpandsObject(lowerer, decl, inferredObjectType);
|
|
4478
4867
|
let init;
|
|
4479
4868
|
try {
|
|
4480
4869
|
init =
|
|
@@ -4639,7 +5028,7 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4639
5028
|
if (returnedEmptyArrayType === null &&
|
|
4640
5029
|
!decl.type &&
|
|
4641
5030
|
!isJsSourceFile(ts.getSourceFileOfNode(decl))) {
|
|
4642
|
-
const evolved = evolvingArrayType(lowerer, decl);
|
|
5031
|
+
const evolved = evolvingArrayType(lowerer, decl) ?? evolvingArrayHolderType(lowerer, decl);
|
|
4643
5032
|
if (evolved !== null) {
|
|
4644
5033
|
type = evolved;
|
|
4645
5034
|
init = lowerer.lowerExprExpecting(decl.initializer, evolved);
|
|
@@ -5116,17 +5505,12 @@ export function hasJsTypeAnnotation(decl) {
|
|
|
5116
5505
|
return (!!statement &&
|
|
5117
5506
|
/@type\b/.test(ts.getSourceFileOfNode(decl).text.slice(statement.pos, ts.tokenStartOfNode(decl))));
|
|
5118
5507
|
}
|
|
5119
|
-
/**
|
|
5120
|
-
*
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
decl.type ||
|
|
5124
|
-
hasJsTypeAnnotation(decl) ||
|
|
5125
|
-
!ts.isIdentifier(decl.name))
|
|
5126
|
-
return false;
|
|
5127
|
-
const symbol = lowerer.resolveValueSymbol(decl.name);
|
|
5508
|
+
/** The assignments to a declaration's binding in its function (or file),
|
|
5509
|
+
* `=` and compound alike. Null when the name has no symbol. */
|
|
5510
|
+
function jsBindingWrites(lowerer, decl, name) {
|
|
5511
|
+
const symbol = lowerer.resolveValueSymbol(name);
|
|
5128
5512
|
if (!symbol)
|
|
5129
|
-
return
|
|
5513
|
+
return null;
|
|
5130
5514
|
let owner = decl;
|
|
5131
5515
|
while (owner.parent && !ts.isFunctionLike(owner) && !ts.isSourceFile(owner))
|
|
5132
5516
|
owner = owner.parent;
|
|
@@ -5148,9 +5532,51 @@ export function jsBindingHasOpenWrites(lowerer, decl) {
|
|
|
5148
5532
|
writes = indexed;
|
|
5149
5533
|
lowerer.jsBindingWritesByOwner.set(owner, writes);
|
|
5150
5534
|
}
|
|
5151
|
-
|
|
5535
|
+
return (writes.get(name.text) ?? []).filter((node) => lowerer.resolveValueSymbol(node.left) === symbol);
|
|
5536
|
+
}
|
|
5537
|
+
/** Whether a JavaScript binding always holds a string: the checker types it
|
|
5538
|
+
* as one, and every write appends to it (`result += part`), which yields a
|
|
5539
|
+
* string whatever the part is. */
|
|
5540
|
+
export function jsBindingAppendsOnly(lowerer, decl) {
|
|
5541
|
+
if (!ts.isIdentifier(decl.name))
|
|
5542
|
+
return false;
|
|
5543
|
+
if (lowerer.mapTypeOf(lowerer.typeOf(decl.name))?.kind !== "string")
|
|
5544
|
+
return false;
|
|
5545
|
+
const writes = jsBindingWrites(lowerer, decl, decl.name);
|
|
5546
|
+
return (writes !== null &&
|
|
5547
|
+
writes.every((node) => node.operatorToken.kind === ts.SyntaxKind.PlusEqualsToken));
|
|
5548
|
+
}
|
|
5549
|
+
/** Inferred JS scalar initializers do not constrain later writes through
|
|
5550
|
+
* an any-valued callback. Keep those bindings open, including captured writes. */
|
|
5551
|
+
export function jsBindingHasOpenWrites(lowerer, decl) {
|
|
5552
|
+
if (!isJsSourceFile(ts.getSourceFileOfNode(decl)) ||
|
|
5553
|
+
decl.type ||
|
|
5554
|
+
hasJsTypeAnnotation(decl) ||
|
|
5555
|
+
!ts.isIdentifier(decl.name))
|
|
5556
|
+
return false;
|
|
5557
|
+
const candidates = jsBindingWrites(lowerer, decl, decl.name);
|
|
5558
|
+
if (candidates === null)
|
|
5559
|
+
return false;
|
|
5152
5560
|
if (candidates.some((node) => (lowerer.typeOf(node.right).flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) !== 0))
|
|
5153
5561
|
return true;
|
|
5562
|
+
// A `+=` of a string turns a number or boolean binding into a string
|
|
5563
|
+
// (`n += "px"`); the checker keeps the declared type.
|
|
5564
|
+
if (candidates.some((node) => node.operatorToken.kind === ts.SyntaxKind.PlusEqualsToken &&
|
|
5565
|
+
(lowerer.typeOf(node.right).flags & ts.TypeFlags.StringLike) !== 0)) {
|
|
5566
|
+
const declared = lowerer.mapTypeOf(lowerer.typeOf(decl.name));
|
|
5567
|
+
if (declared?.kind === "f64" || declared?.kind === "bool")
|
|
5568
|
+
return true;
|
|
5569
|
+
}
|
|
5570
|
+
// A write that can store null or undefined into a binding the checker
|
|
5571
|
+
// types as a primitive (`offset = match[3] || null`): JavaScript files
|
|
5572
|
+
// are checked without strict null checks, so the declared type does not
|
|
5573
|
+
// admit them.
|
|
5574
|
+
// The declared type is mapped only when such a write exists.
|
|
5575
|
+
if (candidates.some((node) => node.operatorToken.kind === ts.SyntaxKind.EqualsToken && mayBeNullish(node.right))) {
|
|
5576
|
+
const primitive = lowerer.mapTypeOf(lowerer.typeOf(decl.name));
|
|
5577
|
+
if (primitive?.kind === "string" || primitive?.kind === "f64" || primitive?.kind === "bool")
|
|
5578
|
+
return true;
|
|
5579
|
+
}
|
|
5154
5580
|
// A plain JavaScript write of a value the declared type cannot hold (the
|
|
5155
5581
|
// checker does not report it): buffer-crc32 replaces its number[] table
|
|
5156
5582
|
// with `new Int32Array(table)`. Only a different representation counts;
|
|
@@ -5177,6 +5603,30 @@ export function jsBindingHasOpenWrites(lowerer, decl) {
|
|
|
5177
5603
|
(written.kind !== declared.kind || written.kind === "bytes"));
|
|
5178
5604
|
});
|
|
5179
5605
|
}
|
|
5606
|
+
/** Whether `node` can evaluate to null or undefined by its form: the
|
|
5607
|
+
* literals, `void`, and conditional or logical expressions with such an
|
|
5608
|
+
* operand in result position. */
|
|
5609
|
+
function mayBeNullish(node) {
|
|
5610
|
+
while (ts.isParenthesizedExpression(node))
|
|
5611
|
+
node = node.expression;
|
|
5612
|
+
if (node.kind === ts.SyntaxKind.NullKeyword || ts.isVoidExpression(node))
|
|
5613
|
+
return true;
|
|
5614
|
+
if (ts.isIdentifier(node))
|
|
5615
|
+
return node.text === "undefined";
|
|
5616
|
+
if (ts.isConditionalExpression(node))
|
|
5617
|
+
return mayBeNullish(node.whenTrue) || mayBeNullish(node.whenFalse);
|
|
5618
|
+
if (ts.isBinaryExpression(node)) {
|
|
5619
|
+
const op = node.operatorToken.kind;
|
|
5620
|
+
if (op === ts.SyntaxKind.BarBarToken ||
|
|
5621
|
+
op === ts.SyntaxKind.QuestionQuestionToken ||
|
|
5622
|
+
op === ts.SyntaxKind.AmpersandAmpersandToken)
|
|
5623
|
+
return (mayBeNullish(node.right) ||
|
|
5624
|
+
(op === ts.SyntaxKind.AmpersandAmpersandToken && mayBeNullish(node.left)));
|
|
5625
|
+
if (op === ts.SyntaxKind.CommaToken)
|
|
5626
|
+
return mayBeNullish(node.right);
|
|
5627
|
+
}
|
|
5628
|
+
return false;
|
|
5629
|
+
}
|
|
5180
5630
|
function immediatelyGuardedAbsenceProbe(lowerer, decl) {
|
|
5181
5631
|
const guard = immediateAbsenceGuard(lowerer, decl);
|
|
5182
5632
|
// `if (!x)`: the falsy test sees a missing value.
|
|
@@ -5639,7 +6089,7 @@ function lowerDeleteStatement(lowerer, expr) {
|
|
|
5639
6089
|
if (obj.type.kind === "record") {
|
|
5640
6090
|
const shape = lowerer.shapes.get(obj.type.shapeId);
|
|
5641
6091
|
if (shape?.indexValue && shape.fields.length === 0 && !shape.tuple) {
|
|
5642
|
-
return { kind: "recordKeyDelete", obj, shapeId: obj.type.shapeId, key: lowerKey(), loc };
|
|
6092
|
+
return markSloppyRecordWrites(lowerer, { kind: "recordKeyDelete", obj, shapeId: obj.type.shapeId, key: lowerKey(), loc }, expr);
|
|
5643
6093
|
}
|
|
5644
6094
|
// `delete r.f` of a declared OPTIONAL field (undefined-armed slot)
|
|
5645
6095
|
// writes the field's ABSENT state: a monomorphic shape cannot remove
|
|
@@ -5659,14 +6109,14 @@ function lowerDeleteStatement(lowerer, expr) {
|
|
|
5659
6109
|
if (field) {
|
|
5660
6110
|
const absent = lowerer.absentFieldValue(field.type, loc);
|
|
5661
6111
|
if (absent) {
|
|
5662
|
-
return {
|
|
6112
|
+
return markSloppyRecordWrites(lowerer, {
|
|
5663
6113
|
kind: "recordSet",
|
|
5664
6114
|
obj,
|
|
5665
6115
|
shapeId: obj.type.shapeId,
|
|
5666
6116
|
field: field.name,
|
|
5667
6117
|
value: absent,
|
|
5668
6118
|
loc,
|
|
5669
|
-
};
|
|
6119
|
+
}, expr, true);
|
|
5670
6120
|
}
|
|
5671
6121
|
}
|
|
5672
6122
|
if (shape?.indexValue) {
|
|
@@ -6429,8 +6879,9 @@ export function lowerExprStatement(lowerer, expr) {
|
|
|
6429
6879
|
// (closures box), the runtime sets the member on OBJ receivers
|
|
6430
6880
|
// and throws Node's TypeErrors on the rest. The receiver is
|
|
6431
6881
|
// PROBED (tryLowerExpression) and claimed exactly when it lowers to
|
|
6432
|
-
// dyn; typed receivers keep their own lowerings and fences.
|
|
6433
|
-
|
|
6882
|
+
// dyn; typed receivers keep their own lowerings and fences. A
|
|
6883
|
+
// private name is the field of its class (fieldTarget).
|
|
6884
|
+
if (!expr.left.questionDotToken && !ts.isPrivateIdentifier(expr.left.name)) {
|
|
6434
6885
|
const recv = tryLowerExpression(lowerer, expr.left.expression);
|
|
6435
6886
|
if (recv && recv.type.kind === "dyn") {
|
|
6436
6887
|
const loc = locOf(expr);
|
|
@@ -7609,7 +8060,7 @@ function lowerAssignTargetInto(lowerer, out, targetNode, blame, dflt, valueOf) {
|
|
|
7609
8060
|
if (arr.type.kind === "array") {
|
|
7610
8061
|
const recv = lowerer.declareHiddenLocal("%dtRecv", arr.type);
|
|
7611
8062
|
out.push({ kind: "varDecl", localId: recv.id, init: arr, loc });
|
|
7612
|
-
const index =
|
|
8063
|
+
const index = lowerOptionalIndex(lowerer, lowerer.lowerExpr(t.argumentExpression), locOf(t.argumentExpression), t.argumentExpression);
|
|
7613
8064
|
if (index.type.kind !== "f64") {
|
|
7614
8065
|
lowerer.unsupported("SC1090", t.argumentExpression, "indexing with non-number keys");
|
|
7615
8066
|
}
|
|
@@ -7998,8 +8449,20 @@ export function lowerForOf(lowerer, stmt) {
|
|
|
7998
8449
|
lowerer.stdlibGlobalMember(stmt.expression, "process") === "stdin") {
|
|
7999
8450
|
return lowerForAwaitStdin(lowerer, stmt);
|
|
8000
8451
|
}
|
|
8001
|
-
//
|
|
8002
|
-
|
|
8452
|
+
// NodeJS.WritableStream is what @types/node answers for pipeline()
|
|
8453
|
+
// with a function destination, whose value is a PassThrough.
|
|
8454
|
+
if (nodeStreamInterfaceSide(lowerer, lowerer.typeOf(stmt.expression)) === "w") {
|
|
8455
|
+
const mapped = lowerer.mapTypeOf(lowerer.typeOf(stmt.expression));
|
|
8456
|
+
const sides = mapped?.kind === "object"
|
|
8457
|
+
? streamSidesOf(lowerer, lowerer.classes.get(mapped.className))
|
|
8458
|
+
: null;
|
|
8459
|
+
if (sides !== "r" && sides !== "rw")
|
|
8460
|
+
lowerer.noLowering("for await over a NodeJS.WritableStream", stmt.expression, "type the stream as the readable class it is: pipeline() answers a PassThrough for a function destination (pipeline(...) as PassThrough, or a JSDoc @type)");
|
|
8461
|
+
}
|
|
8462
|
+
// A checked-dynamic NodeJS.ReadableStream iterates its native stream,
|
|
8463
|
+
// and a Hash, Hmac, Cipheriv or Decipheriv iterates its Transform.
|
|
8464
|
+
const dynStream = lowerForAwaitDynStream(lowerer, stmt, () => lowerForAwaitBuiltin(lowerer, stmt)) ??
|
|
8465
|
+
lowerForAwaitValueStream(lowerer, stmt, () => lowerForAwaitBuiltin(lowerer, stmt));
|
|
8003
8466
|
if (dynStream)
|
|
8004
8467
|
return dynStream;
|
|
8005
8468
|
const builtin = lowerForAwaitBuiltin(lowerer, stmt);
|
|
@@ -8168,6 +8631,11 @@ export function lowerForOf(lowerer, stmt) {
|
|
|
8168
8631
|
}
|
|
8169
8632
|
iterSrc ??= stmt.expression;
|
|
8170
8633
|
let iterable = lowerer.lowerExpr(iterSrc);
|
|
8634
|
+
{
|
|
8635
|
+
const iterableUnion = iterableUnionOf(lowerer, iterable.type);
|
|
8636
|
+
if (iterableUnion)
|
|
8637
|
+
return lowerForOfIterable(lowerer, stmt, iterable, iterableUnion, labels);
|
|
8638
|
+
}
|
|
8171
8639
|
let tupleSource = null;
|
|
8172
8640
|
// A nested loop receiver can be an OOB-safe array read from the outer
|
|
8173
8641
|
// loop (`for (const row of grid) for (const cell of row)`). The checker
|
|
@@ -9826,11 +10294,13 @@ function lowerForIn(lowerer, stmt) {
|
|
|
9826
10294
|
loc,
|
|
9827
10295
|
});
|
|
9828
10296
|
const keys = objectIterOverIndexShape(lowerer, stmt.expression, "keys", receiver.type, rShape, recvRef(), keysT, loc);
|
|
10297
|
+
// The overflow map's hashed key set answers presence directly; a
|
|
10298
|
+
// fresh key list per visit would make the walk quadratic.
|
|
9829
10299
|
const guard = (kRef) => ({
|
|
9830
|
-
kind: "
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
10300
|
+
kind: "recordOvfHas",
|
|
10301
|
+
obj: recvRef(),
|
|
10302
|
+
shapeId,
|
|
10303
|
+
key: kRef,
|
|
9834
10304
|
type: BOOL,
|
|
9835
10305
|
loc,
|
|
9836
10306
|
});
|
|
@@ -9960,10 +10430,23 @@ function lowerForInArray(lowerer, stmt, labels, arrExpr) {
|
|
|
9960
10430
|
try {
|
|
9961
10431
|
const arr = lowerer.declareHiddenLocal("%inarr", arrExpr.type);
|
|
9962
10432
|
const len = lowerer.declareHiddenLocal("%inlen", F64);
|
|
10433
|
+
const keysT = { kind: "array", elem: STRING };
|
|
10434
|
+
const keys = lowerer.declareHiddenLocal("%inkeys", keysT);
|
|
10435
|
+
const total = lowerer.declareHiddenLocal("%intotal", F64);
|
|
9963
10436
|
const i = lowerer.declareHiddenLocal("%ini", F64);
|
|
9964
10437
|
i.mutable = true;
|
|
9965
10438
|
const arrRef = () => ({ kind: "varRef", localId: arr.id, type: arrExpr.type, loc });
|
|
10439
|
+
const keysRef = () => ({ kind: "varRef", localId: keys.id, type: keysT, loc });
|
|
10440
|
+
const lenRef = () => ({ kind: "varRef", localId: len.id, type: F64, loc });
|
|
9966
10441
|
const iRef = () => ({ kind: "varRef", localId: i.id, type: F64, loc });
|
|
10442
|
+
const isIndex = () => ({
|
|
10443
|
+
kind: "bin",
|
|
10444
|
+
op: "<",
|
|
10445
|
+
left: iRef(),
|
|
10446
|
+
right: lenRef(),
|
|
10447
|
+
type: BOOL,
|
|
10448
|
+
loc,
|
|
10449
|
+
});
|
|
9967
10450
|
const liveLen = () => ({
|
|
9968
10451
|
kind: "arrIntrinsic",
|
|
9969
10452
|
method: "length",
|
|
@@ -9972,7 +10455,52 @@ function lowerForInArray(lowerer, stmt, labels, arrExpr) {
|
|
|
9972
10455
|
type: F64,
|
|
9973
10456
|
loc,
|
|
9974
10457
|
});
|
|
9975
|
-
|
|
10458
|
+
// Indices first, then the named keys the array had when the loop began.
|
|
10459
|
+
const namedKey = () => ({
|
|
10460
|
+
kind: "arrayGet",
|
|
10461
|
+
arr: keysRef(),
|
|
10462
|
+
index: { kind: "bin", op: "-", left: iRef(), right: lenRef(), type: F64, loc },
|
|
10463
|
+
type: STRING,
|
|
10464
|
+
loc,
|
|
10465
|
+
});
|
|
10466
|
+
const keyInit = {
|
|
10467
|
+
kind: "ternary",
|
|
10468
|
+
cond: isIndex(),
|
|
10469
|
+
then: { kind: "toString", operand: iRef(), type: STRING, loc },
|
|
10470
|
+
else_: namedKey(),
|
|
10471
|
+
type: STRING,
|
|
10472
|
+
loc,
|
|
10473
|
+
};
|
|
10474
|
+
// An index is visited while it is below the live length and not a hole,
|
|
10475
|
+
// a named key while the array still has it.
|
|
10476
|
+
const visits = {
|
|
10477
|
+
kind: "ternary",
|
|
10478
|
+
cond: isIndex(),
|
|
10479
|
+
then: {
|
|
10480
|
+
kind: "logical",
|
|
10481
|
+
op: "&&",
|
|
10482
|
+
left: { kind: "bin", op: "<", left: iRef(), right: liveLen(), type: BOOL, loc },
|
|
10483
|
+
right: {
|
|
10484
|
+
kind: "bin",
|
|
10485
|
+
op: "!==",
|
|
10486
|
+
left: { kind: "arrayState", arr: arrRef(), index: iRef(), type: F64, loc },
|
|
10487
|
+
right: { kind: "numLit", value: 0, type: F64, loc },
|
|
10488
|
+
type: BOOL,
|
|
10489
|
+
loc,
|
|
10490
|
+
},
|
|
10491
|
+
type: BOOL,
|
|
10492
|
+
loc,
|
|
10493
|
+
},
|
|
10494
|
+
else_: {
|
|
10495
|
+
kind: "libCall",
|
|
10496
|
+
fn: "array.hasNamedKey",
|
|
10497
|
+
args: [arrRef(), namedKey()],
|
|
10498
|
+
type: BOOL,
|
|
10499
|
+
loc,
|
|
10500
|
+
},
|
|
10501
|
+
type: BOOL,
|
|
10502
|
+
loc,
|
|
10503
|
+
};
|
|
9976
10504
|
// The three binding forms, sharing the per-visit key declaration.
|
|
9977
10505
|
let keyDecl;
|
|
9978
10506
|
let writes = [];
|
|
@@ -10025,6 +10553,32 @@ function lowerForInArray(lowerer, stmt, labels, arrExpr) {
|
|
|
10025
10553
|
body: [
|
|
10026
10554
|
{ kind: "varDecl", localId: arr.id, init: arrExpr, loc },
|
|
10027
10555
|
{ kind: "varDecl", localId: len.id, init: liveLen(), loc },
|
|
10556
|
+
{
|
|
10557
|
+
kind: "varDecl",
|
|
10558
|
+
localId: keys.id,
|
|
10559
|
+
init: { kind: "libCall", fn: "array.namedKeys", args: [arrRef()], type: keysT, loc },
|
|
10560
|
+
loc,
|
|
10561
|
+
},
|
|
10562
|
+
{
|
|
10563
|
+
kind: "varDecl",
|
|
10564
|
+
localId: total.id,
|
|
10565
|
+
init: {
|
|
10566
|
+
kind: "bin",
|
|
10567
|
+
op: "+",
|
|
10568
|
+
left: lenRef(),
|
|
10569
|
+
right: {
|
|
10570
|
+
kind: "arrIntrinsic",
|
|
10571
|
+
method: "length",
|
|
10572
|
+
receiver: keysRef(),
|
|
10573
|
+
args: [],
|
|
10574
|
+
type: F64,
|
|
10575
|
+
loc,
|
|
10576
|
+
},
|
|
10577
|
+
type: F64,
|
|
10578
|
+
loc,
|
|
10579
|
+
},
|
|
10580
|
+
loc,
|
|
10581
|
+
},
|
|
10028
10582
|
{
|
|
10029
10583
|
kind: "for",
|
|
10030
10584
|
init: {
|
|
@@ -10037,7 +10591,7 @@ function lowerForInArray(lowerer, stmt, labels, arrExpr) {
|
|
|
10037
10591
|
kind: "bin",
|
|
10038
10592
|
op: "<",
|
|
10039
10593
|
left: iRef(),
|
|
10040
|
-
right: { kind: "varRef", localId:
|
|
10594
|
+
right: { kind: "varRef", localId: total.id, type: F64, loc },
|
|
10041
10595
|
type: BOOL,
|
|
10042
10596
|
loc,
|
|
10043
10597
|
},
|
|
@@ -10057,7 +10611,7 @@ function lowerForInArray(lowerer, stmt, labels, arrExpr) {
|
|
|
10057
10611
|
body: [
|
|
10058
10612
|
{
|
|
10059
10613
|
kind: "if",
|
|
10060
|
-
cond:
|
|
10614
|
+
cond: visits,
|
|
10061
10615
|
then: [keyDecl, ...writes, ...body],
|
|
10062
10616
|
else_: null,
|
|
10063
10617
|
loc,
|