@scriptc/compiler 0.2.3 → 0.2.5
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 +915 -215
- package/ambient/scriptc-overrides.d.ts +5 -1
- package/ambient/scriptc.d.ts +22 -2
- package/dist/backend/build-cache.d.ts +4 -0
- package/dist/backend/build-cache.js +16 -2
- package/dist/backend/build-cache.js.map +1 -1
- package/dist/backend/cycle-analysis.js +17 -5
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-analysis.test.js +50 -11
- package/dist/backend/cycle-analysis.test.js.map +1 -1
- package/dist/backend/debug-symbols.js.map +1 -1
- package/dist/backend/executable-features.js +2 -1
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/external-c.d.ts +13 -6
- package/dist/backend/external-c.js +15 -3
- package/dist/backend/external-c.js.map +1 -1
- package/dist/backend/ffi-callbacks.js +6 -9
- package/dist/backend/ffi-callbacks.js.map +1 -1
- package/dist/backend/library-identity-markers.js.map +1 -1
- package/dist/backend/library-pack.d.ts +1 -1
- package/dist/backend/library-pack.js +81 -24
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/link-plan-core.js +9 -2
- package/dist/backend/link-plan-core.js.map +1 -1
- package/dist/backend/link-plan.d.ts +1 -1
- package/dist/backend/link-plan.js +4 -5
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/linker.d.ts +1 -1
- package/dist/backend/linker.js +42 -23
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/literals.js +5 -4
- package/dist/backend/literals.js.map +1 -1
- package/dist/backend/literals.test.js +30 -5
- package/dist/backend/literals.test.js.map +1 -1
- package/dist/backend/llvm/blocks.test.js +5 -2
- package/dist/backend/llvm/blocks.test.js.map +1 -1
- package/dist/backend/llvm/borrowed-inputs.d.ts +15 -0
- package/dist/backend/llvm/borrowed-inputs.js +28 -0
- package/dist/backend/llvm/borrowed-inputs.js.map +1 -0
- package/dist/backend/llvm/borrowed-receivers.js +43 -19
- package/dist/backend/llvm/borrowed-receivers.js.map +1 -1
- package/dist/backend/llvm/byte-numbers.d.ts +10 -0
- package/dist/backend/llvm/byte-numbers.js +240 -0
- package/dist/backend/llvm/byte-numbers.js.map +1 -0
- package/dist/backend/llvm/bytes-bounds.d.ts +9 -0
- package/dist/backend/llvm/bytes-bounds.js +240 -0
- package/dist/backend/llvm/bytes-bounds.js.map +1 -0
- package/dist/backend/llvm/call-lifetimes.d.ts +10 -0
- package/dist/backend/llvm/call-lifetimes.js +83 -20
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +203 -18
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/checked-value-lifetimes.d.ts +13 -0
- package/dist/backend/llvm/checked-value-lifetimes.js +45 -0
- package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -0
- package/dist/backend/llvm/classes.js +16 -12
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/common.js +4 -1
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/counted-loops.d.ts +6 -0
- package/dist/backend/llvm/counted-loops.js +35 -0
- package/dist/backend/llvm/counted-loops.js.map +1 -0
- package/dist/backend/llvm/debug-info.js +33 -13
- package/dist/backend/llvm/debug-info.js.map +1 -1
- package/dist/backend/llvm/debug-info.test.js +28 -6
- package/dist/backend/llvm/debug-info.test.js.map +1 -1
- package/dist/backend/llvm/dyn.js +68 -22
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +34 -12
- package/dist/backend/llvm/emitter.js +357 -124
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +237 -46
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +28 -8
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +4 -4
- package/dist/backend/llvm/expr-bytes.js +78 -36
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +10 -4
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +40 -21
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +4 -1
- package/dist/backend/llvm/expr-containers.js +157 -76
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +11 -0
- package/dist/backend/llvm/expr-control.js +27 -8
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.js +3 -1
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +50 -33
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-island.js +26 -6
- package/dist/backend/llvm/expr-island.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +139 -37
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +43 -1
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +16 -9
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +44 -26
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +51 -14
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.js +34 -14
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/integer-values.d.ts +10 -0
- package/dist/backend/llvm/integer-values.js +52 -0
- package/dist/backend/llvm/integer-values.js.map +1 -0
- package/dist/backend/llvm/integer-views.d.ts +7 -0
- package/dist/backend/llvm/integer-views.js +83 -0
- package/dist/backend/llvm/integer-views.js.map +1 -0
- package/dist/backend/llvm/integer-views.test.d.ts +1 -0
- package/dist/backend/llvm/integer-views.test.js +69 -0
- package/dist/backend/llvm/integer-views.test.js.map +1 -0
- package/dist/backend/llvm/lib-abi.js +13 -4
- package/dist/backend/llvm/lib-abi.js.map +1 -1
- package/dist/backend/llvm/lib-connect.js +7 -1
- package/dist/backend/llvm/lib-connect.js.map +1 -1
- package/dist/backend/llvm/lib-datagram.js +35 -10
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +36 -15
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +38 -23
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.js +60 -15
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-lookup.js +12 -5
- package/dist/backend/llvm/lib-lookup.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +97 -31
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +57 -14
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +107 -31
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +33 -14
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-test.js +21 -7
- package/dist/backend/llvm/lib-test.js.map +1 -1
- package/dist/backend/llvm/lib-tls.js +69 -20
- package/dist/backend/llvm/lib-tls.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.d.ts +3 -4
- package/dist/backend/llvm/local-array-reads.js +100 -121
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +379 -71
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.d.ts +25 -0
- package/dist/backend/llvm/local-union-storage.js +109 -0
- package/dist/backend/llvm/local-union-storage.js.map +1 -0
- package/dist/backend/llvm/local-union-storage.test.d.ts +1 -0
- package/dist/backend/llvm/local-union-storage.test.js +210 -0
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -0
- package/dist/backend/llvm/map-read-lifetimes.d.ts +6 -2
- package/dist/backend/llvm/map-read-lifetimes.js +46 -16
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +93 -17
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/reference-effects.d.ts +23 -0
- package/dist/backend/llvm/reference-effects.js +179 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -0
- package/dist/backend/llvm/reference-effects.test.d.ts +1 -0
- package/dist/backend/llvm/reference-effects.test.js +157 -0
- package/dist/backend/llvm/reference-effects.test.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +7 -4
- package/dist/backend/llvm/shapes.js +82 -22
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +3 -1
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/split.js +4 -4
- package/dist/backend/llvm/split.js.map +1 -1
- package/dist/backend/llvm/split.test.js +14 -6
- package/dist/backend/llvm/split.test.js.map +1 -1
- package/dist/backend/llvm/stack-unions.js +14 -5
- package/dist/backend/llvm/stack-unions.js.map +1 -1
- package/dist/backend/llvm/stack-unions.test.js +172 -32
- package/dist/backend/llvm/stack-unions.test.js.map +1 -1
- package/dist/backend/llvm/string-construction.d.ts +10 -0
- package/dist/backend/llvm/string-construction.js +38 -0
- package/dist/backend/llvm/string-construction.js.map +1 -0
- package/dist/backend/llvm/string-construction.test.d.ts +1 -0
- package/dist/backend/llvm/string-construction.test.js +90 -0
- package/dist/backend/llvm/string-construction.test.js.map +1 -0
- package/dist/backend/llvm/string-lifetimes.d.ts +2 -2
- package/dist/backend/llvm/string-lifetimes.js +19 -11
- package/dist/backend/llvm/string-lifetimes.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +127 -32
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/switch-dispatch.d.ts +9 -0
- package/dist/backend/llvm/switch-dispatch.js +114 -0
- package/dist/backend/llvm/switch-dispatch.js.map +1 -0
- package/dist/backend/llvm/switch-dispatch.test.d.ts +1 -0
- package/dist/backend/llvm/switch-dispatch.test.js +83 -0
- package/dist/backend/llvm/switch-dispatch.test.js.map +1 -0
- package/dist/backend/llvm/unsupported.js.map +1 -1
- package/dist/backend/llvm/walkers.js +6 -3
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/mangle.js +9 -3
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/may-throw.js +18 -8
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +118 -22
- package/dist/backend/may-throw.test.js.map +1 -1
- package/dist/backend/native/artifact-stamps.d.ts +39 -0
- package/dist/backend/native/artifact-stamps.js +371 -0
- package/dist/backend/native/artifact-stamps.js.map +1 -0
- package/dist/backend/native/cache-warm.d.ts +24 -0
- package/dist/backend/native/cache-warm.js +80 -0
- package/dist/backend/native/cache-warm.js.map +1 -0
- package/dist/backend/native/compiler-fingerprint.d.ts +19 -0
- package/dist/backend/native/compiler-fingerprint.js +357 -0
- package/dist/backend/native/compiler-fingerprint.js.map +1 -0
- package/dist/backend/native/contracts.d.ts +314 -0
- package/dist/backend/native/contracts.js +2 -0
- package/dist/backend/native/contracts.js.map +1 -0
- package/dist/backend/native/dependency-files.d.ts +5 -0
- package/dist/backend/native/dependency-files.js +83 -0
- package/dist/backend/native/dependency-files.js.map +1 -0
- package/dist/backend/native/driver.d.ts +50 -0
- package/dist/backend/native/driver.js +294 -0
- package/dist/backend/native/driver.js.map +1 -0
- package/dist/backend/native/executable.d.ts +18 -0
- package/dist/backend/native/executable.js +1267 -0
- package/dist/backend/native/executable.js.map +1 -0
- package/dist/backend/native/library.d.ts +2 -0
- package/dist/backend/native/library.js +614 -0
- package/dist/backend/native/library.js.map +1 -0
- package/dist/backend/native/linker-fingerprint.d.ts +8 -0
- package/dist/backend/native/linker-fingerprint.js +174 -0
- package/dist/backend/native/linker-fingerprint.js.map +1 -0
- package/dist/backend/native/object-merge.d.ts +2 -0
- package/dist/backend/native/object-merge.js +154 -0
- package/dist/backend/native/object-merge.js.map +1 -0
- package/dist/backend/native/process.d.ts +17 -0
- package/dist/backend/native/process.js +42 -0
- package/dist/backend/native/process.js.map +1 -0
- package/dist/backend/native/program-shards.d.ts +21 -0
- package/dist/backend/native/program-shards.js +99 -0
- package/dist/backend/native/program-shards.js.map +1 -0
- package/dist/backend/native/runtime-inputs.d.ts +12 -0
- package/dist/backend/native/runtime-inputs.js +163 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -0
- package/dist/backend/native/runtime-inputs.test.d.ts +1 -0
- package/dist/backend/native/runtime-inputs.test.js +64 -0
- package/dist/backend/native/runtime-inputs.test.js.map +1 -0
- package/dist/backend/native/runtime-objects.d.ts +16 -0
- package/dist/backend/native/runtime-objects.js +122 -0
- package/dist/backend/native/runtime-objects.js.map +1 -0
- package/dist/backend/native/session.d.ts +12 -0
- package/dist/backend/native/session.js +31 -0
- package/dist/backend/native/session.js.map +1 -0
- package/dist/backend/native/tool-identity.d.ts +37 -0
- package/dist/backend/native/tool-identity.js +310 -0
- package/dist/backend/native/tool-identity.js.map +1 -0
- package/dist/backend/native/trace-paths.d.ts +12 -0
- package/dist/backend/native/trace-paths.js +73 -0
- package/dist/backend/native/trace-paths.js.map +1 -0
- package/dist/backend/native/vendor.d.ts +1 -0
- package/dist/backend/native/vendor.js +12 -0
- package/dist/backend/native/vendor.js.map +1 -0
- package/dist/backend/native-codegen-core.js +2 -1
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +1 -1
- package/dist/backend/native-codegen.js +24 -13
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +12 -9
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.js +9 -5
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-link-info.js +14 -5
- package/dist/backend/native-link-info.js.map +1 -1
- package/dist/backend/native-link-info.test.js +58 -13
- package/dist/backend/native-link-info.test.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +17 -450
- package/dist/backend/native-toolchain.js +17 -3971
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +103 -72
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/native-tools.js +27 -8
- package/dist/backend/native-tools.js.map +1 -1
- package/dist/backend/object-localize.js +17 -14
- package/dist/backend/object-localize.js.map +1 -1
- package/dist/backend/object-localize.test.js +59 -12
- package/dist/backend/object-localize.test.js.map +1 -1
- package/dist/backend/runtime-pack-core.js +96 -49
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-native.js +5 -3
- package/dist/backend/runtime-pack-native.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +87 -15
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.d.ts +1 -1
- package/dist/backend/runtime-pack.js +11 -12
- package/dist/backend/runtime-pack.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +40 -24
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/source-locations.js.map +1 -1
- package/dist/backend/source-locations.test.js +7 -2
- package/dist/backend/source-locations.test.js.map +1 -1
- package/dist/backend/target-diagnostics.js +44 -14
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +93 -20
- package/dist/backend/target-diagnostics.test.js.map +1 -1
- package/dist/backend/targets.js +230 -86
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +32 -18
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/backend/toolchain-environment.js +5 -1
- package/dist/backend/toolchain-environment.js.map +1 -1
- package/dist/backend/vendor-archives.d.ts +2 -2
- package/dist/backend/vendor-archives.js +84 -35
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.js +13 -1
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/warm-cache.d.ts +1 -1
- package/dist/backend/warm-cache.js +33 -9
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +39 -9
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/output-options.js +14 -4
- package/dist/cli/output-options.js.map +1 -1
- package/dist/cli/paths.js.map +1 -1
- package/dist/cli/wasi-runner.js.map +1 -1
- package/dist/compat/fetch-profile.js +36 -35
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/coverage/report.js +16 -17
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +112 -26
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.js +55 -16
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +1 -1
- package/dist/executable/executable-cache.js +78 -48
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +75 -26
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +2 -2
- package/dist/executable/prepare.js.map +1 -1
- package/dist/ffi/ffi-manifest.js +78 -20
- package/dist/ffi/ffi-manifest.js.map +1 -1
- package/dist/ffi/ffi-manifest.test.js +96 -16
- package/dist/ffi/ffi-manifest.test.js.map +1 -1
- package/dist/format-integer.js.map +1 -1
- package/dist/frontend/analysis.js +12 -2
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/arguments-usage.js.map +1 -1
- package/dist/frontend/binding-source.js +9 -3
- package/dist/frontend/binding-source.js.map +1 -1
- package/dist/frontend/builtin-modules.js +46 -2
- package/dist/frontend/builtin-modules.js.map +1 -1
- package/dist/frontend/cjs-resolve.js +40 -17
- package/dist/frontend/cjs-resolve.js.map +1 -1
- package/dist/frontend/cjs-syntax.js +31 -10
- package/dist/frontend/cjs-syntax.js.map +1 -1
- package/dist/frontend/comptime-node.test.js +10 -11
- package/dist/frontend/comptime-node.test.js.map +1 -1
- package/dist/frontend/dts-paths.js +7 -3
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/fork-target.js +17 -12
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/function-completion.js +11 -6
- package/dist/frontend/function-completion.js.map +1 -1
- package/dist/frontend/helper-tokens.js +53 -6
- package/dist/frontend/helper-tokens.js.map +1 -1
- package/dist/frontend/helper-tokens.test.js +18 -2
- package/dist/frontend/helper-tokens.test.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.js +32 -12
- package/dist/frontend/inferred-js-diagnostics.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.test.js +11 -15
- package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
- package/dist/frontend/input-tracker.js +11 -11
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +4 -1
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lib-contract.js +38 -9
- package/dist/frontend/lib-contract.js.map +1 -1
- package/dist/frontend/literal-values.js.map +1 -1
- package/dist/frontend/literal-values.test.js +28 -8
- package/dist/frontend/literal-values.test.js.map +1 -1
- package/dist/frontend/lowering/abstract-equality.js +53 -10
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.d.ts +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.js +108 -106
- package/dist/frontend/lowering/array-indexed-mutation.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +37 -14
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/binding-analysis.d.ts +50 -0
- package/dist/frontend/lowering/binding-analysis.js +376 -0
- package/dist/frontend/lowering/binding-analysis.js.map +1 -0
- package/dist/frontend/lowering/builtin-calls.d.ts +9 -0
- package/dist/frontend/lowering/builtin-calls.js +60 -0
- package/dist/frontend/lowering/builtin-calls.js.map +1 -0
- package/dist/frontend/lowering/builtins/arguments.d.ts +43 -0
- package/dist/frontend/lowering/builtins/arguments.js +247 -0
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -0
- package/dist/frontend/lowering/builtins/async-context.d.ts +52 -0
- package/dist/frontend/lowering/builtins/async-context.js +436 -0
- package/dist/frontend/lowering/builtins/async-context.js.map +1 -0
- package/dist/frontend/lowering/builtins/atomics.d.ts +15 -0
- package/dist/frontend/lowering/builtins/atomics.js +46 -0
- package/dist/frontend/lowering/builtins/atomics.js.map +1 -0
- package/dist/frontend/lowering/builtins/callable-aliases.d.ts +13 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js +87 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-async.d.ts +18 -0
- package/dist/frontend/lowering/builtins/child-process-async.js +245 -0
- package/dist/frontend/lowering/builtins/child-process-async.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-methods.d.ts +21 -0
- package/dist/frontend/lowering/builtins/child-process-methods.js +362 -0
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-sync.d.ts +4 -0
- package/dist/frontend/lowering/builtins/child-process-sync.js +639 -0
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process.d.ts +55 -0
- package/dist/frontend/lowering/builtins/child-process.js +669 -0
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -0
- package/dist/frontend/lowering/builtins/compression.d.ts +7 -0
- package/dist/frontend/lowering/builtins/compression.js +115 -0
- package/dist/frontend/lowering/builtins/compression.js.map +1 -0
- package/dist/frontend/lowering/builtins/console.d.ts +10 -0
- package/dist/frontend/lowering/builtins/console.js +38 -0
- package/dist/frontend/lowering/builtins/console.js.map +1 -0
- package/dist/frontend/lowering/builtins/constants.d.ts +24 -0
- package/dist/frontend/lowering/builtins/constants.js +141 -0
- package/dist/frontend/lowering/builtins/constants.js.map +1 -0
- package/dist/frontend/lowering/builtins/crypto.d.ts +22 -0
- package/dist/frontend/lowering/builtins/crypto.js +517 -0
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -0
- package/dist/frontend/lowering/builtins/dates.d.ts +7 -0
- package/dist/frontend/lowering/builtins/dates.js +101 -0
- package/dist/frontend/lowering/builtins/dates.js.map +1 -0
- package/dist/frontend/lowering/builtins/environment.d.ts +34 -0
- package/dist/frontend/lowering/builtins/environment.js +95 -0
- package/dist/frontend/lowering/builtins/environment.js.map +1 -0
- package/dist/frontend/lowering/builtins/errors.d.ts +14 -0
- package/dist/frontend/lowering/builtins/errors.js +83 -0
- package/dist/frontend/lowering/builtins/errors.js.map +1 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +32 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js +678 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -0
- package/dist/frontend/lowering/builtins/filesystem.d.ts +108 -0
- package/dist/frontend/lowering/builtins/filesystem.js +1061 -0
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -0
- package/dist/frontend/lowering/builtins/ipc.d.ts +8 -0
- package/dist/frontend/lowering/builtins/ipc.js +76 -0
- package/dist/frontend/lowering/builtins/ipc.js.map +1 -0
- package/dist/frontend/lowering/builtins/json.d.ts +12 -0
- package/dist/frontend/lowering/builtins/json.js +387 -0
- package/dist/frontend/lowering/builtins/json.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-bindings.d.ts +85 -0
- package/dist/frontend/lowering/builtins/module-bindings.js +346 -0
- package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-calls.d.ts +8 -0
- package/dist/frontend/lowering/builtins/module-calls.js +303 -0
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +38 -0
- package/dist/frontend/lowering/builtins/module-resolution.js +344 -0
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -0
- package/dist/frontend/lowering/builtins/numbers.d.ts +15 -0
- package/dist/frontend/lowering/builtins/numbers.js +124 -0
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -0
- package/dist/frontend/lowering/builtins/operating-system.d.ts +13 -0
- package/dist/frontend/lowering/builtins/operating-system.js +148 -0
- package/dist/frontend/lowering/builtins/operating-system.js.map +1 -0
- package/dist/frontend/lowering/builtins/performance.d.ts +13 -0
- package/dist/frontend/lowering/builtins/performance.js +100 -0
- package/dist/frontend/lowering/builtins/performance.js.map +1 -0
- package/dist/frontend/lowering/builtins/process.d.ts +50 -0
- package/dist/frontend/lowering/builtins/process.js +1138 -0
- package/dist/frontend/lowering/builtins/process.js.map +1 -0
- package/dist/frontend/lowering/builtins/promises.d.ts +14 -0
- package/dist/frontend/lowering/builtins/promises.js +356 -0
- package/dist/frontend/lowering/builtins/promises.js.map +1 -0
- package/dist/frontend/lowering/builtins/properties.d.ts +11 -0
- package/dist/frontend/lowering/builtins/properties.js +186 -0
- package/dist/frontend/lowering/builtins/properties.js.map +1 -0
- package/dist/frontend/lowering/builtins/querystring.d.ts +19 -0
- package/dist/frontend/lowering/builtins/querystring.js +150 -0
- package/dist/frontend/lowering/builtins/querystring.js.map +1 -0
- package/dist/frontend/lowering/builtins/readline.d.ts +13 -0
- package/dist/frontend/lowering/builtins/readline.js +138 -0
- package/dist/frontend/lowering/builtins/readline.js.map +1 -0
- package/dist/frontend/lowering/builtins/receiver-types.d.ts +5 -0
- package/dist/frontend/lowering/builtins/receiver-types.js +15 -0
- package/dist/frontend/lowering/builtins/receiver-types.js.map +1 -0
- package/dist/frontend/lowering/builtins/reflection.d.ts +13 -0
- package/dist/frontend/lowering/builtins/reflection.js +95 -0
- package/dist/frontend/lowering/builtins/reflection.js.map +1 -0
- package/dist/frontend/lowering/builtins/strings.d.ts +14 -0
- package/dist/frontend/lowering/builtins/strings.js +121 -0
- package/dist/frontend/lowering/builtins/strings.js.map +1 -0
- package/dist/frontend/lowering/builtins/text-codecs.d.ts +29 -0
- package/dist/frontend/lowering/builtins/text-codecs.js +590 -0
- package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -0
- package/dist/frontend/lowering/builtins/timers.d.ts +22 -0
- package/dist/frontend/lowering/builtins/timers.js +180 -0
- package/dist/frontend/lowering/builtins/timers.js.map +1 -0
- package/dist/frontend/lowering/builtins/url.d.ts +37 -0
- package/dist/frontend/lowering/builtins/url.js +596 -0
- package/dist/frontend/lowering/builtins/url.js.map +1 -0
- package/dist/frontend/lowering/builtins/util-types.d.ts +7 -0
- package/dist/frontend/lowering/builtins/util-types.js +31 -0
- package/dist/frontend/lowering/builtins/util-types.js.map +1 -0
- package/dist/frontend/lowering/call-arguments.d.ts +72 -0
- package/dist/frontend/lowering/call-arguments.js +618 -0
- package/dist/frontend/lowering/call-arguments.js.map +1 -0
- package/dist/frontend/lowering/call-signatures.d.ts +115 -0
- package/dist/frontend/lowering/call-signatures.js +719 -0
- package/dist/frontend/lowering/call-signatures.js.map +1 -0
- package/dist/frontend/lowering/callback-arg.js.map +1 -1
- package/dist/frontend/lowering/checked-iterable-spread.js +53 -10
- package/dist/frontend/lowering/checked-iterable-spread.js.map +1 -1
- package/dist/frontend/lowering/checked-promise-all.js +41 -9
- package/dist/frontend/lowering/checked-promise-all.js.map +1 -1
- package/dist/frontend/lowering/class-callbacks.d.ts +1 -1
- package/dist/frontend/lowering/class-callbacks.js +130 -27
- package/dist/frontend/lowering/class-callbacks.js.map +1 -1
- package/dist/frontend/lowering/class-construction.d.ts +1 -1
- package/dist/frontend/lowering/class-construction.js +247 -50
- package/dist/frontend/lowering/class-construction.js.map +1 -1
- package/dist/frontend/lowering/class-descriptors.js +109 -29
- package/dist/frontend/lowering/class-descriptors.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +6 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.js +2471 -465
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +284 -44
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-instance-constructor.js +17 -5
- package/dist/frontend/lowering/class-instance-constructor.js.map +1 -1
- package/dist/frontend/lowering/class-method-values.js +199 -51
- package/dist/frontend/lowering/class-method-values.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.js +345 -86
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-runtime-statics.d.ts +1 -1
- package/dist/frontend/lowering/class-runtime-statics.js +80 -17
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
- package/dist/frontend/lowering/class-static-data.js +76 -16
- package/dist/frontend/lowering/class-static-data.js.map +1 -1
- package/dist/frontend/lowering/coercions/builders.d.ts +13 -0
- package/dist/frontend/lowering/coercions/builders.js +77 -0
- package/dist/frontend/lowering/coercions/builders.js.map +1 -0
- package/dist/frontend/lowering/coercions/function-adapters.d.ts +58 -0
- package/dist/frontend/lowering/coercions/function-adapters.js +430 -0
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -0
- package/dist/frontend/lowering/coercions/island.d.ts +37 -0
- package/dist/frontend/lowering/coercions/island.js +350 -0
- package/dist/frontend/lowering/coercions/island.js.map +1 -0
- package/dist/frontend/lowering/coercions/state.d.ts +14 -0
- package/dist/frontend/lowering/coercions/state.js +16 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -0
- package/dist/frontend/lowering/coercions/structural-plans.d.ts +40 -0
- package/dist/frontend/lowering/coercions/structural-plans.js +447 -0
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -0
- package/dist/frontend/lowering/coercions/structural.d.ts +63 -0
- package/dist/frontend/lowering/coercions/structural.js +616 -0
- package/dist/frontend/lowering/coercions/structural.js.map +1 -0
- package/dist/frontend/lowering/coercions/unions.d.ts +65 -0
- package/dist/frontend/lowering/coercions/unions.js +318 -0
- package/dist/frontend/lowering/coercions/unions.js.map +1 -0
- package/dist/frontend/lowering/collection-ingestion.js +359 -67
- package/dist/frontend/lowering/collection-ingestion.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +92 -0
- package/dist/frontend/lowering/containers/array-callbacks.js +1646 -0
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -0
- package/dist/frontend/lowering/containers/array-construction.d.ts +42 -0
- package/dist/frontend/lowering/containers/array-construction.js +1044 -0
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -0
- package/dist/frontend/lowering/containers/array-iteration.d.ts +16 -0
- package/dist/frontend/lowering/containers/array-iteration.js +95 -0
- package/dist/frontend/lowering/containers/array-iteration.js.map +1 -0
- package/dist/frontend/lowering/containers/array-methods.d.ts +27 -0
- package/dist/frontend/lowering/containers/array-methods.js +1854 -0
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -0
- package/dist/frontend/lowering/containers/bytes.d.ts +17 -17
- package/dist/frontend/lowering/containers/bytes.js +419 -105
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.d.ts +26 -0
- package/dist/frontend/lowering/containers/callback-arguments.js +179 -0
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -0
- package/dist/frontend/lowering/containers/collection-grouping.d.ts +19 -0
- package/dist/frontend/lowering/containers/collection-grouping.js +297 -0
- package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -0
- package/dist/frontend/lowering/containers/collection-methods.d.ts +57 -0
- package/dist/frontend/lowering/containers/collection-methods.js +1314 -0
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -0
- package/dist/frontend/lowering/containers/dynamic-receivers.d.ts +18 -0
- package/dist/frontend/lowering/containers/dynamic-receivers.js +114 -0
- package/dist/frontend/lowering/containers/dynamic-receivers.js.map +1 -0
- package/dist/frontend/lowering/containers/for-of.d.ts +60 -0
- package/dist/frontend/lowering/containers/for-of.js +643 -0
- package/dist/frontend/lowering/containers/for-of.js.map +1 -0
- package/dist/frontend/lowering/containers/indexed-objects.d.ts +132 -0
- package/dist/frontend/lowering/containers/indexed-objects.js +1743 -0
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -0
- package/dist/frontend/lowering/containers/iterator-helpers.d.ts +20 -0
- package/dist/frontend/lowering/containers/iterator-helpers.js +809 -0
- package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js +585 -157
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +213 -63
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/crypto-tables.js +263 -64
- package/dist/frontend/lowering/crypto-tables.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.js +172 -68
- package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.test.js +41 -8
- package/dist/frontend/lowering/deferred-module-initializers.test.js.map +1 -1
- package/dist/frontend/lowering/error-methods.js +339 -65
- package/dist/frontend/lowering/error-methods.js.map +1 -1
- package/dist/frontend/lowering/expressions/evaluation-safety.js +3 -2
- package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -1
- package/dist/frontend/lowering/expressions/global-symbols.js +2 -1
- package/dist/frontend/lowering/expressions/global-symbols.js.map +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js +11 -5
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +67 -13
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +589 -162
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +68 -17
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-field-write.js +45 -18
- package/dist/frontend/lowering/expressions/union-field-write.js.map +1 -1
- package/dist/frontend/lowering/function-context.js +5 -1
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/function-returns.d.ts +67 -0
- package/dist/frontend/lowering/function-returns.js +392 -0
- package/dist/frontend/lowering/function-returns.js.map +1 -0
- package/dist/frontend/lowering/generator-delegation.d.ts +1 -1
- package/dist/frontend/lowering/generator-delegation.js +171 -39
- package/dist/frontend/lowering/generator-delegation.js.map +1 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.d.ts +1 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +176 -36
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +274 -0
- package/dist/frontend/lowering/generic-functions.js +1727 -0
- package/dist/frontend/lowering/generic-functions.js.map +1 -0
- package/dist/frontend/lowering/import-meta.d.ts +1 -1
- package/dist/frontend/lowering/import-meta.js +37 -14
- package/dist/frontend/lowering/import-meta.js.map +1 -1
- package/dist/frontend/lowering/indexed-comparison.js +6 -2
- package/dist/frontend/lowering/indexed-comparison.js.map +1 -1
- package/dist/frontend/lowering/iterator-consumption.d.ts +9 -0
- package/dist/frontend/lowering/iterator-consumption.js +91 -0
- package/dist/frontend/lowering/iterator-consumption.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.js +40 -17
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.test.js +49 -11
- package/dist/frontend/lowering/lib-boundary.test.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.d.ts +0 -19
- package/dist/frontend/lowering/lower-array-sort.js +331 -566
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +248 -43
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +71 -16
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.js +420 -71
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +39 -558
- package/dist/frontend/lowering/lower-calls.js +2593 -5667
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +243 -242
- package/dist/frontend/lowering/lower-classes.js +1704 -727
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +35 -35
- package/dist/frontend/lowering/lower-comptime.js +39 -37
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +59 -31
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.js +5 -2
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +322 -85
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.js +19 -7
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +194 -194
- package/dist/frontend/lowering/lower-exprs.js +3455 -1153
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.d.ts +23 -0
- package/dist/frontend/lowering/lower-functions.js +449 -0
- package/dist/frontend/lowering/lower-functions.js.map +1 -0
- package/dist/frontend/lowering/lower-generators.js +121 -32
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.js +15 -4
- package/dist/frontend/lowering/lower-global-value.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +479 -89
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +79 -79
- package/dist/frontend/lowering/lower-island.js +365 -273
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-island.test.js +7 -2
- package/dist/frontend/lowering/lower-island.test.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +17 -8
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +94 -94
- package/dist/frontend/lowering/lower-modules.js +612 -321
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.js +91 -20
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.js +25 -8
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-module.js +115 -34
- package/dist/frontend/lowering/lower-node-module.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +1210 -290
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +148 -148
- package/dist/frontend/lowering/lower-stmts.js +2312 -984
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js +13 -5
- package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +362 -90
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-system-errors.js +30 -8
- package/dist/frontend/lowering/lower-system-errors.js.map +1 -1
- package/dist/frontend/lowering/lower-test.js +40 -13
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.d.ts +31 -0
- package/dist/frontend/lowering/lower-timers.js +336 -0
- package/dist/frontend/lowering/lower-timers.js.map +1 -0
- package/dist/frontend/lowering/lower-url.d.ts +1 -1
- package/dist/frontend/lowering/lower-url.js +46 -13
- package/dist/frontend/lowering/lower-url.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +21 -351
- package/dist/frontend/lowering/lowerer.js +1031 -2704
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +85 -17
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/module-namespace-elements.js +43 -8
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/native-ffi.d.ts +21 -1
- package/dist/frontend/lowering/native-ffi.js +487 -18
- package/dist/frontend/lowering/native-ffi.js.map +1 -1
- package/dist/frontend/lowering/object-enumeration-receiver.js +55 -10
- package/dist/frontend/lowering/object-enumeration-receiver.js.map +1 -1
- package/dist/frontend/lowering/object-factory-new.d.ts +1 -1
- package/dist/frontend/lowering/object-factory-new.js +36 -11
- package/dist/frontend/lowering/object-factory-new.js.map +1 -1
- package/dist/frontend/lowering/optional-arguments.js +49 -20
- package/dist/frontend/lowering/optional-arguments.js.map +1 -1
- package/dist/frontend/lowering/pairs-snapshot.js +66 -14
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-locals.js +3 -1
- package/dist/frontend/lowering/runtime-optional-locals.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-locals.test.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.js +4 -1
- package/dist/frontend/lowering/sanitize-class-types.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.test.js +86 -18
- package/dist/frontend/lowering/sanitize-class-types.test.js.map +1 -1
- package/dist/frontend/lowering/static-this.js +13 -6
- package/dist/frontend/lowering/static-this.js.map +1 -1
- package/dist/frontend/lowering/string-index.js +32 -10
- package/dist/frontend/lowering/string-index.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +42 -42
- package/dist/frontend/lowering/surfaces.js +1094 -249
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/symbol-fields.js +40 -15
- package/dist/frontend/lowering/symbol-fields.js.map +1 -1
- package/dist/frontend/lowering/symbol-methods.js.map +1 -1
- package/dist/frontend/lowering/text-decoder-encoding.js +236 -24
- package/dist/frontend/lowering/text-decoder-encoding.js.map +1 -1
- package/dist/frontend/lowering/text-decoder-encoding.test.js +84 -12
- package/dist/frontend/lowering/text-decoder-encoding.test.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.js +59 -16
- package/dist/frontend/lowering/union-narrow.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.test.js +24 -7
- package/dist/frontend/lowering/union-narrow.test.js.map +1 -1
- package/dist/frontend/lowering/union-retag.js +155 -40
- package/dist/frontend/lowering/union-retag.js.map +1 -1
- package/dist/frontend/lowering/union-retag.test.js +131 -33
- package/dist/frontend/lowering/union-retag.test.js.map +1 -1
- package/dist/frontend/lowering/unregistered-class-types.js.map +1 -1
- package/dist/frontend/lowering/unregistered-class-types.test.js +34 -8
- package/dist/frontend/lowering/unregistered-class-types.test.js.map +1 -1
- package/dist/frontend/module-syntax.js +21 -8
- package/dist/frontend/module-syntax.js.map +1 -1
- package/dist/frontend/module-syntax.test.js +37 -13
- package/dist/frontend/module-syntax.test.js.map +1 -1
- package/dist/frontend/npm-fetch-analysis.js +13 -4
- package/dist/frontend/npm-fetch-analysis.js.map +1 -1
- package/dist/frontend/npm-fetch-analysis.test.js +33 -10
- package/dist/frontend/npm-fetch-analysis.test.js.map +1 -1
- package/dist/frontend/npm-fetch-node.js.map +1 -1
- package/dist/frontend/npm-fetch-syntax.js +4 -9
- package/dist/frontend/npm-fetch-syntax.js.map +1 -1
- package/dist/frontend/npm-node.js +3 -1
- package/dist/frontend/npm-node.js.map +1 -1
- package/dist/frontend/npm-static-bundled-cjs.js +88 -29
- package/dist/frontend/npm-static-bundled-cjs.js.map +1 -1
- package/dist/frontend/npm-static-bundled-cjs.test.js +29 -10
- package/dist/frontend/npm-static-bundled-cjs.test.js.map +1 -1
- package/dist/frontend/npm-static-declaration-syntax.js +148 -56
- package/dist/frontend/npm-static-declaration-syntax.js.map +1 -1
- package/dist/frontend/npm-static-declarations.d.ts +1 -1
- package/dist/frontend/npm-static-declarations.js.map +1 -1
- package/dist/frontend/npm-static-declarations.test.js +33 -7
- package/dist/frontend/npm-static-declarations.test.js.map +1 -1
- package/dist/frontend/npm-static-prune.js +26 -12
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-prune.test.js +17 -3
- package/dist/frontend/npm-static-prune.test.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-host.js +2 -3
- package/dist/frontend/npm-static-rewrite-host.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +64 -21
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/npm-static-rewrite.js.map +1 -1
- package/dist/frontend/npm-static-subtyping.js +9 -4
- package/dist/frontend/npm-static-subtyping.js.map +1 -1
- package/dist/frontend/npm-static-subtyping.test.js +30 -6
- package/dist/frontend/npm-static-subtyping.test.js.map +1 -1
- package/dist/frontend/npm-static.js +15 -4
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.js +122 -36
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.js +30 -10
- package/dist/frontend/npm.test.js.map +1 -1
- package/dist/frontend/pipeline-native.js.map +1 -1
- package/dist/frontend/pipeline.js +25 -8
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/pipeline.test.js +21 -7
- package/dist/frontend/pipeline.test.js.map +1 -1
- package/dist/frontend/program-node.js +5 -3
- package/dist/frontend/program-node.js.map +1 -1
- package/dist/frontend/program.d.ts +2 -2
- package/dist/frontend/program.js +234 -101
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +27 -27
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/provenance-core.js +8 -4
- package/dist/frontend/provenance-core.js.map +1 -1
- package/dist/frontend/provenance-registry.js +1 -4
- package/dist/frontend/provenance-registry.js.map +1 -1
- package/dist/frontend/resolve.js +32 -20
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/resolve.test.js +1 -1
- package/dist/frontend/resolve.test.js.map +1 -1
- package/dist/frontend/runtime-resolve.js +13 -4
- package/dist/frontend/runtime-resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.test.js +25 -9
- package/dist/frontend/runtime-resolve.test.js.map +1 -1
- package/dist/frontend/services-node.js +6 -2
- package/dist/frontend/services-node.js.map +1 -1
- package/dist/frontend/services-node.test.js +18 -6
- package/dist/frontend/services-node.test.js.map +1 -1
- package/dist/frontend/services.js +8 -4
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/services.test.js +6 -2
- package/dist/frontend/services.test.js.map +1 -1
- package/dist/frontend/ts7/api.js +12 -4
- package/dist/frontend/ts7/api.js.map +1 -1
- package/dist/frontend/ts7/ast-bytes.js +10 -3
- package/dist/frontend/ts7/ast-bytes.js.map +1 -1
- package/dist/frontend/ts7/ast-bytes.test.js +23 -4
- package/dist/frontend/ts7/ast-bytes.test.js.map +1 -1
- package/dist/frontend/ts7/ast-guards.test.js +14 -5
- package/dist/frontend/ts7/ast-guards.test.js.map +1 -1
- package/dist/frontend/ts7/ast-node.d.ts +6 -1
- package/dist/frontend/ts7/ast-node.js +484 -164
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +109 -36
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-text.js +13 -3
- package/dist/frontend/ts7/ast-text.js.map +1 -1
- package/dist/frontend/ts7/ast-text.test.js.map +1 -1
- package/dist/frontend/ts7/ast-types.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.d.ts +1 -1
- package/dist/frontend/ts7/ast-wire.js +55 -20
- package/dist/frontend/ts7/ast-wire.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.test.js +53 -8
- package/dist/frontend/ts7/ast-wire.test.js.map +1 -1
- package/dist/frontend/ts7/ast.js +47 -28
- package/dist/frontend/ts7/ast.js.map +1 -1
- package/dist/frontend/ts7/census-check.js +1 -1
- package/dist/frontend/ts7/census-check.js.map +1 -1
- package/dist/frontend/ts7/checker-cache.js.map +1 -1
- package/dist/frontend/ts7/checker.js +5 -3
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.js +54 -17
- package/dist/frontend/ts7/checker.test.js.map +1 -1
- package/dist/frontend/ts7/enums.test.js +9 -4
- package/dist/frontend/ts7/enums.test.js.map +1 -1
- package/dist/frontend/ts7/native-api.js.map +1 -1
- package/dist/frontend/ts7/native-host.js.map +1 -1
- package/dist/frontend/ts7/native-process.js +9 -3
- package/dist/frontend/ts7/native-process.js.map +1 -1
- package/dist/frontend/ts7/program-adapter.js +1 -1
- package/dist/frontend/ts7/program-adapter.js.map +1 -1
- package/dist/frontend/ts7/program-host.js +7 -4
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/program-host.test.js +43 -11
- package/dist/frontend/ts7/program-host.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-api.js +3 -1
- package/dist/frontend/ts7/rpc-api.js.map +1 -1
- package/dist/frontend/ts7/rpc-client.js +15 -5
- package/dist/frontend/ts7/rpc-client.js.map +1 -1
- package/dist/frontend/ts7/rpc-client.test.js +26 -8
- package/dist/frontend/ts7/rpc-client.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-filesystem.js.map +1 -1
- package/dist/frontend/ts7/rpc-filesystem.test.js +43 -10
- package/dist/frontend/ts7/rpc-filesystem.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-process.js +16 -6
- package/dist/frontend/ts7/rpc-process.js.map +1 -1
- package/dist/frontend/ts7/rpc-process.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-wire.d.ts +1 -0
- package/dist/frontend/ts7/rpc-wire.js +41 -14
- package/dist/frontend/ts7/rpc-wire.js.map +1 -1
- package/dist/frontend/ts7/rpc-wire.test.js +36 -6
- package/dist/frontend/ts7/rpc-wire.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.js +209 -68
- package/dist/frontend/ts7/semantic-checker.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.test.js +29 -14
- package/dist/frontend/ts7/semantic-checker.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.js +7 -1
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.test.js +17 -3
- package/dist/frontend/ts7/semantic-json.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.js +147 -51
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.test.js +72 -19
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-types.d.ts +2 -2
- package/dist/frontend/ts7/session-cache.js +10 -3
- package/dist/frontend/ts7/session-cache.js.map +1 -1
- package/dist/frontend/ts7/session-cache.test.js +13 -4
- package/dist/frontend/ts7/session-cache.test.js.map +1 -1
- package/dist/frontend/ts7/session-path.js +25 -10
- package/dist/frontend/ts7/session-path.js.map +1 -1
- package/dist/frontend/ts7/session-path.test.js +47 -4
- package/dist/frontend/ts7/session-path.test.js.map +1 -1
- package/dist/frontend/ts7/session-timing.js +22 -3
- package/dist/frontend/ts7/session-timing.js.map +1 -1
- package/dist/frontend/ts7/session-timing.test.js +12 -3
- package/dist/frontend/ts7/session-timing.test.js.map +1 -1
- package/dist/frontend/ts7/session.d.ts +1 -0
- package/dist/frontend/ts7/session.js +109 -35
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/ts7/session.test.js +69 -15
- package/dist/frontend/ts7/session.test.js.map +1 -1
- package/dist/frontend/ts7/source-parser.js +17 -6
- package/dist/frontend/ts7/source-parser.js.map +1 -1
- package/dist/frontend/ts7/source-parser.test.js +32 -9
- package/dist/frontend/ts7/source-parser.test.js.map +1 -1
- package/dist/frontend/tsc-codes.js +56 -11
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/tsc-codes.test.d.ts +1 -0
- package/dist/frontend/tsc-codes.test.js +16 -0
- package/dist/frontend/tsc-codes.test.js.map +1 -0
- package/dist/frontend/type-mapper.js +547 -206
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-mapper.test.js +108 -33
- package/dist/frontend/type-mapper.test.js.map +1 -1
- package/dist/frontend/union-discriminants.js +8 -2
- package/dist/frontend/union-discriminants.js.map +1 -1
- package/dist/frontend/union-discriminants.test.js +77 -20
- package/dist/frontend/union-discriminants.test.js.map +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.js +150 -81
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.js +97 -38
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/analysis.test.js +91 -15
- package/dist/ir/analysis.test.js.map +1 -1
- package/dist/ir/api.d.ts +4 -0
- package/dist/ir/api.js +6 -0
- package/dist/ir/api.js.map +1 -0
- package/dist/ir/build.d.ts +7 -0
- package/dist/ir/build.js +27 -1
- package/dist/ir/build.js.map +1 -1
- package/dist/ir/builtin-effects.d.ts +9 -0
- package/dist/ir/builtin-effects.js +631 -0
- package/dist/ir/builtin-effects.js.map +1 -0
- package/dist/ir/builtin-signatures.d.ts +15 -0
- package/dist/ir/builtin-signatures.js +3396 -0
- package/dist/ir/builtin-signatures.js.map +1 -0
- package/dist/ir/byte-numbers.d.ts +20 -0
- package/dist/ir/byte-numbers.js +116 -0
- package/dist/ir/byte-numbers.js.map +1 -0
- package/dist/ir/byte-numbers.test.d.ts +1 -0
- package/dist/ir/byte-numbers.test.js +55 -0
- package/dist/ir/byte-numbers.test.js.map +1 -0
- package/dist/ir/constant-tables.js +13 -5
- package/dist/ir/constant-tables.js.map +1 -1
- package/dist/ir/constant-tables.test.js +47 -7
- package/dist/ir/constant-tables.test.js.map +1 -1
- package/dist/ir/control-flow.js +2 -1
- package/dist/ir/control-flow.js.map +1 -1
- package/dist/ir/control-flow.test.js +35 -11
- package/dist/ir/control-flow.test.js.map +1 -1
- package/dist/ir/initializer-bindings.d.ts +9 -0
- package/dist/ir/initializer-bindings.js +115 -0
- package/dist/ir/initializer-bindings.js.map +1 -0
- package/dist/ir/initializer-bindings.test.d.ts +1 -0
- package/dist/ir/initializer-bindings.test.js +118 -0
- package/dist/ir/initializer-bindings.test.js.map +1 -0
- package/dist/ir/integer-loop-facts.d.ts +12 -0
- package/dist/ir/integer-loop-facts.js +137 -0
- package/dist/ir/integer-loop-facts.js.map +1 -0
- package/dist/ir/integer-loops.d.ts +19 -0
- package/dist/ir/integer-loops.js +172 -11
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +122 -9
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +8 -6
- package/dist/ir/integer-ranges.js +416 -90
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +239 -10
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/intrinsic-signatures.d.ts +20 -0
- package/dist/ir/intrinsic-signatures.js +57 -0
- package/dist/ir/intrinsic-signatures.js.map +1 -0
- package/dist/ir/ir.d.ts +14 -2155
- package/dist/ir/ir.js +169 -1394
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +98 -77
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +221 -0
- package/dist/ir/runtime-features.js +551 -0
- package/dist/ir/runtime-features.js.map +1 -0
- package/dist/ir/runtime-features.test.d.ts +1 -0
- package/dist/ir/runtime-features.test.js +98 -0
- package/dist/ir/runtime-features.test.js.map +1 -0
- package/dist/ir/scalar-records.js +130 -40
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/scalar-records.test.js +146 -27
- package/dist/ir/scalar-records.test.js.map +1 -1
- package/dist/ir/serialize.js +4 -2
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.js +44 -9
- package/dist/ir/serialize.test.js.map +1 -1
- package/dist/ir/traverse.js +156 -43
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/traverse.test.js +99 -24
- package/dist/ir/traverse.test.js.map +1 -1
- package/dist/ir/validate.d.ts +1 -31
- package/dist/ir/validate.js +826 -1915
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +627 -111
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/cache-primitives.js +9 -10
- package/dist/library/cache-primitives.js.map +1 -1
- package/dist/library/cache-reset.test.js +2 -1
- package/dist/library/cache-reset.test.js.map +1 -1
- package/dist/library/compiler-self-identity.js +11 -5
- package/dist/library/compiler-self-identity.js.map +1 -1
- package/dist/library/compiler-self-identity.test.js +10 -3
- package/dist/library/compiler-self-identity.test.js.map +1 -1
- package/dist/library/fence-eval.js +24 -7
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/fence-eval.test.js +31 -7
- package/dist/library/fence-eval.test.js.map +1 -1
- package/dist/library/int-infer.js +199 -59
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +133 -57
- package/dist/library/int-infer.test.js.map +1 -1
- package/dist/library/ir-policy.d.ts +27 -0
- package/dist/library/ir-policy.js +232 -0
- package/dist/library/ir-policy.js.map +1 -0
- package/dist/library/library-cache.js +40 -17
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +24 -13
- package/dist/library/library-cache.test.js.map +1 -1
- package/dist/library/library-profile.js +68 -13
- package/dist/library/library-profile.js.map +1 -1
- package/dist/library/prepare.js +48 -20
- package/dist/library/prepare.js.map +1 -1
- package/dist/library/semantic-source.js +16 -14
- package/dist/library/semantic-source.js.map +1 -1
- package/dist/library/semantic-source.test.js +9 -14
- package/dist/library/semantic-source.test.js.map +1 -1
- package/dist/library/sidecar-validate.js +53 -12
- package/dist/library/sidecar-validate.js.map +1 -1
- package/dist/library/sidecar.js +85 -24
- package/dist/library/sidecar.js.map +1 -1
- package/dist/library/trap-teaching.js +11 -2
- package/dist/library/trap-teaching.js.map +1 -1
- package/dist/native/cache.js +10 -4
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cli.js +34 -9
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +167 -43
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/compiler.test.js +129 -32
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/comptime.js +23 -7
- package/dist/native/comptime.js.map +1 -1
- package/dist/native/comptime.test.js +26 -6
- package/dist/native/comptime.test.js.map +1 -1
- package/dist/native/executable-cache.js +77 -27
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/executable-cache.test.js +41 -6
- package/dist/native/executable-cache.test.js.map +1 -1
- package/dist/native/file-identity.js +9 -2
- package/dist/native/file-identity.js.map +1 -1
- package/dist/native/file-identity.test.js.map +1 -1
- package/dist/native/library.js +50 -12
- package/dist/native/library.js.map +1 -1
- package/dist/native/prepare.js +119 -34
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +22 -6
- package/dist/native/prepare.test.js.map +1 -1
- package/dist/native/runtime-typescript.js +24 -11
- package/dist/native/runtime-typescript.js.map +1 -1
- package/dist/native/runtime-typescript.test.js.map +1 -1
- package/dist/native/sanitizer.js +71 -18
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +77 -20
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/task.js.map +1 -1
- package/dist/native/task.test.js +7 -2
- package/dist/native/task.test.js.map +1 -1
- package/dist/native/toolchain.js +74 -29
- package/dist/native/toolchain.js.map +1 -1
- package/dist/native/toolchain.test.js +95 -18
- package/dist/native/toolchain.test.js.map +1 -1
- package/dist/startup-cache.d.ts +1 -1
- package/dist/startup-cache.js +1 -1
- package/dist/startup-cache.js.map +1 -1
- package/dist/timing.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +0 -601
- package/dist/frontend/lowering/lower-builtins.js +0 -8984
- package/dist/frontend/lowering/lower-builtins.js.map +0 -1
- package/dist/frontend/lowering/lower-containers.d.ts +0 -382
- package/dist/frontend/lowering/lower-containers.js +0 -7366
- package/dist/frontend/lowering/lower-containers.js.map +0 -1
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
import { InternalCompilerError } from "../../errors.js";
|
|
2
|
+
import * as ts from "../ts7/adapter.js";
|
|
3
|
+
import { bodyReadsArguments } from "../arguments-usage.js";
|
|
4
|
+
import { DYN, JSVAL, UNDEFINED_T, VOID, canMarshalTypedFuncIntoIsland, isUnitType, typeEquals, } from "../../ir/ir.js";
|
|
5
|
+
import { isJsSourceFile, isNodeEsmFile } from "../program.js";
|
|
6
|
+
import { genResultRecord, jsOpenObjectType } from "../type-mapper.js";
|
|
7
|
+
import { dynFallbackType } from "./lowerer.js";
|
|
8
|
+
import { builtinModuleFnOf } from "./surfaces.js";
|
|
9
|
+
import { mixinFnShapeOf } from "./lower-mixins.js";
|
|
10
|
+
import { isStreamUndefCallExpr } from "./lower-server.js";
|
|
11
|
+
import { nsPathPrefix } from "./lower-namespaces.js";
|
|
12
|
+
import { declSymbolOf } from "./lower-modules.js";
|
|
13
|
+
import { npmStaticPackageOfPath } from "../npm-static.js";
|
|
14
|
+
import { implicitMonoFile, implicitAnyParamSymbolsOf } from "./generic-functions.js";
|
|
15
|
+
/** The one func-type projection of completed parameter shapes. Typed rest
|
|
16
|
+
* parameters keep their packed array as the trailing native ABI slot and
|
|
17
|
+
* mark the value variadic so indirect call sites run completeArgs before
|
|
18
|
+
* callValue. Dynamic rest remains the historical hidden ScrDyn slot, while
|
|
19
|
+
* island rest spells its engine-array slot directly. */
|
|
20
|
+
export function funcTypeFromParamShapes(shapes, ret) {
|
|
21
|
+
const typedRest = shapes.some((shape) => shape.mode === "rest");
|
|
22
|
+
const dynRest = shapes.some((shape) => shape.mode === "dynRest");
|
|
23
|
+
const argumentsAll = shapes.some((shape) => shape.mode === "arguments");
|
|
24
|
+
const islandRest = shapes.some((shape) => shape.mode === "islandRest");
|
|
25
|
+
return {
|
|
26
|
+
kind: "func",
|
|
27
|
+
params: shapes
|
|
28
|
+
.filter((shape) => shape.mode !== "dynRest" && shape.mode !== "arguments")
|
|
29
|
+
.map((shape) => shape.type),
|
|
30
|
+
ret,
|
|
31
|
+
...(typedRest || dynRest || islandRest || argumentsAll ? { rest: true } : {}),
|
|
32
|
+
...(argumentsAll ? { argumentsAll: true } : {}),
|
|
33
|
+
...(typedRest || islandRest
|
|
34
|
+
? { restAbi: typedRest ? "typed" : "jsval" }
|
|
35
|
+
: {}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Registers `const alias = overloadedDeclaration` as a compile-time
|
|
39
|
+
* callable projection. The source function's one implementation ABI is
|
|
40
|
+
* already collected in fnSigsBySymbol; each direct call still uses the
|
|
41
|
+
* TS7-resolved overload result bridge. The alias owns no storage, and a
|
|
42
|
+
* value read materializes the source function's interned closure, so JS
|
|
43
|
+
* identity (`alias === source`) is preserved. */
|
|
44
|
+
export function registerOverloadedCallableAlias(lowerer, decl) {
|
|
45
|
+
if (!ts.isIdentifier(decl.name) || !decl.initializer)
|
|
46
|
+
return false;
|
|
47
|
+
let init = decl.initializer;
|
|
48
|
+
while (ts.isParenthesizedExpression(init))
|
|
49
|
+
init = init.expression;
|
|
50
|
+
if (!ts.isIdentifier(init))
|
|
51
|
+
return false;
|
|
52
|
+
const aliasType = lowerer.typeOf(decl.name);
|
|
53
|
+
if (lowerer.checker.getCallSignatures(aliasType).length < 2)
|
|
54
|
+
return false;
|
|
55
|
+
const sourceSymbol = lowerer.resolveValueSymbol(init);
|
|
56
|
+
if (!sourceSymbol)
|
|
57
|
+
return false;
|
|
58
|
+
const sourceProjection = lowerer.staticCallables.get(sourceSymbol);
|
|
59
|
+
const signature = lowerer.fnSigsBySymbol.get(sourceSymbol) ??
|
|
60
|
+
(sourceProjection?.kind === "declared-function" ? sourceProjection.signature : undefined);
|
|
61
|
+
if (!signature)
|
|
62
|
+
return false;
|
|
63
|
+
const aliasSymbol = lowerer.checker.getSymbolAtLocation(decl.name);
|
|
64
|
+
if (!aliasSymbol)
|
|
65
|
+
return false;
|
|
66
|
+
lowerer.staticCallables.set(aliasSymbol, { kind: "declared-function", signature });
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
export function generatorMeta(lowerer, type) {
|
|
70
|
+
const resultType = genResultRecord(type.yieldT, type.retT, lowerer.shapes, lowerer.unions);
|
|
71
|
+
if (resultType === null) {
|
|
72
|
+
throw new InternalCompilerError("lowerer bug: mapped generator without an IteratorResult record");
|
|
73
|
+
}
|
|
74
|
+
return { yieldT: type.yieldT, nextT: type.nextT, resultType };
|
|
75
|
+
}
|
|
76
|
+
/** One parameter's ParamShape — the shared signature-shaped collection
|
|
77
|
+
* point for function declarations, methods, constructors, and lambdas
|
|
78
|
+
* (generic declarations defer to their call sites, where the resolved
|
|
79
|
+
* types exist; see lowerGenericCall).
|
|
80
|
+
*
|
|
81
|
+
* - `x?: T`: the checker already types the param `T | undefined` under
|
|
82
|
+
* strictNullChecks, so the ABI type IS that union and the body narrows
|
|
83
|
+
* with `!== undefined` like any union local.
|
|
84
|
+
* - `x: T = e`: the ABI type is a synthesized `T | undefined` union (the
|
|
85
|
+
* caller may omit the arg or pass undefined — both trigger the default,
|
|
86
|
+
* JS-exact); the body sees plain T through the two-local prologue
|
|
87
|
+
* (declareParams). A single-arm T narrows in the prologue; a UNION T
|
|
88
|
+
* re-tags through the interned retag helper (the undefined arm is the
|
|
89
|
+
* one stranded case, unreachable from the else-branch by construction).
|
|
90
|
+
* - `...xs: T[]`: the ABI type is the array; call sites pack the surplus.
|
|
91
|
+
*/
|
|
92
|
+
export function paramShape(lowerer, param) {
|
|
93
|
+
if (isJsSourceFile(param.getSourceFile()) && ts.isSetAccessorDeclaration(param.parent))
|
|
94
|
+
return { type: DYN, mode: "required" };
|
|
95
|
+
if (isJsSourceFile(param.getSourceFile()) &&
|
|
96
|
+
ts.isConstructorDeclaration(param.parent) &&
|
|
97
|
+
!param.dotDotDotToken) {
|
|
98
|
+
// Reflective JavaScript construction can supply values outside the
|
|
99
|
+
// constructor's documented usual types. Retain the actual arguments
|
|
100
|
+
// and apply checked conversions only at operations that need them.
|
|
101
|
+
return param.initializer
|
|
102
|
+
? { type: DYN, mode: "omittable", bodyType: DYN }
|
|
103
|
+
: { type: DYN, mode: param.questionToken ? "omittable" : "required" };
|
|
104
|
+
}
|
|
105
|
+
const executor = param.parent;
|
|
106
|
+
const construction = executor?.parent;
|
|
107
|
+
const nativeExecutor = executor &&
|
|
108
|
+
(ts.isArrowFunction(executor) || ts.isFunctionExpression(executor)) &&
|
|
109
|
+
ts.isNewExpression(construction) &&
|
|
110
|
+
construction.arguments?.[0] === executor &&
|
|
111
|
+
lowerer.isStdlibGlobal(construction.expression, "Promise");
|
|
112
|
+
if (!nativeExecutor &&
|
|
113
|
+
isJsSourceFile(param.getSourceFile()) &&
|
|
114
|
+
!param.type &&
|
|
115
|
+
!param.dotDotDotToken &&
|
|
116
|
+
!ts.isSetAccessorDeclaration(param.parent) &&
|
|
117
|
+
!/@(?:param|type)\b/.test(param.getSourceFile().text.slice(param.parent?.pos ?? param.pos, param.getStart()))) {
|
|
118
|
+
return param.initializer
|
|
119
|
+
? { type: DYN, mode: "omittable", bodyType: DYN }
|
|
120
|
+
: { type: DYN, mode: "required" };
|
|
121
|
+
}
|
|
122
|
+
if (param.initializer &&
|
|
123
|
+
isJsSourceFile(param.getSourceFile()) &&
|
|
124
|
+
!param.type &&
|
|
125
|
+
!/@(?:param|type)\b/.test(param.getSourceFile().text.slice(param.parent?.pos ?? param.pos, param.getStart()))) {
|
|
126
|
+
return { type: DYN, mode: "omittable", bodyType: DYN };
|
|
127
|
+
}
|
|
128
|
+
// Inferred JS array patterns describe the bindings, not an exact tuple
|
|
129
|
+
// contract. Consume the actual iterable, including surplus elements.
|
|
130
|
+
if (ts.isArrayBindingPattern(param.name) &&
|
|
131
|
+
isJsSourceFile(param.getSourceFile()) &&
|
|
132
|
+
!param.type &&
|
|
133
|
+
!/@(?:param|type)\b/.test(param.getSourceFile().text.slice(param.parent?.pos ?? param.pos, param.getStart()))) {
|
|
134
|
+
if (param.dotDotDotToken)
|
|
135
|
+
return { type: DYN, mode: "dynRest" };
|
|
136
|
+
return param.initializer
|
|
137
|
+
? { type: DYN, mode: "omittable", bodyType: DYN }
|
|
138
|
+
: { type: DYN, mode: "required" };
|
|
139
|
+
}
|
|
140
|
+
if (lowerer.checkedCallbackParams.has(param)) {
|
|
141
|
+
if (param.dotDotDotToken)
|
|
142
|
+
return { type: DYN, mode: "dynRest" };
|
|
143
|
+
return param.initializer
|
|
144
|
+
? { type: DYN, mode: "omittable", bodyType: DYN }
|
|
145
|
+
: { type: DYN, mode: "required" };
|
|
146
|
+
}
|
|
147
|
+
const moduleNs = lowerer.moduleNsParamOverrides.get(param);
|
|
148
|
+
if (moduleNs !== undefined) {
|
|
149
|
+
return { type: moduleNs, mode: param.questionToken ? "omittable" : "required" };
|
|
150
|
+
}
|
|
151
|
+
// Island-handle params (a then-handler receiving a dynamic import's
|
|
152
|
+
// namespace handle — markJsvalHandlerParams): jsval, whatever the
|
|
153
|
+
// contextual type spelled.
|
|
154
|
+
if (ts.isIdentifier(param.name) && lowerer.jsvalParamOverrides.has(param)) {
|
|
155
|
+
return { type: JSVAL, mode: param.questionToken ? "omittable" : "required" };
|
|
156
|
+
}
|
|
157
|
+
if (!ts.isIdentifier(param.name)) {
|
|
158
|
+
// A destructuring pattern parameter — `([label, value]) => ...`,
|
|
159
|
+
// `({ x }) => ...`. The ABI slot carries the SOURCE value (the
|
|
160
|
+
// tuple/array/record itself); the callee prologue desugars the reads
|
|
161
|
+
// through the declaration-destructuring machinery (declareParams →
|
|
162
|
+
// lowerBindingPattern), so the fences inside patterns (computed
|
|
163
|
+
// keys, class-instance sources, union sources) are the declaration
|
|
164
|
+
// fences verbatim. A rest parameter bound to a pattern would need
|
|
165
|
+
// the packing machinery on top — fenced.
|
|
166
|
+
if (param.questionToken) {
|
|
167
|
+
lowerer.unsupported("SC1031", param, "optional destructuring pattern parameters");
|
|
168
|
+
}
|
|
169
|
+
if (param.dotDotDotToken) {
|
|
170
|
+
// A REST parameter bound to a pattern (`(...[[k1, v1]]: [string,
|
|
171
|
+
// number][])`): the ABI packs the surplus arguments into one
|
|
172
|
+
// array exactly like an identifier rest param; the prologue then
|
|
173
|
+
// destructures the packed array through the declaration
|
|
174
|
+
// machinery (declareParams → lowerBindingPattern).
|
|
175
|
+
const type = lowerer.irTypeOf(param.name);
|
|
176
|
+
const tupleRest = type.kind === "record" && lowerer.shapes.get(type.shapeId)?.tuple === true;
|
|
177
|
+
if (type.kind !== "array" && !tupleRest)
|
|
178
|
+
lowerer.badType(param.name, lowerer.typeOf(param.name));
|
|
179
|
+
return { type, mode: "rest" };
|
|
180
|
+
}
|
|
181
|
+
if (param.initializer) {
|
|
182
|
+
// A WHOLE-PATTERN default (`({ x } = { x: 1 }) => ...`): the ABI
|
|
183
|
+
// slot arms the pattern's type with undefined, exactly the
|
|
184
|
+
// identifier-param default below; the callee prologue picks the
|
|
185
|
+
// default when the argument was omitted or undefined, then the
|
|
186
|
+
// pattern destructures the picked value (declareParams).
|
|
187
|
+
const raw = lowerer.irTypeOf(param.name);
|
|
188
|
+
return defaultParameterShape(lowerer, param, raw);
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
type: lowerer.runtimeOptionalBindingType(param.name, lowerer.irTypeOf(param.name)),
|
|
192
|
+
mode: "required",
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
if (param.dotDotDotToken) {
|
|
196
|
+
// A JS rest param with no static element type (`(...args)` — any[]):
|
|
197
|
+
// the VARIADIC dyn form. The lifted function takes one trailing dyn
|
|
198
|
+
// ARRAY param the dyn call thunk fills with the call's surplus
|
|
199
|
+
// arguments; the binding is that array (dynRest — funcType marks
|
|
200
|
+
// `rest`, and the value only ever calls through the boxed thunk).
|
|
201
|
+
if (isJsSourceFile(param.getSourceFile())) {
|
|
202
|
+
const restMapped = lowerer.mapTypeOf(lowerer.typeOf(param.name));
|
|
203
|
+
// `any[]` under --dynamic maps to an island-element array — that
|
|
204
|
+
// is inference residue, not element information; the binding is
|
|
205
|
+
// the ENGINE's own arguments array (an island handle) and the
|
|
206
|
+
// value crosses as a REST host function (the withPlugins
|
|
207
|
+
// `async (...args) =>` shape). Static builds keep the variadic
|
|
208
|
+
// dyn form for every unmappable JS rest.
|
|
209
|
+
if (restMapped?.kind === "array" && restMapped.elem.kind === "jsval" && lowerer.dynamic) {
|
|
210
|
+
return { type: JSVAL, mode: "islandRest" };
|
|
211
|
+
}
|
|
212
|
+
if (restMapped?.kind !== "array") {
|
|
213
|
+
return { type: DYN, mode: "dynRest" };
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const type = lowerer.runtimeOptionalBindingType(param.name, lowerer.irTypeOf(param.name));
|
|
217
|
+
// Tuple-typed rest params don't map to an array; generic rest is the
|
|
218
|
+
// generic path's business. Anything non-array here is unmappable.
|
|
219
|
+
if (type.kind !== "array")
|
|
220
|
+
lowerer.badType(param.name, lowerer.typeOf(param.name));
|
|
221
|
+
return { type, mode: "rest" };
|
|
222
|
+
}
|
|
223
|
+
if (param.initializer) {
|
|
224
|
+
const raw = lowerer.irTypeOf(param.name);
|
|
225
|
+
// An optional JS array parameter is a live caller-owned buffer,
|
|
226
|
+
// including typed arrays passed through checked callbacks. Extracting
|
|
227
|
+
// a native array here would copy it and discard element writes.
|
|
228
|
+
if (isJsSourceFile(param.getSourceFile()) &&
|
|
229
|
+
!param.type &&
|
|
230
|
+
(raw.kind === "array" ||
|
|
231
|
+
(raw.kind === "union" &&
|
|
232
|
+
lowerer.unions.get(raw.unionId)?.arms.some((arm) => arm.kind === "array")))) {
|
|
233
|
+
return { type: DYN, mode: "omittable", bodyType: DYN };
|
|
234
|
+
}
|
|
235
|
+
return defaultParameterShape(lowerer, param, raw);
|
|
236
|
+
}
|
|
237
|
+
let type = lowerer.runtimeOptionalBindingType(param.name, lowerer.irTypeOf(param.name));
|
|
238
|
+
const body = param.parent?.body;
|
|
239
|
+
if (isJsSourceFile(param.getSourceFile()) &&
|
|
240
|
+
body &&
|
|
241
|
+
type.kind !== "dyn" &&
|
|
242
|
+
type.kind !== "jsval") {
|
|
243
|
+
const symbol = lowerer.checker.getSymbolAtLocation(param.name);
|
|
244
|
+
let acceptsUndefined = false;
|
|
245
|
+
ts.walkPreorder(body, (node) => {
|
|
246
|
+
if (acceptsUndefined || !ts.isBinaryExpression(node))
|
|
247
|
+
return;
|
|
248
|
+
const op = node.operatorToken.kind;
|
|
249
|
+
if (op !== ts.SyntaxKind.EqualsEqualsEqualsToken &&
|
|
250
|
+
op !== ts.SyntaxKind.ExclamationEqualsEqualsToken &&
|
|
251
|
+
op !== ts.SyntaxKind.EqualsEqualsToken &&
|
|
252
|
+
op !== ts.SyntaxKind.ExclamationEqualsToken)
|
|
253
|
+
return;
|
|
254
|
+
const checks = (value, absent) => ts.isIdentifier(value) &&
|
|
255
|
+
ts.isIdentifier(absent) &&
|
|
256
|
+
absent.text === "undefined" &&
|
|
257
|
+
(lowerer.typeOf(absent).flags & ts.TypeFlags.Undefined) !== 0 &&
|
|
258
|
+
lowerer.checker.getSymbolAtLocation(value) === symbol;
|
|
259
|
+
acceptsUndefined = checks(node.left, node.right) || checks(node.right, node.left);
|
|
260
|
+
});
|
|
261
|
+
// A JavaScript body that handles an absent argument defines a wider
|
|
262
|
+
// contract than its JSDoc's usual value. Checked callers must deliver
|
|
263
|
+
// undefined to that branch rather than reject it at the ABI boundary.
|
|
264
|
+
if (acceptsUndefined)
|
|
265
|
+
type = lowerer.promoteRuntimeOptionalParameter(param.name, type);
|
|
266
|
+
}
|
|
267
|
+
if (type.kind === "void") {
|
|
268
|
+
return { type: DYN, mode: param.questionToken ? "omittable" : "required" };
|
|
269
|
+
}
|
|
270
|
+
if (param.questionToken &&
|
|
271
|
+
!lowerer.bareUndefinedArmedUnion(type) &&
|
|
272
|
+
type.kind !== "dyn" &&
|
|
273
|
+
type.kind !== "jsval") {
|
|
274
|
+
// `x?: unknown` where unknown came from an annotation: undefined is
|
|
275
|
+
// absorbed into the hole type, so no undefined ARM exists — but a
|
|
276
|
+
// checked-dynamic slot holds the dyn undefined directly (`bar?: any`
|
|
277
|
+
// — an omitted call passes it, undefinedArgFor), and an island slot
|
|
278
|
+
// the engine's own undefined likewise (`options?: [string?]` — an
|
|
279
|
+
// optional-tuple param, jsval-mapped), so dyn and jsval params stay
|
|
280
|
+
// omittable.
|
|
281
|
+
lowerer.unsupported("SC1090", param, `optional parameters of type '${lowerer.fmt(type)}'`);
|
|
282
|
+
}
|
|
283
|
+
return { type, mode: param.questionToken ? "omittable" : "required" };
|
|
284
|
+
}
|
|
285
|
+
/** A `this` PARAMETER declaration (`function f(this: void, x: {}) ...`)
|
|
286
|
+
* — type-world only: tsc types the receiver with it, callers never pass
|
|
287
|
+
* it, and signature.getParameters() excludes it. The syntactic walks
|
|
288
|
+
* (paramShapes, declareParams) skip it with this predicate so ABI slots
|
|
289
|
+
* and call completion stay aligned with what JS actually passes. */
|
|
290
|
+
export function isThisParameter(param) {
|
|
291
|
+
return ts.isIdentifier(param.name) && param.name.text === "this";
|
|
292
|
+
}
|
|
293
|
+
/** ParamShapes for a whole parameter list. */
|
|
294
|
+
export function paramShapes(lowerer, params, signature, blameOf) {
|
|
295
|
+
if (!signature)
|
|
296
|
+
return params.filter((p) => !isThisParameter(p)).map((param) => lowerer.paramShape(param));
|
|
297
|
+
const symbols = signature.getParameters();
|
|
298
|
+
return params.map((declParam, i) => {
|
|
299
|
+
const symbol = symbols[i];
|
|
300
|
+
const tsType = symbol
|
|
301
|
+
? lowerer.checker.getTypeOfSymbol(symbol)
|
|
302
|
+
: lowerer.typeOf(declParam.name);
|
|
303
|
+
const mapped = jsOpenObjectType(declParam, lowerer.runtimeOptionalBindingType(declParam.name, lowerer.mapTypeOf(tsType) ?? lowerer.irTypeOf(declParam.name)), lowerer.shapes, lowerer.unions);
|
|
304
|
+
if (!mapped || mapped.kind === "void")
|
|
305
|
+
lowerer.badType(blameOf?.(declParam, i) ?? declParam.name, tsType);
|
|
306
|
+
if (declParam.dotDotDotToken) {
|
|
307
|
+
if (mapped.kind !== "array")
|
|
308
|
+
lowerer.badType(blameOf?.(declParam, i) ?? declParam.name, tsType);
|
|
309
|
+
return { type: mapped, mode: "rest" };
|
|
310
|
+
}
|
|
311
|
+
if (declParam.initializer)
|
|
312
|
+
return defaultParameterShape(lowerer, declParam, mapped);
|
|
313
|
+
if (declParam.questionToken && !lowerer.bareUndefinedArmedUnion(mapped)) {
|
|
314
|
+
lowerer.unsupported("SC1090", declParam, `optional parameters of type '${lowerer.fmt(mapped)}'`);
|
|
315
|
+
}
|
|
316
|
+
return { type: mapped, mode: declParam.questionToken ? "omittable" : "required" };
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/** A default expression may itself yield undefined. Keep that arm in the
|
|
320
|
+
* body and parameter-property storage, including for literal `undefined`
|
|
321
|
+
* and void expressions: the general type mapper represents those as VOID,
|
|
322
|
+
* so checking only a mapped undefinedT silently erased a valid value.
|
|
323
|
+
* Shared by declared and instantiated signatures, including destructuring. */
|
|
324
|
+
function defaultParameterShape(lowerer, param, raw) {
|
|
325
|
+
if (raw.kind === "dyn" || raw.kind === "jsval") {
|
|
326
|
+
return { type: raw, mode: "omittable", bodyType: raw };
|
|
327
|
+
}
|
|
328
|
+
if (lowerer.bareUndefinedArmedUnion(raw) && param.initializer) {
|
|
329
|
+
const initializer = lowerer.typeOf(param.initializer);
|
|
330
|
+
const parts = initializer.isUnionType() ? ts.constituentTypes(initializer) : [initializer];
|
|
331
|
+
if (parts.some((part) => (part.flags & (ts.TypeFlags.Undefined | ts.TypeFlags.Void)) !== 0)) {
|
|
332
|
+
return { type: raw, mode: "omittable", bodyType: raw };
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
const bodyType = lowerer.stripUndefinedArm(raw);
|
|
336
|
+
lowerer.checkDefaultParamBodyType(param, bodyType);
|
|
337
|
+
const abi = bodyType.kind === "union"
|
|
338
|
+
? lowerer.withUndefinedArmOf(bodyType)
|
|
339
|
+
: lowerer.withUndefinedArm(bodyType);
|
|
340
|
+
if (!abi)
|
|
341
|
+
lowerer.badType(param.name, lowerer.typeOf(param.name));
|
|
342
|
+
return { type: abi, mode: "omittable", bodyType };
|
|
343
|
+
}
|
|
344
|
+
/** The fences on a defaulted parameter's body type: it becomes the value
|
|
345
|
+
* arm of the synthesized `T | undefined` ABI union, so it must be a valid
|
|
346
|
+
* single arm. Functions, Maps and Sets are valid: the ABI union's test is
|
|
347
|
+
* the prologue's own undefined-tag check (never a user narrowing, which
|
|
348
|
+
* is what keeps containers out of unions with data siblings), so `runner: Runner =
|
|
349
|
+
* defaultRunner` and `skip: Set<string> = new Set()` arm like any ref
|
|
350
|
+
* kind — the nullable-callback union shape, built by the compiler. */
|
|
351
|
+
export function checkDefaultParamBodyType(lowerer, param, bodyType) {
|
|
352
|
+
if (bodyType.kind === "void" ||
|
|
353
|
+
bodyType.kind === "regex" ||
|
|
354
|
+
bodyType.kind === "date" ||
|
|
355
|
+
bodyType.kind === "dyn" ||
|
|
356
|
+
bodyType.kind === "jsval" ||
|
|
357
|
+
isUnitType(bodyType)) {
|
|
358
|
+
lowerer.unsupported("SC1090", param, `parameter default values on '${lowerer.fmt(bodyType)}'-typed parameters`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
/** DECISION (docs/ir.md): function VALUES carry one completed native ABI.
|
|
362
|
+
* Optional/default parameters appear as literal `T | undefined` slots;
|
|
363
|
+
* typed rest parameters appear as one trailing typed-array slot plus the
|
|
364
|
+
* typed-rest marker that makes indirect call sites pack source arguments.
|
|
365
|
+
* A value is admitted only where its target type projects to that same
|
|
366
|
+
* completed signature. */
|
|
367
|
+
export function requireExactArityValue(lowerer, blame, contextual, shapes, funcType) {
|
|
368
|
+
// dynRest params ride the boxed thunk (JS arity — no completed-ABI
|
|
369
|
+
// spelling exists or is needed); they don't gate the value form.
|
|
370
|
+
// Dynamic-tier omittable params (`{} = a` with `a: any` — jsval/dyn
|
|
371
|
+
// slots) don't either: their ABI slot IS the declared param type (no
|
|
372
|
+
// synthesized union), so every func-type spelling of the signature
|
|
373
|
+
// already matches and short calls through the value complete with the
|
|
374
|
+
// tier's undefined (omittedArgFor).
|
|
375
|
+
if (shapes.every((s) => s.mode === "required" ||
|
|
376
|
+
s.mode === "dynRest" ||
|
|
377
|
+
s.mode === "arguments" ||
|
|
378
|
+
s.mode === "islandRest" ||
|
|
379
|
+
(s.mode === "omittable" && (s.type.kind === "dyn" || s.type.kind === "jsval")))) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
// The type the value FLOWS under must spell the completed ABI: the
|
|
383
|
+
// contextual (target) type when one exists, otherwise the expression's
|
|
384
|
+
// OWN inferred type — the unannotated-const case (`const f = (x = 5) =>
|
|
385
|
+
// ...`), where every later read types the value by that inference and
|
|
386
|
+
// optional/defaulted params spell their `T | undefined` slots (mapType's
|
|
387
|
+
// completed-signature contract), so omitted trailing args complete with
|
|
388
|
+
// the undefined arm like any direct call.
|
|
389
|
+
const target = contextual ? lowerer.checker.getContextualType(contextual) : undefined;
|
|
390
|
+
const mapped = target
|
|
391
|
+
? lowerer.mapTypeOf(target)
|
|
392
|
+
: contextual
|
|
393
|
+
? lowerer.mapTypeOf(lowerer.typeOf(contextual))
|
|
394
|
+
: null;
|
|
395
|
+
if (mapped && typeEquals(mapped, funcType))
|
|
396
|
+
return;
|
|
397
|
+
// A union-typed slot (`runner || defaultRunner` under a
|
|
398
|
+
// `CommandRunner | undefined` context): the value can only inhabit
|
|
399
|
+
// the union's one func arm — judge by it.
|
|
400
|
+
let mappedFn = mapped?.kind === "union"
|
|
401
|
+
? (() => {
|
|
402
|
+
const arms = lowerer.unions.get(mapped.unionId)?.arms.filter((a) => a.kind === "func") ?? [];
|
|
403
|
+
return arms.length === 1 ? arms[0] : null;
|
|
404
|
+
})()
|
|
405
|
+
: mapped;
|
|
406
|
+
// A contextual type that maps to something non-functional (`picked ||
|
|
407
|
+
// defaultRunner` — tsc's contextual answer for the rhs is not the
|
|
408
|
+
// slot): judge by the expression's OWN completed type; the slot's
|
|
409
|
+
// coercion still enforces (or adapts) the flow it lands in.
|
|
410
|
+
if (mappedFn?.kind !== "func" && contextual) {
|
|
411
|
+
const ownType = lowerer.typeOf(contextual);
|
|
412
|
+
mappedFn =
|
|
413
|
+
lowerer.mapTypeOf(ownType) ??
|
|
414
|
+
(isJsSourceFile(contextual.getSourceFile())
|
|
415
|
+
? dynFallbackType(lowerer, contextual, ownType)
|
|
416
|
+
: null);
|
|
417
|
+
}
|
|
418
|
+
if (mappedFn && typeEquals(mappedFn, funcType))
|
|
419
|
+
return;
|
|
420
|
+
// A target signature that agrees on the completed parameters and
|
|
421
|
+
// differs only by RETURNING the structural spawnSync-result record
|
|
422
|
+
// (the CommandRunner shape): the slot coercion bridges with the
|
|
423
|
+
// interned runner-value adapter, so the value passes here.
|
|
424
|
+
if (mappedFn?.kind === "func" &&
|
|
425
|
+
funcType.kind === "func" &&
|
|
426
|
+
lowerer.spawnResFnAdapterPlan(funcType, mappedFn) !== null) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
// An uncontextualized npm-static implementation function can still
|
|
430
|
+
// have a declaration-backed completed ABI: the package's .d.ts
|
|
431
|
+
// projection supplies the body-facing parameter/return types while
|
|
432
|
+
// the shipped JavaScript's own inferred type remains wider (`any`
|
|
433
|
+
// callback fields are the common case). lambdaSignature has already
|
|
434
|
+
// constructed and validated that concrete ABI, and every eventual
|
|
435
|
+
// storage/call site independently checks it. Admit the value at birth;
|
|
436
|
+
// do not make the unprojected JS inference veto its authored surface.
|
|
437
|
+
if (target === undefined &&
|
|
438
|
+
contextual !== null &&
|
|
439
|
+
(ts.isArrowFunction(contextual) || ts.isFunctionExpression(contextual)) &&
|
|
440
|
+
npmStaticPackageOfPath(contextual.getSourceFile().fileName) !== null) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
// An 'any'-typed slot is the ISLAND boundary: the host-function
|
|
444
|
+
// trampoline already implements JS call semantics over the completed
|
|
445
|
+
// signature — a missing engine argument arrives as undefined and takes
|
|
446
|
+
// the omittable param's undefined arm (which is what triggers the
|
|
447
|
+
// default), surplus arguments drop. So a function with optional/
|
|
448
|
+
// defaulted params may flow into a package API whenever the completed
|
|
449
|
+
// signature can cross at all (jsvalIn re-checks and speaks otherwise) —
|
|
450
|
+
// commander's `.option(flags, desc, collector, [])` pattern.
|
|
451
|
+
if (mapped?.kind === "jsval" &&
|
|
452
|
+
canMarshalTypedFuncIntoIsland(funcType, (id) => lowerer.shapes.get(id), (id) => lowerer.unions.get(id))) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
lowerer.unsupported("SC1090", blame, "functions with optional or defaulted parameters as values, except where the " +
|
|
456
|
+
"target type spells the completed signature with required parameters " +
|
|
457
|
+
"(a '(x?: T) => R' function flows into a '(x: T | undefined) => R' slot, " +
|
|
458
|
+
"and a package/'any' slot takes any signature that can cross the island " +
|
|
459
|
+
"boundary; otherwise call the function directly)");
|
|
460
|
+
}
|
|
461
|
+
export function collectSignature(lowerer, decl) {
|
|
462
|
+
lowerer.collectDeferring(() => declSymbolOf(lowerer, decl), () => lowerer.collectSignatureInner(decl));
|
|
463
|
+
}
|
|
464
|
+
export function collectSignatureInner(lowerer, decl) {
|
|
465
|
+
// The one legal nameless declaration form is `export default function
|
|
466
|
+
// () {}` — its symbol is the module's default export (declSymbolOf)
|
|
467
|
+
// and it registers under the synthetic "%default" spelling.
|
|
468
|
+
if (!decl.name && declSymbolOf(lowerer, decl) === undefined) {
|
|
469
|
+
lowerer.unsupported("SC1090", decl, "anonymous function declarations");
|
|
470
|
+
}
|
|
471
|
+
// A body-less declaration is type-world and lowers to NOTHING: an
|
|
472
|
+
// OVERLOAD SIGNATURE when an implementation shares the symbol (the
|
|
473
|
+
// implementation's own collection registers the one real ABI — tsc
|
|
474
|
+
// resolved every call site against the signatures, and the
|
|
475
|
+
// implementation's parameter types are supersets by the
|
|
476
|
+
// overload-compatibility rules, so calls flow through that ABI), or an
|
|
477
|
+
// AMBIENT `declare function` nothing defines (references compile to
|
|
478
|
+
// Node's ReferenceError at the use site — the `declare const` /
|
|
479
|
+
// ambient-namespace undefRead stance, ambientUndefinedFnSymbolOf).
|
|
480
|
+
if (!decl.body)
|
|
481
|
+
return;
|
|
482
|
+
// A MIXIN function (`function M(Base: T) { return class extends Base
|
|
483
|
+
// {…} }`) has no callable signature of its own — its return type is a
|
|
484
|
+
// per-call class, so calls instantiate per site (lower-mixins.ts) and
|
|
485
|
+
// nothing ever dispatches through an ABI. Recognized here so the
|
|
486
|
+
// declaration neither registers a broken signature nor lowers as a
|
|
487
|
+
// body (run()/discover() skip by the same test). Generic mixins still
|
|
488
|
+
// register their generic signature below: non-mixin-shaped calls
|
|
489
|
+
// degrade to the generic machinery's own per-site fences.
|
|
490
|
+
if (!decl.typeParameters && mixinFnShapeOf(lowerer, decl))
|
|
491
|
+
return;
|
|
492
|
+
const isAsync = decl.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword) === true;
|
|
493
|
+
const isGenerator = decl.asteriskToken !== undefined;
|
|
494
|
+
if (decl.typeParameters) {
|
|
495
|
+
// Generic async composes: each monomorphized instance is an async
|
|
496
|
+
// IrFunction like any other — its own spawn wrapper, its body
|
|
497
|
+
// returning the resolved promise's inner (lowerGenericInstance).
|
|
498
|
+
lowerer.collectGenericSignature(decl);
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
// IMPLICIT-ANY monomorphization (npm-static JS): a function whose
|
|
502
|
+
// signature carries bindable untyped params registers like a generic
|
|
503
|
+
// declaration — no ABI of its own, one instance per call-site type
|
|
504
|
+
// tuple (generic-functions.ts). Everything that
|
|
505
|
+
// routes generic declarations (direct calls, namespace/CJS member
|
|
506
|
+
// calls, value references) resolves it through genericFnsBySymbol
|
|
507
|
+
// unchanged.
|
|
508
|
+
if (implicitMonoFile(decl.getSourceFile()) && !isAsync && !isGenerator) {
|
|
509
|
+
const implicit = implicitAnyParamSymbolsOf(lowerer, decl);
|
|
510
|
+
if (implicit) {
|
|
511
|
+
const nameText = decl.name?.text ?? "%default";
|
|
512
|
+
const symbol = declSymbolOf(lowerer, decl);
|
|
513
|
+
if (!symbol)
|
|
514
|
+
lowerer.unsupported("SC1090", decl, "this function form");
|
|
515
|
+
lowerer.genericFnsBySymbol.set(symbol, {
|
|
516
|
+
decl,
|
|
517
|
+
baseName: nameText,
|
|
518
|
+
qualifiedName: lowerer.qualify(decl.getSourceFile(), nsPathPrefix(decl) + nameText),
|
|
519
|
+
typeParams: [],
|
|
520
|
+
instances: new Map(),
|
|
521
|
+
implicitParams: implicit,
|
|
522
|
+
});
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
const params = lowerer.paramShapes(decl.parameters);
|
|
527
|
+
// The zero-parameter declaration retains its dynRest ABI; value
|
|
528
|
+
// functions use the full arguments slot even with no named parameters.
|
|
529
|
+
appendArgumentsParameter(lowerer, decl, params, decl.parameters.length > 0 ? "arguments" : "dynRest");
|
|
530
|
+
const nameBlame = decl.name ?? decl;
|
|
531
|
+
const returnType = lowerer.declaredReturnType(decl, nameBlame);
|
|
532
|
+
if (isAsync && !isGenerator && returnType.kind !== "promise") {
|
|
533
|
+
lowerer.badType(nameBlame, lowerer.typeOf(nameBlame));
|
|
534
|
+
}
|
|
535
|
+
if (isGenerator && (returnType.kind !== "generator" || (returnType.async === true) !== isAsync)) {
|
|
536
|
+
lowerer.badType(nameBlame, lowerer.typeOf(nameBlame));
|
|
537
|
+
}
|
|
538
|
+
const symbol = declSymbolOf(lowerer, decl);
|
|
539
|
+
if (!symbol)
|
|
540
|
+
lowerer.unsupported("SC1090", decl, "this function form");
|
|
541
|
+
lowerer.fnSigsBySymbol.set(symbol, {
|
|
542
|
+
// Namespace-nested functions carry the namespace path (nsPathPrefix)
|
|
543
|
+
// so `namespace A { export function f }` and a top-level `f` never
|
|
544
|
+
// collide. The anonymous default export takes the synthetic
|
|
545
|
+
// "%default" spelling ('%' cannot appear in a user identifier).
|
|
546
|
+
name: lowerer.qualify(decl.getSourceFile(), nsPathPrefix(decl) + (decl.name?.text ?? "%default")),
|
|
547
|
+
params,
|
|
548
|
+
returnType,
|
|
549
|
+
isAsync,
|
|
550
|
+
...(isGenerator && returnType.kind === "generator"
|
|
551
|
+
? { generator: generatorMeta(lowerer, returnType) }
|
|
552
|
+
: {}),
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
/** Arrows inherit arguments. Ordinary JS functions receive a hidden
|
|
556
|
+
* array unless a declared rest parameter already owns that contract.
|
|
557
|
+
* Class methods are strict; other parameterized forms require ES modules
|
|
558
|
+
* because sloppy-mode arguments alias named parameters. */
|
|
559
|
+
function appendArgumentsParameter(lowerer, node, shapes, mode) {
|
|
560
|
+
if (shapes.some((s) => s.mode === "rest" || s.mode === "dynRest" || s.mode === "islandRest") ||
|
|
561
|
+
!(ts.isFunctionExpression(node) ||
|
|
562
|
+
ts.isFunctionDeclaration(node) ||
|
|
563
|
+
ts.isMethodDeclaration(node)) ||
|
|
564
|
+
!isJsSourceFile(node.getSourceFile()) ||
|
|
565
|
+
!bodyReadsArguments(node))
|
|
566
|
+
return;
|
|
567
|
+
if (node.parameters.length > 0 || ts.isMethodDeclaration(node)) {
|
|
568
|
+
const classMethod = ts.isMethodDeclaration(node) &&
|
|
569
|
+
(ts.isClassDeclaration(node.parent) || ts.isClassExpression(node.parent));
|
|
570
|
+
if (!classMethod && !isNodeEsmFile(node.getSourceFile(), lowerer.program)) {
|
|
571
|
+
lowerer.unsupported("SC1090", node, "parameterized 'arguments' outside an ES module (sloppy-mode parameter aliases)");
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
shapes.push({ type: DYN, mode });
|
|
575
|
+
}
|
|
576
|
+
/** Signature checks + param shapes + IR func type for any lambda-like
|
|
577
|
+
* node. The func type's params are the ABI types: optional/default params
|
|
578
|
+
* become `T | undefined`, and typed rest becomes one packed-array slot.
|
|
579
|
+
* requireExactArityValue decides whether that completed ABI may escape. */
|
|
580
|
+
export function lambdaSignature(lowerer, node) {
|
|
581
|
+
if (!node.body)
|
|
582
|
+
lowerer.unsupported("SC1090", node, "function overload signatures");
|
|
583
|
+
// A JS replacement of a native stream's write method receives the
|
|
584
|
+
// actual call tuple, including overloads and omitted arguments. Node's
|
|
585
|
+
// contextual overload signature cannot define this closure's ABI.
|
|
586
|
+
if (isJsSourceFile(node.getSourceFile()) &&
|
|
587
|
+
!node.type &&
|
|
588
|
+
(ts.isFunctionExpression(node) || ts.isArrowFunction(node)) &&
|
|
589
|
+
node.parameters.every((param) => !param.type && !param.dotDotDotToken && !param.initializer) &&
|
|
590
|
+
ts.isBinaryExpression(node.parent) &&
|
|
591
|
+
node.parent.right === node &&
|
|
592
|
+
node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken &&
|
|
593
|
+
ts.isPropertyAccessExpression(node.parent.left) &&
|
|
594
|
+
node.parent.left.name.text === "write" &&
|
|
595
|
+
lowerer.isStdlibMember(node.parent.left)) {
|
|
596
|
+
const receiver = lowerer.lowerExpr(node.parent.left.expression);
|
|
597
|
+
if (receiver.type.kind === "dyn") {
|
|
598
|
+
const shapes = node.parameters.map(() => ({ type: DYN, mode: "required" }));
|
|
599
|
+
return { shapes, funcType: funcTypeFromParamShapes(shapes, DYN) };
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
if (node.typeParameters) {
|
|
603
|
+
// Generic function-like forms monomorphize only where a static home
|
|
604
|
+
// exists: top-level generic function declarations, generic methods
|
|
605
|
+
// (class and object-literal), and module-scope never-reassigned
|
|
606
|
+
// bindings initialized with a generic arrow/function expression —
|
|
607
|
+
// all collected before this path. Everything else lambda-shaped
|
|
608
|
+
// (arguments, IIFEs, default exports, nested declarations) has no
|
|
609
|
+
// per-instantiation story and stays out.
|
|
610
|
+
lowerer.unsupported("SC1090", node, ts.isMethodDeclaration(node)
|
|
611
|
+
? "generic methods"
|
|
612
|
+
: ts.isFunctionDeclaration(node)
|
|
613
|
+
? "generic nested functions (only top-level generic function declarations are supported)"
|
|
614
|
+
: "generic arrow/function expressions outside a never-reassigned module-scope binding (only `const f = <T>(x: T) => ...` bindings and top-level generic function declarations monomorphize)");
|
|
615
|
+
}
|
|
616
|
+
const shapes = lowerer.paramShapes(node.parameters);
|
|
617
|
+
// Error-first callbacks captured by native filesystem adapters receive
|
|
618
|
+
// the selected runtime overload. Ambient contextual inference can pick
|
|
619
|
+
// the string overload even when options request a Buffer.
|
|
620
|
+
if ((ts.isArrowFunction(node) || ts.isFunctionExpression(node)) &&
|
|
621
|
+
ts.isCallExpression(node.parent) &&
|
|
622
|
+
node.parent.arguments.at(-1) === node) {
|
|
623
|
+
const builtin = ts.isPropertyAccessExpression(node.parent.expression)
|
|
624
|
+
? lowerer.builtinMemberOf(node.parent.expression)
|
|
625
|
+
: ts.isIdentifier(node.parent.expression)
|
|
626
|
+
? lowerer.builtinImportOf(node.parent.expression)
|
|
627
|
+
: null;
|
|
628
|
+
if (builtin?.module === "fs" &&
|
|
629
|
+
builtin.member !== "rename" &&
|
|
630
|
+
builtinModuleFnOf(lowerer, builtin.module, builtin.member)?.fn === "fs.callbackCall") {
|
|
631
|
+
for (let index = 0; index < shapes.length; index++) {
|
|
632
|
+
if (!node.parameters[index]?.type) {
|
|
633
|
+
shapes[index].type = DYN;
|
|
634
|
+
if (shapes[index].bodyType)
|
|
635
|
+
shapes[index].bodyType = DYN;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
// A concise arrow over an h2-only stream/session call (`() =>
|
|
641
|
+
// req.stream.destroy()`): the call ALWAYS throws on this lowering
|
|
642
|
+
// (stream is undefined — the streamUndefCall precedent), so the body
|
|
643
|
+
// is throw-only and the declared return type (ServerHttp2Stream,
|
|
644
|
+
// unmappable) must not decide the ABI — void, the `never` stance.
|
|
645
|
+
let ret = ts.isArrowFunction(node) && !ts.isBlock(node.body) && isStreamUndefCallExpr(lowerer, node.body)
|
|
646
|
+
? VOID
|
|
647
|
+
: lowerer.declaredReturnType(node, node);
|
|
648
|
+
ret = lowerer.runtimeOptionalFunctionReturnType(node, ret);
|
|
649
|
+
// A contextually-typed arrow/function EXPRESSION whose slot signature
|
|
650
|
+
// returns a composite type the inferred return doesn't spell adopts
|
|
651
|
+
// the slot's return as its ABI: `(n) => work()` (inferring Promise<void>) against
|
|
652
|
+
// an `(n) => Promise<void> | void` field must RETURN that union — the
|
|
653
|
+
// body's returns coerce into it per return site (arm values wrap;
|
|
654
|
+
// width-coercible records rebuild into their arm — the runJobs
|
|
655
|
+
// `{ data, id }` literal against `Buffer | string | GeneratedOutput`),
|
|
656
|
+
// a void body's implicit completion becomes the undefined arm, and the
|
|
657
|
+
// closure VALUE matches the slot exactly (no runtime re-tag exists for
|
|
658
|
+
// func returns). tsc vetted the assignability — a return the coercion
|
|
659
|
+
// path can't carry fences per site with its own actionable message.
|
|
660
|
+
// ASYNC lambdas adopt through the promise: an inferred Promise<record>
|
|
661
|
+
// against a Promise<union> slot returns the union promise (the fiber's
|
|
662
|
+
// returns coerce; the spawn-wrapper ABI still returns a promise).
|
|
663
|
+
// jsval-returning bodies stay out (adoption would force validated
|
|
664
|
+
// exits the writer never asked for).
|
|
665
|
+
// Array and record returns also need the destination during literal
|
|
666
|
+
// construction: a callback building IrStmt[] must wrap each element at
|
|
667
|
+
// that recursive layout instead of first inferring narrower arrays.
|
|
668
|
+
const isAsyncLike = !ts.isMethodDeclaration(node) &&
|
|
669
|
+
node.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword) === true;
|
|
670
|
+
const innerRet = isAsyncLike && ret.kind === "promise" ? ret.inner : ret;
|
|
671
|
+
// Union-inferred returns adopt too (a mixed-return body inferring a
|
|
672
|
+
// SUB-union of the slot's union — adopting is a no-op when the two
|
|
673
|
+
// already agree); only jsval stays out.
|
|
674
|
+
if ((ts.isArrowFunction(node) || ts.isFunctionExpression(node)) &&
|
|
675
|
+
(!isAsyncLike || ret.kind === "promise") &&
|
|
676
|
+
innerRet.kind !== "jsval") {
|
|
677
|
+
// The slot's signature: the contextual type stripped of its nullish
|
|
678
|
+
// parts (an OPTIONAL callback field's context is the whole
|
|
679
|
+
// `(...) | undefined` union) with exactly one call signature — and
|
|
680
|
+
// declared in USER code: stdlib callback slots (flatMap's
|
|
681
|
+
// `U | readonly U[]`, sort comparators) have intrinsic lowerings
|
|
682
|
+
// that inspect the INFERRED type, so they must not widen.
|
|
683
|
+
const ctxType = lowerer.checker.getContextualType(node);
|
|
684
|
+
const ctxSigs = ctxType
|
|
685
|
+
? lowerer.checker.getCallSignatures(lowerer.checker.getNonNullableType(ctxType))
|
|
686
|
+
: [];
|
|
687
|
+
const ctxDecl = ctxSigs.length === 1 ? lowerer.checker.signatureDeclaration(ctxSigs[0]) : undefined;
|
|
688
|
+
const ctxRetRaw = ctxDecl && !ctxDecl.getSourceFile().isDeclarationFile
|
|
689
|
+
? lowerer.mapTypeOf(lowerer.checker.getReturnTypeOfSignature(ctxSigs[0]))
|
|
690
|
+
: null;
|
|
691
|
+
const ctxRet = isAsyncLike && ctxRetRaw?.kind === "promise" ? ctxRetRaw.inner : ctxRetRaw;
|
|
692
|
+
if ((ctxRet?.kind === "union" || ctxRet?.kind === "array" || ctxRet?.kind === "record") &&
|
|
693
|
+
(innerRet.kind !== "void" ||
|
|
694
|
+
(ctxRet.kind === "union" && lowerer.armTag(ctxRet.unionId, UNDEFINED_T) >= 0))) {
|
|
695
|
+
ret = isAsyncLike ? { kind: "promise", inner: ctxRet } : ctxRet;
|
|
696
|
+
}
|
|
697
|
+
// A VOID slot discards the callback's result (TS's void-returning
|
|
698
|
+
// assignability rule; JS ignores the value), so an UNANNOTATED
|
|
699
|
+
// sync lambda adopts void regardless of what its body infers —
|
|
700
|
+
// `() => socket.destroy()` infers Socket (destroy returns `this`
|
|
701
|
+
// for chaining) but the error-listener slot never looks. Stdlib
|
|
702
|
+
// slots included: no intrinsic lowering inspects an inferred
|
|
703
|
+
// return where its own declared slot is void. Async lambdas stay
|
|
704
|
+
// out (the spawn-wrapper ABI must still return a promise), and an
|
|
705
|
+
// explicit return annotation keeps its word.
|
|
706
|
+
if (!isAsyncLike &&
|
|
707
|
+
!node.type &&
|
|
708
|
+
ret.kind !== "void" &&
|
|
709
|
+
ctxSigs.length === 1 &&
|
|
710
|
+
!!(lowerer.checker.getReturnTypeOfSignature(ctxSigs[0]).flags & ts.TypeFlags.Void)) {
|
|
711
|
+
ret = VOID;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
ret = lowerer.contextualFunctionReturns.get(node) ?? ret;
|
|
715
|
+
appendArgumentsParameter(lowerer, node, shapes, "arguments");
|
|
716
|
+
const funcType = funcTypeFromParamShapes(shapes, ret);
|
|
717
|
+
return { shapes, funcType };
|
|
718
|
+
}
|
|
719
|
+
//# sourceMappingURL=call-signatures.js.map
|