@scriptc/compiler 0.4.0 → 0.4.2
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 +617 -83
- package/dist/backend/cycle-analysis.d.ts +2 -1
- package/dist/backend/cycle-analysis.js +4 -4
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-mutability.d.ts +2 -1
- package/dist/backend/cycle-mutability.js +2 -2
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.js +10 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.d.ts +2 -1
- package/dist/backend/immutability.js +2 -2
- package/dist/backend/immutability.js.map +1 -1
- package/dist/backend/library-pack.js +7 -0
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/link-plan-core.d.ts +2 -0
- package/dist/backend/link-plan-core.js +2 -0
- package/dist/backend/link-plan-core.js.map +1 -1
- package/dist/backend/link-plan.d.ts +1 -0
- package/dist/backend/link-plan.js +1 -0
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +7 -3
- package/dist/backend/llvm/alloc.js +7 -4
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/array-search.js +4 -1
- package/dist/backend/llvm/array-search.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.d.ts +23 -2
- package/dist/backend/llvm/bytes-loop-versions.js +115 -19
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +131 -0
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +99 -2
- package/dist/backend/llvm/classes.js +436 -57
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +235 -16
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +21 -5
- package/dist/backend/llvm/common.js +50 -5
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.js +8 -4
- 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 +4 -1
- package/dist/backend/llvm/counted-loops.js +62 -23
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +3 -1
- package/dist/backend/llvm/dense-array-access.js +61 -38
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +4 -0
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.d.ts +19 -16
- package/dist/backend/llvm/dense-array-loops.js +49 -13
- package/dist/backend/llvm/dense-array-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.test.js +50 -14
- package/dist/backend/llvm/dense-array-loops.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +34 -1
- package/dist/backend/llvm/dyn.js +393 -14
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +27 -8
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-module.js +67 -39
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-statements.d.ts +3 -25
- package/dist/backend/llvm/emit-statements.js +414 -37
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +159 -22
- package/dist/backend/llvm/emitter.js +573 -89
- package/dist/backend/llvm/emitter.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 +110 -40
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +1 -1
- package/dist/backend/llvm/expr-calls.js +51 -26
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +27 -14
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- 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 +95 -5
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +29 -11
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +55 -0
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +48 -20
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.js +131 -35
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/integer-clones.js +3 -3
- package/dist/backend/llvm/integer-clones.js.map +1 -1
- package/dist/backend/llvm/js-ic.d.ts +18 -0
- package/dist/backend/llvm/js-ic.js +712 -0
- package/dist/backend/llvm/js-ic.js.map +1 -0
- package/dist/backend/llvm/jsval.js +139 -11
- package/dist/backend/llvm/jsval.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +10 -0
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +61 -0
- 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 +20 -17
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +69 -17
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +75 -1
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +65 -28
- 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 +91 -61
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +14 -0
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +20 -4
- package/dist/backend/llvm/map-number-lookup.js +43 -7
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/narrow-guards.js +64 -0
- package/dist/backend/llvm/narrow-guards.js.map +1 -1
- package/dist/backend/llvm/publish.d.ts +11 -1
- package/dist/backend/llvm/publish.js +80 -22
- 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 +1 -1
- package/dist/backend/llvm/receivers.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +2 -0
- 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/regions.js +2 -2
- package/dist/backend/llvm/regions.js.map +1 -1
- package/dist/backend/llvm/regions.test.js +7 -1
- package/dist/backend/llvm/regions.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +17 -9
- package/dist/backend/llvm/shapes.js +21 -17
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.d.ts +20 -1
- package/dist/backend/llvm/speculative-integers.js +94 -6
- package/dist/backend/llvm/speculative-integers.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.test.js +55 -1
- package/dist/backend/llvm/speculative-integers.test.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 +4 -1
- package/dist/backend/llvm/string-reads.js +88 -4
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/thread-slots.test.js +5 -4
- package/dist/backend/llvm/thread-slots.test.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/mangle.d.ts +8 -0
- package/dist/backend/mangle.js +12 -0
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +40 -2
- package/dist/backend/native/executable.js +40 -7
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/library.js +3 -1
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +17 -6
- package/dist/backend/native-codegen.js +55 -9
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +18 -14
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +30 -2
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-profile.d.ts +32 -0
- package/dist/backend/native-profile.js +39 -0
- package/dist/backend/native-profile.js.map +1 -0
- package/dist/backend/native-profile.test.d.ts +1 -0
- package/dist/backend/native-profile.test.js +58 -0
- package/dist/backend/native-profile.test.js.map +1 -0
- package/dist/backend/native-tools.d.ts +14 -0
- package/dist/backend/native-tools.js +13 -0
- package/dist/backend/native-tools.js.map +1 -1
- package/dist/backend/optimization.d.ts +2 -2
- 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 +4 -0
- package/dist/backend/runtime-pack-core.js +4 -0
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +7 -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 +12 -69
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.js +38 -1
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/warm-cache.js +6 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +89 -7
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/host.d.ts +3 -0
- package/dist/cli/output-options.d.ts +2 -0
- package/dist/cli/output-options.js +9 -0
- package/dist/cli/output-options.js.map +1 -1
- package/dist/cli/usage.d.ts +15 -1
- package/dist/cli/usage.js +30 -2
- package/dist/cli/usage.js.map +1 -1
- package/dist/compile-types.d.ts +9 -0
- package/dist/contracts/check.js +2 -3
- package/dist/contracts/check.js.map +1 -1
- package/dist/coverage/report.d.ts +7 -2
- package/dist/coverage/report.js +18 -0
- 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.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 +2 -1
- package/dist/diagnostics/envelope.js +5 -2
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +32 -0
- package/dist/executable/executable-cache.js +65 -7
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +50 -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/arguments-usage.d.ts +8 -0
- package/dist/frontend/arguments-usage.js +98 -0
- package/dist/frontend/arguments-usage.js.map +1 -1
- package/dist/frontend/arguments-usage.test.d.ts +1 -0
- package/dist/frontend/arguments-usage.test.js +32 -0
- package/dist/frontend/arguments-usage.test.js.map +1 -0
- package/dist/frontend/builtin-package-aliases.d.ts +24 -0
- package/dist/frontend/builtin-package-aliases.js +133 -0
- package/dist/frontend/builtin-package-aliases.js.map +1 -0
- package/dist/frontend/builtin-package-aliases.test.d.ts +1 -0
- package/dist/frontend/builtin-package-aliases.test.js +48 -0
- package/dist/frontend/builtin-package-aliases.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 +4 -0
- package/dist/frontend/dts-paths.js +9 -1
- package/dist/frontend/dts-paths.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 +3 -2
- 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/builtin-class-dyn.d.ts +8 -0
- package/dist/frontend/lowering/builtins/builtin-class-dyn.js +50 -1
- package/dist/frontend/lowering/builtins/builtin-class-dyn.js.map +1 -1
- package/dist/frontend/lowering/builtins/callable-aliases.js +3 -2
- package/dist/frontend/lowering/builtins/callable-aliases.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-sync.js +2 -1
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +7 -2
- package/dist/frontend/lowering/builtins/crypto.js +63 -4
- 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 +21 -0
- package/dist/frontend/lowering/builtins/ecdh.js +208 -0
- package/dist/frontend/lowering/builtins/ecdh.js.map +1 -0
- 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/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 +54 -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 +9 -5
- 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.d.ts +9 -0
- package/dist/frontend/lowering/builtins/process.js +47 -2
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +3 -2
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/promisify-callback.d.ts +3 -0
- package/dist/frontend/lowering/builtins/promisify-callback.js +23 -4
- package/dist/frontend/lowering/builtins/promisify-callback.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +2 -1
- package/dist/frontend/lowering/builtins/readline.js +23 -6
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/reflection.js +26 -0
- package/dist/frontend/lowering/builtins/reflection.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 +6 -2
- package/dist/frontend/lowering/builtins/timers.js.map +1 -1
- package/dist/frontend/lowering/builtins/typed-array-members.d.ts +7 -0
- package/dist/frontend/lowering/builtins/typed-array-members.js +160 -0
- package/dist/frontend/lowering/builtins/typed-array-members.js.map +1 -0
- package/dist/frontend/lowering/builtins/url.js +4 -3
- 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/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.d.ts +4 -0
- package/dist/frontend/lowering/call-signatures.js +137 -13
- 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/cjs-exports-object.js +34 -1
- package/dist/frontend/lowering/cjs-exports-object.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-construction.d.ts +2 -1
- package/dist/frontend/lowering/class-construction.js +8 -13
- 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 +34 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +577 -152
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +77 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +3 -0
- 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 +17 -0
- package/dist/frontend/lowering/class-protocols.js +117 -7
- 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 +42 -4
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-to-primitive.d.ts +2 -2
- package/dist/frontend/lowering/class-to-primitive.js +31 -8
- 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/fresh-spread.d.ts +13 -0
- package/dist/frontend/lowering/coercions/fresh-spread.js +95 -0
- package/dist/frontend/lowering/coercions/fresh-spread.js.map +1 -0
- package/dist/frontend/lowering/coercions/function-adapters.js +105 -75
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +8 -7
- 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-callbacks.d.ts +15 -0
- package/dist/frontend/lowering/containers/array-callbacks.js +36 -32
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-concat.js +2 -1
- package/dist/frontend/lowering/containers/array-concat.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +32 -4
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +11 -5
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.js +2 -1
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.d.ts +10 -1
- package/dist/frontend/lowering/containers/bytes.js +601 -24
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +52 -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 +80 -10
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +8 -7
- 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 +85 -22
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +2 -1
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/cycle-initialization.d.ts +26 -10
- package/dist/frontend/lowering/cycle-initialization.js +177 -39
- 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 +204 -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/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 +4 -0
- package/dist/frontend/lowering/error-methods.js.map +1 -1
- package/dist/frontend/lowering/expressions/array-literals.js +48 -13
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +124 -8
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +30 -7
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +46 -7
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/keyed-field-targets.d.ts +14 -2
- package/dist/frontend/lowering/expressions/keyed-field-targets.js +91 -10
- package/dist/frontend/lowering/expressions/keyed-field-targets.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.js +52 -7
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +0 -3
- package/dist/frontend/lowering/expressions/object-literals.js +75 -7
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +17 -8
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +5 -4
- package/dist/frontend/lowering/expressions/property-access.js +351 -16
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +112 -9
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/typeof.js +13 -0
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +64 -10
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/generator-delegation.d.ts +8 -0
- package/dist/frontend/lowering/generator-delegation.js +191 -1
- package/dist/frontend/lowering/generator-delegation.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 +46 -1
- package/dist/frontend/lowering/generic-functions.js +660 -73
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/handle-properties.d.ts +24 -0
- package/dist/frontend/lowering/handle-properties.js +281 -0
- package/dist/frontend/lowering/handle-properties.js.map +1 -0
- package/dist/frontend/lowering/intern-tables.js +2 -1
- package/dist/frontend/lowering/intern-tables.js.map +1 -1
- package/dist/frontend/lowering/iterable-spelling.d.ts +7 -0
- package/dist/frontend/lowering/iterable-spelling.js +38 -0
- package/dist/frontend/lowering/iterable-spelling.js.map +1 -0
- package/dist/frontend/lowering/iterator-adapters.js +9 -8
- package/dist/frontend/lowering/iterator-adapters.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 +7 -2
- package/dist/frontend/lowering/key-order-witness.js +21 -4
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.test.js +38 -2
- 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-array-sort.d.ts +33 -15
- package/dist/frontend/lowering/lower-array-sort.js +117 -21
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.test.js +93 -14
- package/dist/frontend/lowering/lower-array-sort.test.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 +3 -1
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.js +1 -0
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +4 -0
- package/dist/frontend/lowering/lower-calls.js +504 -97
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +22 -0
- package/dist/frontend/lowering/lower-classes.js +339 -32
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +65 -15
- 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 +148 -12
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +308 -72
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +10 -4
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +578 -16
- 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.d.ts +11 -3
- package/dist/frontend/lowering/lower-modules.js +227 -72
- 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 +24 -3
- 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 +263 -60
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.js +39 -18
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +7 -10
- package/dist/frontend/lowering/lower-stmts.js +584 -69
- 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.js +575 -165
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +21 -4
- package/dist/frontend/lowering/lower-timers.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +151 -30
- package/dist/frontend/lowering/lowerer.js +725 -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/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/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/rebindable-functions.d.ts +8 -0
- package/dist/frontend/lowering/rebindable-functions.js +54 -0
- package/dist/frontend/lowering/rebindable-functions.js.map +1 -0
- 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 +26 -0
- package/dist/frontend/lowering/static-typeof.js +172 -0
- package/dist/frontend/lowering/static-typeof.js.map +1 -0
- package/dist/frontend/lowering/strict-equality.js +2 -1
- package/dist/frontend/lowering/strict-equality.js.map +1 -1
- package/dist/frontend/lowering/string-index-bounds.js +3 -2
- package/dist/frontend/lowering/string-index-bounds.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.js +72 -30
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/thenables.d.ts +16 -0
- package/dist/frontend/lowering/thenables.js +124 -0
- package/dist/frontend/lowering/thenables.js.map +1 -0
- package/dist/frontend/lowering/var-hoisting.js +37 -3
- package/dist/frontend/lowering/var-hoisting.js.map +1 -1
- package/dist/frontend/npm-static-builtin-aliases.d.ts +8 -0
- package/dist/frontend/npm-static-builtin-aliases.js +65 -0
- package/dist/frontend/npm-static-builtin-aliases.js.map +1 -0
- package/dist/frontend/npm-static-bundled-chunks.d.ts +8 -1
- package/dist/frontend/npm-static-bundled-chunks.js +173 -2
- package/dist/frontend/npm-static-bundled-chunks.js.map +1 -1
- package/dist/frontend/npm-static-bundled-chunks.test.js +112 -0
- package/dist/frontend/npm-static-bundled-chunks.test.js.map +1 -1
- package/dist/frontend/npm-static-bundled-esm.js +224 -4
- package/dist/frontend/npm-static-bundled-esm.js.map +1 -1
- package/dist/frontend/npm-static-bundled-esm.test.js +129 -0
- package/dist/frontend/npm-static-bundled-esm.test.js.map +1 -1
- package/dist/frontend/npm-static-enum-iife.d.ts +6 -0
- package/dist/frontend/npm-static-enum-iife.js +280 -0
- package/dist/frontend/npm-static-enum-iife.js.map +1 -0
- package/dist/frontend/npm-static-enum-iife.test.d.ts +1 -0
- package/dist/frontend/npm-static-enum-iife.test.js +116 -0
- package/dist/frontend/npm-static-enum-iife.test.js.map +1 -0
- 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 +16 -0
- package/dist/frontend/npm-static.js +93 -3
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.js +13 -0
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/package-shims.d.ts +47 -0
- package/dist/frontend/package-shims.js +300 -0
- package/dist/frontend/package-shims.js.map +1 -0
- package/dist/frontend/pipeline.js +67 -1
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program.d.ts +21 -0
- package/dist/frontend/program.js +174 -14
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +1 -1
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/resolve.js +13 -0
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/services.d.ts +12 -0
- package/dist/frontend/services.js +37 -0
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/ts7/ast-node.d.ts +21 -7
- package/dist/frontend/ts7/ast-node.js +131 -29
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +60 -0
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.d.ts +27 -2
- package/dist/frontend/ts7/ast-wire.js +124 -21
- package/dist/frontend/ts7/ast-wire.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.d.ts +13 -1
- package/dist/frontend/ts7/checker.js +75 -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/program-host.d.ts +6 -5
- package/dist/frontend/ts7/program-host.js +12 -2
- 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 +18 -0
- package/dist/frontend/ts7/semantic-model.js +90 -16
- 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 +19 -4
- package/dist/frontend/ts7/session.js +1 -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 +38 -6
- package/dist/frontend/type-mapper.js +466 -47
- 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 +8 -0
- package/dist/index.js +453 -85
- package/dist/index.js.map +1 -1
- package/dist/ir/array-length-stability.d.ts +3 -2
- package/dist/ir/array-length-stability.js +22 -2
- package/dist/ir/array-length-stability.js.map +1 -1
- package/dist/ir/array-length-stability.test.js +47 -1
- package/dist/ir/array-length-stability.test.js.map +1 -1
- package/dist/ir/builtin-effects.js +41 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +5 -1
- package/dist/ir/builtin-signatures.js +187 -16
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/final-fields.d.ts +2 -1
- package/dist/ir/final-fields.js +2 -2
- package/dist/ir/final-fields.js.map +1 -1
- package/dist/ir/function-references.test.js +2 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/int32-slots.d.ts +13 -5
- package/dist/ir/int32-slots.js +112 -115
- 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 +14 -4
- package/dist/ir/integer-loop-facts.js +172 -32
- 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 +193 -39
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +201 -1
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +10 -1
- package/dist/ir/integer-ranges.js +122 -25
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +255 -1
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/ir.d.ts +17 -2
- package/dist/ir/ir.js +11 -1
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/js-ic.d.ts +52 -0
- package/dist/ir/js-ic.js +199 -0
- package/dist/ir/js-ic.js.map +1 -0
- package/dist/ir/js-ic.test.d.ts +1 -0
- package/dist/ir/js-ic.test.js +148 -0
- package/dist/ir/js-ic.test.js.map +1 -0
- package/dist/ir/jsval.js +38 -4
- package/dist/ir/jsval.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +64 -5
- package/dist/ir/runtime-features.js +358 -101
- package/dist/ir/runtime-features.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 +124 -70
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +77 -24
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +15 -2
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/ir-policy.js +11 -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/cli.js +22 -0
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +33 -4
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/executable-cache.js +3 -0
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/prepare.js +8 -1
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.test.js +10 -0
- package/dist/native/sanitizer.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 +22 -21
- package/shims/fs-extra/core/api.ts +1192 -0
- package/shims/fs-extra/index.ts +9 -0
- package/shims/undici/core/agent.ts +163 -0
- package/shims/undici/core/api.ts +93 -0
- package/shims/undici/core/client.ts +1304 -0
- package/shims/undici/core/connector.ts +157 -0
- package/shims/undici/core/diagnostics-types.ts +68 -0
- package/shims/undici/core/diagnostics.ts +16 -0
- package/shims/undici/core/dispatcher.ts +574 -0
- package/shims/undici/core/errors-v5.ts +22 -0
- package/shims/undici/core/errors-v7.ts +25 -0
- package/shims/undici/core/errors.ts +255 -0
- package/shims/undici/core/fetch.ts +635 -0
- package/shims/undici/core/pool.ts +280 -0
- package/shims/undici/core/readable.ts +268 -0
- package/shims/undici/core/request.ts +313 -0
- package/shims/undici/core/timers.ts +80 -0
- package/shims/undici/core/types.ts +167 -0
- package/shims/undici/core/util.ts +67 -0
- package/shims/undici/v5.ts +119 -0
- package/shims/undici/v7.ts +119 -0
- package/surface-manifest.json +20 -52
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { lowerTupleAliasDecl, stripTypeWrappers } from "./typed-arguments.js";
|
|
2
|
-
import { declaredMemberOf } from "./expressions/property-access.js";
|
|
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
5
|
import { lowerForAwaitDynStream } from "./dyn-streams.js";
|
|
6
|
+
import { lowerForAwaitValueStream } from "./builtins/hash-stream.js";
|
|
7
|
+
import { lowerChildPropertyWrite } from "./handle-properties.js";
|
|
6
8
|
import { matchAllRowsReadByElements, storedMatchAllRowsReadByElements, } from "./containers/match-row-uses.js";
|
|
7
|
-
import { dynUndefinedExpr, numLit, varRef } from "../../ir/build.js";
|
|
9
|
+
import { dynUndefinedExpr, nodeThrowExpr, numLit, varRef } from "../../ir/build.js";
|
|
10
|
+
import { runtimeKeyPatternRead } from "./expressions/keyed-field-targets.js";
|
|
11
|
+
import { declaresHoistedBinding, staticCondition } from "./static-typeof.js";
|
|
8
12
|
import { lowerCollectionSpread } from "./containers/collection-methods.js";
|
|
9
13
|
import { lowerEventObjectPropertyWrite } from "./lower-event-target.js";
|
|
10
14
|
import { lowerDynObjectLiteral } from "./expressions/object-literals.js";
|
|
11
15
|
import { importMetaBindingSource } from "./import-meta.js";
|
|
12
16
|
import { iteratorCanStep, iteratorValue } from "./iterator-consumption.js";
|
|
17
|
+
import { notIterableSpelling } from "./iterable-spelling.js";
|
|
13
18
|
import { isPrivateSplitConsumer } from "./split-consumers.js";
|
|
14
19
|
import { InternalCompilerError } from "../../errors.js";
|
|
15
20
|
/* Statement lowering: the statement dispatch (lowerStmt), variable
|
|
@@ -42,7 +47,7 @@ import { lowerForOfArrayIter, lowerForOfMap, lowerForOfSearchParams, lowerForOfS
|
|
|
42
47
|
import { lowerForOfHelperChain } from "./containers/iterator-helpers.js";
|
|
43
48
|
import { objectIterOverIndexShape } from "./containers/indexed-objects.js";
|
|
44
49
|
import { strCharsCall } from "./containers/array-construction.js";
|
|
45
|
-
import { bindingContextualGenericFnNodeOf, bindingGenericFnAliasInfoOf, bindingGenericFnInfoOf, bindingGenericFnNodeOf, implicitLocalFnInfoOf, implicitLocalFnNodeOf, implicitMethodCallInfersReturn, genericLocalClassBinding, } from "./generic-functions.js";
|
|
50
|
+
import { bindingContextualGenericFnNodeOf, bindingGenericFnAliasInfoOf, bindingGenericFnInfoOf, bindingGenericFnNodeOf, genericBindingPresenceStore, genericBindingStoredValue, implicitLocalFnInfoOf, implicitLocalFnNodeOf, implicitMethodCallInfersReturn, genericLocalClassBinding, } from "./generic-functions.js";
|
|
46
51
|
import { bindingNeverReassigned, deadUnmappableBinding, nullishExprUnitOf, nullishGenericBindingUnitOf, } from "./binding-analysis.js";
|
|
47
52
|
import { hasExplicitJsDocReturn } from "./function-returns.js";
|
|
48
53
|
import { recordKeysArrayCall } from "./lower-calls.js";
|
|
@@ -53,7 +58,7 @@ import { classStaticDataFor } from "./class-static-data.js";
|
|
|
53
58
|
import { objectFactorySignature } from "./object-factory-new.js";
|
|
54
59
|
import { isClassCallback, lowerClassCallbackAssign } from "./class-callbacks.js";
|
|
55
60
|
import { classForInHasKey, classPropertiesHelper } from "./class-dynamic-dispatch.js";
|
|
56
|
-
import { genericIfaceBindingKeepsClass } from "./lower-classes.js";
|
|
61
|
+
import { genericIfaceBindingKeepsClass, superConditionLead } from "./lower-classes.js";
|
|
57
62
|
import { lowerStreamUnderscoreAssign, streamClassAliasDecl } from "./lower-stream.js";
|
|
58
63
|
import { staticAssertInstanceDecl } from "./assert-instances.js";
|
|
59
64
|
import { lowerHttpResPropertyAssignment, lowerHttpServerTimeoutAssignment, lowerNetServerMaxConnectionsAssignment, lowerServerCloseOverrideAssignment, } from "./lower-server.js";
|
|
@@ -65,8 +70,9 @@ import { lowerNodeModuleCall } from "./builtins/module-resolution.js";
|
|
|
65
70
|
import { registerBuiltinCallableAlias } from "./builtins/callable-aliases.js";
|
|
66
71
|
import { builtinClassAliasOwnsNoSlot, registerBuiltinClassAlias } from "./builtins/class-values.js";
|
|
67
72
|
import { lowerEnumDeclaration } from "./lower-enums.js";
|
|
68
|
-
import { abstractPropertyDeclOf, aliasTypeofNarrows, isMatchSliceType, lowerAbsenceProbe, lowerCompoundValueToTarget, lowerElementCompoundStatement, lowerIncDec, lowerIncDecTarget, lowerGroupsProjection, matchResultNamedGroupsOf, runtimeOptionalGuardIds, runtimeOptionalTrueIds, symbolFieldInfo, withRuntimeOptionalNarrowed, } from "./lower-exprs.js";
|
|
73
|
+
import { abstractPropertyDeclOf, aliasTypeofNarrows, isMatchSliceType, lowerAbsenceProbe, lowerCompoundValueToTarget, lowerElementCompoundStatement, lowerIncDec, lowerIncDecTarget, lowerOptionalNumber, lowerGroupsProjection, matchResultNamedGroupsOf, runtimeOptionalGuardIds, runtimeOptionalTrueIds, symbolFieldInfo, withRuntimeOptionalNarrowed, } from "./lower-exprs.js";
|
|
69
74
|
import { globalSymbolKey } from "./expressions/global-symbols.js";
|
|
75
|
+
import { identifiersNamed } from "./identifier-uses.js";
|
|
70
76
|
import { lowerShortCircuitAssignment } from "./expressions/nullish-assignment.js";
|
|
71
77
|
import { builtinGlobalValue, jsHoldsDynObject, lowerEnvironmentKey, lowerNativeFunctionAssignment, lowerStrictEquality, } from "./lower-exprs.js";
|
|
72
78
|
import { keptIdentityAssertion } from "./assertion-identity.js";
|
|
@@ -1007,6 +1013,10 @@ function varBindingType(lowerer, nameNode) {
|
|
|
1007
1013
|
ts.isVariableDeclaration(nameNode.parent) &&
|
|
1008
1014
|
isNativeBuiltinValueInitializer(lowerer, nameNode.parent.initializer))
|
|
1009
1015
|
return DYN;
|
|
1016
|
+
if (ts.isVariableDeclaration(nameNode.parent) &&
|
|
1017
|
+
!nameNode.parent.type &&
|
|
1018
|
+
isPromisePrototypeRead(lowerer, nameNode.parent.initializer))
|
|
1019
|
+
return DYN;
|
|
1010
1020
|
let type = lowerer.mapTypeOf(lowerer.typeOf(nameNode));
|
|
1011
1021
|
if (type?.kind === "record" && isJsSourceFile(ts.getSourceFileOfNode(nameNode))) {
|
|
1012
1022
|
const shape = lowerer.shapes.get(type.shapeId);
|
|
@@ -1310,19 +1320,40 @@ export function lowerStmt(lowerer, stmt) {
|
|
|
1310
1320
|
return lowerer.lowerDefaultExport(stmt);
|
|
1311
1321
|
}
|
|
1312
1322
|
if (ts.isIfStatement(stmt)) {
|
|
1313
|
-
|
|
1323
|
+
// `if (super(), test)`: the super call runs as a statement, then the
|
|
1324
|
+
// test decides.
|
|
1325
|
+
const lead = superConditionLead(stmt.expression);
|
|
1326
|
+
const leading = lead ? lowerer.lowerExprStatement(lead.left) : null;
|
|
1327
|
+
const test = lead ? lead.right : stmt.expression;
|
|
1328
|
+
const cond = lowerer.lowerCondition(test);
|
|
1329
|
+
// A global-detection condition (static-typeof.ts) folds; its untaken
|
|
1330
|
+
// arm is code Node never runs and does not lower, unless it declares a
|
|
1331
|
+
// hoisted binding.
|
|
1332
|
+
const decided = staticCondition(lowerer, test);
|
|
1333
|
+
if (decided !== null) {
|
|
1334
|
+
const taken = decided ? stmt.thenStatement : stmt.elseStatement;
|
|
1335
|
+
const untaken = decided ? stmt.elseStatement : stmt.thenStatement;
|
|
1336
|
+
if (untaken === undefined || !declaresHoistedBinding(untaken)) {
|
|
1337
|
+
const arm = taken === undefined ? [] : lowerer.lowerScopedBlock(taken);
|
|
1338
|
+
const folded = decided
|
|
1339
|
+
? { kind: "if", cond, then: arm, else_: null, loc: locOf(stmt) }
|
|
1340
|
+
: { kind: "if", cond, then: [], else_: arm, loc: locOf(stmt) };
|
|
1341
|
+
return leading ? { kind: "block", body: [leading, folded], loc: locOf(stmt) } : folded;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1314
1344
|
// Aliased-typeof narrows (ms's `var type = typeof val` guard): the
|
|
1315
1345
|
// then-branch lowers under what a TRUE condition proves, the
|
|
1316
1346
|
// else-branch under a FALSE one — the var/let alias narrowing the
|
|
1317
1347
|
// checker only performs for consts (aliasTypeofNarrows).
|
|
1318
|
-
const then = lowerer.narrowingAliases(aliasTypeofNarrows(lowerer,
|
|
1348
|
+
const then = lowerer.narrowingAliases(aliasTypeofNarrows(lowerer, test, true), () => withRuntimeOptionalNarrowed(lowerer, runtimeOptionalTrueIds(lowerer, test), () => lowerer.lowerScopedBlock(stmt.thenStatement)));
|
|
1319
1349
|
const else_ = stmt.elseStatement
|
|
1320
|
-
? lowerer.narrowingAliases(aliasTypeofNarrows(lowerer,
|
|
1350
|
+
? lowerer.narrowingAliases(aliasTypeofNarrows(lowerer, test, false), () => withRuntimeOptionalNarrowed(lowerer, runtimeOptionalGuardIds(lowerer, test, false), () => lowerer.lowerScopedBlock(stmt.elseStatement)))
|
|
1321
1351
|
: null;
|
|
1322
1352
|
for (const local of falsyExitRuntimeOptionalLocals(lowerer, stmt)) {
|
|
1323
1353
|
lowerer.runtimeOptionalLocals.delete(lowerer.runtimeOptionalRootOf(local));
|
|
1324
1354
|
}
|
|
1325
|
-
|
|
1355
|
+
const lowered = { kind: "if", cond, then, else_, loc: locOf(stmt) };
|
|
1356
|
+
return leading ? { kind: "block", body: [leading, lowered], loc: locOf(stmt) } : lowered;
|
|
1326
1357
|
}
|
|
1327
1358
|
if (ts.isWhileStatement(stmt)) {
|
|
1328
1359
|
const labels = lowerer.takeLabels();
|
|
@@ -1953,11 +1984,19 @@ export function lowerDestructuringDecl(lowerer, decl, isLet) {
|
|
|
1953
1984
|
// destructure property 'a' of 'f(...)' as it is null.") for the source
|
|
1954
1985
|
// spellings the assignment form reproduces; other sources are refused,
|
|
1955
1986
|
// as in the assignment form. JavaScript files keep their existing
|
|
1956
|
-
// per-read errors
|
|
1957
|
-
|
|
1987
|
+
// per-read errors, except that a runtime computed first key checks the
|
|
1988
|
+
// source first: Node throws before it evaluates any key, and V8's bare
|
|
1989
|
+
// message names the source.
|
|
1990
|
+
const jsRuntimeKeyCheck = init.type.kind === "dyn" &&
|
|
1958
1991
|
ts.isObjectBindingPattern(decl.name) &&
|
|
1959
|
-
|
|
1960
|
-
lowerer
|
|
1992
|
+
isJsSourceFile(ts.getSourceFileOfNode(decl)) &&
|
|
1993
|
+
startsWithRuntimeKey(lowerer, decl.name) &&
|
|
1994
|
+
destrSpellingOf(decl.initializer) !== null;
|
|
1995
|
+
if (jsRuntimeKeyCheck ||
|
|
1996
|
+
(init.type.kind === "dyn" &&
|
|
1997
|
+
ts.isObjectBindingPattern(decl.name) &&
|
|
1998
|
+
!isJsSourceFile(ts.getSourceFileOfNode(decl)) &&
|
|
1999
|
+
lowerer.anyOrigin(decl.initializer))) {
|
|
1961
2000
|
const spelling = destrSpellingOf(decl.initializer);
|
|
1962
2001
|
if (spelling === null) {
|
|
1963
2002
|
lowerer.unsupported("SC1031", decl.initializer, "destructuring declaration from an `any` source whose expression spelling is unsupported (use a variable, ordinary property chain, or ordinary call)");
|
|
@@ -2430,6 +2469,27 @@ export function lowerBindingPattern(lowerer, pattern, srcRef, srcType, isLet, ou
|
|
|
2430
2469
|
return;
|
|
2431
2470
|
}
|
|
2432
2471
|
if (srcType.kind === "dyn") {
|
|
2472
|
+
// A runtime computed first key evaluates after RequireObjectCoercible:
|
|
2473
|
+
// a nullish source throws before the key's side effects run. Later
|
|
2474
|
+
// keys follow a read that already threw.
|
|
2475
|
+
if (ts.isObjectBindingPattern(pattern) && startsWithRuntimeKey(lowerer, pattern)) {
|
|
2476
|
+
const loc = locOf(pattern);
|
|
2477
|
+
for (const unit of ["null", "undefined"]) {
|
|
2478
|
+
out.push({
|
|
2479
|
+
kind: "if",
|
|
2480
|
+
cond: { kind: "dynTest", test: unit, value: srcRef(), type: BOOL, loc },
|
|
2481
|
+
then: [
|
|
2482
|
+
{
|
|
2483
|
+
kind: "exprStmt",
|
|
2484
|
+
expr: nodeThrowExpr(1, "", `Cannot read properties of ${unit}`, VOID, loc),
|
|
2485
|
+
loc,
|
|
2486
|
+
},
|
|
2487
|
+
],
|
|
2488
|
+
else_: null,
|
|
2489
|
+
loc,
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2433
2493
|
for (const el of pattern.elements.nodes) {
|
|
2434
2494
|
if (el.name === undefined)
|
|
2435
2495
|
continue;
|
|
@@ -2471,10 +2531,14 @@ export function lowerBindingPattern(lowerer, pattern, srcRef, srcType, isLet, ou
|
|
|
2471
2531
|
ts.isNumericLiteral(prop)
|
|
2472
2532
|
? patternKeyNameOf(lowerer, prop)
|
|
2473
2533
|
: null;
|
|
2474
|
-
|
|
2534
|
+
// A runtime computed key (`{ [name]: v }`) reads the live property.
|
|
2535
|
+
const runtimeRead = propName === null && ts.isComputedPropertyName(prop)
|
|
2536
|
+
? runtimeKeyPatternRead(lowerer, prop.expression, srcRef(), out, loc)
|
|
2537
|
+
: null;
|
|
2538
|
+
if (propName === null && runtimeRead === null) {
|
|
2475
2539
|
lowerer.unsupported("SC1031", el, "destructuring with computed keys that do not fold to one property name");
|
|
2476
2540
|
}
|
|
2477
|
-
let value = {
|
|
2541
|
+
let value = runtimeRead ?? {
|
|
2478
2542
|
kind: "dynKeyGet",
|
|
2479
2543
|
key: { kind: "strLit", value: propName, type: STRING, loc },
|
|
2480
2544
|
value: srcRef(),
|
|
@@ -2685,7 +2749,18 @@ export function lowerBindingPattern(lowerer, pattern, srcRef, srcType, isLet, ou
|
|
|
2685
2749
|
? patternKeyNameOf(lowerer, prop)
|
|
2686
2750
|
: null;
|
|
2687
2751
|
if (propName === null) {
|
|
2688
|
-
|
|
2752
|
+
// A runtime computed key (`{ [name]: v }`): the keyed read of an
|
|
2753
|
+
// index-signature entry, of the declared field a literal-union key
|
|
2754
|
+
// names, or of a JavaScript record's live property.
|
|
2755
|
+
const runtimeRead = ts.isComputedPropertyName(prop)
|
|
2756
|
+
? runtimeKeyPatternRead(lowerer, prop.expression, srcRef(), out, locOf(el))
|
|
2757
|
+
: null;
|
|
2758
|
+
if (runtimeRead === null) {
|
|
2759
|
+
lowerer.unsupported("SC1031", el, "destructuring with computed keys that do not fold to one property name");
|
|
2760
|
+
}
|
|
2761
|
+
const value = el.initializer ? applyBindingDefault(lowerer, el, runtimeRead) : runtimeRead;
|
|
2762
|
+
lowerer.bindPatternTarget(el.name, value, isLet, out);
|
|
2763
|
+
continue;
|
|
2689
2764
|
}
|
|
2690
2765
|
// An ACCESSOR property (%get:/%set: closure slots): the element's
|
|
2691
2766
|
// read IS a getter call — once, at the element's pattern position
|
|
@@ -2919,6 +2994,13 @@ function lowerModuleNamespacePattern(lowerer, pattern, source, isLet, out) {
|
|
|
2919
2994
|
lowerer.bindPatternTarget(el.name, value, isLet, out);
|
|
2920
2995
|
}
|
|
2921
2996
|
}
|
|
2997
|
+
/** Whether a pattern's first element has a computed key that does not
|
|
2998
|
+
* fold to one property name, so the key evaluates at run time. */
|
|
2999
|
+
function startsWithRuntimeKey(lowerer, pattern) {
|
|
3000
|
+
const first = pattern.elements.nodes[0];
|
|
3001
|
+
const key = first?.dotDotDotToken === undefined ? first?.propertyName : undefined;
|
|
3002
|
+
return (key !== undefined && ts.isComputedPropertyName(key) && patternKeyNameOf(lowerer, key) === null);
|
|
3003
|
+
}
|
|
2922
3004
|
function patternKeyNameOf(lowerer, prop) {
|
|
2923
3005
|
if (ts.isIdentifier(prop) || ts.isPrivateIdentifier(prop))
|
|
2924
3006
|
return prop.text;
|
|
@@ -3196,6 +3278,10 @@ function stdlibGlobalTokenDestructure(lowerer, decl, isLet) {
|
|
|
3196
3278
|
const globalName = stdlibGlobalNameOf(lowerer, decl.initializer);
|
|
3197
3279
|
if (globalName === null)
|
|
3198
3280
|
return null;
|
|
3281
|
+
// `workerData` is a value (the data the worker was started with), not an
|
|
3282
|
+
// API surface: its members destructure as any untyped value's do.
|
|
3283
|
+
if (globalName === "workerData")
|
|
3284
|
+
return null;
|
|
3199
3285
|
if (!ts.isObjectBindingPattern(decl.name)) {
|
|
3200
3286
|
lowerer.unsupported("SC1031", decl.name, `array destructuring of the builtin global '${globalName}' (builtin globals are not iterable)`);
|
|
3201
3287
|
}
|
|
@@ -3240,9 +3326,13 @@ function stdlibGlobalTokenDestructure(lowerer, decl, isLet) {
|
|
|
3240
3326
|
const canonical = ts.symbolName(member) === "global" ? "globalThis" : ts.symbolName(member);
|
|
3241
3327
|
token = `[builtin ${canonical}]`;
|
|
3242
3328
|
alias = canonical;
|
|
3243
|
-
// Builtin constructors read as their interned function values,
|
|
3244
|
-
// same values the bare and
|
|
3245
|
-
|
|
3329
|
+
// Builtin constructors read as their interned function values, and
|
|
3330
|
+
// crypto as the WebCrypto object: the same values the bare and
|
|
3331
|
+
// `globalThis.X` spellings read.
|
|
3332
|
+
value =
|
|
3333
|
+
canonical === "crypto"
|
|
3334
|
+
? { kind: "libCall", fn: "webcrypto.object", args: [], type: DYN, loc: locOf(el) }
|
|
3335
|
+
: builtinGlobalValue(canonical, locOf(el), true);
|
|
3246
3336
|
}
|
|
3247
3337
|
else if (globalName === "console" && !CONSOLE_CALL_MEMBERS.has(propName)) {
|
|
3248
3338
|
token = `[builtin console.${propName}]`;
|
|
@@ -3874,6 +3964,69 @@ export function lowerVarDeclList(lowerer, list) {
|
|
|
3874
3964
|
}
|
|
3875
3965
|
return out.length === 1 ? out[0] : { kind: "block", body: out, loc: locOf(list) };
|
|
3876
3966
|
}
|
|
3967
|
+
/** The type of an unannotated TypeScript binding initialized with `[]`
|
|
3968
|
+
* whose element type evolves: the checker types the declaration as
|
|
3969
|
+
* `never[]` or `any[]` and each later read by the elements written before
|
|
3970
|
+
* it, and reads inside closures as the unsettled array. When every read
|
|
3971
|
+
* with a settled element type maps to the same array type, the binding has
|
|
3972
|
+
* that type. When reads disagree or the binding is reassigned, it is
|
|
3973
|
+
* checked-dynamic, as the same binding is at module scope. Null for other
|
|
3974
|
+
* bindings. */
|
|
3975
|
+
function evolvingArrayType(lowerer, decl) {
|
|
3976
|
+
if (!ts.isIdentifier(decl.name) || decl.initializer === undefined)
|
|
3977
|
+
return null;
|
|
3978
|
+
let initializer = decl.initializer;
|
|
3979
|
+
while (ts.isParenthesizedExpression(initializer))
|
|
3980
|
+
initializer = initializer.expression;
|
|
3981
|
+
if (!ts.isArrayLiteralExpression(initializer) || initializer.elements.nodes.length !== 0)
|
|
3982
|
+
return null;
|
|
3983
|
+
const unsettled = (t) => {
|
|
3984
|
+
if (!lowerer.checker.isArrayType(t))
|
|
3985
|
+
return false;
|
|
3986
|
+
const elem = lowerer.checker.getTypeArguments(t)[0];
|
|
3987
|
+
return elem !== undefined && (elem.flags & (ts.TypeFlags.Never | ts.TypeFlags.Any)) !== 0;
|
|
3988
|
+
};
|
|
3989
|
+
if (!unsettled(lowerer.typeOf(decl.name)))
|
|
3990
|
+
return null;
|
|
3991
|
+
const symbol = lowerer.checker.getSymbolAtLocation(decl.name);
|
|
3992
|
+
if (symbol === undefined)
|
|
3993
|
+
return null;
|
|
3994
|
+
const owner = (node) => {
|
|
3995
|
+
let n = node.parent;
|
|
3996
|
+
while (n !== undefined && !ts.isFunctionLike(n) && !ts.isSourceFile(n))
|
|
3997
|
+
n = n.parent;
|
|
3998
|
+
return n ?? ts.getSourceFileOfNode(node);
|
|
3999
|
+
};
|
|
4000
|
+
const scope = owner(decl);
|
|
4001
|
+
let result = null;
|
|
4002
|
+
// The file's identifiers are indexed by name once (identifiersNamed), so
|
|
4003
|
+
// each binding resolves only the uses spelled like it.
|
|
4004
|
+
for (const node of identifiersNamed(lowerer, ts.getSourceFileOfNode(decl), decl.name.text)) {
|
|
4005
|
+
if (node === decl.name ||
|
|
4006
|
+
node.pos < scope.pos ||
|
|
4007
|
+
node.end > scope.end ||
|
|
4008
|
+
lowerer.checker.getSymbolAtLocation(node) !== symbol)
|
|
4009
|
+
continue;
|
|
4010
|
+
let target = node;
|
|
4011
|
+
while (ts.isParenthesizedExpression(target.parent))
|
|
4012
|
+
target = target.parent;
|
|
4013
|
+
const parent = target.parent;
|
|
4014
|
+
const reassigned = ts.isBinaryExpression(parent) &&
|
|
4015
|
+
parent.left === target &&
|
|
4016
|
+
parent.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
|
|
4017
|
+
parent.operatorToken.kind <= ts.SyntaxKind.LastAssignment;
|
|
4018
|
+
if (reassigned)
|
|
4019
|
+
return DYN;
|
|
4020
|
+
const t = lowerer.typeOf(node);
|
|
4021
|
+
if (unsettled(t))
|
|
4022
|
+
continue;
|
|
4023
|
+
const mapped = lowerer.mapTypeOf(t);
|
|
4024
|
+
if (!mapped || mapped.kind !== "array" || (result !== null && !typeEquals(result, mapped)))
|
|
4025
|
+
return DYN;
|
|
4026
|
+
result = mapped;
|
|
4027
|
+
}
|
|
4028
|
+
return result ?? DYN;
|
|
4029
|
+
}
|
|
3877
4030
|
/** A single static type for an initializer-less JavaScript `let` whose
|
|
3878
4031
|
* later plain writes all agree. An evolving JS local reads as `undefined`
|
|
3879
4032
|
* until control flow proves a write, so a scalar slot is sound only when
|
|
@@ -4111,8 +4264,19 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4111
4264
|
{
|
|
4112
4265
|
const gfnNode = bindingGenericFnNodeOf(decl) ?? bindingContextualGenericFnNodeOf(lowerer, decl);
|
|
4113
4266
|
if (gfnNode) {
|
|
4114
|
-
bindingGenericFnInfoOf(lowerer, decl, gfnNode);
|
|
4115
|
-
|
|
4267
|
+
const info = bindingGenericFnInfoOf(lowerer, decl, gfnNode);
|
|
4268
|
+
// A nested function that lowered before this declaration read the
|
|
4269
|
+
// binding as an ordinary TDZ box (predeclareForwardCapture); the
|
|
4270
|
+
// declaration initializes it, so those reads see the function once
|
|
4271
|
+
// it runs and a ReferenceError before.
|
|
4272
|
+
const symbol = lowerer.checker.getSymbolAtLocation(decl.name);
|
|
4273
|
+
const pre = symbol ? lowerer.ctx.tdzPredeclared.get(symbol) : undefined;
|
|
4274
|
+
if (pre) {
|
|
4275
|
+
lowerer.ctx.tdzPredeclared.delete(symbol);
|
|
4276
|
+
const value = genericBindingStoredValue(lowerer, decl, info);
|
|
4277
|
+
return { kind: "assign", localId: pre.id, value, initializes: true, loc: locOf(decl) };
|
|
4278
|
+
}
|
|
4279
|
+
return genericBindingPresenceStore(info, decl);
|
|
4116
4280
|
}
|
|
4117
4281
|
}
|
|
4118
4282
|
// `const h = id` — an ALIAS of a generic function: the alias's symbol
|
|
@@ -4379,6 +4543,9 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4379
4543
|
!hasJsTypeAnnotation(decl) &&
|
|
4380
4544
|
init.type.kind === "func")
|
|
4381
4545
|
type = init.type;
|
|
4546
|
+
// Promise.prototype is an ordinary object the checker types Promise<any>.
|
|
4547
|
+
if (!decl.type && !hasJsTypeAnnotation(decl) && isPromisePrototypeRead(lowerer, decl.initializer))
|
|
4548
|
+
type = DYN;
|
|
4382
4549
|
// A typed-arguments function expression (typed-arguments.ts): the
|
|
4383
4550
|
// checker types the binding variadic, but its value has the fixed
|
|
4384
4551
|
// signature every use asserts.
|
|
@@ -4494,6 +4661,17 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4494
4661
|
}
|
|
4495
4662
|
}
|
|
4496
4663
|
}
|
|
4664
|
+
// A TypeScript `const nodes = [];` filled by later writes: the checker
|
|
4665
|
+
// types each read by the elements written before it (evolvingArrayType).
|
|
4666
|
+
if (returnedEmptyArrayType === null &&
|
|
4667
|
+
!decl.type &&
|
|
4668
|
+
!isJsSourceFile(ts.getSourceFileOfNode(decl))) {
|
|
4669
|
+
const evolved = evolvingArrayType(lowerer, decl);
|
|
4670
|
+
if (evolved !== null) {
|
|
4671
|
+
type = evolved;
|
|
4672
|
+
init = lowerer.lowerExprExpecting(decl.initializer, evolved);
|
|
4673
|
+
}
|
|
4674
|
+
}
|
|
4497
4675
|
// An unannotated binding holding an OOB-SAFE indexed read (`elem |
|
|
4498
4676
|
// undefined`) where the checker spells the bare element: the binding
|
|
4499
4677
|
// adopts the runtime-honest union. This covers both inferred package JS
|
|
@@ -4561,7 +4739,28 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4561
4739
|
// `let` may be reassigned a different shape later; genuine `any`
|
|
4562
4740
|
// only — every other unmappable keeps its own diagnostic.
|
|
4563
4741
|
const checkerAny = (lowerer.typeOf(decl.name).flags & ts.TypeFlags.Any) !== 0;
|
|
4564
|
-
|
|
4742
|
+
// An annotation the checker could not resolve (a package type alias that
|
|
4743
|
+
// reads as `any`) over an empty object literal: the binding is a
|
|
4744
|
+
// dictionary the code fills by key (`files[name] = entry`), which the
|
|
4745
|
+
// empty struct the literal would adopt cannot hold. It holds the
|
|
4746
|
+
// checked-dynamic object instead.
|
|
4747
|
+
let emptyAnyDictionary = false;
|
|
4748
|
+
if (checkerAny && decl.type && !isLet && init.type.kind === "record") {
|
|
4749
|
+
let lit = decl.initializer;
|
|
4750
|
+
while (ts.isParenthesizedExpression(lit))
|
|
4751
|
+
lit = lit.expression;
|
|
4752
|
+
const shape = lowerer.shapes.get(init.type.shapeId);
|
|
4753
|
+
if (ts.isObjectLiteralExpression(lit) &&
|
|
4754
|
+
lit.properties.nodes.length === 0 &&
|
|
4755
|
+
shape &&
|
|
4756
|
+
shape.fields.length === 0 &&
|
|
4757
|
+
!shape.indexValue) {
|
|
4758
|
+
type = DYN;
|
|
4759
|
+
emptyAnyDictionary = true;
|
|
4760
|
+
}
|
|
4761
|
+
}
|
|
4762
|
+
if (!emptyAnyDictionary &&
|
|
4763
|
+
(type === null || (type.kind === "dyn" && checkerAny)) &&
|
|
4565
4764
|
!isLet &&
|
|
4566
4765
|
(checkerAny ||
|
|
4567
4766
|
(lowerer.checkerAnyArray(decl.name) && lowerer.isArrayValueType(init.type)) ||
|
|
@@ -4976,8 +5175,68 @@ export function jsBindingHasOpenWrites(lowerer, decl) {
|
|
|
4976
5175
|
writes = indexed;
|
|
4977
5176
|
lowerer.jsBindingWritesByOwner.set(owner, writes);
|
|
4978
5177
|
}
|
|
4979
|
-
|
|
4980
|
-
|
|
5178
|
+
const candidates = (writes.get(decl.name.text) ?? []).filter((node) => lowerer.resolveValueSymbol(node.left) === symbol);
|
|
5179
|
+
if (candidates.some((node) => (lowerer.typeOf(node.right).flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) !== 0))
|
|
5180
|
+
return true;
|
|
5181
|
+
// A write that can store null or undefined into a binding the checker
|
|
5182
|
+
// types as a primitive (`offset = match[3] || null`): JavaScript files
|
|
5183
|
+
// are checked without strict null checks, so the declared type does not
|
|
5184
|
+
// admit them.
|
|
5185
|
+
// The declared type is mapped only when such a write exists.
|
|
5186
|
+
if (candidates.some((node) => node.operatorToken.kind === ts.SyntaxKind.EqualsToken && mayBeNullish(node.right))) {
|
|
5187
|
+
const primitive = lowerer.mapTypeOf(lowerer.typeOf(decl.name));
|
|
5188
|
+
if (primitive?.kind === "string" || primitive?.kind === "f64" || primitive?.kind === "bool")
|
|
5189
|
+
return true;
|
|
5190
|
+
}
|
|
5191
|
+
// A plain JavaScript write of a value the declared type cannot hold (the
|
|
5192
|
+
// checker does not report it): buffer-crc32 replaces its number[] table
|
|
5193
|
+
// with `new Int32Array(table)`. Only a different representation counts;
|
|
5194
|
+
// writes that coerce into the declared type keep it.
|
|
5195
|
+
// A write whose checker type is the declaration's own maps to the same
|
|
5196
|
+
// representation; the declared type is mapped only for the others.
|
|
5197
|
+
const declaredType = lowerer.typeOf(decl.name);
|
|
5198
|
+
const differing = candidates.filter((node) => node.operatorToken.kind === ts.SyntaxKind.EqualsToken &&
|
|
5199
|
+
lowerer.typeOf(node.right) !== declaredType);
|
|
5200
|
+
if (differing.length === 0)
|
|
5201
|
+
return false;
|
|
5202
|
+
const declared = lowerer.mapTypeOf(declaredType);
|
|
5203
|
+
if (declared === null || declared.kind === "dyn" || declared.kind === "union")
|
|
5204
|
+
return false;
|
|
5205
|
+
return differing.some((node) => {
|
|
5206
|
+
const written = lowerer.mapTypeOf(lowerer.typeOf(node.right));
|
|
5207
|
+
return (written !== null &&
|
|
5208
|
+
written.kind !== "dyn" &&
|
|
5209
|
+
written.kind !== "union" &&
|
|
5210
|
+
!isUnitType(written) &&
|
|
5211
|
+
lowerer.dynConvertible(written) &&
|
|
5212
|
+
lowerer.dynConvertible(declared) &&
|
|
5213
|
+
!typeEquals(written, declared) &&
|
|
5214
|
+
(written.kind !== declared.kind || written.kind === "bytes"));
|
|
5215
|
+
});
|
|
5216
|
+
}
|
|
5217
|
+
/** Whether `node` can evaluate to null or undefined by its form: the
|
|
5218
|
+
* literals, `void`, and conditional or logical expressions with such an
|
|
5219
|
+
* operand in result position. */
|
|
5220
|
+
function mayBeNullish(node) {
|
|
5221
|
+
while (ts.isParenthesizedExpression(node))
|
|
5222
|
+
node = node.expression;
|
|
5223
|
+
if (node.kind === ts.SyntaxKind.NullKeyword || ts.isVoidExpression(node))
|
|
5224
|
+
return true;
|
|
5225
|
+
if (ts.isIdentifier(node))
|
|
5226
|
+
return node.text === "undefined";
|
|
5227
|
+
if (ts.isConditionalExpression(node))
|
|
5228
|
+
return mayBeNullish(node.whenTrue) || mayBeNullish(node.whenFalse);
|
|
5229
|
+
if (ts.isBinaryExpression(node)) {
|
|
5230
|
+
const op = node.operatorToken.kind;
|
|
5231
|
+
if (op === ts.SyntaxKind.BarBarToken ||
|
|
5232
|
+
op === ts.SyntaxKind.QuestionQuestionToken ||
|
|
5233
|
+
op === ts.SyntaxKind.AmpersandAmpersandToken)
|
|
5234
|
+
return (mayBeNullish(node.right) ||
|
|
5235
|
+
(op === ts.SyntaxKind.AmpersandAmpersandToken && mayBeNullish(node.left)));
|
|
5236
|
+
if (op === ts.SyntaxKind.CommaToken)
|
|
5237
|
+
return mayBeNullish(node.right);
|
|
5238
|
+
}
|
|
5239
|
+
return false;
|
|
4981
5240
|
}
|
|
4982
5241
|
function immediatelyGuardedAbsenceProbe(lowerer, decl) {
|
|
4983
5242
|
const guard = immediateAbsenceGuard(lowerer, decl);
|
|
@@ -5954,16 +6213,12 @@ export function lowerExprStatement(lowerer, expr) {
|
|
|
5954
6213
|
if (!isRelativeSpecifier(spec) && canonicalBuiltinModule(spec) === null) {
|
|
5955
6214
|
const refusal = probeNodeRequireRefusal(sf.fileName, spec);
|
|
5956
6215
|
if (refusal !== null) {
|
|
6216
|
+
// The same throw as the expression form (cjs-inline-require):
|
|
6217
|
+
// an Error carrying Node's MODULE_NOT_FOUND code.
|
|
5957
6218
|
const loc = locOf(expr);
|
|
5958
6219
|
return {
|
|
5959
|
-
kind: "
|
|
5960
|
-
|
|
5961
|
-
kind: "libCall",
|
|
5962
|
-
fn: "error.new",
|
|
5963
|
-
args: [{ kind: "strLit", value: refusal.message, type: STRING, loc }],
|
|
5964
|
-
type: { kind: "object", className: "%Error" },
|
|
5965
|
-
loc,
|
|
5966
|
-
},
|
|
6220
|
+
kind: "exprStmt",
|
|
6221
|
+
expr: nodeThrowExpr(0, "MODULE_NOT_FOUND", refusal.message, VOID, loc),
|
|
5967
6222
|
loc,
|
|
5968
6223
|
};
|
|
5969
6224
|
}
|
|
@@ -6235,8 +6490,9 @@ export function lowerExprStatement(lowerer, expr) {
|
|
|
6235
6490
|
// (closures box), the runtime sets the member on OBJ receivers
|
|
6236
6491
|
// and throws Node's TypeErrors on the rest. The receiver is
|
|
6237
6492
|
// PROBED (tryLowerExpression) and claimed exactly when it lowers to
|
|
6238
|
-
// dyn; typed receivers keep their own lowerings and fences.
|
|
6239
|
-
|
|
6493
|
+
// dyn; typed receivers keep their own lowerings and fences. A
|
|
6494
|
+
// private name is the field of its class (fieldTarget).
|
|
6495
|
+
if (!expr.left.questionDotToken && !ts.isPrivateIdentifier(expr.left.name)) {
|
|
6240
6496
|
const recv = tryLowerExpression(lowerer, expr.left.expression);
|
|
6241
6497
|
if (recv && recv.type.kind === "dyn") {
|
|
6242
6498
|
const loc = locOf(expr);
|
|
@@ -6438,6 +6694,8 @@ export function lowerExprStatement(lowerer, expr) {
|
|
|
6438
6694
|
loc,
|
|
6439
6695
|
};
|
|
6440
6696
|
}
|
|
6697
|
+
if (recv?.type.kind === "child" && isJsSourceFile(ts.getSourceFileOfNode(expr)))
|
|
6698
|
+
return lowerChildPropertyWrite(lowerer, recv, expr.left, expr.right, locOf(expr));
|
|
6441
6699
|
// `err.code = v` on an Error value (`err as Error & { code?:
|
|
6442
6700
|
// string }`): typed reads come from the runtime error's code
|
|
6443
6701
|
// slot, so the write lands there. A value that is not statically
|
|
@@ -7413,7 +7671,7 @@ function lowerAssignTargetInto(lowerer, out, targetNode, blame, dflt, valueOf) {
|
|
|
7413
7671
|
if (arr.type.kind === "array") {
|
|
7414
7672
|
const recv = lowerer.declareHiddenLocal("%dtRecv", arr.type);
|
|
7415
7673
|
out.push({ kind: "varDecl", localId: recv.id, init: arr, loc });
|
|
7416
|
-
const index = lowerer.lowerExpr(t.argumentExpression);
|
|
7674
|
+
const index = lowerOptionalNumber(lowerer, lowerer.lowerExpr(t.argumentExpression), locOf(t.argumentExpression), t.argumentExpression);
|
|
7417
7675
|
if (index.type.kind !== "f64") {
|
|
7418
7676
|
lowerer.unsupported("SC1090", t.argumentExpression, "indexing with non-number keys");
|
|
7419
7677
|
}
|
|
@@ -7426,6 +7684,30 @@ function lowerAssignTargetInto(lowerer, out, targetNode, blame, dflt, valueOf) {
|
|
|
7426
7684
|
return;
|
|
7427
7685
|
}
|
|
7428
7686
|
}
|
|
7687
|
+
else if (recvT?.kind === "bytes") {
|
|
7688
|
+
// A typed-array element (`[a[i], b[i]] = [h, l]`): the receiver, then
|
|
7689
|
+
// the index, then the value, as the plain element write `b[i] = v`
|
|
7690
|
+
// stores it (an f64 the runtime coerces; invalid indices are ignored).
|
|
7691
|
+
const arr = lowerer.lowerExpr(t.expression);
|
|
7692
|
+
if (arr.type.kind === "bytes") {
|
|
7693
|
+
const recv = lowerer.declareHiddenLocal("%dtRecv", arr.type);
|
|
7694
|
+
out.push({ kind: "varDecl", localId: recv.id, init: arr, loc });
|
|
7695
|
+
const index = lowerer.lowerExpr(t.argumentExpression);
|
|
7696
|
+
if (index.type.kind !== "f64") {
|
|
7697
|
+
lowerer.unsupported("SC1090", t.argumentExpression, "indexing with non-number keys");
|
|
7698
|
+
}
|
|
7699
|
+
const idx = lowerer.declareHiddenLocal("%dtIdx", F64);
|
|
7700
|
+
out.push({ kind: "varDecl", localId: idx.id, init: index, loc });
|
|
7701
|
+
out.push({
|
|
7702
|
+
kind: "bytesSet",
|
|
7703
|
+
arr: varRef(recv.id, arr.type, loc),
|
|
7704
|
+
index: varRef(idx.id, F64, loc),
|
|
7705
|
+
value: lowerer.coerceInto(blame, valueOf(F64), F64),
|
|
7706
|
+
loc,
|
|
7707
|
+
});
|
|
7708
|
+
return;
|
|
7709
|
+
}
|
|
7710
|
+
}
|
|
7429
7711
|
else if (recvT?.kind === "record") {
|
|
7430
7712
|
// Tuple positions and LITERAL declared record keys are field
|
|
7431
7713
|
// writes (the element-write lowering's own rule); runtime keys
|
|
@@ -7727,6 +8009,14 @@ function lowerArrayAssignInto(lowerer, out, target, tmpRef, blame, loc) {
|
|
|
7727
8009
|
* specific diagnostics; other iterables fail on their types. The loop
|
|
7728
8010
|
* variable is a fresh const binding per iteration (its own scope, like a
|
|
7729
8011
|
* loop body). */
|
|
8012
|
+
/** Whether a `for await` head is untyped: the checker answers any or
|
|
8013
|
+
* unknown, or a type that maps to a checked-dynamic value. */
|
|
8014
|
+
function isUntypedIterable(lowerer, node) {
|
|
8015
|
+
const type = lowerer.typeOf(node);
|
|
8016
|
+
if ((type.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) !== 0)
|
|
8017
|
+
return true;
|
|
8018
|
+
return lowerer.mapTypeOf(type)?.kind === "dyn";
|
|
8019
|
+
}
|
|
7730
8020
|
export function lowerForOf(lowerer, stmt) {
|
|
7731
8021
|
// Labels consume HERE (nested statements must never see them). The
|
|
7732
8022
|
// plain array/string paths carry them; the container/matchAll/stdin
|
|
@@ -7770,13 +8060,34 @@ export function lowerForOf(lowerer, stmt) {
|
|
|
7770
8060
|
lowerer.stdlibGlobalMember(stmt.expression, "process") === "stdin") {
|
|
7771
8061
|
return lowerForAwaitStdin(lowerer, stmt);
|
|
7772
8062
|
}
|
|
7773
|
-
// A checked-dynamic NodeJS.ReadableStream iterates its native stream
|
|
7774
|
-
|
|
8063
|
+
// A checked-dynamic NodeJS.ReadableStream iterates its native stream,
|
|
8064
|
+
// and a Hash, Hmac, Cipheriv or Decipheriv iterates its Transform.
|
|
8065
|
+
const dynStream = lowerForAwaitDynStream(lowerer, stmt, () => lowerForAwaitBuiltin(lowerer, stmt)) ??
|
|
8066
|
+
lowerForAwaitValueStream(lowerer, stmt, () => lowerForAwaitBuiltin(lowerer, stmt));
|
|
7775
8067
|
if (dynStream)
|
|
7776
8068
|
return dynStream;
|
|
7777
8069
|
const builtin = lowerForAwaitBuiltin(lowerer, stmt);
|
|
7778
8070
|
if (builtin)
|
|
7779
8071
|
return builtin;
|
|
8072
|
+
// An untyped value (a JavaScript async generator whose recursive
|
|
8073
|
+
// return the checker types `any`): a compiled async generator steps
|
|
8074
|
+
// natively; any other value takes the checked-dynamic async protocol.
|
|
8075
|
+
// A synchronous generator, and in JavaScript any other head that
|
|
8076
|
+
// reaches here, takes the same protocol: values of a synchronous
|
|
8077
|
+
// iterator are awaited as the async-from-sync iterator awaits them, and
|
|
8078
|
+
// a value that is not iterable throws Node's TypeError.
|
|
8079
|
+
const headT = lowerer.mapTypeOf(lowerer.typeOf(stmt.expression));
|
|
8080
|
+
const syncGenerator = (headT?.kind === "generator" && headT.async !== true) || isJsSourceFile(stmt.getSourceFile());
|
|
8081
|
+
if (lowerer.ctx.isAsync && (syncGenerator || isUntypedIterable(lowerer, stmt.expression))) {
|
|
8082
|
+
const iterable = lowerer.lowerExpr(stmt.expression);
|
|
8083
|
+
if (iterable.type.kind === "generator" && iterable.type.async)
|
|
8084
|
+
return lowerForAwaitGenerator(lowerer, stmt, iterable, labels);
|
|
8085
|
+
if (iterable.type.kind === "dyn")
|
|
8086
|
+
return lowerForOfDyn(lowerer, stmt, iterable, labels, true);
|
|
8087
|
+
if ((iterable.type.kind === "generator" || isJsSourceFile(stmt.getSourceFile())) &&
|
|
8088
|
+
lowerer.dynConvertible(iterable.type))
|
|
8089
|
+
return lowerForOfDyn(lowerer, stmt, lowerer.coerceToExpected(iterable, DYN), labels, true);
|
|
8090
|
+
}
|
|
7780
8091
|
// A NodeJS.ReadableStream iterates as the general Readable.
|
|
7781
8092
|
requestGeneralStreamSurface(lowerer, stmt.expression);
|
|
7782
8093
|
lowerer.unsupported("SC1070", stmt, "'for await' over this value (supported: typed async generators, represented class async iterators, process.stdin, and Node/Web readable streams)");
|
|
@@ -8035,9 +8346,11 @@ export function lowerForOf(lowerer, stmt) {
|
|
|
8035
8346
|
}
|
|
8036
8347
|
// A CHECKED-DYNAMIC iterable (`unknown[]`, the collapsed
|
|
8037
8348
|
// `(string | object)[]`, JSON-parsed values): a checked IteratorRecord
|
|
8038
|
-
// binds each yielded dyn value.
|
|
8349
|
+
// binds each yielded dyn value. Under `for await` (a JavaScript array
|
|
8350
|
+
// literal mixing promises and plain values) the async-from-sync rules
|
|
8351
|
+
// await each value.
|
|
8039
8352
|
if (iterable.type.kind === "dyn") {
|
|
8040
|
-
return lowerForOfDyn(lowerer, stmt, iterable, labels);
|
|
8353
|
+
return lowerForOfDyn(lowerer, stmt, iterable, labels, stmt.awaitModifier !== undefined);
|
|
8041
8354
|
}
|
|
8042
8355
|
if (tupleSource === null) {
|
|
8043
8356
|
lowerer.badType(stmt.expression, lowerer.typeOf(stmt.expression));
|
|
@@ -8941,24 +9254,9 @@ function lowerForOfClassIterator(lowerer, stmt, iterable, cit, labels) {
|
|
|
8941
9254
|
/** A checked IteratorRecord stays live throughout the loop. Cache next once,
|
|
8942
9255
|
* read done before value, and close only after a yielded value has arrived.
|
|
8943
9256
|
* Abrupt body throws retain precedence over errors raised by return(). */
|
|
8944
|
-
function lowerForOfDyn(lowerer, stmt, iterable, labels) {
|
|
9257
|
+
function lowerForOfDyn(lowerer, stmt, iterable, labels, asyncLoop = false) {
|
|
8945
9258
|
const loc = locOf(stmt);
|
|
8946
|
-
const
|
|
8947
|
-
if (ts.isIdentifier(e))
|
|
8948
|
-
return e.text;
|
|
8949
|
-
if (ts.isPropertyAccessExpression(e) && !e.questionDotToken && ts.isIdentifier(e.name)) {
|
|
8950
|
-
const base = headText(e.expression);
|
|
8951
|
-
return base === null ? null : `${base}.${e.name.text}`;
|
|
8952
|
-
}
|
|
8953
|
-
return null;
|
|
8954
|
-
};
|
|
8955
|
-
const name = headText(stmt.expression);
|
|
8956
|
-
const callee = ts.isCallExpression(stmt.expression) ? headText(stmt.expression.expression) : null;
|
|
8957
|
-
const spell = name !== null
|
|
8958
|
-
? `${name} is not iterable`
|
|
8959
|
-
: callee !== null
|
|
8960
|
-
? `${callee} is not a function or its return value is not iterable`
|
|
8961
|
-
: "";
|
|
9259
|
+
const spell = notIterableSpelling(stmt.expression, asyncLoop ? "async iterable" : "iterable");
|
|
8962
9260
|
const iterator = lowerer.declareHiddenLocal("%dofIterator", DYN);
|
|
8963
9261
|
const next = lowerer.declareHiddenLocal("%dofNext", DYN);
|
|
8964
9262
|
const fast = lowerer.declareHiddenLocal("%dofNative", BOOL);
|
|
@@ -8969,6 +9267,14 @@ function lowerForOfDyn(lowerer, stmt, iterable, labels) {
|
|
|
8969
9267
|
const needsClose = lowerer.declareHiddenLocal("%dofNeedsClose", BOOL);
|
|
8970
9268
|
needsClose.mutable = true;
|
|
8971
9269
|
const error = lowerer.declareHiddenLocal("%dofError", CAUGHT);
|
|
9270
|
+
const syncIterator = asyncLoop ? lowerer.declareHiddenLocal("%dofSync", BOOL) : null;
|
|
9271
|
+
const awaitDyn = (value) => ({
|
|
9272
|
+
kind: "libCall",
|
|
9273
|
+
fn: "async.awaitDyn",
|
|
9274
|
+
args: [value],
|
|
9275
|
+
type: DYN,
|
|
9276
|
+
loc,
|
|
9277
|
+
});
|
|
8972
9278
|
const get = (source, key) => ({
|
|
8973
9279
|
kind: "dynKeyGet",
|
|
8974
9280
|
value: source,
|
|
@@ -9020,7 +9326,24 @@ function lowerForOfDyn(lowerer, stmt, iterable, labels) {
|
|
|
9020
9326
|
type: BOOL,
|
|
9021
9327
|
loc,
|
|
9022
9328
|
},
|
|
9023
|
-
then: [
|
|
9329
|
+
then: [
|
|
9330
|
+
{
|
|
9331
|
+
kind: "exprStmt",
|
|
9332
|
+
// return()'s (awaited) result must be an object, as for next().
|
|
9333
|
+
expr: asyncLoop
|
|
9334
|
+
? check(awaitDyn({
|
|
9335
|
+
kind: "dynCall",
|
|
9336
|
+
callee: varRef(returned.id, DYN, loc),
|
|
9337
|
+
receiver: varRef(iterator.id, DYN, loc),
|
|
9338
|
+
calleeName: "iterator method",
|
|
9339
|
+
args: [],
|
|
9340
|
+
type: DYN,
|
|
9341
|
+
loc,
|
|
9342
|
+
}))
|
|
9343
|
+
: call(varRef(returned.id, DYN, loc)),
|
|
9344
|
+
loc,
|
|
9345
|
+
},
|
|
9346
|
+
],
|
|
9024
9347
|
else_: null,
|
|
9025
9348
|
loc,
|
|
9026
9349
|
},
|
|
@@ -9101,7 +9424,9 @@ function lowerForOfDyn(lowerer, stmt, iterable, labels) {
|
|
|
9101
9424
|
{
|
|
9102
9425
|
kind: "varDecl",
|
|
9103
9426
|
localId: value.id,
|
|
9104
|
-
init:
|
|
9427
|
+
init: syncIterator
|
|
9428
|
+
? asyncIteratorValue(lowerer, varRef(iterator.id, DYN, loc), varRef(next.id, DYN, loc), varRef(syncIterator.id, BOOL, loc), done, loc)
|
|
9429
|
+
: iteratorValue(lowerer, varRef(iterator.id, DYN, loc), varRef(next.id, DYN, loc), varRef(fast.id, BOOL, loc), done, loc, "iterator method"),
|
|
9105
9430
|
loc,
|
|
9106
9431
|
},
|
|
9107
9432
|
{
|
|
@@ -9126,13 +9451,29 @@ function lowerForOfDyn(lowerer, stmt, iterable, labels) {
|
|
|
9126
9451
|
localId: iterator.id,
|
|
9127
9452
|
init: check({
|
|
9128
9453
|
kind: "libCall",
|
|
9129
|
-
fn: "dyn.iterator",
|
|
9454
|
+
fn: asyncLoop ? "dyn.asyncIteratorOpen" : "dyn.iterator",
|
|
9130
9455
|
args: [iterable, { kind: "strLit", value: spell, type: STRING, loc }],
|
|
9131
9456
|
type: DYN,
|
|
9132
9457
|
loc,
|
|
9133
9458
|
}),
|
|
9134
9459
|
loc,
|
|
9135
9460
|
},
|
|
9461
|
+
...(syncIterator
|
|
9462
|
+
? [
|
|
9463
|
+
{
|
|
9464
|
+
kind: "varDecl",
|
|
9465
|
+
localId: syncIterator.id,
|
|
9466
|
+
init: {
|
|
9467
|
+
kind: "libCall",
|
|
9468
|
+
fn: "dyn.asyncIteratorWasSync",
|
|
9469
|
+
args: [],
|
|
9470
|
+
type: BOOL,
|
|
9471
|
+
loc,
|
|
9472
|
+
},
|
|
9473
|
+
loc,
|
|
9474
|
+
},
|
|
9475
|
+
]
|
|
9476
|
+
: []),
|
|
9136
9477
|
{
|
|
9137
9478
|
kind: "varDecl",
|
|
9138
9479
|
localId: next.id,
|
|
@@ -9142,7 +9483,9 @@ function lowerForOfDyn(lowerer, stmt, iterable, labels) {
|
|
|
9142
9483
|
{
|
|
9143
9484
|
kind: "varDecl",
|
|
9144
9485
|
localId: fast.id,
|
|
9145
|
-
init:
|
|
9486
|
+
init: asyncLoop
|
|
9487
|
+
? { kind: "boolLit", value: false, type: BOOL, loc }
|
|
9488
|
+
: iteratorCanStep(varRef(iterator.id, DYN, loc), varRef(next.id, DYN, loc), loc),
|
|
9146
9489
|
loc,
|
|
9147
9490
|
},
|
|
9148
9491
|
{
|
|
@@ -9194,6 +9537,91 @@ function lowerForOfDyn(lowerer, stmt, iterable, labels) {
|
|
|
9194
9537
|
lowerer.scopes.pop();
|
|
9195
9538
|
}
|
|
9196
9539
|
}
|
|
9540
|
+
/** One step of `for await` over a checked-dynamic iterator: await next()'s
|
|
9541
|
+
* result, read done before value, and await each value of a synchronous
|
|
9542
|
+
* iterator, including its final one, as the async-from-sync iterator does. */
|
|
9543
|
+
function asyncIteratorValue(lowerer, iterator, next, sync, done, loc) {
|
|
9544
|
+
const result = lowerer.declareHiddenLocal("%asyncIteratorResult", DYN);
|
|
9545
|
+
const get = (key) => ({
|
|
9546
|
+
kind: "dynKeyGet",
|
|
9547
|
+
value: varRef(result.id, DYN, loc),
|
|
9548
|
+
key: { kind: "strLit", value: key, type: STRING, loc },
|
|
9549
|
+
type: DYN,
|
|
9550
|
+
loc,
|
|
9551
|
+
});
|
|
9552
|
+
const awaitDyn = (value) => ({
|
|
9553
|
+
kind: "libCall",
|
|
9554
|
+
fn: "async.awaitDyn",
|
|
9555
|
+
args: [value],
|
|
9556
|
+
type: DYN,
|
|
9557
|
+
loc,
|
|
9558
|
+
});
|
|
9559
|
+
return {
|
|
9560
|
+
kind: "seqExpr",
|
|
9561
|
+
type: DYN,
|
|
9562
|
+
loc,
|
|
9563
|
+
stmts: [
|
|
9564
|
+
{
|
|
9565
|
+
kind: "varDecl",
|
|
9566
|
+
localId: result.id,
|
|
9567
|
+
init: {
|
|
9568
|
+
kind: "libCall",
|
|
9569
|
+
fn: "dyn.iteratorResult",
|
|
9570
|
+
args: [
|
|
9571
|
+
awaitDyn({
|
|
9572
|
+
kind: "dynCall",
|
|
9573
|
+
callee: next,
|
|
9574
|
+
receiver: iterator,
|
|
9575
|
+
calleeName: "iterator method",
|
|
9576
|
+
args: [],
|
|
9577
|
+
type: DYN,
|
|
9578
|
+
loc,
|
|
9579
|
+
}),
|
|
9580
|
+
],
|
|
9581
|
+
type: DYN,
|
|
9582
|
+
loc,
|
|
9583
|
+
},
|
|
9584
|
+
loc,
|
|
9585
|
+
},
|
|
9586
|
+
{
|
|
9587
|
+
kind: "assign",
|
|
9588
|
+
localId: done.id,
|
|
9589
|
+
value: { kind: "dynTest", test: "truthy", value: get("done"), type: BOOL, loc },
|
|
9590
|
+
loc,
|
|
9591
|
+
},
|
|
9592
|
+
],
|
|
9593
|
+
// A synchronous iterator's final value is still read and awaited, so a
|
|
9594
|
+
// throwing getter or a rejected promise there rejects the loop.
|
|
9595
|
+
result: {
|
|
9596
|
+
kind: "ternary",
|
|
9597
|
+
cond: sync,
|
|
9598
|
+
then: {
|
|
9599
|
+
kind: "ternary",
|
|
9600
|
+
cond: varRef(done.id, BOOL, loc),
|
|
9601
|
+
then: {
|
|
9602
|
+
kind: "seqExpr",
|
|
9603
|
+
stmts: [{ kind: "exprStmt", expr: awaitDyn(get("value")), loc }],
|
|
9604
|
+
result: dynUndefinedExpr(loc),
|
|
9605
|
+
type: DYN,
|
|
9606
|
+
loc,
|
|
9607
|
+
},
|
|
9608
|
+
else_: awaitDyn(get("value")),
|
|
9609
|
+
type: DYN,
|
|
9610
|
+
loc,
|
|
9611
|
+
},
|
|
9612
|
+
else_: {
|
|
9613
|
+
kind: "ternary",
|
|
9614
|
+
cond: varRef(done.id, BOOL, loc),
|
|
9615
|
+
then: dynUndefinedExpr(loc),
|
|
9616
|
+
else_: get("value"),
|
|
9617
|
+
type: DYN,
|
|
9618
|
+
loc,
|
|
9619
|
+
},
|
|
9620
|
+
type: DYN,
|
|
9621
|
+
loc,
|
|
9622
|
+
},
|
|
9623
|
+
};
|
|
9624
|
+
}
|
|
9197
9625
|
function lowerForOfString(lowerer, stmt, iterable, labels) {
|
|
9198
9626
|
let exprTarget = null;
|
|
9199
9627
|
let exprTargetNode = null;
|
|
@@ -9596,10 +10024,23 @@ function lowerForInArray(lowerer, stmt, labels, arrExpr) {
|
|
|
9596
10024
|
try {
|
|
9597
10025
|
const arr = lowerer.declareHiddenLocal("%inarr", arrExpr.type);
|
|
9598
10026
|
const len = lowerer.declareHiddenLocal("%inlen", F64);
|
|
10027
|
+
const keysT = { kind: "array", elem: STRING };
|
|
10028
|
+
const keys = lowerer.declareHiddenLocal("%inkeys", keysT);
|
|
10029
|
+
const total = lowerer.declareHiddenLocal("%intotal", F64);
|
|
9599
10030
|
const i = lowerer.declareHiddenLocal("%ini", F64);
|
|
9600
10031
|
i.mutable = true;
|
|
9601
10032
|
const arrRef = () => ({ kind: "varRef", localId: arr.id, type: arrExpr.type, loc });
|
|
10033
|
+
const keysRef = () => ({ kind: "varRef", localId: keys.id, type: keysT, loc });
|
|
10034
|
+
const lenRef = () => ({ kind: "varRef", localId: len.id, type: F64, loc });
|
|
9602
10035
|
const iRef = () => ({ kind: "varRef", localId: i.id, type: F64, loc });
|
|
10036
|
+
const isIndex = () => ({
|
|
10037
|
+
kind: "bin",
|
|
10038
|
+
op: "<",
|
|
10039
|
+
left: iRef(),
|
|
10040
|
+
right: lenRef(),
|
|
10041
|
+
type: BOOL,
|
|
10042
|
+
loc,
|
|
10043
|
+
});
|
|
9603
10044
|
const liveLen = () => ({
|
|
9604
10045
|
kind: "arrIntrinsic",
|
|
9605
10046
|
method: "length",
|
|
@@ -9608,7 +10049,52 @@ function lowerForInArray(lowerer, stmt, labels, arrExpr) {
|
|
|
9608
10049
|
type: F64,
|
|
9609
10050
|
loc,
|
|
9610
10051
|
});
|
|
9611
|
-
|
|
10052
|
+
// Indices first, then the named keys the array had when the loop began.
|
|
10053
|
+
const namedKey = () => ({
|
|
10054
|
+
kind: "arrayGet",
|
|
10055
|
+
arr: keysRef(),
|
|
10056
|
+
index: { kind: "bin", op: "-", left: iRef(), right: lenRef(), type: F64, loc },
|
|
10057
|
+
type: STRING,
|
|
10058
|
+
loc,
|
|
10059
|
+
});
|
|
10060
|
+
const keyInit = {
|
|
10061
|
+
kind: "ternary",
|
|
10062
|
+
cond: isIndex(),
|
|
10063
|
+
then: { kind: "toString", operand: iRef(), type: STRING, loc },
|
|
10064
|
+
else_: namedKey(),
|
|
10065
|
+
type: STRING,
|
|
10066
|
+
loc,
|
|
10067
|
+
};
|
|
10068
|
+
// An index is visited while it is below the live length and not a hole,
|
|
10069
|
+
// a named key while the array still has it.
|
|
10070
|
+
const visits = {
|
|
10071
|
+
kind: "ternary",
|
|
10072
|
+
cond: isIndex(),
|
|
10073
|
+
then: {
|
|
10074
|
+
kind: "logical",
|
|
10075
|
+
op: "&&",
|
|
10076
|
+
left: { kind: "bin", op: "<", left: iRef(), right: liveLen(), type: BOOL, loc },
|
|
10077
|
+
right: {
|
|
10078
|
+
kind: "bin",
|
|
10079
|
+
op: "!==",
|
|
10080
|
+
left: { kind: "arrayState", arr: arrRef(), index: iRef(), type: F64, loc },
|
|
10081
|
+
right: { kind: "numLit", value: 0, type: F64, loc },
|
|
10082
|
+
type: BOOL,
|
|
10083
|
+
loc,
|
|
10084
|
+
},
|
|
10085
|
+
type: BOOL,
|
|
10086
|
+
loc,
|
|
10087
|
+
},
|
|
10088
|
+
else_: {
|
|
10089
|
+
kind: "libCall",
|
|
10090
|
+
fn: "array.hasNamedKey",
|
|
10091
|
+
args: [arrRef(), namedKey()],
|
|
10092
|
+
type: BOOL,
|
|
10093
|
+
loc,
|
|
10094
|
+
},
|
|
10095
|
+
type: BOOL,
|
|
10096
|
+
loc,
|
|
10097
|
+
};
|
|
9612
10098
|
// The three binding forms, sharing the per-visit key declaration.
|
|
9613
10099
|
let keyDecl;
|
|
9614
10100
|
let writes = [];
|
|
@@ -9661,6 +10147,32 @@ function lowerForInArray(lowerer, stmt, labels, arrExpr) {
|
|
|
9661
10147
|
body: [
|
|
9662
10148
|
{ kind: "varDecl", localId: arr.id, init: arrExpr, loc },
|
|
9663
10149
|
{ kind: "varDecl", localId: len.id, init: liveLen(), loc },
|
|
10150
|
+
{
|
|
10151
|
+
kind: "varDecl",
|
|
10152
|
+
localId: keys.id,
|
|
10153
|
+
init: { kind: "libCall", fn: "array.namedKeys", args: [arrRef()], type: keysT, loc },
|
|
10154
|
+
loc,
|
|
10155
|
+
},
|
|
10156
|
+
{
|
|
10157
|
+
kind: "varDecl",
|
|
10158
|
+
localId: total.id,
|
|
10159
|
+
init: {
|
|
10160
|
+
kind: "bin",
|
|
10161
|
+
op: "+",
|
|
10162
|
+
left: lenRef(),
|
|
10163
|
+
right: {
|
|
10164
|
+
kind: "arrIntrinsic",
|
|
10165
|
+
method: "length",
|
|
10166
|
+
receiver: keysRef(),
|
|
10167
|
+
args: [],
|
|
10168
|
+
type: F64,
|
|
10169
|
+
loc,
|
|
10170
|
+
},
|
|
10171
|
+
type: F64,
|
|
10172
|
+
loc,
|
|
10173
|
+
},
|
|
10174
|
+
loc,
|
|
10175
|
+
},
|
|
9664
10176
|
{
|
|
9665
10177
|
kind: "for",
|
|
9666
10178
|
init: {
|
|
@@ -9673,7 +10185,7 @@ function lowerForInArray(lowerer, stmt, labels, arrExpr) {
|
|
|
9673
10185
|
kind: "bin",
|
|
9674
10186
|
op: "<",
|
|
9675
10187
|
left: iRef(),
|
|
9676
|
-
right: { kind: "varRef", localId:
|
|
10188
|
+
right: { kind: "varRef", localId: total.id, type: F64, loc },
|
|
9677
10189
|
type: BOOL,
|
|
9678
10190
|
loc,
|
|
9679
10191
|
},
|
|
@@ -9693,7 +10205,7 @@ function lowerForInArray(lowerer, stmt, labels, arrExpr) {
|
|
|
9693
10205
|
body: [
|
|
9694
10206
|
{
|
|
9695
10207
|
kind: "if",
|
|
9696
|
-
cond:
|
|
10208
|
+
cond: visits,
|
|
9697
10209
|
then: [keyDecl, ...writes, ...body],
|
|
9698
10210
|
else_: null,
|
|
9699
10211
|
loc,
|
|
@@ -9821,17 +10333,20 @@ export function lowerForStatement(lowerer, stmt) {
|
|
|
9821
10333
|
lowerer.scopes.pop();
|
|
9822
10334
|
}
|
|
9823
10335
|
}
|
|
9824
|
-
/** safe-buffer's `var Buffer = buffer.Buffer`
|
|
9825
|
-
*
|
|
9826
|
-
*
|
|
9827
|
-
*
|
|
9828
|
-
*
|
|
10336
|
+
/** safe-buffer's `var Buffer = buffer.Buffer` (or `var pna = process`, the
|
|
10337
|
+
* process-nextick-args binding once it compiles as process) at file scope:
|
|
10338
|
+
* a `var` alias of a surfaced global other than the global object itself
|
|
10339
|
+
* is the same alias plumbing as the const spelling when nothing reassigns
|
|
10340
|
+
* it and no code that runs before the declaration can read it (the
|
|
10341
|
+
* require-binding early-reference analysis), so the hoisted undefined is
|
|
10342
|
+
* unobservable. */
|
|
9829
10343
|
export function stdlibBufferVarAlias(lowerer, decl) {
|
|
9830
10344
|
if (!ts.isIdentifier(decl.name) ||
|
|
9831
10345
|
!ts.isVariableDeclarationList(decl.parent) ||
|
|
9832
10346
|
(decl.parent.flags & (ts.NodeFlags.Let | ts.NodeFlags.Const)) !== 0 ||
|
|
9833
10347
|
decl.initializer === undefined ||
|
|
9834
|
-
!bufferNamespaceMember(lowerer, decl.initializer)
|
|
10348
|
+
!(bufferNamespaceMember(lowerer, decl.initializer) ||
|
|
10349
|
+
(stdlibGlobalAliasNameOf(lowerer, decl.initializer) ?? "globalThis") !== "globalThis"))
|
|
9835
10350
|
return false;
|
|
9836
10351
|
const symbol = lowerer.checker.getSymbolAtLocation(decl.name);
|
|
9837
10352
|
return (symbol !== undefined &&
|