@scriptc/compiler 0.3.6 → 0.4.1
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 +717 -55
- package/ambient/scriptc.d.ts +134 -0
- package/dist/backend/cycle-analysis.d.ts +1 -1
- package/dist/backend/cycle-analysis.js +1 -0
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-analysis.test.js +13 -1
- package/dist/backend/cycle-analysis.test.js.map +1 -1
- package/dist/backend/cycle-mutability.js +16 -5
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.js +20 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.test.js +1 -1
- package/dist/backend/library-pack.js +9 -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 +41 -4
- package/dist/backend/llvm/alloc.js +138 -7
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/alloc.test.js +30 -1
- package/dist/backend/llvm/alloc.test.js.map +1 -1
- package/dist/backend/llvm/appended-array-literals.test.js +1 -1
- package/dist/backend/llvm/array-search.js +3 -1
- package/dist/backend/llvm/array-search.js.map +1 -1
- package/dist/backend/llvm/array-search.test.js +1 -1
- package/dist/backend/llvm/blocks.d.ts +8 -0
- package/dist/backend/llvm/blocks.js +43 -1
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/blocks.test.js +22 -1
- package/dist/backend/llvm/blocks.test.js.map +1 -1
- package/dist/backend/llvm/byte-numbers.js +15 -5
- package/dist/backend/llvm/byte-numbers.js.map +1 -1
- package/dist/backend/llvm/bytes-alias.d.ts +14 -0
- package/dist/backend/llvm/bytes-alias.js +20 -0
- package/dist/backend/llvm/bytes-alias.js.map +1 -0
- package/dist/backend/llvm/bytes-loop-versions.d.ts +86 -0
- package/dist/backend/llvm/bytes-loop-versions.js +506 -0
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -0
- package/dist/backend/llvm/bytes-loop-versions.test.d.ts +1 -0
- package/dist/backend/llvm/bytes-loop-versions.test.js +244 -0
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -0
- package/dist/backend/llvm/call-lifetimes.js +50 -1
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +34 -0
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/checked-narrows.test.js +1 -1
- package/dist/backend/llvm/checked-value-lifetimes.js +4 -1
- package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +38 -1
- package/dist/backend/llvm/classes.js +185 -35
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +79 -17
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +21 -3
- package/dist/backend/llvm/common.js +51 -3
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.d.ts +5 -1
- package/dist/backend/llvm/constant-callbacks.js +55 -12
- package/dist/backend/llvm/constant-callbacks.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.test.js +88 -1
- package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
- package/dist/backend/llvm/counted-loops.d.ts +4 -0
- package/dist/backend/llvm/counted-loops.js +37 -0
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +15 -4
- package/dist/backend/llvm/dense-array-access.js +125 -44
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +63 -3
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.d.ts +51 -0
- package/dist/backend/llvm/dense-array-loops.js +162 -0
- package/dist/backend/llvm/dense-array-loops.js.map +1 -0
- package/dist/backend/llvm/dense-array-loops.test.d.ts +1 -0
- package/dist/backend/llvm/dense-array-loops.test.js +128 -0
- package/dist/backend/llvm/dense-array-loops.test.js.map +1 -0
- package/dist/backend/llvm/dyn-handle-tags.test.d.ts +1 -0
- package/dist/backend/llvm/dyn-handle-tags.test.js +38 -0
- package/dist/backend/llvm/dyn-handle-tags.test.js.map +1 -0
- package/dist/backend/llvm/dyn.d.ts +37 -4
- package/dist/backend/llvm/dyn.js +354 -183
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.d.ts +64 -0
- package/dist/backend/llvm/emit-function.js +1193 -0
- package/dist/backend/llvm/emit-function.js.map +1 -0
- package/dist/backend/llvm/emit-module.d.ts +24 -0
- package/dist/backend/llvm/emit-module.js +1557 -0
- package/dist/backend/llvm/emit-module.js.map +1 -0
- package/dist/backend/llvm/emit-statements.d.ts +59 -0
- package/dist/backend/llvm/emit-statements.js +2041 -0
- package/dist/backend/llvm/emit-statements.js.map +1 -0
- package/dist/backend/llvm/emitter.d.ts +566 -291
- package/dist/backend/llvm/emitter.js +728 -4671
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +57 -3
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +73 -46
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-async.test.js +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +2 -0
- package/dist/backend/llvm/expr-bytes.js +76 -29
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.d.ts +6 -2
- package/dist/backend/llvm/expr-callbacks.js +48 -11
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +1 -1
- package/dist/backend/llvm/expr-calls.js +87 -56
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-calls.test.js +1 -1
- package/dist/backend/llvm/expr-containers.js +45 -24
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-control.js +16 -16
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.d.ts +3 -0
- package/dist/backend/llvm/expr-dynamic.js +113 -66
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +124 -28
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +57 -2
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.d.ts +1 -1
- package/dist/backend/llvm/expr-records.js +32 -11
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +65 -27
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +2 -2
- package/dist/backend/llvm/expr-stream-callbacks.js +22 -1
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/int32-abi.test.js +2 -2
- package/dist/backend/llvm/integer-clones.js +3 -3
- package/dist/backend/llvm/integer-clones.js.map +1 -1
- package/dist/backend/llvm/integer-clones.test.js +3 -3
- package/dist/backend/llvm/integer-remainder.d.ts +34 -13
- package/dist/backend/llvm/integer-remainder.js +156 -22
- package/dist/backend/llvm/integer-remainder.js.map +1 -1
- package/dist/backend/llvm/intern-tables.test.js +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-encoding.d.ts +21 -0
- package/dist/backend/llvm/jsval-encoding.js +20 -0
- package/dist/backend/llvm/jsval-encoding.js.map +1 -0
- package/dist/backend/llvm/jsval.d.ts +12 -0
- package/dist/backend/llvm/jsval.js +616 -0
- package/dist/backend/llvm/jsval.js.map +1 -0
- package/dist/backend/llvm/lazy-captures.d.ts +12 -2
- package/dist/backend/llvm/lazy-captures.js +39 -17
- package/dist/backend/llvm/lazy-captures.js.map +1 -1
- package/dist/backend/llvm/lib-abi.js +1 -1
- package/dist/backend/llvm/lib-abi.js.map +1 -1
- package/dist/backend/llvm/lib-connect.js +1 -1
- package/dist/backend/llvm/lib-connect.js.map +1 -1
- package/dist/backend/llvm/lib-datagram.js +14 -8
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +189 -23
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +42 -13
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.js +3 -3
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-lookup.js +2 -2
- package/dist/backend/llvm/lib-lookup.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +56 -22
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +94 -53
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.d.ts +12 -0
- package/dist/backend/llvm/lib-shared.js +209 -6
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +46 -16
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-test.js +43 -7
- package/dist/backend/llvm/lib-test.js.map +1 -1
- package/dist/backend/llvm/lib-tls.js +4 -9
- package/dist/backend/llvm/lib-tls.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +42 -33
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +1 -1
- package/dist/backend/llvm/local-extents.d.ts +19 -0
- package/dist/backend/llvm/local-extents.js +169 -0
- package/dist/backend/llvm/local-extents.js.map +1 -0
- package/dist/backend/llvm/local-extents.test.d.ts +1 -0
- package/dist/backend/llvm/local-extents.test.js +92 -0
- package/dist/backend/llvm/local-extents.test.js.map +1 -0
- package/dist/backend/llvm/local-union-storage.js +7 -7
- package/dist/backend/llvm/local-union-storage.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +2 -2
- package/dist/backend/llvm/map-entry-fusion.test.js +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +20 -4
- package/dist/backend/llvm/map-number-lookup.js +45 -9
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.js +2 -2
- package/dist/backend/llvm/map-read-lifetimes.test.js +2 -2
- package/dist/backend/llvm/narrow-guards.d.ts +38 -0
- package/dist/backend/llvm/narrow-guards.js +215 -0
- package/dist/backend/llvm/narrow-guards.js.map +1 -0
- package/dist/backend/llvm/nullable-unions.d.ts +64 -6
- package/dist/backend/llvm/nullable-unions.js +103 -6
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.test.d.ts +1 -0
- package/dist/backend/llvm/nullable-unions.test.js +65 -0
- package/dist/backend/llvm/nullable-unions.test.js.map +1 -0
- package/dist/backend/llvm/publish.d.ts +7 -0
- package/dist/backend/llvm/publish.js +50 -19
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/publish.test.js +1 -1
- package/dist/backend/llvm/receivers.d.ts +31 -0
- package/dist/backend/llvm/receivers.js +395 -0
- package/dist/backend/llvm/receivers.js.map +1 -0
- package/dist/backend/llvm/record-results.d.ts +12 -1
- package/dist/backend/llvm/record-results.js +64 -4
- package/dist/backend/llvm/record-results.js.map +1 -1
- package/dist/backend/llvm/reference-effects.js +9 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-writes.d.ts +4 -0
- package/dist/backend/llvm/reference-writes.js +142 -6
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/reference-writes.test.d.ts +1 -0
- package/dist/backend/llvm/reference-writes.test.js +88 -0
- package/dist/backend/llvm/reference-writes.test.js.map +1 -0
- package/dist/backend/llvm/regex-matchers.d.ts +8 -0
- package/dist/backend/llvm/regex-matchers.js +33 -0
- package/dist/backend/llvm/regex-matchers.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.test.js +23 -1
- package/dist/backend/llvm/regex-matchers.test.js.map +1 -1
- package/dist/backend/llvm/regions.d.ts +1 -1
- package/dist/backend/llvm/regions.js +10 -7
- package/dist/backend/llvm/regions.js.map +1 -1
- package/dist/backend/llvm/regions.test.js +8 -2
- package/dist/backend/llvm/regions.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +74 -45
- package/dist/backend/llvm/shapes.js +289 -28
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +37 -3
- package/dist/backend/llvm/shapes.test.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/split-loops.js +2 -2
- package/dist/backend/llvm/split-loops.js.map +1 -1
- package/dist/backend/llvm/stack-objects.d.ts +26 -6
- package/dist/backend/llvm/stack-objects.js +133 -10
- package/dist/backend/llvm/stack-objects.js.map +1 -1
- package/dist/backend/llvm/stack-objects.test.js +55 -1
- package/dist/backend/llvm/stack-objects.test.js.map +1 -1
- package/dist/backend/llvm/stack-unions.test.js +1 -1
- package/dist/backend/llvm/string-construction.test.js +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +15 -14
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +1 -1
- package/dist/backend/llvm/string-reads.js +4 -4
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/string-slices.d.ts +25 -0
- package/dist/backend/llvm/string-slices.js +207 -1
- package/dist/backend/llvm/string-slices.js.map +1 -1
- package/dist/backend/llvm/string-slices.test.js +139 -2
- package/dist/backend/llvm/string-slices.test.js.map +1 -1
- package/dist/backend/llvm/switch-dispatch.test.js +2 -2
- package/dist/backend/llvm/thread-slots.d.ts +5 -0
- package/dist/backend/llvm/thread-slots.js +142 -0
- package/dist/backend/llvm/thread-slots.js.map +1 -0
- package/dist/backend/llvm/thread-slots.test.d.ts +1 -0
- package/dist/backend/llvm/thread-slots.test.js +111 -0
- package/dist/backend/llvm/thread-slots.test.js.map +1 -0
- package/dist/backend/llvm/union-repr.d.ts +7 -7
- package/dist/backend/llvm/union-repr.js +18 -2
- package/dist/backend/llvm/union-repr.js.map +1 -1
- package/dist/backend/llvm/union-retype.test.js +17 -3
- package/dist/backend/llvm/union-retype.test.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +2 -2
- package/dist/backend/llvm/walkers.js +51 -26
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/llvm/wasm-modules.d.ts +16 -0
- package/dist/backend/llvm/wasm-modules.js +66 -0
- package/dist/backend/llvm/wasm-modules.js.map +1 -0
- package/dist/backend/llvm/wrapping-sums.d.ts +7 -0
- package/dist/backend/llvm/wrapping-sums.js +11 -3
- package/dist/backend/llvm/wrapping-sums.js.map +1 -1
- package/dist/backend/mangle.d.ts +12 -0
- package/dist/backend/mangle.js +18 -0
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/may-throw.d.ts +3 -0
- package/dist/backend/may-throw.js +4 -2
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +1 -1
- package/dist/backend/native/contracts.d.ts +57 -0
- package/dist/backend/native/executable.js +211 -139
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/library.js +2 -0
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +1 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +6 -0
- package/dist/backend/native-codegen.js +19 -0
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +27 -0
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +48 -0
- 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/publication.test.js +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-core.d.ts +13 -1
- package/dist/backend/runtime-pack-core.js +14 -1
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-native.js +1 -1
- package/dist/backend/runtime-pack-native.js.map +1 -1
- package/dist/backend/runtime-pack-native.test.d.ts +1 -0
- package/dist/backend/runtime-pack-native.test.js +31 -0
- package/dist/backend/runtime-pack-native.test.js.map +1 -0
- package/dist/backend/runtime-pack-targets.test.js +9 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +9 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/stack-observations.d.ts +22 -0
- package/dist/backend/stack-observations.js +382 -0
- package/dist/backend/stack-observations.js.map +1 -0
- package/dist/backend/stack-observations.test.d.ts +1 -0
- package/dist/backend/stack-observations.test.js +233 -0
- package/dist/backend/stack-observations.test.js.map +1 -0
- package/dist/backend/target-diagnostics.js +15 -0
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +1 -1
- package/dist/backend/warm-cache.js +8 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/backend/young-nursery.d.ts +7 -0
- package/dist/backend/young-nursery.js +10 -0
- package/dist/backend/young-nursery.js.map +1 -0
- package/dist/cli/command.js +106 -4
- 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 +21 -1
- package/dist/cli/usage.js +43 -1
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.js +10 -1
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +22 -0
- package/dist/contracts/check.js +25 -8
- package/dist/contracts/check.js.map +1 -1
- package/dist/contracts/int32-elements.d.ts +115 -0
- package/dist/contracts/int32-elements.js +1179 -0
- package/dist/contracts/int32-elements.js.map +1 -0
- package/dist/coverage/report.d.ts +16 -0
- package/dist/coverage/report.js +182 -1
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +16 -3
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +2 -0
- package/dist/coverage/verdict-cache.js +12 -0
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/coverage/verdict-cache.test.js +2 -1
- package/dist/coverage/verdict-cache.test.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +10 -6
- package/dist/diagnostics/diagnostic.js +29 -21
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +39 -2
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/diagnostics/render.d.ts +7 -0
- package/dist/diagnostics/render.js +50 -13
- package/dist/diagnostics/render.js.map +1 -1
- package/dist/diagnostics/render.test.d.ts +1 -0
- package/dist/diagnostics/render.test.js +49 -0
- package/dist/diagnostics/render.test.js.map +1 -0
- package/dist/executable/executable-cache.d.ts +27 -0
- package/dist/executable/executable-cache.js +19 -1
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +12 -1
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +2 -1
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +6 -1
- 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-modules.d.ts +16 -2
- package/dist/frontend/builtin-modules.js +40 -7
- package/dist/frontend/builtin-modules.js.map +1 -1
- 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/cjs-syntax.js +52 -51
- package/dist/frontend/cjs-syntax.js.map +1 -1
- package/dist/frontend/contract-types.d.ts +3 -0
- package/dist/frontend/contract-types.js +36 -7
- package/dist/frontend/contract-types.js.map +1 -1
- 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/experimental-import.d.ts +5 -1
- package/dist/frontend/experimental-import.js +26 -7
- package/dist/frontend/experimental-import.js.map +1 -1
- package/dist/frontend/fork-target.js +20 -22
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/fork-target.test.js +2 -1
- package/dist/frontend/fork-target.test.js.map +1 -1
- package/dist/frontend/function-completion.js +6 -6
- package/dist/frontend/function-completion.js.map +1 -1
- package/dist/frontend/helper-tokens.js +15 -3
- package/dist/frontend/helper-tokens.js.map +1 -1
- package/dist/frontend/helper-tokens.test.js +7 -1
- package/dist/frontend/helper-tokens.test.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.js +14 -17
- package/dist/frontend/inferred-js-diagnostics.js.map +1 -1
- package/dist/frontend/input-tracker.d.ts +3 -0
- package/dist/frontend/input-tracker.js +32 -3
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/lib-contract.js +36 -32
- package/dist/frontend/lib-contract.js.map +1 -1
- package/dist/frontend/lib-exports.js +3 -3
- package/dist/frontend/lib-exports.js.map +1 -1
- package/dist/frontend/lowering/array-values.d.ts +8 -3
- package/dist/frontend/lowering/array-values.js +60 -11
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/assert-instances.js +4 -4
- package/dist/frontend/lowering/assert-instances.js.map +1 -1
- package/dist/frontend/lowering/assertion-identity.d.ts +12 -0
- package/dist/frontend/lowering/assertion-identity.js +70 -0
- package/dist/frontend/lowering/assertion-identity.js.map +1 -0
- package/dist/frontend/lowering/assertion-members.d.ts +28 -0
- package/dist/frontend/lowering/assertion-members.js +185 -0
- package/dist/frontend/lowering/assertion-members.js.map +1 -0
- package/dist/frontend/lowering/binding-analysis.js +27 -20
- package/dist/frontend/lowering/binding-analysis.js.map +1 -1
- package/dist/frontend/lowering/builtin-calls.js +63 -5
- package/dist/frontend/lowering/builtin-calls.js.map +1 -1
- package/dist/frontend/lowering/builtin-function-fences.d.ts +14 -0
- package/dist/frontend/lowering/builtin-function-fences.js +42 -0
- package/dist/frontend/lowering/builtin-function-fences.js.map +1 -0
- package/dist/frontend/lowering/builtins/arguments.js +1 -1
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/async-context.js +53 -52
- package/dist/frontend/lowering/builtins/async-context.js.map +1 -1
- package/dist/frontend/lowering/builtins/atomics.js +6 -6
- package/dist/frontend/lowering/builtins/atomics.js.map +1 -1
- package/dist/frontend/lowering/builtins/blob.js +8 -6
- package/dist/frontend/lowering/builtins/blob.js.map +1 -1
- package/dist/frontend/lowering/builtins/builtin-class-dyn.d.ts +31 -0
- package/dist/frontend/lowering/builtins/builtin-class-dyn.js +205 -0
- package/dist/frontend/lowering/builtins/builtin-class-dyn.js.map +1 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js +17 -5
- package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-async.js +7 -7
- package/dist/frontend/lowering/builtins/child-process-async.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.d.ts +6 -4
- package/dist/frontend/lowering/builtins/child-process-methods.js +310 -57
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-sync.js +16 -10
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process.d.ts +6 -4
- package/dist/frontend/lowering/builtins/child-process.js +85 -61
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
- package/dist/frontend/lowering/builtins/class-values.d.ts +60 -0
- package/dist/frontend/lowering/builtins/class-values.js +226 -0
- package/dist/frontend/lowering/builtins/class-values.js.map +1 -0
- package/dist/frontend/lowering/builtins/compression.d.ts +9 -0
- package/dist/frontend/lowering/builtins/compression.js +107 -44
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/constants.d.ts +9 -1
- package/dist/frontend/lowering/builtins/constants.js +28 -7
- package/dist/frontend/lowering/builtins/constants.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +22 -0
- package/dist/frontend/lowering/builtins/crypto.js +215 -38
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/dates.d.ts +7 -1
- package/dist/frontend/lowering/builtins/dates.js +92 -16
- package/dist/frontend/lowering/builtins/dates.js.map +1 -1
- package/dist/frontend/lowering/builtins/disposable-stack.d.ts +18 -0
- package/dist/frontend/lowering/builtins/disposable-stack.js +137 -0
- package/dist/frontend/lowering/builtins/disposable-stack.js.map +1 -0
- package/dist/frontend/lowering/builtins/ecdh.d.ts +10 -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/environment.js +3 -3
- package/dist/frontend/lowering/builtins/environment.js.map +1 -1
- package/dist/frontend/lowering/builtins/errors.d.ts +14 -10
- package/dist/frontend/lowering/builtins/errors.js +169 -3
- package/dist/frontend/lowering/builtins/errors.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js +128 -116
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem.js +77 -77
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-glob.js +3 -3
- package/dist/frontend/lowering/builtins/fs-glob.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-streams.js +10 -11
- package/dist/frontend/lowering/builtins/fs-streams.js.map +1 -1
- package/dist/frontend/lowering/builtins/ipc.js +45 -8
- package/dist/frontend/lowering/builtins/ipc.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +284 -24
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/key-object.js +4 -4
- package/dist/frontend/lowering/builtins/key-object.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-bindings.d.ts +8 -0
- package/dist/frontend/lowering/builtins/module-bindings.js +71 -22
- package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-calls.js +55 -44
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +4 -3
- package/dist/frontend/lowering/builtins/module-resolution.js +24 -23
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/navigator.d.ts +13 -0
- package/dist/frontend/lowering/builtins/navigator.js +40 -0
- package/dist/frontend/lowering/builtins/navigator.js.map +1 -0
- package/dist/frontend/lowering/builtins/net-address.d.ts +19 -0
- package/dist/frontend/lowering/builtins/net-address.js +156 -0
- package/dist/frontend/lowering/builtins/net-address.js.map +1 -0
- package/dist/frontend/lowering/builtins/numbers.js +25 -9
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/operating-system.d.ts +4 -0
- package/dist/frontend/lowering/builtins/operating-system.js +25 -12
- package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
- package/dist/frontend/lowering/builtins/performance.d.ts +12 -0
- package/dist/frontend/lowering/builtins/performance.js +259 -8
- package/dist/frontend/lowering/builtins/performance.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.d.ts +41 -1
- package/dist/frontend/lowering/builtins/process.js +505 -99
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.d.ts +5 -1
- package/dist/frontend/lowering/builtins/promises.js +326 -43
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/promisify-callback.d.ts +40 -0
- package/dist/frontend/lowering/builtins/promisify-callback.js +338 -0
- package/dist/frontend/lowering/builtins/promisify-callback.js.map +1 -0
- package/dist/frontend/lowering/builtins/properties.js +37 -1
- package/dist/frontend/lowering/builtins/properties.js.map +1 -1
- package/dist/frontend/lowering/builtins/querystring.js +14 -14
- package/dist/frontend/lowering/builtins/querystring.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +12 -2
- package/dist/frontend/lowering/builtins/readline.js +136 -39
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/receiver-types.js +3 -5
- package/dist/frontend/lowering/builtins/receiver-types.js.map +1 -1
- package/dist/frontend/lowering/builtins/reflection.js +42 -14
- package/dist/frontend/lowering/builtins/reflection.js.map +1 -1
- package/dist/frontend/lowering/builtins/runtime-constructor.d.ts +26 -0
- package/dist/frontend/lowering/builtins/runtime-constructor.js +165 -0
- package/dist/frontend/lowering/builtins/runtime-constructor.js.map +1 -0
- package/dist/frontend/lowering/builtins/strings.js +101 -12
- package/dist/frontend/lowering/builtins/strings.js.map +1 -1
- package/dist/frontend/lowering/builtins/text-codecs.js +41 -38
- package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
- package/dist/frontend/lowering/builtins/timers.js +79 -30
- 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.d.ts +3 -0
- package/dist/frontend/lowering/builtins/url.js +120 -17
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/builtins/util-types.js +20 -4
- package/dist/frontend/lowering/builtins/util-types.js.map +1 -1
- package/dist/frontend/lowering/builtins/v8.d.ts +11 -0
- package/dist/frontend/lowering/builtins/v8.js +105 -0
- package/dist/frontend/lowering/builtins/v8.js.map +1 -0
- package/dist/frontend/lowering/builtins/webassembly.d.ts +33 -0
- package/dist/frontend/lowering/builtins/webassembly.js +388 -0
- package/dist/frontend/lowering/builtins/webassembly.js.map +1 -0
- package/dist/frontend/lowering/builtins/webcrypto.d.ts +20 -0
- package/dist/frontend/lowering/builtins/webcrypto.js +112 -0
- package/dist/frontend/lowering/builtins/webcrypto.js.map +1 -0
- package/dist/frontend/lowering/builtins/workers.d.ts +12 -0
- package/dist/frontend/lowering/builtins/workers.js +193 -8
- package/dist/frontend/lowering/builtins/workers.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.js +69 -14
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.d.ts +23 -1
- package/dist/frontend/lowering/call-signatures.js +379 -55
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/checked-promise-all.d.ts +3 -0
- package/dist/frontend/lowering/checked-promise-all.js +1 -1
- package/dist/frontend/lowering/checked-promise-all.js.map +1 -1
- package/dist/frontend/lowering/cjs-exports-object.d.ts +53 -0
- package/dist/frontend/lowering/cjs-exports-object.js +561 -0
- package/dist/frontend/lowering/cjs-exports-object.js.map +1 -0
- package/dist/frontend/lowering/cjs-inline-require.d.ts +86 -0
- package/dist/frontend/lowering/cjs-inline-require.js +314 -0
- package/dist/frontend/lowering/cjs-inline-require.js.map +1 -0
- package/dist/frontend/lowering/cjs-tsc-interop.d.ts +28 -0
- package/dist/frontend/lowering/cjs-tsc-interop.js +208 -0
- package/dist/frontend/lowering/cjs-tsc-interop.js.map +1 -0
- package/dist/frontend/lowering/class-attributes.d.ts +19 -0
- package/dist/frontend/lowering/class-attributes.js +378 -0
- package/dist/frontend/lowering/class-attributes.js.map +1 -0
- package/dist/frontend/lowering/class-callbacks.d.ts +3 -1
- package/dist/frontend/lowering/class-callbacks.js +21 -10
- package/dist/frontend/lowering/class-callbacks.js.map +1 -1
- package/dist/frontend/lowering/class-construction.js +49 -4
- package/dist/frontend/lowering/class-construction.js.map +1 -1
- package/dist/frontend/lowering/class-descriptors.d.ts +2 -0
- package/dist/frontend/lowering/class-descriptors.js +8 -8
- package/dist/frontend/lowering/class-descriptors.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +64 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +1124 -90
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-instance-constructor.js +1 -1
- package/dist/frontend/lowering/class-instance-constructor.js.map +1 -1
- package/dist/frontend/lowering/class-iterables.d.ts +11 -0
- package/dist/frontend/lowering/class-iterables.js +31 -0
- package/dist/frontend/lowering/class-iterables.js.map +1 -0
- package/dist/frontend/lowering/class-method-mutations.js +73 -35
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-method-values.js +56 -10
- package/dist/frontend/lowering/class-method-values.js.map +1 -1
- package/dist/frontend/lowering/class-protocol-dispatch.js +24 -22
- package/dist/frontend/lowering/class-protocol-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +10 -0
- package/dist/frontend/lowering/class-protocols.js +76 -45
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.d.ts +6 -0
- package/dist/frontend/lowering/class-prototypes.js +86 -19
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-runtime-statics.js +1 -1
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
- package/dist/frontend/lowering/class-static-data.js +2 -2
- package/dist/frontend/lowering/class-static-data.js.map +1 -1
- package/dist/frontend/lowering/class-to-primitive.d.ts +25 -0
- package/dist/frontend/lowering/class-to-primitive.js +264 -0
- package/dist/frontend/lowering/class-to-primitive.js.map +1 -0
- package/dist/frontend/lowering/class-unions.d.ts +25 -0
- package/dist/frontend/lowering/class-unions.js +102 -1
- package/dist/frontend/lowering/class-unions.js.map +1 -1
- package/dist/frontend/lowering/code-generation.d.ts +14 -0
- package/dist/frontend/lowering/code-generation.js +127 -0
- package/dist/frontend/lowering/code-generation.js.map +1 -0
- 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.d.ts +16 -2
- package/dist/frontend/lowering/coercions/function-adapters.js +239 -68
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +25 -3
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +35 -3
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.d.ts +15 -0
- package/dist/frontend/lowering/coercions/unions.js +57 -1
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/collection-ingestion.js +2 -2
- package/dist/frontend/lowering/collection-ingestion.js.map +1 -1
- package/dist/frontend/lowering/collection-narrowing.js +2 -4
- package/dist/frontend/lowering/collection-narrowing.js.map +1 -1
- package/dist/frontend/lowering/construction-escapes.js +8 -8
- package/dist/frontend/lowering/construction-escapes.js.map +1 -1
- package/dist/frontend/lowering/construction-escapes.test.js +4 -4
- package/dist/frontend/lowering/construction-escapes.test.js.map +1 -1
- package/dist/frontend/lowering/constructor-returns.d.ts +61 -0
- package/dist/frontend/lowering/constructor-returns.js +477 -0
- package/dist/frontend/lowering/constructor-returns.js.map +1 -0
- package/dist/frontend/lowering/containers/array-callback-call.js +1 -1
- package/dist/frontend/lowering/containers/array-callback-call.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +17 -0
- package/dist/frontend/lowering/containers/array-callbacks.js +287 -118
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-concat.js +1 -1
- package/dist/frontend/lowering/containers/array-concat.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.d.ts +0 -1
- package/dist/frontend/lowering/containers/array-construction.js +58 -13
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-from-async.d.ts +6 -5
- package/dist/frontend/lowering/containers/array-from-async.js +159 -14
- package/dist/frontend/lowering/containers/array-from-async.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +94 -77
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.js +1 -0
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.d.ts +9 -0
- package/dist/frontend/lowering/containers/bytes.js +649 -113
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.d.ts +9 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +55 -5
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-grouping.d.ts +7 -8
- package/dist/frontend/lowering/containers/collection-grouping.js +217 -26
- package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +126 -28
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/dynamic-receivers.js +1 -1
- package/dist/frontend/lowering/containers/dynamic-receivers.js.map +1 -1
- package/dist/frontend/lowering/containers/exec-result-uses.js +2 -2
- package/dist/frontend/lowering/containers/exec-result-uses.js.map +1 -1
- package/dist/frontend/lowering/containers/for-of.d.ts +6 -0
- package/dist/frontend/lowering/containers/for-of.js +19 -19
- package/dist/frontend/lowering/containers/for-of.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +142 -57
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/iterator-helpers.d.ts +53 -4
- package/dist/frontend/lowering/containers/iterator-helpers.js +1581 -462
- package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
- package/dist/frontend/lowering/containers/match-row-uses.d.ts +17 -0
- package/dist/frontend/lowering/containers/match-row-uses.js +264 -0
- package/dist/frontend/lowering/containers/match-row-uses.js.map +1 -0
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +14 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js +455 -30
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/cycle-initialization.d.ts +30 -10
- package/dist/frontend/lowering/cycle-initialization.js +191 -35
- package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.js +47 -43
- package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
- package/dist/frontend/lowering/devirtualize.d.ts +1 -1
- package/dist/frontend/lowering/devirtualize.js +27 -7
- package/dist/frontend/lowering/devirtualize.js.map +1 -1
- package/dist/frontend/lowering/divergences.d.ts +0 -5
- package/dist/frontend/lowering/divergences.js +62 -125
- package/dist/frontend/lowering/divergences.js.map +1 -1
- package/dist/frontend/lowering/dyn-streams.d.ts +25 -0
- package/dist/frontend/lowering/dyn-streams.js +257 -0
- package/dist/frontend/lowering/dyn-streams.js.map +1 -0
- package/dist/frontend/lowering/error-methods.js +4 -1
- package/dist/frontend/lowering/error-methods.js.map +1 -1
- package/dist/frontend/lowering/error-name-order.d.ts +19 -0
- package/dist/frontend/lowering/error-name-order.js +93 -0
- package/dist/frontend/lowering/error-name-order.js.map +1 -0
- package/dist/frontend/lowering/expressions/array-literals.d.ts +21 -0
- package/dist/frontend/lowering/expressions/array-literals.js +723 -0
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -0
- package/dist/frontend/lowering/expressions/binary.d.ts +35 -0
- package/dist/frontend/lowering/expressions/binary.js +2557 -0
- package/dist/frontend/lowering/expressions/binary.js.map +1 -0
- package/dist/frontend/lowering/expressions/element-access.d.ts +31 -0
- package/dist/frontend/lowering/expressions/element-access.js +1804 -0
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -0
- package/dist/frontend/lowering/expressions/evaluation-safety.js +4 -3
- package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -1
- package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +38 -0
- package/dist/frontend/lowering/expressions/hosted-narrowing.js +160 -0
- package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -0
- package/dist/frontend/lowering/expressions/identifiers.d.ts +4 -0
- package/dist/frontend/lowering/expressions/identifiers.js +830 -0
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -0
- package/dist/frontend/lowering/expressions/keyed-field-targets.d.ts +52 -0
- package/dist/frontend/lowering/expressions/keyed-field-targets.js +307 -0
- package/dist/frontend/lowering/expressions/keyed-field-targets.js.map +1 -0
- package/dist/frontend/lowering/expressions/narrowing.d.ts +37 -0
- package/dist/frontend/lowering/expressions/narrowing.js +1337 -0
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -0
- package/dist/frontend/lowering/expressions/native-proxy.js +4 -4
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +45 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +10 -0
- package/dist/frontend/lowering/expressions/object-literals.js +301 -86
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +3 -2
- package/dist/frontend/lowering/expressions/optional-chains.js +103 -17
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +115 -0
- package/dist/frontend/lowering/expressions/property-access.js +3787 -0
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -0
- package/dist/frontend/lowering/expressions/relational.d.ts +28 -0
- package/dist/frontend/lowering/expressions/relational.js +1724 -0
- package/dist/frontend/lowering/expressions/relational.js.map +1 -0
- package/dist/frontend/lowering/expressions/typeof.d.ts +22 -0
- package/dist/frontend/lowering/expressions/typeof.js +551 -0
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -0
- package/dist/frontend/lowering/expressions/union-fields.js +1 -1
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.d.ts +21 -0
- package/dist/frontend/lowering/expressions/updates.js +780 -0
- package/dist/frontend/lowering/expressions/updates.js.map +1 -0
- package/dist/frontend/lowering/function-context.d.ts +10 -0
- package/dist/frontend/lowering/function-context.js +11 -1
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/function-returns.js +52 -28
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/general-streams.d.ts +25 -0
- package/dist/frontend/lowering/general-streams.js +108 -0
- package/dist/frontend/lowering/general-streams.js.map +1 -0
- 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 +7 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +172 -69
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +43 -0
- package/dist/frontend/lowering/generic-functions.js +593 -118
- 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/import-meta.js +2 -2
- package/dist/frontend/lowering/import-meta.js.map +1 -1
- package/dist/frontend/lowering/intern-tables.js +10 -9
- 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.d.ts +19 -0
- package/dist/frontend/lowering/iterator-adapters.js +331 -3
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/js-class-fields.d.ts +28 -0
- package/dist/frontend/lowering/js-class-fields.js +170 -0
- package/dist/frontend/lowering/js-class-fields.js.map +1 -0
- package/dist/frontend/lowering/js-dynamic-objects.d.ts +15 -0
- package/dist/frontend/lowering/js-dynamic-objects.js +299 -0
- package/dist/frontend/lowering/js-dynamic-objects.js.map +1 -0
- package/dist/frontend/lowering/js-dynamic-objects.test.d.ts +1 -0
- package/dist/frontend/lowering/js-dynamic-objects.test.js +35 -0
- package/dist/frontend/lowering/js-dynamic-objects.test.js.map +1 -0
- package/dist/frontend/lowering/json-require.d.ts +22 -0
- package/dist/frontend/lowering/json-require.js +131 -0
- package/dist/frontend/lowering/json-require.js.map +1 -0
- package/dist/frontend/lowering/key-order-witness.d.ts +44 -0
- package/dist/frontend/lowering/key-order-witness.js +641 -0
- package/dist/frontend/lowering/key-order-witness.js.map +1 -0
- package/dist/frontend/lowering/key-order-witness.test.d.ts +1 -0
- package/dist/frontend/lowering/key-order-witness.test.js +239 -0
- package/dist/frontend/lowering/key-order-witness.test.js.map +1 -0
- package/dist/frontend/lowering/lifetime-regions.js +7 -7
- 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 +61 -60
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.d.ts +10 -1
- package/dist/frontend/lowering/lower-async-iteration.js +34 -6
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.d.ts +5 -0
- package/dist/frontend/lowering/lower-builtin-values.js +33 -3
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +1404 -448
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +54 -3
- package/dist/frontend/lowering/lower-classes.js +1529 -472
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +4 -2
- package/dist/frontend/lowering/lower-comptime.js +111 -13
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-console.js +13 -11
- package/dist/frontend/lowering/lower-console.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.d.ts +10 -0
- package/dist/frontend/lowering/lower-dgram.js +241 -21
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.js +113 -14
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.d.ts +16 -7
- package/dist/frontend/lowering/lower-event-emitter.js +258 -70
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-event-target.js +2 -2
- package/dist/frontend/lowering/lower-event-target.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.js +17 -13
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +188 -186
- package/dist/frontend/lowering/lower-exprs.js +1509 -12486
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +72 -22
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.d.ts +6 -0
- package/dist/frontend/lowering/lower-generators.js +39 -20
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.js +5 -1
- package/dist/frontend/lowering/lower-global-value.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +900 -107
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +23 -20
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-mock.d.ts +8 -1
- package/dist/frontend/lowering/lower-mock.js +185 -18
- 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 +445 -94
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +6 -0
- package/dist/frontend/lowering/lower-namespaces.js +65 -33
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-module.d.ts +16 -0
- package/dist/frontend/lowering/lower-node-module.js +147 -14
- package/dist/frontend/lowering/lower-node-module.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +6 -6
- package/dist/frontend/lowering/lower-server.js +514 -101
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +4 -0
- package/dist/frontend/lowering/lower-stdlib.js +179 -118
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +30 -7
- package/dist/frontend/lowering/lower-stmts.js +1950 -433
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +3 -0
- package/dist/frontend/lowering/lower-stream.js +398 -56
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-test.d.ts +3 -0
- package/dist/frontend/lowering/lower-test.js +437 -62
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +96 -32
- package/dist/frontend/lowering/lower-timers.js.map +1 -1
- package/dist/frontend/lowering/lower-url.js +1 -1
- package/dist/frontend/lowering/lower-url.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +424 -27
- package/dist/frontend/lowering/lowerer.js +2062 -310
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +10 -4
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/maybe-promise.d.ts +46 -0
- package/dist/frontend/lowering/maybe-promise.js +249 -0
- package/dist/frontend/lowering/maybe-promise.js.map +1 -0
- package/dist/frontend/lowering/module-member-this.d.ts +3 -0
- package/dist/frontend/lowering/module-member-this.js +262 -0
- package/dist/frontend/lowering/module-member-this.js.map +1 -0
- package/dist/frontend/lowering/module-namespace-elements.js +1 -1
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/nan-coded-reads.d.ts +3 -0
- package/dist/frontend/lowering/nan-coded-reads.js +45 -32
- package/dist/frontend/lowering/nan-coded-reads.js.map +1 -1
- package/dist/frontend/lowering/narrowing-stability.d.ts +18 -3
- package/dist/frontend/lowering/narrowing-stability.js +104 -32
- package/dist/frontend/lowering/narrowing-stability.js.map +1 -1
- package/dist/frontend/lowering/native-ffi.js +11 -11
- package/dist/frontend/lowering/native-ffi.js.map +1 -1
- package/dist/frontend/lowering/object-factory-new.js +6 -8
- package/dist/frontend/lowering/object-factory-new.js.map +1 -1
- package/dist/frontend/lowering/private-brands.d.ts +46 -0
- package/dist/frontend/lowering/private-brands.js +265 -0
- package/dist/frontend/lowering/private-brands.js.map +1 -0
- package/dist/frontend/lowering/promise-executor-adapter.d.ts +11 -0
- package/dist/frontend/lowering/promise-executor-adapter.js +87 -0
- package/dist/frontend/lowering/promise-executor-adapter.js.map +1 -0
- 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.d.ts +32 -0
- package/dist/frontend/lowering/require-initialization.js +246 -0
- package/dist/frontend/lowering/require-initialization.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-bounds.js +7 -7
- package/dist/frontend/lowering/runtime-optional-bounds.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-elements.js +12 -12
- package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-guards.js +10 -10
- package/dist/frontend/lowering/runtime-optional-guards.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-guards.test.js +1 -1
- package/dist/frontend/lowering/runtime-optional-guards.test.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-ownership.js +10 -9
- package/dist/frontend/lowering/runtime-optional-ownership.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-provenance.js +2 -2
- package/dist/frontend/lowering/runtime-optional-provenance.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-records.d.ts +35 -0
- package/dist/frontend/lowering/runtime-optional-records.js +205 -32
- package/dist/frontend/lowering/runtime-optional-records.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-records.test.js +19 -1
- package/dist/frontend/lowering/runtime-optional-records.test.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.test.js +2 -2
- package/dist/frontend/lowering/split-consumers.js +4 -4
- package/dist/frontend/lowering/split-consumers.js.map +1 -1
- package/dist/frontend/lowering/static-function-names.d.ts +28 -0
- package/dist/frontend/lowering/static-function-names.js +212 -0
- package/dist/frontend/lowering/static-function-names.js.map +1 -0
- package/dist/frontend/lowering/static-this.js +6 -6
- package/dist/frontend/lowering/static-this.js.map +1 -1
- package/dist/frontend/lowering/static-typeof.d.ts +26 -0
- package/dist/frontend/lowering/static-typeof.js +133 -0
- package/dist/frontend/lowering/static-typeof.js.map +1 -0
- package/dist/frontend/lowering/strict-mode.d.ts +5 -0
- package/dist/frontend/lowering/strict-mode.js +31 -0
- package/dist/frontend/lowering/strict-mode.js.map +1 -0
- package/dist/frontend/lowering/string-index-bounds.js +13 -12
- package/dist/frontend/lowering/string-index-bounds.js.map +1 -1
- package/dist/frontend/lowering/string-index.d.ts +12 -0
- package/dist/frontend/lowering/string-index.js +72 -1
- package/dist/frontend/lowering/string-index.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +12 -3
- package/dist/frontend/lowering/surfaces.js +282 -45
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/symbol-fields.d.ts +7 -0
- package/dist/frontend/lowering/symbol-fields.js +204 -36
- package/dist/frontend/lowering/symbol-fields.js.map +1 -1
- package/dist/frontend/lowering/symbol-methods.d.ts +2 -1
- package/dist/frontend/lowering/symbol-methods.js +24 -6
- package/dist/frontend/lowering/symbol-methods.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/thread-slots.d.ts +13 -0
- package/dist/frontend/lowering/thread-slots.js +208 -0
- package/dist/frontend/lowering/thread-slots.js.map +1 -0
- package/dist/frontend/lowering/typed-arguments.d.ts +74 -0
- package/dist/frontend/lowering/typed-arguments.js +472 -0
- package/dist/frontend/lowering/typed-arguments.js.map +1 -0
- package/dist/frontend/lowering/union-retag.d.ts +8 -0
- package/dist/frontend/lowering/union-retag.js +27 -0
- package/dist/frontend/lowering/union-retag.js.map +1 -1
- package/dist/frontend/lowering/union-retag.test.js +24 -1
- package/dist/frontend/lowering/union-retag.test.js.map +1 -1
- package/dist/frontend/lowering/var-hoisting.js +6 -6
- package/dist/frontend/lowering/var-hoisting.js.map +1 -1
- package/dist/frontend/lowering/width-lift.d.ts +4 -0
- package/dist/frontend/mock-shapes.js +13 -6
- package/dist/frontend/mock-shapes.js.map +1 -1
- package/dist/frontend/module-source-candidates.js +1 -1
- package/dist/frontend/module-source-candidates.js.map +1 -1
- package/dist/frontend/module-source-candidates.test.js +2 -1
- package/dist/frontend/module-source-candidates.test.js.map +1 -1
- package/dist/frontend/module-syntax.js +8 -8
- package/dist/frontend/module-syntax.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 +58 -0
- package/dist/frontend/npm-static-bundled-chunks.js +981 -0
- package/dist/frontend/npm-static-bundled-chunks.js.map +1 -0
- package/dist/frontend/npm-static-bundled-chunks.test.d.ts +1 -0
- package/dist/frontend/npm-static-bundled-chunks.test.js +399 -0
- package/dist/frontend/npm-static-bundled-chunks.test.js.map +1 -0
- package/dist/frontend/npm-static-bundled-cjs.js +24 -23
- package/dist/frontend/npm-static-bundled-cjs.js.map +1 -1
- package/dist/frontend/npm-static-bundled-esm.d.ts +9 -0
- package/dist/frontend/npm-static-bundled-esm.js +988 -0
- package/dist/frontend/npm-static-bundled-esm.js.map +1 -0
- package/dist/frontend/npm-static-bundled-esm.test.d.ts +1 -0
- package/dist/frontend/npm-static-bundled-esm.test.js +336 -0
- package/dist/frontend/npm-static-bundled-esm.test.js.map +1 -0
- package/dist/frontend/npm-static-cjs-exports-alias.d.ts +2 -0
- package/dist/frontend/npm-static-cjs-exports-alias.js +186 -0
- package/dist/frontend/npm-static-cjs-exports-alias.js.map +1 -0
- package/dist/frontend/npm-static-cjs-exports-alias.test.d.ts +1 -0
- package/dist/frontend/npm-static-cjs-exports-alias.test.js +73 -0
- package/dist/frontend/npm-static-cjs-exports-alias.test.js.map +1 -0
- package/dist/frontend/npm-static-cjs-exports-var.d.ts +2 -0
- package/dist/frontend/npm-static-cjs-exports-var.js +236 -0
- package/dist/frontend/npm-static-cjs-exports-var.js.map +1 -0
- package/dist/frontend/npm-static-declaration-syntax.js +102 -101
- package/dist/frontend/npm-static-declaration-syntax.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-prune.js +36 -24
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-host.d.ts +4 -1
- package/dist/frontend/npm-static-rewrite-host.js +14 -3
- package/dist/frontend/npm-static-rewrite-host.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.d.ts +19 -0
- package/dist/frontend/npm-static-rewrite-syntax.js +274 -101
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/npm-static-subtyping.js +7 -9
- package/dist/frontend/npm-static-subtyping.js.map +1 -1
- package/dist/frontend/npm-static.d.ts +25 -1
- package/dist/frontend/npm-static.js +212 -16
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm-static.test.js +22 -1
- package/dist/frontend/npm-static.test.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 +230 -26
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/pipeline.test.js +22 -1
- package/dist/frontend/pipeline.test.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +6 -1
- package/dist/frontend/program-analysis.js +7 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program.d.ts +100 -2
- package/dist/frontend/program.js +1627 -262
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +76 -6
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/resolve.js +49 -2
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/resolve.test.js +49 -0
- package/dist/frontend/resolve.test.js.map +1 -1
- package/dist/frontend/services.d.ts +26 -1
- package/dist/frontend/services.js +59 -3
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/services.test.js +2 -1
- package/dist/frontend/services.test.js.map +1 -1
- package/dist/frontend/threads-import.js +1 -1
- package/dist/frontend/threads-import.js.map +1 -1
- package/dist/frontend/tier-analysis.d.ts +71 -0
- package/dist/frontend/tier-analysis.js +522 -0
- package/dist/frontend/tier-analysis.js.map +1 -0
- package/dist/frontend/ts7/api-conformance.d.ts +234 -0
- package/dist/frontend/ts7/api-conformance.js +7 -0
- package/dist/frontend/ts7/api-conformance.js.map +1 -0
- package/dist/frontend/ts7/ast-guards.generated.js +2 -1
- package/dist/frontend/ts7/ast-guards.generated.js.map +1 -1
- package/dist/frontend/ts7/ast-node.d.ts +47 -25
- package/dist/frontend/ts7/ast-node.js +64 -18
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +36 -12
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-types.d.ts +10 -3
- package/dist/frontend/ts7/ast-types.generated.d.ts +39 -39
- package/dist/frontend/ts7/ast.d.ts +1 -0
- package/dist/frontend/ts7/ast.js +3 -2
- package/dist/frontend/ts7/ast.js.map +1 -1
- package/dist/frontend/ts7/checker-backend.d.ts +23 -0
- package/dist/frontend/ts7/checker-backend.js +88 -0
- package/dist/frontend/ts7/checker-backend.js.map +1 -0
- package/dist/frontend/ts7/checker-backend.test.d.ts +1 -0
- package/dist/frontend/ts7/checker-backend.test.js +63 -0
- package/dist/frontend/ts7/checker-backend.test.js.map +1 -0
- package/dist/frontend/ts7/checker-cache.d.ts +0 -3
- package/dist/frontend/ts7/checker-cache.js +0 -6
- package/dist/frontend/ts7/checker-cache.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +18 -11
- package/dist/frontend/ts7/checker.js +42 -55
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.js +10 -7
- package/dist/frontend/ts7/checker.test.js.map +1 -1
- package/dist/frontend/ts7/diagnostic.d.ts +19 -0
- package/dist/frontend/ts7/diagnostic.js +22 -0
- package/dist/frontend/ts7/diagnostic.js.map +1 -0
- package/dist/frontend/ts7/node-functions.d.ts +8 -0
- package/dist/frontend/ts7/node-functions.js +18 -0
- package/dist/frontend/ts7/node-functions.js.map +1 -0
- package/dist/frontend/ts7/program-host.d.ts +10 -5
- package/dist/frontend/ts7/program-host.js +19 -0
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/rpc-api.d.ts +5 -1
- package/dist/frontend/ts7/rpc-api.js +8 -1
- package/dist/frontend/ts7/rpc-api.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.d.ts +13 -6
- package/dist/frontend/ts7/semantic-checker.js +26 -8
- package/dist/frontend/ts7/semantic-checker.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.test.js +12 -9
- package/dist/frontend/ts7/semantic-checker.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.d.ts +57 -24
- package/dist/frontend/ts7/semantic-model.js +114 -16
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.test.js +4 -4
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-types.d.ts +7 -3
- package/dist/frontend/ts7/semantic-types.js +1 -1
- package/dist/frontend/ts7/semantic-types.js.map +1 -1
- package/dist/frontend/ts7/session.d.ts +30 -15
- package/dist/frontend/ts7/session.js +8 -5
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/ts7/session.test.js +9 -5
- package/dist/frontend/ts7/session.test.js.map +1 -1
- package/dist/frontend/ts7/source-parser.d.ts +6 -2
- package/dist/frontend/ts7/source-parser.js +24 -3
- package/dist/frontend/ts7/source-parser.js.map +1 -1
- package/dist/frontend/ts7/source-parser.test.js +38 -17
- package/dist/frontend/ts7/source-parser.test.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +122 -2
- package/dist/frontend/type-mapper.js +2735 -723
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-only-imports.d.ts +28 -0
- package/dist/frontend/type-only-imports.js +122 -0
- package/dist/frontend/type-only-imports.js.map +1 -0
- package/dist/frontend/worker-target.js +8 -8
- package/dist/frontend/worker-target.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +87 -8
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.js +4 -2
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/api.d.ts +1 -1
- package/dist/ir/api.js +1 -1
- package/dist/ir/api.js.map +1 -1
- package/dist/ir/array-length-stability.d.ts +31 -0
- package/dist/ir/array-length-stability.js +249 -0
- package/dist/ir/array-length-stability.js.map +1 -0
- package/dist/ir/array-length-stability.test.d.ts +1 -0
- package/dist/ir/array-length-stability.test.js +134 -0
- package/dist/ir/array-length-stability.test.js.map +1 -0
- package/dist/ir/build.d.ts +2 -2
- package/dist/ir/build.js +1 -1
- package/dist/ir/build.js.map +1 -1
- package/dist/ir/builtin-effects.js +116 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +540 -29
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/byte-numbers.js +3 -0
- package/dist/ir/byte-numbers.js.map +1 -1
- package/dist/ir/callback-specialization.d.ts +37 -0
- package/dist/ir/callback-specialization.js +459 -0
- package/dist/ir/callback-specialization.js.map +1 -0
- package/dist/ir/callback-specialization.test.d.ts +1 -0
- package/dist/ir/callback-specialization.test.js +208 -0
- package/dist/ir/callback-specialization.test.js.map +1 -0
- package/dist/ir/capture-values.d.ts +0 -1
- package/dist/ir/capture-values.js +51 -40
- package/dist/ir/capture-values.js.map +1 -1
- package/dist/ir/constant-globals.test.js +1 -1
- package/dist/ir/constant-tables.test.js +1 -1
- package/dist/ir/field-values.test.js +1 -1
- package/dist/ir/final-fields.test.js +1 -1
- package/dist/ir/function-references.test.js +9 -1
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/init-only-globals.test.js +1 -1
- package/dist/ir/initializer-bindings.test.js +1 -1
- package/dist/ir/int32-slots.d.ts +14 -0
- package/dist/ir/int32-slots.js +97 -14
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +1 -1
- package/dist/ir/integer-loop-facts.d.ts +7 -0
- package/dist/ir/integer-loop-facts.js +103 -17
- package/dist/ir/integer-loop-facts.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +1 -1
- package/dist/ir/integer-loops.js +39 -9
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +104 -0
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +13 -1
- package/dist/ir/integer-ranges.js +125 -26
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +273 -2
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/intrinsic-signatures.js +6 -0
- package/dist/ir/intrinsic-signatures.js.map +1 -1
- package/dist/ir/ir.d.ts +221 -58
- package/dist/ir/ir.js +127 -12
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +10 -0
- package/dist/ir/ir.test.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.d.ts +8 -0
- package/dist/ir/jsval.js +399 -0
- package/dist/ir/jsval.js.map +1 -0
- package/dist/ir/jsval.test.d.ts +1 -0
- package/dist/ir/jsval.test.js +239 -0
- package/dist/ir/jsval.test.js.map +1 -0
- package/dist/ir/runtime-features.d.ts +183 -33
- package/dist/ir/runtime-features.js +795 -422
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/scalar-records.test.js +1 -1
- package/dist/ir/self-captures.d.ts +33 -0
- package/dist/ir/self-captures.js +245 -0
- package/dist/ir/self-captures.js.map +1 -0
- package/dist/ir/self-captures.test.d.ts +1 -0
- package/dist/ir/self-captures.test.js +135 -0
- package/dist/ir/self-captures.test.js.map +1 -0
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +7 -4
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/tiers.d.ts +26 -0
- package/dist/ir/tiers.js +101 -0
- package/dist/ir/tiers.js.map +1 -0
- package/dist/ir/tiers.test.d.ts +1 -0
- package/dist/ir/tiers.test.js +140 -0
- package/dist/ir/tiers.test.js.map +1 -0
- package/dist/ir/traverse.js +201 -150
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/traverse.test.js +33 -30
- package/dist/ir/traverse.test.js.map +1 -1
- package/dist/ir/unshare.js +65 -3
- package/dist/ir/unshare.js.map +1 -1
- package/dist/ir/unshare.test.js +1 -1
- package/dist/ir/validate.js +196 -76
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +41 -11
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/fence-eval.test.js +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/ir-policy.js +14 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/library/library-cache.d.ts +1 -0
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +5 -5
- package/dist/library/library-profile.d.ts +4 -4
- package/dist/library/library-profile.js +35 -7
- package/dist/library/library-profile.js.map +1 -1
- package/dist/library/prepare.js +13 -1
- 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 +35 -6
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/compiler.test.js +2 -2
- package/dist/native/executable-cache.js +3 -0
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/prepare.js +10 -0
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.test.js +19 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/toolchain.d.ts +2 -0
- package/dist/native/toolchain.js +10 -1
- package/dist/native/toolchain.js.map +1 -1
- package/dist/native/toolchain.test.js +39 -1
- package/dist/native/toolchain.test.js.map +1 -1
- package/dist/startup-cache.d.ts +1 -0
- package/dist/startup-cache.js +1 -0
- package/dist/startup-cache.js.map +1 -1
- package/dist/wasm/base64.d.ts +5 -0
- package/dist/wasm/base64.js +62 -0
- package/dist/wasm/base64.js.map +1 -0
- package/dist/wasm/binary.d.ts +36 -0
- package/dist/wasm/binary.js +1976 -0
- package/dist/wasm/binary.js.map +1 -0
- package/dist/wasm/binary.test.d.ts +1 -0
- package/dist/wasm/binary.test.js +190 -0
- package/dist/wasm/binary.test.js.map +1 -0
- package/dist/wasm/discover.d.ts +38 -0
- package/dist/wasm/discover.js +377 -0
- package/dist/wasm/discover.js.map +1 -0
- package/dist/wasm/discover.test.d.ts +1 -0
- package/dist/wasm/discover.test.js +24 -0
- package/dist/wasm/discover.test.js.map +1 -0
- package/dist/wasm/module.d.ts +151 -0
- package/dist/wasm/module.js +575 -0
- package/dist/wasm/module.js.map +1 -0
- package/dist/wasm/translate.d.ts +48 -0
- package/dist/wasm/translate.js +2129 -0
- package/dist/wasm/translate.js.map +1 -0
- package/dist/wasm/translate.test.d.ts +1 -0
- package/dist/wasm/translate.test.js +207 -0
- package/dist/wasm/translate.test.js.map +1 -0
- package/package.json +22 -20
- 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 +304 -22
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { staticNameBindings } from "./static-function-names.js";
|
|
1
2
|
import * as ts from "../ts7/adapter.js";
|
|
2
3
|
import { bodyReadsArguments } from "../arguments-usage.js";
|
|
3
4
|
import { DYN, isUnitType, typeEquals, } from "../../ir/ir.js";
|
|
4
5
|
import { isJsSourceFile, locOf } from "../program.js";
|
|
5
6
|
import { typeKey } from "../type-mapper.js";
|
|
7
|
+
import { functionCanReturnUndefined } from "../function-completion.js";
|
|
6
8
|
import { PoisonError, dynFallbackType, neverTaintedJsType, newFnCtx } from "./lowerer.js";
|
|
7
9
|
import { tryLowerExpression } from "./expressions/try-lower-expression.js";
|
|
8
|
-
import { findGenericMethodOn } from "./lower-classes.js";
|
|
10
|
+
import { findGenericMethodOn, storedClassValueType } from "./lower-classes.js";
|
|
9
11
|
import { nsPathPrefix } from "./lower-namespaces.js";
|
|
10
12
|
import { declSymbolOf } from "./lower-modules.js";
|
|
11
13
|
import { npmStaticPackageOfPath } from "../npm-static.js";
|
|
@@ -41,9 +43,7 @@ function checkGenericParameterNames(lowerer, parameters, allowPatterns) {
|
|
|
41
43
|
* cannot see them; const bindings need no whole-file write scan. */
|
|
42
44
|
function requireStableGenericBinding(lowerer, decl, symbol, name) {
|
|
43
45
|
const isConst = (ts.getCombinedNodeFlags(decl) & ts.NodeFlags.Const) !== 0;
|
|
44
|
-
const redeclared =
|
|
45
|
-
.declarationsOf(symbol)
|
|
46
|
-
.some((d) => d !== decl && ts.isVariableDeclaration(d) && d.initializer !== undefined);
|
|
46
|
+
const redeclared = symbol.declarations.some((d) => d !== decl && ts.isVariableDeclaration(d) && d.initializer !== undefined);
|
|
47
47
|
if (!isConst && (redeclared || !bindingNeverReassigned(lowerer, symbol, decl))) {
|
|
48
48
|
lowerer.unsupported("SC1090", decl.name, `generic function values in reassigned bindings (calls of '${name}' resolve statically against this initializer, so the binding must provably hold it — a const, or a let/var nothing in its declaring file writes)`);
|
|
49
49
|
}
|
|
@@ -54,8 +54,8 @@ function requireStableGenericBinding(lowerer, decl, symbol, name) {
|
|
|
54
54
|
* generic function requires no body lowering). Called inside
|
|
55
55
|
* collectSignature's poison catch. */
|
|
56
56
|
export function collectGenericSignature(lowerer, decl) {
|
|
57
|
-
const typeParams = declaredTypeParameterSymbols(lowerer, decl.typeParameters, decl, "this function form");
|
|
58
|
-
checkGenericParameterNames(lowerer, decl.parameters, true);
|
|
57
|
+
const typeParams = declaredTypeParameterSymbols(lowerer, decl.typeParameters.nodes, decl, "this function form");
|
|
58
|
+
checkGenericParameterNames(lowerer, decl.parameters.nodes, true);
|
|
59
59
|
const nameText = decl.name?.text ?? "%default"; // nameless = the default export (checked by collectSignatureInner)
|
|
60
60
|
const symbol = declSymbolOf(lowerer, decl);
|
|
61
61
|
if (!symbol)
|
|
@@ -63,7 +63,7 @@ export function collectGenericSignature(lowerer, decl) {
|
|
|
63
63
|
lowerer.genericFnsBySymbol.set(symbol, {
|
|
64
64
|
decl,
|
|
65
65
|
baseName: nameText,
|
|
66
|
-
qualifiedName: lowerer.qualify(
|
|
66
|
+
qualifiedName: lowerer.qualify(ts.getSourceFileOfNode(decl), nsPathPrefix(decl) + nameText),
|
|
67
67
|
typeParams,
|
|
68
68
|
instances: new Map(),
|
|
69
69
|
});
|
|
@@ -84,7 +84,7 @@ export function lowerGenericCall(lowerer, expr, info) {
|
|
|
84
84
|
const instance = info.implicitParams
|
|
85
85
|
? implicitCallInstance(lowerer, expr, info)
|
|
86
86
|
: genericCallInstance(lowerer, expr, info);
|
|
87
|
-
const args = lowerer.completeArgs(expr.arguments, instance.params, loc, expr);
|
|
87
|
+
const args = lowerer.completeArgs(expr.arguments.nodes, instance.params, loc, expr);
|
|
88
88
|
return { kind: "call", callee: instance.name, args, type: instance.returnType, loc };
|
|
89
89
|
}
|
|
90
90
|
/** The instance a CALL of a generic function-like names: resolved
|
|
@@ -100,27 +100,40 @@ export function genericCallInstance(lowerer, expr, info) {
|
|
|
100
100
|
// honest story (monomorphize per implementation signature with the
|
|
101
101
|
// reconcile bridge, like the non-generic path).
|
|
102
102
|
{
|
|
103
|
-
const rdecl = rsig ?
|
|
104
|
-
if (
|
|
103
|
+
const rdecl = rsig ? rsig.declaration : undefined;
|
|
104
|
+
if (rsig &&
|
|
105
|
+
rdecl &&
|
|
105
106
|
(ts.isFunctionDeclaration(rdecl) || ts.isMethodDeclaration(rdecl)) &&
|
|
106
107
|
!rdecl.body) {
|
|
108
|
+
const overload = overloadCallInstance(lowerer, expr, info, rsig, rdecl);
|
|
109
|
+
if (overload)
|
|
110
|
+
return overload;
|
|
107
111
|
lowerer.unsupported("SC1090", expr, `calls selecting an overload signature of a generic ${ts.isMethodDeclaration(rdecl) ? "method" : "function"} (only the implementation signature monomorphizes)`);
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
|
-
if (!rsig || rsig.getParameters().length !== info.decl.parameters.length) {
|
|
114
|
+
if (!rsig || rsig.getParameters().length !== info.decl.parameters.nodes.length) {
|
|
111
115
|
lowerer.unsupported("SC1090", expr, "this call form");
|
|
112
116
|
}
|
|
113
117
|
// Per-param shapes from the RESOLVED signature (types substituted) plus
|
|
114
118
|
// the declaration's modes: rest stays the resolved array, a default's
|
|
115
119
|
// ABI union is synthesized over the resolved body type — exactly the
|
|
116
120
|
// paramShape rules, applied to post-substitution types.
|
|
117
|
-
const params = paramShapes(lowerer, info.decl.parameters, rsig, (_param, i) => expr.arguments[i] ?? expr);
|
|
121
|
+
const params = paramShapes(lowerer, info.decl.parameters.nodes, rsig, (_param, i) => expr.arguments.nodes[i] ?? expr);
|
|
118
122
|
const retTs = lowerer.checker.getReturnTypeOfSignature(rsig);
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
123
|
+
const local = localClassResultInstance(lowerer, expr, info, rsig, params, retTs);
|
|
124
|
+
if (local)
|
|
125
|
+
return local;
|
|
126
|
+
// A result instantiated at `any` (a type argument inferred from an
|
|
127
|
+
// untyped value, such as an untyped forwarding call) is checked-dynamic.
|
|
128
|
+
const mappedReturn = lowerer.mapTypeOf(retTs) ??
|
|
129
|
+
((retTs.flags & ts.TypeFlags.Any) !== 0 && !isJsSourceFile(ts.getSourceFileOfNode(info.decl))
|
|
130
|
+
? DYN
|
|
131
|
+
: null);
|
|
132
|
+
if (!mappedReturn) {
|
|
121
133
|
fenceGenericSignatureResult(lowerer, expr, retTs);
|
|
122
134
|
lowerer.badType(expr, retTs);
|
|
123
135
|
}
|
|
136
|
+
const returnType = runtimeReturnType(lowerer, info, mappedReturn);
|
|
124
137
|
// keyof-constrained type parameters (`K extends keyof T`): the bound
|
|
125
138
|
// LITERAL is semantic — the instance body reads the named field — so
|
|
126
139
|
// the bindings compute EAGERLY (the key needs them) and each literal
|
|
@@ -129,27 +142,246 @@ export function genericCallInstance(lowerer, expr, info) {
|
|
|
129
142
|
// different fields). Non-literal bindings (a key union, plain string)
|
|
130
143
|
// share one runtime-keyed instance per IR signature, exactly the
|
|
131
144
|
// widened discipline.
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
145
|
+
const named = staticNameBindings(lowerer, expr, info);
|
|
146
|
+
if (keyofConstrainedTypeParams(info).size > 0) {
|
|
134
147
|
const tsBindings = new Map();
|
|
135
148
|
const bindings = lowerer.inferTypeParamBindings(expr, info, rsig, tsBindings);
|
|
136
|
-
const litKey = info.typeParams
|
|
137
|
-
.filter((tp) => keyofTps.has(tp))
|
|
138
|
-
.map((tp) => {
|
|
139
|
-
const bound = tsBindings.get(tp);
|
|
140
|
-
return bound?.isStringLiteralType()
|
|
141
|
-
? JSON.stringify(bound.value)
|
|
142
|
-
: bound?.isNumberLiteralType()
|
|
143
|
-
? String(bound.value)
|
|
144
|
-
: "*";
|
|
145
|
-
})
|
|
146
|
-
.join(",");
|
|
147
149
|
return internGenericInstance(lowerer, expr, info, params, returnType, () => bindings, {
|
|
148
|
-
extraKey:
|
|
150
|
+
extraKey: `${keyofLiteralKey(info, tsBindings)}${named?.key ?? ""}`,
|
|
149
151
|
tsBindings,
|
|
152
|
+
...(named ? { staticFnNames: named.names } : {}),
|
|
150
153
|
});
|
|
151
154
|
}
|
|
152
|
-
return internGenericInstance(lowerer, expr, info, params, returnType, (tsBindings) => lowerer.inferTypeParamBindings(expr, info, rsig, tsBindings));
|
|
155
|
+
return internGenericInstance(lowerer, expr, info, params, returnType, (tsBindings) => lowerer.inferTypeParamBindings(expr, info, rsig, tsBindings), named ? { extraKey: named.key, staticFnNames: named.names } : undefined);
|
|
156
|
+
}
|
|
157
|
+
/** A call that resolved to an OVERLOAD signature of a generic function
|
|
158
|
+
* or method with an implementation (`request<T>(p: WithHandler<T>):
|
|
159
|
+
* Promise<T>; request(p: Plain): Promise<Res>; request<T>(p: Params<T>)
|
|
160
|
+
* {...}`): the implementation monomorphizes under the bindings the
|
|
161
|
+
* overload's resolved signature proves for its type parameters (the
|
|
162
|
+
* structural unification every generic call uses, run against the
|
|
163
|
+
* overload; unbound parameters take their declared defaults). The
|
|
164
|
+
* instance's parameters and result are the IMPLEMENTATION's under those
|
|
165
|
+
* bindings — the body was checked against them — and the call's
|
|
166
|
+
* arguments and result coerce across, exactly as a non-generic overload
|
|
167
|
+
* call reconciles with its implementation (parameters the overload omits
|
|
168
|
+
* must be optional in the implementation). Null when the overload does
|
|
169
|
+
* not belong to this implementation or the arities do not line up. */
|
|
170
|
+
function overloadCallInstance(lowerer, expr, info, rsig, rdecl) {
|
|
171
|
+
const impl = info.decl;
|
|
172
|
+
if (rdecl.parent !== impl.parent ||
|
|
173
|
+
rdecl.name === undefined ||
|
|
174
|
+
impl.name === undefined ||
|
|
175
|
+
rdecl.name.getText() !== impl.name.getText() ||
|
|
176
|
+
rdecl.parameters.nodes.length > impl.parameters.nodes.length ||
|
|
177
|
+
impl.parameters.nodes
|
|
178
|
+
.slice(rdecl.parameters.nodes.length)
|
|
179
|
+
.some((p) => p.questionToken === undefined && p.initializer === undefined) ||
|
|
180
|
+
rdecl.parameters.nodes.some((p) => p.dotDotDotToken !== undefined))
|
|
181
|
+
return null;
|
|
182
|
+
const declSig = lowerer.checker.getSignatureFromDeclaration(impl);
|
|
183
|
+
if (!declSig)
|
|
184
|
+
return null;
|
|
185
|
+
const tsBindings = new Map();
|
|
186
|
+
const bindings = new Map();
|
|
187
|
+
unifySignatureBindings(lowerer, info, rsig, bindings, tsBindings);
|
|
188
|
+
// Explicit type arguments name the OVERLOAD's type parameters, which
|
|
189
|
+
// need not match the implementation's in order: the resolved overload
|
|
190
|
+
// already carries them, so unification binds first, and an explicit
|
|
191
|
+
// argument binds only a still-unbound implementation parameter of the
|
|
192
|
+
// same name.
|
|
193
|
+
const overloadTps = rdecl.typeParameters?.nodes ?? [];
|
|
194
|
+
expr.typeArguments?.nodes.forEach((ta, i) => {
|
|
195
|
+
const name = overloadTps[i]?.name.text;
|
|
196
|
+
const tp = info.typeParams.find((p) => ts.symbolName(p) === name);
|
|
197
|
+
if (!tp || bindings.has(tp))
|
|
198
|
+
return;
|
|
199
|
+
const taT = lowerer.checker.getTypeFromTypeNode(ta);
|
|
200
|
+
const mapped = lowerer.mapTypeOf(taT);
|
|
201
|
+
if (mapped) {
|
|
202
|
+
bindings.set(tp, mapped);
|
|
203
|
+
tsBindings.set(tp, taT);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
bindDefaultTypeParams(lowerer, info.typeParams, impl.typeParameters?.nodes, bindings, tsBindings);
|
|
207
|
+
// A type parameter the overload never mentions (a handler the overload
|
|
208
|
+
// omits) is `unknown`, the checker's own answer for an uninferred one.
|
|
209
|
+
for (const tp of info.typeParams) {
|
|
210
|
+
if (bindings.has(tp))
|
|
211
|
+
continue;
|
|
212
|
+
bindings.set(tp, DYN);
|
|
213
|
+
tsBindings.set(tp, lowerer.checker.getUnknownType());
|
|
214
|
+
}
|
|
215
|
+
const previous = lowerer.typeParamBindings;
|
|
216
|
+
const previousTs = lowerer.typeParamTsBindings;
|
|
217
|
+
lowerer.typeParamBindings = bindings;
|
|
218
|
+
lowerer.typeParamTsBindings = tsBindings;
|
|
219
|
+
let params;
|
|
220
|
+
let returnType;
|
|
221
|
+
try {
|
|
222
|
+
params = paramShapes(lowerer, impl.parameters.nodes, declSig, (_param, i) => expr.arguments.nodes[i] ?? expr);
|
|
223
|
+
returnType = lowerer.mapTypeOf(lowerer.checker.getReturnTypeOfSignature(declSig));
|
|
224
|
+
}
|
|
225
|
+
finally {
|
|
226
|
+
lowerer.typeParamBindings = previous;
|
|
227
|
+
lowerer.typeParamTsBindings = previousTs;
|
|
228
|
+
}
|
|
229
|
+
if (!returnType)
|
|
230
|
+
return null;
|
|
231
|
+
// keyof-constrained parameters key their instance on the bound literal,
|
|
232
|
+
// as on the implementation-signature path.
|
|
233
|
+
const runtimeReturn = runtimeReturnType(lowerer, info, returnType);
|
|
234
|
+
return internGenericInstance(lowerer, expr, info, params, runtimeReturn, () => bindings, {
|
|
235
|
+
...(keyofConstrainedTypeParams(info).size > 0
|
|
236
|
+
? { extraKey: keyofLiteralKey(info, tsBindings) }
|
|
237
|
+
: {}),
|
|
238
|
+
tsBindings,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/** An instance's result type: a body that can return an indexed read
|
|
242
|
+
* that misses returns undefined there, as in JavaScript, whatever the
|
|
243
|
+
* declared result says. An async body's promise is always present and
|
|
244
|
+
* settles with undefined there. */
|
|
245
|
+
function runtimeReturnType(lowerer, info, mapped) {
|
|
246
|
+
if (!lowerer.runtimeOptionalGenericReturns.has(info.decl))
|
|
247
|
+
return mapped;
|
|
248
|
+
return mapped.kind === "promise"
|
|
249
|
+
? { kind: "promise", inner: lowerer.runtimeOptionalType(mapped.inner) }
|
|
250
|
+
: lowerer.runtimeOptionalType(mapped);
|
|
251
|
+
}
|
|
252
|
+
/** A generic factory whose result is one of its own local classes
|
|
253
|
+
* (`function base<T>(v: T) { return class { value: T = v }; }`). Each
|
|
254
|
+
* instance has its own class, so the instance is keyed on its bindings and
|
|
255
|
+
* the result maps inside it, where the local class takes the instance's
|
|
256
|
+
* name and bindings. */
|
|
257
|
+
function localClassResultInstance(lowerer, expr, info, rsig, params, retTs) {
|
|
258
|
+
if (!localClassOfResult(lowerer, info, retTs))
|
|
259
|
+
return null;
|
|
260
|
+
const tsBindings = new Map();
|
|
261
|
+
const bindings = lowerer.inferTypeParamBindings(expr, info, rsig, tsBindings);
|
|
262
|
+
const bindingKey = info.typeParams
|
|
263
|
+
.map((tp) => {
|
|
264
|
+
const bound = bindings.get(tp);
|
|
265
|
+
return bound ? typeKey(bound) : "?";
|
|
266
|
+
})
|
|
267
|
+
.join(",");
|
|
268
|
+
const pending = { kind: "void" };
|
|
269
|
+
const inst = internGenericInstance(lowerer, expr, info, params, pending, () => bindings, {
|
|
270
|
+
extraKey: `@class<${bindingKey}>`,
|
|
271
|
+
tsBindings,
|
|
272
|
+
});
|
|
273
|
+
if (inst.returnType !== pending)
|
|
274
|
+
return inst;
|
|
275
|
+
const returnType = withInstanceScope(lowerer, info, inst, () => lowerer.mapTypeOf(retTs));
|
|
276
|
+
if (!returnType) {
|
|
277
|
+
fenceGenericSignatureResult(lowerer, expr, retTs);
|
|
278
|
+
lowerer.badType(expr, retTs);
|
|
279
|
+
}
|
|
280
|
+
inst.returnType = returnType;
|
|
281
|
+
// Values of the class outside the factory (`const b = new B()`, `b.read()`)
|
|
282
|
+
// carry the instantiated checker type; record which class it names. A
|
|
283
|
+
// call inside another generic instance can have a type that depends on
|
|
284
|
+
// that instance's parameters, which no single class answers.
|
|
285
|
+
if (lowerer.typeParamBindings !== null)
|
|
286
|
+
return inst;
|
|
287
|
+
const instance = returnType.kind === "classval"
|
|
288
|
+
? lowerer.checker
|
|
289
|
+
.getConstructSignatures(retTs)
|
|
290
|
+
.map((sig) => lowerer.checker.getReturnTypeOfSignature(sig))
|
|
291
|
+
: [retTs];
|
|
292
|
+
const className = returnType.kind === "classval" || returnType.kind === "object" ? returnType.className : null;
|
|
293
|
+
if (className !== null)
|
|
294
|
+
for (const type of instance)
|
|
295
|
+
lowerer.localClassInstanceTypes.set(type.id, className);
|
|
296
|
+
return inst;
|
|
297
|
+
}
|
|
298
|
+
/** The class value a call of a generic factory returns when the result is
|
|
299
|
+
* one of the factory's local classes (`class C extends base(42) {}`), or
|
|
300
|
+
* null for any other call. */
|
|
301
|
+
export function genericLocalClassResult(lowerer, expr) {
|
|
302
|
+
if (!ts.isIdentifier(expr.expression))
|
|
303
|
+
return null;
|
|
304
|
+
const info = lowerer.genericFnOf(expr.expression);
|
|
305
|
+
if (!info || info.implicitParams)
|
|
306
|
+
return null;
|
|
307
|
+
const rsig = lowerer.checker.getResolvedSignature(expr);
|
|
308
|
+
if (!rsig || !localClassOfResult(lowerer, info, lowerer.checker.getReturnTypeOfSignature(rsig)))
|
|
309
|
+
return null;
|
|
310
|
+
return genericCallInstance(lowerer, expr, info).returnType;
|
|
311
|
+
}
|
|
312
|
+
/** The type of a `const` binding whose initializer calls a generic factory
|
|
313
|
+
* returning one of its local classes (`const B = base(7)`), or constructs
|
|
314
|
+
* such a class (`const b = new B()`); null for any other binding. */
|
|
315
|
+
export function genericLocalClassBinding(lowerer, node) {
|
|
316
|
+
const decl = node.parent;
|
|
317
|
+
if (!ts.isIdentifier(node) ||
|
|
318
|
+
!decl ||
|
|
319
|
+
!ts.isVariableDeclaration(decl) ||
|
|
320
|
+
decl.name !== node ||
|
|
321
|
+
!decl.initializer ||
|
|
322
|
+
(ts.getCombinedNodeFlags(decl) & ts.NodeFlags.Const) === 0)
|
|
323
|
+
return null;
|
|
324
|
+
// An `any` binding keeps the checked-dynamic representation.
|
|
325
|
+
if ((lowerer.typeOf(node).flags & ts.TypeFlags.Any) !== 0)
|
|
326
|
+
return null;
|
|
327
|
+
let init = decl.initializer;
|
|
328
|
+
while (ts.isParenthesizedExpression(init))
|
|
329
|
+
init = init.expression;
|
|
330
|
+
if (ts.isCallExpression(init))
|
|
331
|
+
return genericLocalClassResult(lowerer, init);
|
|
332
|
+
if (!ts.isNewExpression(init))
|
|
333
|
+
return null;
|
|
334
|
+
const constructed = storedClassValueType(lowerer, init.expression);
|
|
335
|
+
if (constructed?.kind !== "classval")
|
|
336
|
+
return null;
|
|
337
|
+
const classDecl = lowerer.classes.get(constructed.className)?.decl;
|
|
338
|
+
return classDecl && insideGenericFunction(classDecl)
|
|
339
|
+
? { kind: "object", className: constructed.className }
|
|
340
|
+
: null;
|
|
341
|
+
}
|
|
342
|
+
/** Whether `node` is declared inside a function with type parameters. */
|
|
343
|
+
function insideGenericFunction(node) {
|
|
344
|
+
for (let parent = node.parent; parent && !ts.isSourceFile(parent); parent = parent.parent)
|
|
345
|
+
if (ts.isFunctionLike(parent) && (parent.typeParameters?.nodes.length ?? 0) > 0)
|
|
346
|
+
return true;
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
/** The class declared inside a generic function that `type` is the
|
|
350
|
+
* constructor or instance type of, or null. */
|
|
351
|
+
function localClassOfResult(lowerer, info, type) {
|
|
352
|
+
const symbol = type.getSymbol();
|
|
353
|
+
if (!symbol || !(symbol.flags & ts.SymbolFlags.Class))
|
|
354
|
+
return null;
|
|
355
|
+
const decl = symbol.valueDeclaration;
|
|
356
|
+
if (!decl || !(ts.isClassExpression(decl) || ts.isClassDeclaration(decl)))
|
|
357
|
+
return null;
|
|
358
|
+
for (let parent = decl.parent; parent && !ts.isSourceFile(parent); parent = parent.parent)
|
|
359
|
+
if (parent === info.decl)
|
|
360
|
+
return decl;
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
/** Runs `fn` under an instance's type bindings and local-class names, as
|
|
364
|
+
* its body lowers. */
|
|
365
|
+
function withInstanceScope(lowerer, info, inst, fn) {
|
|
366
|
+
const prevBindings = lowerer.typeParamBindings;
|
|
367
|
+
const prevTsBindings = lowerer.typeParamTsBindings;
|
|
368
|
+
const previousPath = lowerer.genericInstantiationPath;
|
|
369
|
+
const prevContext = lowerer.instantiationContext;
|
|
370
|
+
lowerer.typeParamBindings = inst.bindings;
|
|
371
|
+
lowerer.typeParamTsBindings = inst.tsBindings ?? null;
|
|
372
|
+
lowerer.genericInstantiationPath = inst.path;
|
|
373
|
+
lowerer.instantiationContext = `instantiating '${info.baseName}' with ${inst.typeArgsText}`;
|
|
374
|
+
lowerer.localClassInstantiations.push({ owner: info.decl, name: inst.name });
|
|
375
|
+
try {
|
|
376
|
+
return fn();
|
|
377
|
+
}
|
|
378
|
+
finally {
|
|
379
|
+
lowerer.localClassInstantiations.pop();
|
|
380
|
+
lowerer.typeParamBindings = prevBindings;
|
|
381
|
+
lowerer.typeParamTsBindings = prevTsBindings;
|
|
382
|
+
lowerer.genericInstantiationPath = previousPath;
|
|
383
|
+
lowerer.instantiationContext = prevContext;
|
|
384
|
+
}
|
|
153
385
|
}
|
|
154
386
|
/** The one instance table both instantiation routes share: key identity IS
|
|
155
387
|
* signature identity, so a call (`identity(1)`) and a pinned VALUE
|
|
@@ -180,7 +412,7 @@ function internGenericInstance(lowerer, blame, info, params, returnType, makeBin
|
|
|
180
412
|
return JSON.stringify(tsBound.value);
|
|
181
413
|
}
|
|
182
414
|
const bound = bindings.get(tp);
|
|
183
|
-
return bound ? lowerer.fmt(bound) : tp
|
|
415
|
+
return bound ? lowerer.fmt(bound) : ts.symbolName(tp);
|
|
184
416
|
})
|
|
185
417
|
.join(", ");
|
|
186
418
|
// Deep polymorphic recursion renders unbounded types — keep messages sane.
|
|
@@ -194,6 +426,7 @@ function internGenericInstance(lowerer, blame, info, params, returnType, makeBin
|
|
|
194
426
|
bindings,
|
|
195
427
|
tsBindings,
|
|
196
428
|
typeArgsText,
|
|
429
|
+
...(opts?.staticFnNames ? { staticFnNames: opts.staticFnNames } : {}),
|
|
197
430
|
};
|
|
198
431
|
info.instances.set(key, inst);
|
|
199
432
|
lowerer.instantiationQueue.push({ info, inst });
|
|
@@ -209,7 +442,7 @@ function keyofConstrainedTypeParams(info) {
|
|
|
209
442
|
if (info.keyofTps)
|
|
210
443
|
return info.keyofTps;
|
|
211
444
|
const out = new Set();
|
|
212
|
-
info.decl.typeParameters?.forEach((tpDecl, i) => {
|
|
445
|
+
info.decl.typeParameters?.nodes.forEach((tpDecl, i) => {
|
|
213
446
|
const sym = info.typeParams[i];
|
|
214
447
|
if (!sym || tpDecl.constraint === undefined)
|
|
215
448
|
return;
|
|
@@ -221,6 +454,24 @@ function keyofConstrainedTypeParams(info) {
|
|
|
221
454
|
info.keyofTps = out;
|
|
222
455
|
return out;
|
|
223
456
|
}
|
|
457
|
+
/** The instance-key suffix of the literals bound to `info`'s
|
|
458
|
+
* keyof-constrained type parameters (`@"a"`; `*` for a non-literal
|
|
459
|
+
* binding): two literals can map to one IR signature while their bodies
|
|
460
|
+
* read different fields. */
|
|
461
|
+
function keyofLiteralKey(info, tsBindings) {
|
|
462
|
+
const keyofTps = keyofConstrainedTypeParams(info);
|
|
463
|
+
const literals = info.typeParams
|
|
464
|
+
.filter((tp) => keyofTps.has(tp))
|
|
465
|
+
.map((tp) => {
|
|
466
|
+
const bound = tsBindings.get(tp);
|
|
467
|
+
return bound?.isStringLiteralType()
|
|
468
|
+
? JSON.stringify(bound.value)
|
|
469
|
+
: bound?.isNumberLiteralType()
|
|
470
|
+
? String(bound.value)
|
|
471
|
+
: "*";
|
|
472
|
+
});
|
|
473
|
+
return `@${literals.join(",")}`;
|
|
474
|
+
}
|
|
224
475
|
/** Type-parameter symbol → concrete IR type for one instantiation.
|
|
225
476
|
* Explicit type arguments bind directly; the rest come from structurally
|
|
226
477
|
* matching each DECLARED param/return type (which mentions the type
|
|
@@ -231,7 +482,7 @@ function keyofConstrainedTypeParams(info) {
|
|
|
231
482
|
* (carrying the instantiation context). */
|
|
232
483
|
export function inferTypeParamBindings(lowerer, expr, info, rsig, tsBindings) {
|
|
233
484
|
const bindings = new Map();
|
|
234
|
-
expr.typeArguments?.forEach((ta, i) => {
|
|
485
|
+
expr.typeArguments?.nodes.forEach((ta, i) => {
|
|
235
486
|
const tp = info.typeParams[i];
|
|
236
487
|
if (!tp)
|
|
237
488
|
return;
|
|
@@ -243,7 +494,7 @@ export function inferTypeParamBindings(lowerer, expr, info, rsig, tsBindings) {
|
|
|
243
494
|
}
|
|
244
495
|
});
|
|
245
496
|
unifySignatureBindings(lowerer, info, rsig, bindings, tsBindings);
|
|
246
|
-
bindDefaultTypeParams(lowerer, info.typeParams, info.decl.typeParameters, bindings, tsBindings);
|
|
497
|
+
bindDefaultTypeParams(lowerer, info.typeParams, info.decl.typeParameters?.nodes, bindings, tsBindings);
|
|
247
498
|
return bindings;
|
|
248
499
|
}
|
|
249
500
|
/** Type parameters still unbound after unification take their declared
|
|
@@ -298,7 +549,11 @@ function unifySignatureBindings(lowerer, info, rsig, bindings, tsBindings) {
|
|
|
298
549
|
tsBindings.set(sym, lowerer.typeParamTsResolver(inst) ?? inst);
|
|
299
550
|
}
|
|
300
551
|
if (!bindings.has(sym)) {
|
|
301
|
-
const mapped = lowerer.mapTypeOf(inst)
|
|
552
|
+
const mapped = lowerer.mapTypeOf(inst) ??
|
|
553
|
+
((inst.flags & ts.TypeFlags.Any) !== 0 &&
|
|
554
|
+
!isJsSourceFile(ts.getSourceFileOfNode(info.decl))
|
|
555
|
+
? DYN
|
|
556
|
+
: null);
|
|
302
557
|
// A visitor's inferred T can be void. It still binds the
|
|
303
558
|
// return convention of `(node) => T`; discarding it leaves
|
|
304
559
|
// the callback's return type spuriously uninstantiated.
|
|
@@ -334,6 +589,31 @@ function unifySignatureBindings(lowerer, info, rsig, bindings, tsBindings) {
|
|
|
334
589
|
// too is safe only when no undeclared null arm remains.
|
|
335
590
|
unify(dParts[0], lowerer.checker.getNonNullableType(inst), depth + 1);
|
|
336
591
|
}
|
|
592
|
+
else if (dParts.length > 1 && iParts.length === dParts.length) {
|
|
593
|
+
// `T | Promise<T>` against `Res | Promise<Res>`: each declared
|
|
594
|
+
// part that names a generic target (Promise, an interface, an
|
|
595
|
+
// alias) pairs with the one instantiated part of the same target;
|
|
596
|
+
// a single remaining bare type parameter takes the single
|
|
597
|
+
// remaining instantiated part.
|
|
598
|
+
const remaining = [...iParts];
|
|
599
|
+
const bare = [];
|
|
600
|
+
for (const d of dParts) {
|
|
601
|
+
if (d.flags & ts.TypeFlags.TypeParameter) {
|
|
602
|
+
bare.push(d);
|
|
603
|
+
continue;
|
|
604
|
+
}
|
|
605
|
+
const target = d.getSymbol() ?? d.getAliasSymbol();
|
|
606
|
+
if (target === undefined)
|
|
607
|
+
return;
|
|
608
|
+
const matches = remaining.filter((i) => (i.getSymbol() ?? i.getAliasSymbol()) === target);
|
|
609
|
+
if (matches.length !== 1)
|
|
610
|
+
return;
|
|
611
|
+
remaining.splice(remaining.indexOf(matches[0]), 1);
|
|
612
|
+
unify(d, matches[0], depth + 1);
|
|
613
|
+
}
|
|
614
|
+
if (bare.length === 1 && remaining.length === 1)
|
|
615
|
+
unify(bare[0], remaining[0], depth + 1);
|
|
616
|
+
}
|
|
337
617
|
return;
|
|
338
618
|
}
|
|
339
619
|
// Instantiations of the SAME generic ALIAS (Partial<T> vs
|
|
@@ -400,7 +680,7 @@ function unifySignatureBindings(lowerer, info, rsig, bindings, tsBindings) {
|
|
|
400
680
|
}
|
|
401
681
|
if (declared.flags & ts.TypeFlags.Object) {
|
|
402
682
|
for (const dp of lowerer.checker.getPropertiesOfType(declared)) {
|
|
403
|
-
const ip = lowerer.checker.getPropertyOfType(inst, dp
|
|
683
|
+
const ip = lowerer.checker.getPropertyOfType(inst, ts.symbolName(dp));
|
|
404
684
|
if (ip)
|
|
405
685
|
unify(lowerer.checker.getTypeOfSymbol(dp), lowerer.checker.getTypeOfSymbol(ip), depth + 1);
|
|
406
686
|
}
|
|
@@ -431,6 +711,8 @@ export function lowerGenericInstance(lowerer, info, inst) {
|
|
|
431
711
|
const prevSuppress = lowerer.suppressStats;
|
|
432
712
|
const prevClass = lowerer.currentClass;
|
|
433
713
|
const prevImplicit = lowerer.implicitParamTypes;
|
|
714
|
+
const prevStaticFnNames = lowerer.staticFnNames;
|
|
715
|
+
lowerer.staticFnNames = inst.staticFnNames ?? null;
|
|
434
716
|
// A generic METHOD of a generic-class INSTANTIATION lowers under BOTH
|
|
435
717
|
// binding sets: the receiver instantiation's class type parameters
|
|
436
718
|
// underneath, the method instantiation's own on top (disjoint symbol
|
|
@@ -460,7 +742,7 @@ export function lowerGenericInstance(lowerer, info, inst) {
|
|
|
460
742
|
// body returns the resolved promise's INNER type, calls enter through
|
|
461
743
|
// the instance's own spawn wrapper (the emitter routes by fn.async),
|
|
462
744
|
// and awaits park this instance's fibers.
|
|
463
|
-
const isAsync = decl.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword) === true;
|
|
745
|
+
const isAsync = decl.modifiers?.nodes.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword) === true;
|
|
464
746
|
const nameBlame = (ts.isArrowFunction(decl) ? undefined : decl.name) ?? decl;
|
|
465
747
|
const isGenerator = decl.asteriskToken !== undefined;
|
|
466
748
|
if (isAsync && !isGenerator && inst.returnType.kind !== "promise") {
|
|
@@ -478,6 +760,8 @@ export function lowerGenericInstance(lowerer, info, inst) {
|
|
|
478
760
|
: lowerer.bodyReturnType(isAsync, inst.returnType);
|
|
479
761
|
const fnCtx = newFnCtx(false, null, null, bodyReturn);
|
|
480
762
|
fnCtx.isAsync = isAsync;
|
|
763
|
+
// Instances lower on demand, on top of whichever caller reached them.
|
|
764
|
+
fnCtx.thisBoundary = true;
|
|
481
765
|
// Implicit-any instances whose declared return did not map lower in
|
|
482
766
|
// return-INFERENCE mode: `return` statements record here bare, and the
|
|
483
767
|
// post-pass (resolveInferredReturn) settles the type and wraps them.
|
|
@@ -491,6 +775,8 @@ export function lowerGenericInstance(lowerer, info, inst) {
|
|
|
491
775
|
lowerer.fnStack.push(fnCtx);
|
|
492
776
|
lowerer.localClassInstantiations.push({ owner: decl, name: inst.name });
|
|
493
777
|
lowerer.genericInstantiationPath = inst.path;
|
|
778
|
+
if (inst.erased)
|
|
779
|
+
lowerer.erasingDepth++;
|
|
494
780
|
try {
|
|
495
781
|
// Static specializations bind lexical this only when the caller
|
|
496
782
|
// proved its exact receiver. Other instances retain the fence;
|
|
@@ -514,12 +800,12 @@ export function lowerGenericInstance(lowerer, info, inst) {
|
|
|
514
800
|
}
|
|
515
801
|
// Default-param initializers lower per instance, with the bindings
|
|
516
802
|
// threaded — a default mentioning T resolves like any body expression.
|
|
517
|
-
const declared = lowerer.declareParams(decl.parameters, inst.params);
|
|
803
|
+
const declared = lowerer.declareParams(decl.parameters.nodes, inst.params);
|
|
518
804
|
params.push(...declared.params);
|
|
519
805
|
const body = [...receiverInit, ...declared.prologue];
|
|
520
806
|
const bodyBlock = blockBodyOf(decl);
|
|
521
807
|
if (bodyBlock) {
|
|
522
|
-
body.push(...lowerer.lowerStmts(bodyBlock.statements));
|
|
808
|
+
body.push(...lowerer.lowerStmts(bodyBlock.statements.nodes));
|
|
523
809
|
if (fnCtx.inferReturn) {
|
|
524
810
|
bodyReturn = resolveInferredReturn(lowerer, inst, fnCtx.inferReturn, body, decl);
|
|
525
811
|
inst.returnType = bodyReturn;
|
|
@@ -587,9 +873,12 @@ export function lowerGenericInstance(lowerer, info, inst) {
|
|
|
587
873
|
lowerer.typeParamBindings = prevBindings;
|
|
588
874
|
lowerer.typeParamTsBindings = prevTsBindings;
|
|
589
875
|
lowerer.implicitParamTypes = prevImplicit;
|
|
876
|
+
lowerer.staticFnNames = prevStaticFnNames;
|
|
590
877
|
lowerer.instantiationContext = prevContext;
|
|
591
878
|
lowerer.localClassInstantiations.pop();
|
|
592
879
|
lowerer.suppressStats = prevSuppress;
|
|
880
|
+
if (inst.erased)
|
|
881
|
+
lowerer.erasingDepth--;
|
|
593
882
|
}
|
|
594
883
|
}
|
|
595
884
|
/** A generic function taken as a VALUE, monomorphized by flow. A function
|
|
@@ -617,6 +906,12 @@ export function lowerGenericFnValue(lowerer, ref, info) {
|
|
|
617
906
|
lowerer.noteEdge(inst.name);
|
|
618
907
|
return { kind: "closure", fnName: inst.name, captures: [], type: funcType, loc };
|
|
619
908
|
}
|
|
909
|
+
// Each call of the enclosing function makes a new function object for a
|
|
910
|
+
// binding declared inside it (`make() !== make()` when make returns
|
|
911
|
+
// it), which one shared compiled instance cannot give.
|
|
912
|
+
if (info.functionScoped) {
|
|
913
|
+
lowerer.unsupported("SC1090", ref, `generic arrow/function-expression bindings declared inside functions as values (each call of the enclosing function makes a new '${info.baseName}' function object, while its compiled instances are shared module functions — call '${info.baseName}' directly, or declare it at module scope)`);
|
|
914
|
+
}
|
|
620
915
|
const fenceUnpinned = () => lowerer.unsupported("SC1090", ref, `generic functions as values without a pinned concrete signature (annotate the destination — e.g. 'const f: (x: number) => number = ${info.baseName}' — instantiate explicitly ('${info.baseName}<number>'), or call '${info.baseName}' directly)`);
|
|
621
916
|
// The PINNING type: an instantiation expression's own checker type
|
|
622
917
|
// (explicit type arguments applied), else the reference's contextual
|
|
@@ -654,7 +949,7 @@ export function lowerGenericFnValue(lowerer, ref, info) {
|
|
|
654
949
|
const hofBinding = runtimeOptionalHofGenericBinding(lowerer, ref, info);
|
|
655
950
|
if (hofBinding)
|
|
656
951
|
bindings.set(hofBinding.typeParam, hofBinding.type);
|
|
657
|
-
bindDefaultTypeParams(lowerer, info.typeParams, info.decl.typeParameters, bindings);
|
|
952
|
+
bindDefaultTypeParams(lowerer, info.typeParams, info.decl.typeParameters?.nodes, bindings);
|
|
658
953
|
// A pinning signature that itself keeps type parameters (`let g: <T>(x:
|
|
659
954
|
// T) => T = identity` — storing the generic signature as such) binds
|
|
660
955
|
// nothing: mapType answers null for an unsubstituted parameter.
|
|
@@ -673,7 +968,7 @@ function runtimeOptionalHofGenericBinding(lowerer, ref, info) {
|
|
|
673
968
|
while (argument.parent && ts.isParenthesizedExpression(argument.parent))
|
|
674
969
|
argument = argument.parent;
|
|
675
970
|
const call = argument.parent;
|
|
676
|
-
if (!ts.isCallExpression(call) || call.arguments[0] !== argument)
|
|
971
|
+
if (!ts.isCallExpression(call) || call.arguments.nodes[0] !== argument)
|
|
677
972
|
return null;
|
|
678
973
|
if (!ts.isPropertyAccessExpression(call.expression) || call.expression.name.text !== "map")
|
|
679
974
|
return null;
|
|
@@ -682,7 +977,7 @@ function runtimeOptionalHofGenericBinding(lowerer, ref, info) {
|
|
|
682
977
|
const receiver = lowerer.mapTypeOf(lowerer.typeOf(call.expression.expression));
|
|
683
978
|
if (receiver?.kind !== "array")
|
|
684
979
|
return null;
|
|
685
|
-
const parameter = info.decl.parameters[0];
|
|
980
|
+
const parameter = info.decl.parameters.nodes[0];
|
|
686
981
|
if (!parameter || !ts.isIdentifier(parameter.name))
|
|
687
982
|
return null;
|
|
688
983
|
const parameterType = lowerer.typeOf(parameter.name);
|
|
@@ -693,6 +988,20 @@ function runtimeOptionalHofGenericBinding(lowerer, ref, info) {
|
|
|
693
988
|
return null;
|
|
694
989
|
return { typeParam, type: lowerer.runtimeOptionalType(receiver.elem) };
|
|
695
990
|
}
|
|
991
|
+
/** The erased instance of a generic declaration: every type parameter
|
|
992
|
+
* bound to `unknown`, the function JavaScript runs for any type arguments.
|
|
993
|
+
* Values of generic methods (dynamic dispatch, interface views) call it. */
|
|
994
|
+
export function erasedGenericInstance(lowerer, blame, info) {
|
|
995
|
+
lowerer.erasingDepth++;
|
|
996
|
+
try {
|
|
997
|
+
const instance = genericValueInstance(lowerer, blame, info, new Map(info.typeParams.map((tp) => [tp, DYN])));
|
|
998
|
+
instance.erased = true;
|
|
999
|
+
return instance;
|
|
1000
|
+
}
|
|
1001
|
+
finally {
|
|
1002
|
+
lowerer.erasingDepth--;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
696
1005
|
/** The instance a pinned VALUE reference names: the declaration's modes
|
|
697
1006
|
* over the DECLARED types mapped under the bindings (mapType's resolver
|
|
698
1007
|
* substitutes — the instance-body trick), which is the same result the
|
|
@@ -704,7 +1013,7 @@ function genericValueInstance(lowerer, ref, info, bindings) {
|
|
|
704
1013
|
const rendered = info.typeParams
|
|
705
1014
|
.map((tp) => {
|
|
706
1015
|
const bound = bindings.get(tp);
|
|
707
|
-
return bound ? lowerer.fmt(bound) : tp
|
|
1016
|
+
return bound ? lowerer.fmt(bound) : ts.symbolName(tp);
|
|
708
1017
|
})
|
|
709
1018
|
.join(", ");
|
|
710
1019
|
lowerer.typeParamBindings = bindings;
|
|
@@ -713,7 +1022,7 @@ function genericValueInstance(lowerer, ref, info, bindings) {
|
|
|
713
1022
|
const declSig = lowerer.checker.getSignatureFromDeclaration(info.decl);
|
|
714
1023
|
if (!declSig)
|
|
715
1024
|
lowerer.unsupported("SC1090", ref, "this function form");
|
|
716
|
-
const params = paramShapes(lowerer, info.decl.parameters, declSig);
|
|
1025
|
+
const params = paramShapes(lowerer, info.decl.parameters.nodes, declSig);
|
|
717
1026
|
const retTs = lowerer.checker.getReturnTypeOfSignature(declSig);
|
|
718
1027
|
const returnType = lowerer.mapTypeOf(retTs);
|
|
719
1028
|
if (!returnType) {
|
|
@@ -797,7 +1106,7 @@ function paramWrittenInBody(lowerer, body, sym, name) {
|
|
|
797
1106
|
hit = true;
|
|
798
1107
|
return;
|
|
799
1108
|
}
|
|
800
|
-
|
|
1109
|
+
ts.forEachChild(m, scan);
|
|
801
1110
|
};
|
|
802
1111
|
scan(n);
|
|
803
1112
|
return hit;
|
|
@@ -829,7 +1138,7 @@ function paramWrittenInBody(lowerer, body, sym, name) {
|
|
|
829
1138
|
written = true;
|
|
830
1139
|
return;
|
|
831
1140
|
}
|
|
832
|
-
|
|
1141
|
+
ts.forEachChild(n, walk);
|
|
833
1142
|
};
|
|
834
1143
|
walk(body);
|
|
835
1144
|
return written;
|
|
@@ -845,6 +1154,105 @@ function broadPromiseParam(lowerer, type) {
|
|
|
845
1154
|
arms.some((arm) => arm.kind === "promise" && arm.inner.kind === "dyn") &&
|
|
846
1155
|
arms.every((arm) => isUnitType(arm) || (arm.kind === "promise" && arm.inner.kind === "dyn")));
|
|
847
1156
|
}
|
|
1157
|
+
/** The destructured object parameters of a JS function-like that bind like
|
|
1158
|
+
* implicit type parameters: every element a plain name (optionally renamed
|
|
1159
|
+
* from an identifier or string key) with no default, no rest element, and
|
|
1160
|
+
* no write in the body, under a broad inferred type. Parallel to
|
|
1161
|
+
* decl.parameters. */
|
|
1162
|
+
export function implicitPatternsOf(lowerer, decl) {
|
|
1163
|
+
return decl.parameters.nodes.map((param) => {
|
|
1164
|
+
if (!ts.isObjectBindingPattern(param.name) || !decl.body)
|
|
1165
|
+
return null;
|
|
1166
|
+
if (param.dotDotDotToken || param.questionToken || param.initializer)
|
|
1167
|
+
return null;
|
|
1168
|
+
const elements = [];
|
|
1169
|
+
for (const element of param.name.elements.nodes) {
|
|
1170
|
+
if (element.dotDotDotToken || element.initializer || !ts.isIdentifier(element.name))
|
|
1171
|
+
return null;
|
|
1172
|
+
const key = element.propertyName ?? element.name;
|
|
1173
|
+
if (!ts.isIdentifier(key) && !ts.isStringLiteral(key))
|
|
1174
|
+
return null;
|
|
1175
|
+
const symbol = lowerer.checker.getSymbolAtLocation(element.name);
|
|
1176
|
+
if (!symbol || paramWrittenInBody(lowerer, decl.body, symbol, element.name.text))
|
|
1177
|
+
return null;
|
|
1178
|
+
// A JSDoc or contextual type names the properties: keep its ABI.
|
|
1179
|
+
if ((lowerer.typeOf(element.name).flags & ts.TypeFlags.Any) === 0)
|
|
1180
|
+
return null;
|
|
1181
|
+
elements.push({ property: key.text, symbol });
|
|
1182
|
+
}
|
|
1183
|
+
return elements.length > 0 ? { elements } : null;
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
/** The type a destructured parameter takes at one call site (the object's
|
|
1187
|
+
* own representation, a record or a checked value) and the checker type
|
|
1188
|
+
* each destructured name binds. An object literal argument types the names
|
|
1189
|
+
* from its property expressions, which see the enclosing instance's
|
|
1190
|
+
* bindings (`makeClass({ Base, name })` inside a specialized
|
|
1191
|
+
* `extend(Base, name)`); any other argument uses its checker type. Null
|
|
1192
|
+
* when the argument lacks a destructured property, or passes a class the
|
|
1193
|
+
* callee itself defines: each such class would instantiate the callee
|
|
1194
|
+
* again (a static `extend` calling `makeClass({ Base: this })`). */
|
|
1195
|
+
function implicitPatternBinding(lowerer, callee, pattern, arg) {
|
|
1196
|
+
let literal = arg;
|
|
1197
|
+
while (ts.isParenthesizedExpression(literal))
|
|
1198
|
+
literal = literal.expression;
|
|
1199
|
+
const types = new Map();
|
|
1200
|
+
if (ts.isObjectLiteralExpression(literal)) {
|
|
1201
|
+
const values = new Map();
|
|
1202
|
+
/** Shorthand properties name the binding they read. */
|
|
1203
|
+
const shorthand = new Map();
|
|
1204
|
+
for (const property of literal.properties.nodes) {
|
|
1205
|
+
if (ts.isShorthandPropertyAssignment(property) && ts.isIdentifier(property.name)) {
|
|
1206
|
+
values.set(property.name.text, property.name);
|
|
1207
|
+
const read = lowerer.checker.getShorthandAssignmentValueSymbol(property);
|
|
1208
|
+
if (read)
|
|
1209
|
+
shorthand.set(property.name.text, read);
|
|
1210
|
+
}
|
|
1211
|
+
else if (ts.isPropertyAssignment(property) &&
|
|
1212
|
+
(ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)))
|
|
1213
|
+
values.set(property.name.text, property.initializer);
|
|
1214
|
+
else
|
|
1215
|
+
return null;
|
|
1216
|
+
}
|
|
1217
|
+
for (const element of pattern.elements) {
|
|
1218
|
+
const value = values.get(element.property);
|
|
1219
|
+
if (!value)
|
|
1220
|
+
return null;
|
|
1221
|
+
const read = shorthand.get(element.property);
|
|
1222
|
+
const type = (read && lowerer.implicitParamTypes?.get(read)) ?? lowerer.typeOf(value);
|
|
1223
|
+
types.set(element.symbol, lowerer.checker.getBaseTypeOfLiteralType(type));
|
|
1224
|
+
}
|
|
1225
|
+
// The object keeps the representation the call site lowers it to; the
|
|
1226
|
+
// destructured names read their static types back out of it.
|
|
1227
|
+
const lowered = tryLowerExpression(lowerer, literal);
|
|
1228
|
+
if (lowered?.type.kind !== "record" && lowered?.type.kind !== "dyn")
|
|
1229
|
+
return null;
|
|
1230
|
+
if (lowered.type.kind === "record") {
|
|
1231
|
+
for (const field of lowerer.shapes.get(lowered.type.shapeId)?.fields ?? [])
|
|
1232
|
+
if (field.type.kind === "classval" && classDefinedIn(lowerer, field.type.className, callee))
|
|
1233
|
+
return null;
|
|
1234
|
+
}
|
|
1235
|
+
return { record: lowered.type, types };
|
|
1236
|
+
}
|
|
1237
|
+
const argType = lowerer.checker.getBaseTypeOfLiteralType(lowerer.typeOf(arg));
|
|
1238
|
+
const record = lowerer.mapTypeOf(argType);
|
|
1239
|
+
if (record?.kind !== "record")
|
|
1240
|
+
return null;
|
|
1241
|
+
for (const element of pattern.elements) {
|
|
1242
|
+
const property = lowerer.checker.getPropertyOfType(argType, element.property);
|
|
1243
|
+
if (!property)
|
|
1244
|
+
return null;
|
|
1245
|
+
types.set(element.symbol, lowerer.checker.getTypeOfSymbol(property));
|
|
1246
|
+
}
|
|
1247
|
+
return { record, types };
|
|
1248
|
+
}
|
|
1249
|
+
/** The class is declared inside `scope`. */
|
|
1250
|
+
function classDefinedIn(lowerer, className, scope) {
|
|
1251
|
+
for (let n = lowerer.classes.get(className)?.decl ?? undefined; n; n = n.parent)
|
|
1252
|
+
if (n === scope)
|
|
1253
|
+
return true;
|
|
1254
|
+
return false;
|
|
1255
|
+
}
|
|
848
1256
|
/** The implicit-type-parameter slots of a JS function-like: parallel to
|
|
849
1257
|
* decl.parameters, the param SYMBOL where the slot is a bindable
|
|
850
1258
|
* implicit param (identifier-named, broad inferred/JSDoc type, not
|
|
@@ -857,17 +1265,17 @@ export function implicitAnyParamSymbolsOf(lowerer, decl, classParams = false) {
|
|
|
857
1265
|
return null;
|
|
858
1266
|
if (decl.asteriskToken)
|
|
859
1267
|
return null;
|
|
860
|
-
if (decl.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword))
|
|
1268
|
+
if (decl.modifiers?.nodes.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword))
|
|
861
1269
|
return null;
|
|
862
1270
|
if (decl.typeParameters !== undefined)
|
|
863
1271
|
return null; // real generics own the machinery
|
|
864
|
-
if (decl.parameters.length === 0)
|
|
1272
|
+
if (decl.parameters.nodes.length === 0)
|
|
865
1273
|
return null;
|
|
866
1274
|
// The variadic-`arguments` form keeps its dynRest story whole.
|
|
867
1275
|
if (bodyReadsArguments(decl))
|
|
868
1276
|
return null;
|
|
869
1277
|
let hasImplicitParams = false;
|
|
870
|
-
const out = decl.parameters.map((param) => {
|
|
1278
|
+
const out = decl.parameters.nodes.map((param) => {
|
|
871
1279
|
if (!ts.isIdentifier(param.name))
|
|
872
1280
|
return null;
|
|
873
1281
|
if (param.dotDotDotToken || param.questionToken || param.initializer)
|
|
@@ -894,6 +1302,10 @@ export function implicitAnyParamSymbolsOf(lowerer, decl, classParams = false) {
|
|
|
894
1302
|
hasImplicitParams = true;
|
|
895
1303
|
return sym;
|
|
896
1304
|
});
|
|
1305
|
+
// Destructured object parameters monomorphize too (implicitPatternsOf);
|
|
1306
|
+
// their slots stay null here.
|
|
1307
|
+
if (!hasImplicitParams && isJsSourceFile(ts.getSourceFileOfNode(decl)))
|
|
1308
|
+
hasImplicitParams = implicitPatternsOf(lowerer, decl).some((pattern) => pattern !== null);
|
|
897
1309
|
return hasImplicitParams ? out : null;
|
|
898
1310
|
}
|
|
899
1311
|
/** The checker-fallback return type an implicit instance PROMISES before
|
|
@@ -907,10 +1319,10 @@ function implicitDeclaredReturn(lowerer, info) {
|
|
|
907
1319
|
// narrower JSDoc (for example a Vector2 target documented as Vector3).
|
|
908
1320
|
// Infer their result from the specialized body as well.
|
|
909
1321
|
if (info.member?.kind === "static" &&
|
|
910
|
-
info.decl.parameters.some((param, index) => info.implicitParams?.[index] &&
|
|
1322
|
+
info.decl.parameters.nodes.some((param, index) => info.implicitParams?.[index] &&
|
|
911
1323
|
lowerer.mapTypeOf(lowerer.typeOf(param.name))?.kind === "object"))
|
|
912
1324
|
return null;
|
|
913
|
-
const broadCallbackSymbols = new Set(info.decl.parameters.flatMap((param, index) => {
|
|
1325
|
+
const broadCallbackSymbols = new Set(info.decl.parameters.nodes.flatMap((param, index) => {
|
|
914
1326
|
const symbol = info.implicitParams?.[index];
|
|
915
1327
|
return symbol !== null &&
|
|
916
1328
|
symbol !== undefined &&
|
|
@@ -957,7 +1369,7 @@ function implicitDeclaredReturn(lowerer, info) {
|
|
|
957
1369
|
// container instead of checking every element against that guess.
|
|
958
1370
|
if (!hasExplicitJsDocReturn(info.decl))
|
|
959
1371
|
return null;
|
|
960
|
-
if (info.decl.parameters.some((param, index) => info.implicitParams?.[index] &&
|
|
1372
|
+
if (info.decl.parameters.nodes.some((param, index) => info.implicitParams?.[index] &&
|
|
961
1373
|
lowerer.mapTypeOf(lowerer.typeOf(param.name))?.kind === "array"))
|
|
962
1374
|
return null;
|
|
963
1375
|
const elem = lowerer.checker.getTypeArguments(retTs)[0];
|
|
@@ -990,9 +1402,7 @@ function implicitDeclaredReturn(lowerer, info) {
|
|
|
990
1402
|
return undefined;
|
|
991
1403
|
const symbol = lowerer.resolveValueSymbol(node.expression);
|
|
992
1404
|
if (symbol &&
|
|
993
|
-
lowerer
|
|
994
|
-
.declarationsOf(symbol)
|
|
995
|
-
.some((decl) => ts.isVariableDeclaration(decl) && jsBindingHasOpenWrites(lowerer, decl)))
|
|
1405
|
+
symbol.declarations.some((decl) => ts.isVariableDeclaration(decl) && jsBindingHasOpenWrites(lowerer, decl)))
|
|
996
1406
|
openReturn = true;
|
|
997
1407
|
return undefined;
|
|
998
1408
|
});
|
|
@@ -1020,6 +1430,14 @@ function implicitDeclaredReturn(lowerer, info) {
|
|
|
1020
1430
|
return null;
|
|
1021
1431
|
if (mapped !== null && promiseCarriesDyn(lowerer, mapped) && !hasExplicitJsDocReturn(info.decl))
|
|
1022
1432
|
return null;
|
|
1433
|
+
// A JavaScript body that can complete without returning yields
|
|
1434
|
+
// undefined there, whatever its JSDoc claims (bcryptjs's `hash`
|
|
1435
|
+
// returns a promise only when no callback is passed), exactly as
|
|
1436
|
+
// declaredReturnType widens non-generic JavaScript functions.
|
|
1437
|
+
if (mapped !== null &&
|
|
1438
|
+
isJsSourceFile(ts.getSourceFileOfNode(info.decl)) &&
|
|
1439
|
+
functionCanReturnUndefined(info.decl))
|
|
1440
|
+
return lowerer.withUndefinedArmOf(mapped) ?? mapped;
|
|
1023
1441
|
return mapped;
|
|
1024
1442
|
}
|
|
1025
1443
|
catch (e) {
|
|
@@ -1057,7 +1475,7 @@ function bindableImplicitIr(t) {
|
|
|
1057
1475
|
function storedImplicitArgumentType(lowerer, arg) {
|
|
1058
1476
|
while (ts.isParenthesizedExpression(arg))
|
|
1059
1477
|
arg = arg.expression;
|
|
1060
|
-
if (isJsSourceFile(
|
|
1478
|
+
if (isJsSourceFile(ts.getSourceFileOfNode(arg)) &&
|
|
1061
1479
|
(ts.isArrowFunction(arg) || ts.isFunctionExpression(arg))) {
|
|
1062
1480
|
const saved = lowerer.diagSink;
|
|
1063
1481
|
const diagnostics = [];
|
|
@@ -1081,9 +1499,9 @@ function storedImplicitArgumentType(lowerer, arg) {
|
|
|
1081
1499
|
return awaited?.kind === "promise" ? awaited.inner : awaited;
|
|
1082
1500
|
}
|
|
1083
1501
|
if (ts.isObjectLiteralExpression(arg) &&
|
|
1084
|
-
isJsSourceFile(
|
|
1085
|
-
(arg.properties.length === 0 ||
|
|
1086
|
-
arg.properties.some((property) => ts.isMethodDeclaration(property) ||
|
|
1502
|
+
isJsSourceFile(ts.getSourceFileOfNode(arg)) &&
|
|
1503
|
+
(arg.properties.nodes.length === 0 ||
|
|
1504
|
+
arg.properties.nodes.some((property) => ts.isMethodDeclaration(property) ||
|
|
1087
1505
|
ts.isAccessor(property) ||
|
|
1088
1506
|
(!ts.isSpreadAssignment(property) &&
|
|
1089
1507
|
property.name !== undefined &&
|
|
@@ -1091,7 +1509,7 @@ function storedImplicitArgumentType(lowerer, arg) {
|
|
|
1091
1509
|
return DYN;
|
|
1092
1510
|
if (ts.isIdentifier(arg))
|
|
1093
1511
|
return lowerer.peekLocal(arg)?.type ?? lowerer.globalOf(arg)?.type ?? null;
|
|
1094
|
-
if (isJsSourceFile(
|
|
1512
|
+
if (isJsSourceFile(ts.getSourceFileOfNode(arg)) &&
|
|
1095
1513
|
(ts.isPropertyAccessExpression(arg) || ts.isElementAccessExpression(arg))) {
|
|
1096
1514
|
// Mutable JS members can retain an initializer-only checker type (for
|
|
1097
1515
|
// example a linked-list slot initially null). Specialize to the value
|
|
@@ -1100,7 +1518,7 @@ function storedImplicitArgumentType(lowerer, arg) {
|
|
|
1100
1518
|
if (represented)
|
|
1101
1519
|
return represented.type;
|
|
1102
1520
|
}
|
|
1103
|
-
if (isJsSourceFile(
|
|
1521
|
+
if (isJsSourceFile(ts.getSourceFileOfNode(arg)) &&
|
|
1104
1522
|
(ts.isCallExpression(arg) ||
|
|
1105
1523
|
ts.isConditionalExpression(arg) ||
|
|
1106
1524
|
(ts.isBinaryExpression(arg) &&
|
|
@@ -1133,7 +1551,27 @@ function storedImplicitArgumentType(lowerer, arg) {
|
|
|
1133
1551
|
export function implicitCallInstance(lowerer, call, info) {
|
|
1134
1552
|
const shapes = [];
|
|
1135
1553
|
const argTypes = new Map();
|
|
1136
|
-
info.
|
|
1554
|
+
const patterns = (info.implicitPatterns ??= implicitPatternsOf(lowerer, info.decl));
|
|
1555
|
+
/** The destructured names' bound types, which the object's own
|
|
1556
|
+
* representation does not always carry. */
|
|
1557
|
+
const patternKey = [];
|
|
1558
|
+
info.decl.parameters.nodes.forEach((param, i) => {
|
|
1559
|
+
const pattern = patterns[i];
|
|
1560
|
+
const patternArg = call.arguments.nodes[i];
|
|
1561
|
+
if (pattern && patternArg && !ts.isSpreadElement(patternArg)) {
|
|
1562
|
+
// The argument's object type binds each destructured name, so a
|
|
1563
|
+
// class passed as `{ Base }` keeps its static class type.
|
|
1564
|
+
const bound = implicitPatternBinding(lowerer, info.decl, pattern, patternArg);
|
|
1565
|
+
if (bound) {
|
|
1566
|
+
for (const [symbol, type] of bound.types) {
|
|
1567
|
+
argTypes.set(symbol, type);
|
|
1568
|
+
const mapped = lowerer.mapTypeOf(type);
|
|
1569
|
+
patternKey.push(mapped ? typeKey(mapped) : "?");
|
|
1570
|
+
}
|
|
1571
|
+
shapes.push({ type: bound.record, mode: "required" });
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1137
1575
|
const sym = info.implicitParams[i];
|
|
1138
1576
|
if (!sym) {
|
|
1139
1577
|
shapes.push(lowerer.paramShape(param));
|
|
@@ -1143,7 +1581,7 @@ export function implicitCallInstance(lowerer, call, info) {
|
|
|
1143
1581
|
const declared = lowerer.paramShape(param);
|
|
1144
1582
|
if ((lowerer.typeOf(param.name).flags & ts.TypeFlags.Any) === 0)
|
|
1145
1583
|
bound = declared.type;
|
|
1146
|
-
const arg = call.arguments[i];
|
|
1584
|
+
const arg = call.arguments.nodes[i];
|
|
1147
1585
|
if (arg && !ts.isSpreadElement(arg)) {
|
|
1148
1586
|
const stored = storedImplicitArgumentType(lowerer, arg);
|
|
1149
1587
|
if (stored?.kind === "dyn") {
|
|
@@ -1152,6 +1590,17 @@ export function implicitCallInstance(lowerer, call, info) {
|
|
|
1152
1590
|
shapes.push({ type: bound, mode: "required" });
|
|
1153
1591
|
return;
|
|
1154
1592
|
}
|
|
1593
|
+
// `this` in a static method specialized for its receiver class is
|
|
1594
|
+
// that class: bind it as a call naming the class would.
|
|
1595
|
+
if (stored?.kind === "classval" && arg.kind === ts.SyntaxKind.ThisKeyword) {
|
|
1596
|
+
const classDecl = lowerer.classes.get(stored.className)?.decl;
|
|
1597
|
+
const classType = classDecl?.name ? lowerer.typeOf(classDecl.name) : null;
|
|
1598
|
+
if (classType) {
|
|
1599
|
+
argTypes.set(sym, classType);
|
|
1600
|
+
shapes.push({ type: stored, mode: "required" });
|
|
1601
|
+
return;
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1155
1604
|
// A represented native array must keep its storage when a direct
|
|
1156
1605
|
// inferred helper receives it. Re-boxing a checker-any array would
|
|
1157
1606
|
// copy it, losing writes (and attempting to read unfilled slots).
|
|
@@ -1178,7 +1627,7 @@ export function implicitCallInstance(lowerer, call, info) {
|
|
|
1178
1627
|
const t = lowerer.checker.getBaseTypeOfLiteralType(lowerer.typeOf(arg));
|
|
1179
1628
|
const mapped = (neverTaintedJsType(lowerer, arg, t) ? null : lowerer.mapTypeOf(t)) ??
|
|
1180
1629
|
dynFallbackType(lowerer, arg, t);
|
|
1181
|
-
if (isJsSourceFile(
|
|
1630
|
+
if (isJsSourceFile(ts.getSourceFileOfNode(arg)) &&
|
|
1182
1631
|
ts.isArrayLiteralExpression(arg) &&
|
|
1183
1632
|
mapped?.kind === "array" &&
|
|
1184
1633
|
(mapped.elem.kind === "classval" ||
|
|
@@ -1201,7 +1650,7 @@ export function implicitCallInstance(lowerer, call, info) {
|
|
|
1201
1650
|
// That checker supertype is not an empty-record runtime layout:
|
|
1202
1651
|
// preserve represented arms through the checked boundary instead
|
|
1203
1652
|
// of specializing a call to a union that would discard them.
|
|
1204
|
-
if (isJsSourceFile(
|
|
1653
|
+
if (isJsSourceFile(ts.getSourceFileOfNode(arg)) &&
|
|
1205
1654
|
mapped?.kind === "func" &&
|
|
1206
1655
|
!lowerer.dynConvertible(mapped)) {
|
|
1207
1656
|
argTypes.set(sym, lowerer.checker.getUnknownType());
|
|
@@ -1247,27 +1696,27 @@ export function implicitCallInstance(lowerer, call, info) {
|
|
|
1247
1696
|
}
|
|
1248
1697
|
shapes.push({ type: bound, mode: "required" });
|
|
1249
1698
|
});
|
|
1250
|
-
return internImplicitInstance(lowerer, call, info, shapes, argTypes);
|
|
1699
|
+
return internImplicitInstance(lowerer, call, info, shapes, argTypes, patternKey.join(","));
|
|
1251
1700
|
}
|
|
1252
1701
|
/** The all-dyn DEFAULT instance — today's compiled body exactly: what a
|
|
1253
1702
|
* VALUE reference of an implicit-any function names (indirect calls
|
|
1254
1703
|
* carry no per-site types to bind). */
|
|
1255
1704
|
export function implicitDefaultInstance(lowerer, blame, info) {
|
|
1256
|
-
const shapes = info.decl.parameters.map((param, i) => info.implicitParams[i] ? { type: DYN, mode: "required" } : lowerer.paramShape(param));
|
|
1705
|
+
const shapes = info.decl.parameters.nodes.map((param, i) => info.implicitParams[i] ? { type: DYN, mode: "required" } : lowerer.paramShape(param));
|
|
1257
1706
|
const argTypes = new Map();
|
|
1258
1707
|
// Newly bindable nominal class parameters must not retain their JSDoc
|
|
1259
1708
|
// receiver type in the checked fallback. Keep existing broad JS inference.
|
|
1260
|
-
for (let i = 0; i < info.decl.parameters.length; i++) {
|
|
1709
|
+
for (let i = 0; i < info.decl.parameters.nodes.length; i++) {
|
|
1261
1710
|
const symbol = info.implicitParams?.[i];
|
|
1262
|
-
const kind = lowerer.mapTypeOf(lowerer.typeOf(info.decl.parameters[i].name))?.kind;
|
|
1711
|
+
const kind = lowerer.mapTypeOf(lowerer.typeOf(info.decl.parameters.nodes[i].name))?.kind;
|
|
1263
1712
|
if (symbol && (kind === "object" || kind === "array")) {
|
|
1264
1713
|
argTypes.set(symbol, lowerer.checker.getUnknownType());
|
|
1265
1714
|
}
|
|
1266
1715
|
}
|
|
1267
1716
|
return internImplicitInstance(lowerer, blame, info, shapes, argTypes);
|
|
1268
1717
|
}
|
|
1269
|
-
function internImplicitInstance(lowerer, blame, info, shapes, argTypes) {
|
|
1270
|
-
const key = shapes.map((s) => typeKey(s.type)).join(",");
|
|
1718
|
+
function internImplicitInstance(lowerer, blame, info, shapes, argTypes, patternKey = "") {
|
|
1719
|
+
const key = shapes.map((s) => typeKey(s.type)).join(",") + (patternKey ? `|${patternKey}` : "");
|
|
1271
1720
|
let inst = info.instances.get(key);
|
|
1272
1721
|
if (inst?.implicitState === "failed")
|
|
1273
1722
|
lowerer.unsupported("SC1090", blame, `the failed specialization of '${info.baseName}'`);
|
|
@@ -1284,7 +1733,7 @@ function internImplicitInstance(lowerer, blame, info, shapes, argTypes) {
|
|
|
1284
1733
|
`${MAX_INSTANTIATION_RECURSION} recursive specializations on one demand path)`);
|
|
1285
1734
|
}
|
|
1286
1735
|
const rendered = shapes.map((s) => lowerer.fmt(s.type)).join(", ");
|
|
1287
|
-
const dynamicBroadPromise = info.decl.parameters.some((param, index) => info.implicitParams?.[index] !== null &&
|
|
1736
|
+
const dynamicBroadPromise = info.decl.parameters.nodes.some((param, index) => info.implicitParams?.[index] !== null &&
|
|
1288
1737
|
info.implicitParams?.[index] !== undefined &&
|
|
1289
1738
|
shapes[index]?.type.kind === "dyn" &&
|
|
1290
1739
|
broadPromiseParam(lowerer, lowerer.typeOf(param.name)));
|
|
@@ -1322,7 +1771,7 @@ function internImplicitInstance(lowerer, blame, info, shapes, argTypes) {
|
|
|
1322
1771
|
// this exact committed instance body here; repeated instantiations of
|
|
1323
1772
|
// the same declaration find the facade memos warm.
|
|
1324
1773
|
lowerer.checker.prefetchRoots([
|
|
1325
|
-
...info.decl.parameters.flatMap((param) =>
|
|
1774
|
+
...info.decl.parameters.nodes.flatMap((param) => param.initializer ? [param.initializer] : []),
|
|
1326
1775
|
...(info.decl.body ? [info.decl.body] : []),
|
|
1327
1776
|
]);
|
|
1328
1777
|
const fn = lowerer.lowerGenericInstance(info, inst);
|
|
@@ -1369,7 +1818,7 @@ export function implicitLocalFnNodeOf(lowerer, decl) {
|
|
|
1369
1818
|
if (cached !== undefined)
|
|
1370
1819
|
return cached ? cached.decl : null;
|
|
1371
1820
|
const probe = () => {
|
|
1372
|
-
if (!implicitMonoFile(
|
|
1821
|
+
if (!implicitMonoFile(ts.getSourceFileOfNode(decl)))
|
|
1373
1822
|
return null;
|
|
1374
1823
|
if (!ts.isIdentifier(decl.name) || decl.initializer === undefined)
|
|
1375
1824
|
return null;
|
|
@@ -1386,35 +1835,55 @@ export function implicitLocalFnNodeOf(lowerer, decl) {
|
|
|
1386
1835
|
if (!sym)
|
|
1387
1836
|
return null;
|
|
1388
1837
|
const isConst = (ts.getCombinedNodeFlags(decl) & ts.NodeFlags.Const) !== 0;
|
|
1389
|
-
const redeclared =
|
|
1390
|
-
.declarationsOf(sym)
|
|
1391
|
-
.some((d) => d !== decl && ts.isVariableDeclaration(d) && d.initializer !== undefined);
|
|
1838
|
+
const redeclared = sym.declarations.some((d) => d !== decl && ts.isVariableDeclaration(d) && d.initializer !== undefined);
|
|
1392
1839
|
if (redeclared)
|
|
1393
1840
|
return null;
|
|
1394
1841
|
if (!isConst && !bindingNeverReassigned(lowerer, sym, decl))
|
|
1395
1842
|
return null;
|
|
1396
|
-
//
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1843
|
+
// Instances are module functions with no frame.
|
|
1844
|
+
return capturesEnclosingFrame(lowerer, init, decl, init.body) ? null : init;
|
|
1845
|
+
};
|
|
1846
|
+
const node = probe();
|
|
1847
|
+
if (node === null) {
|
|
1848
|
+
lowerer.implicitLocalFns.set(decl, null);
|
|
1849
|
+
return null;
|
|
1850
|
+
}
|
|
1851
|
+
return node;
|
|
1852
|
+
}
|
|
1853
|
+
/** True when `fn`, bound by `decl`, uses its enclosing function's frame
|
|
1854
|
+
* somewhere in `scope`: `this`, `super`, `arguments` or `new.target`, or
|
|
1855
|
+
* a value or type declared in an enclosing function (a local, a parameter,
|
|
1856
|
+
* an enclosing generic's type parameter). Module-scope declarations and
|
|
1857
|
+
* the binding itself are reachable from the module functions the
|
|
1858
|
+
* instances compile to. */
|
|
1859
|
+
function capturesEnclosingFrame(lowerer, fn, decl, scope) {
|
|
1860
|
+
const file = ts.getSourceFileOfNode(decl);
|
|
1861
|
+
const self = lowerer.checker.getSymbolAtLocation(decl.name);
|
|
1862
|
+
let captures = false;
|
|
1863
|
+
const scan = (n) => {
|
|
1864
|
+
if (captures)
|
|
1865
|
+
return;
|
|
1866
|
+
if (n.kind === ts.SyntaxKind.ThisKeyword ||
|
|
1867
|
+
n.kind === ts.SyntaxKind.SuperKeyword ||
|
|
1868
|
+
ts.isMetaProperty(n)) {
|
|
1869
|
+
// Arrow bodies see the ENCLOSING this; function expressions
|
|
1870
|
+
// rebind their own — but a bare `this` there is untyped JS
|
|
1871
|
+
// dynamism either way. Reject both, cheaply and soundly.
|
|
1872
|
+
captures = true;
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1875
|
+
if (ts.isIdentifier(n)) {
|
|
1876
|
+
const s = lowerer.checker.getSymbolAtLocation(n);
|
|
1877
|
+
if (s === undefined) {
|
|
1878
|
+
if (n.text === "arguments")
|
|
1879
|
+
captures = true;
|
|
1407
1880
|
}
|
|
1408
|
-
if (
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
// Declared outside the initializer, in this file: a capture
|
|
1415
|
-
// exactly when some enclosing FUNCTION scope declares it —
|
|
1416
|
-
// module-scope declarations are reachable from any module
|
|
1417
|
-
// function.
|
|
1881
|
+
else if (s !== self) {
|
|
1882
|
+
for (const d of s.declarations) {
|
|
1883
|
+
if (ts.getSourceFileOfNode(d) !== file || (d.pos >= fn.pos && d.end <= fn.end))
|
|
1884
|
+
continue;
|
|
1885
|
+
// Declared outside the function, in this file: a capture
|
|
1886
|
+
// exactly when some enclosing FUNCTION scope declares it.
|
|
1418
1887
|
for (let p = d.parent; p !== undefined && !ts.isSourceFile(p); p = p.parent) {
|
|
1419
1888
|
if (ts.isFunctionLike(p)) {
|
|
1420
1889
|
captures = true;
|
|
@@ -1423,17 +1892,11 @@ export function implicitLocalFnNodeOf(lowerer, decl) {
|
|
|
1423
1892
|
}
|
|
1424
1893
|
}
|
|
1425
1894
|
}
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
scan(init.body);
|
|
1429
|
-
return captures ? null : init;
|
|
1895
|
+
}
|
|
1896
|
+
ts.forEachChild(n, scan);
|
|
1430
1897
|
};
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
lowerer.implicitLocalFns.set(decl, null);
|
|
1434
|
-
return null;
|
|
1435
|
-
}
|
|
1436
|
-
return node;
|
|
1898
|
+
scan(scope);
|
|
1899
|
+
return captures;
|
|
1437
1900
|
}
|
|
1438
1901
|
/** Registers (or returns) the GenericFnInfo of a qualifying implicit-any
|
|
1439
1902
|
* function-value binding — implicitLocalFnNodeOf's companion, the
|
|
@@ -1458,7 +1921,7 @@ export function implicitLocalFnInfoOf(lowerer, decl, fnNode) {
|
|
|
1458
1921
|
const info = {
|
|
1459
1922
|
decl: fnNode,
|
|
1460
1923
|
baseName: name,
|
|
1461
|
-
qualifiedName: lowerer.qualify(
|
|
1924
|
+
qualifiedName: lowerer.qualify(ts.getSourceFileOfNode(decl), nsPathPrefix(stmt ?? decl, decl) + `${name}%l${ts.tokenStartOfNode(decl)}`),
|
|
1462
1925
|
typeParams: [],
|
|
1463
1926
|
instances: new Map(),
|
|
1464
1927
|
implicitParams: implicit,
|
|
@@ -1477,7 +1940,7 @@ export function implicitLocalFnInfoOf(lowerer, decl, fnNode) {
|
|
|
1477
1940
|
* arrow/function-expression property's initializer (`{ m: <T>(x: T) =>
|
|
1478
1941
|
* ... }`). Null when the property's declaration isn't that shape. */
|
|
1479
1942
|
export function objLitGenericFnNodeOf(lowerer, propSym) {
|
|
1480
|
-
const decl =
|
|
1943
|
+
const decl = propSym.valueDeclaration;
|
|
1481
1944
|
if (!decl)
|
|
1482
1945
|
return null;
|
|
1483
1946
|
if (ts.isMethodDeclaration(decl) && ts.isObjectLiteralExpression(decl.parent)) {
|
|
@@ -1511,7 +1974,7 @@ export function objLitGenericFnInfoOf(lowerer, blame, name, found) {
|
|
|
1511
1974
|
return existing;
|
|
1512
1975
|
if (fnNode.asteriskToken)
|
|
1513
1976
|
lowerer.unsupported("SC1071", blame);
|
|
1514
|
-
if (fnNode.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword)) {
|
|
1977
|
+
if (fnNode.modifiers?.nodes.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword)) {
|
|
1515
1978
|
lowerer.unsupported("SC1090", blame, "async object-literal generic methods");
|
|
1516
1979
|
}
|
|
1517
1980
|
// `this` is the receiver object — records don't model it (the
|
|
@@ -1525,12 +1988,12 @@ export function objLitGenericFnInfoOf(lowerer, blame, name, found) {
|
|
|
1525
1988
|
lowerer.unsupported("SC1090", blame, `object-literal generic methods declared inside functions (the compiled instantiations of '${name}' are module functions and cannot capture the enclosing frame — declare the object at module scope)`);
|
|
1526
1989
|
}
|
|
1527
1990
|
}
|
|
1528
|
-
const typeParams = declaredTypeParameterSymbols(lowerer, fnNode.typeParameters, blame, "this method form");
|
|
1529
|
-
checkGenericParameterNames(lowerer, fnNode.parameters, false);
|
|
1991
|
+
const typeParams = declaredTypeParameterSymbols(lowerer, fnNode.typeParameters.nodes, blame, "this method form");
|
|
1992
|
+
checkGenericParameterNames(lowerer, fnNode.parameters.nodes, false);
|
|
1530
1993
|
const info = {
|
|
1531
1994
|
decl: fnNode,
|
|
1532
1995
|
baseName: name,
|
|
1533
|
-
qualifiedName: lowerer.qualify(
|
|
1996
|
+
qualifiedName: lowerer.qualify(ts.getSourceFileOfNode(fnNode), `%ol${ts.tokenStartOfNode(fnNode)}.${name}`),
|
|
1534
1997
|
typeParams,
|
|
1535
1998
|
instances: new Map(),
|
|
1536
1999
|
objectLiteral: true,
|
|
@@ -1607,9 +2070,16 @@ export function bindingGenericFnInfoOf(lowerer, decl, fnNode) {
|
|
|
1607
2070
|
const name = decl.name.text;
|
|
1608
2071
|
if (fnNode.asteriskToken)
|
|
1609
2072
|
lowerer.unsupported("SC1071", fnNode);
|
|
2073
|
+
// Inside a function, the compiled instances are module functions, so
|
|
2074
|
+
// the initializer may not use the enclosing frame.
|
|
2075
|
+
let functionScoped = false;
|
|
1610
2076
|
for (let n = decl.parent; n !== undefined && !ts.isSourceFile(n); n = n.parent) {
|
|
1611
2077
|
if (ts.isFunctionLike(n)) {
|
|
1612
|
-
lowerer
|
|
2078
|
+
if (capturesEnclosingFrame(lowerer, fnNode, decl, fnNode)) {
|
|
2079
|
+
lowerer.unsupported("SC1090", fnNode, `generic arrow/function-expression bindings that use the frames of their enclosing functions (the compiled instantiations of '${name}' are module functions and cannot capture its locals, parameters, type parameters or 'this' — pass them as arguments, or declare the binding at module scope)`);
|
|
2080
|
+
}
|
|
2081
|
+
functionScoped = true;
|
|
2082
|
+
break;
|
|
1613
2083
|
}
|
|
1614
2084
|
}
|
|
1615
2085
|
const sym = lowerer.checker.getSymbolAtLocation(decl.name);
|
|
@@ -1618,7 +2088,7 @@ export function bindingGenericFnInfoOf(lowerer, decl, fnNode) {
|
|
|
1618
2088
|
requireStableGenericBinding(lowerer, decl, sym, name);
|
|
1619
2089
|
const typeParams = [];
|
|
1620
2090
|
if (fnNode.typeParameters !== undefined) {
|
|
1621
|
-
typeParams.push(...declaredTypeParameterSymbols(lowerer, fnNode.typeParameters, fnNode, "this function form"));
|
|
2091
|
+
typeParams.push(...declaredTypeParameterSymbols(lowerer, fnNode.typeParameters.nodes, fnNode, "this function form"));
|
|
1622
2092
|
}
|
|
1623
2093
|
else {
|
|
1624
2094
|
// The CONTEXTUAL shape (bindingContextualGenericFnNodeOf): the type
|
|
@@ -1636,14 +2106,19 @@ export function bindingGenericFnInfoOf(lowerer, decl, fnNode) {
|
|
|
1636
2106
|
typeParams.push(tpSym);
|
|
1637
2107
|
}
|
|
1638
2108
|
}
|
|
1639
|
-
checkGenericParameterNames(lowerer, fnNode.parameters, true);
|
|
2109
|
+
checkGenericParameterNames(lowerer, fnNode.parameters.nodes, true);
|
|
1640
2110
|
const stmt = decl.parent?.parent; // declarator → list → statement (nsPathPrefix wants the statement)
|
|
2111
|
+
// A binding in a function or block can share its name with another; its
|
|
2112
|
+
// instances take the declaration's position.
|
|
2113
|
+
const topLevel = stmt?.parent !== undefined && (ts.isSourceFile(stmt.parent) || ts.isModuleBlock(stmt.parent));
|
|
1641
2114
|
const info = {
|
|
1642
2115
|
decl: fnNode,
|
|
1643
2116
|
baseName: name,
|
|
1644
|
-
qualifiedName: lowerer.qualify(
|
|
2117
|
+
qualifiedName: lowerer.qualify(ts.getSourceFileOfNode(decl), nsPathPrefix(stmt ?? decl, decl) +
|
|
2118
|
+
(topLevel ? name : `${name}%l${ts.tokenStartOfNode(decl)}`)),
|
|
1645
2119
|
typeParams,
|
|
1646
2120
|
instances: new Map(),
|
|
2121
|
+
...(functionScoped ? { functionScoped: true } : {}),
|
|
1647
2122
|
};
|
|
1648
2123
|
lowerer.bindingGenericFns.set(fnNode, info);
|
|
1649
2124
|
lowerer.genericFnsBySymbol.set(sym, info);
|
|
@@ -1709,7 +2184,7 @@ export function requireObjLitGenericReceiver(lowerer, blame, recvExpr, literal,
|
|
|
1709
2184
|
if (!ts.isIdentifier(recv))
|
|
1710
2185
|
fenceReceiver();
|
|
1711
2186
|
const recvSym = lowerer.resolveValueSymbol(recv);
|
|
1712
|
-
const recvDecl = recvSym ?
|
|
2187
|
+
const recvDecl = recvSym ? recvSym.valueDeclaration : undefined;
|
|
1713
2188
|
if (!recvDecl ||
|
|
1714
2189
|
!ts.isVariableDeclaration(recvDecl) ||
|
|
1715
2190
|
!ts.isVariableDeclarationList(recvDecl.parent) ||
|