@scriptc/compiler 0.2.4 → 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.js.map +1 -1
- 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.js +6 -1
- package/dist/backend/llvm/byte-numbers.js.map +1 -1
- package/dist/backend/llvm/bytes-bounds.js +73 -22
- package/dist/backend/llvm/bytes-bounds.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.d.ts +3 -0
- package/dist/backend/llvm/call-lifetimes.js +60 -17
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +159 -28
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/checked-value-lifetimes.d.ts +4 -0
- package/dist/backend/llvm/checked-value-lifetimes.js +14 -4
- package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
- 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.js +10 -3
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- 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 +9 -3
- package/dist/backend/llvm/emitter.js +238 -105
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +233 -42
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +25 -6
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +13 -4
- 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 +20 -9
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +2 -0
- package/dist/backend/llvm/expr-containers.js +92 -33
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-control.js +1 -3
- 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 +19 -4
- 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 +88 -19
- 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 +10 -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.js +15 -4
- package/dist/backend/llvm/integer-values.js.map +1 -1
- package/dist/backend/llvm/integer-views.js +23 -7
- package/dist/backend/llvm/integer-views.js.map +1 -1
- package/dist/backend/llvm/integer-views.test.js +42 -7
- package/dist/backend/llvm/integer-views.test.js.map +1 -1
- 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 +35 -16
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +33 -18
- 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 +1 -0
- package/dist/backend/llvm/local-array-reads.js +96 -30
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +368 -60
- 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 +44 -14
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +89 -17
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/reference-effects.d.ts +3 -2
- package/dist/backend/llvm/reference-effects.js +67 -36
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-effects.test.js +92 -9
- package/dist/backend/llvm/reference-effects.test.js.map +1 -1
- package/dist/backend/llvm/shapes.js +60 -17
- 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 +151 -32
- package/dist/backend/llvm/stack-unions.test.js.map +1 -1
- package/dist/backend/llvm/string-construction.js.map +1 -1
- package/dist/backend/llvm/string-construction.test.js +32 -7
- package/dist/backend/llvm/string-construction.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.js +14 -8
- package/dist/backend/llvm/string-lifetimes.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +112 -26
- 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 +355 -72
- 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 +580 -158
- 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 +1701 -724
- 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 +3446 -1154
- 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 +1024 -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 +545 -204
- 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 +95 -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.js +67 -16
- package/dist/ir/byte-numbers.js.map +1 -1
- package/dist/ir/byte-numbers.test.js +17 -4
- package/dist/ir/byte-numbers.test.js.map +1 -1
- 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.js +85 -30
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +76 -13
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.js +93 -21
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +199 -21
- 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 +6 -2150
- package/dist/ir/ir.js +160 -1396
- 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 +782 -1889
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +610 -114
- 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 +68 -26
- package/dist/native/toolchain.js.map +1 -1
- package/dist/native/toolchain.test.js +59 -20
- 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 -8986
- 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 -7344
- package/dist/frontend/lowering/lower-containers.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InternalCompilerError } from "../errors.js";
|
|
2
2
|
import * as ts from "./ts7/adapter.js";
|
|
3
3
|
import { bodyReadsArguments } from "./arguments-usage.js";
|
|
4
|
-
import { BYTES_ELEMENT_NAME, arrayOf, BOOL, bytesOf, canConvertToDyn, CHILD_T, CRYPTOHASH_T, CRYPTOHMAC_T, DATE_T, DYN, F64, funcOf, isSupportedArrayElem, isSupportedIndexValue, isSupportedMapKey, isSupportedMapValue, isSupportedSetElem, isUnitType, JSVAL, mapOf, NULL_T, PROCSTREAM_T, RUNTIME_EMITTER_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, setOf, STRING, SYMBOL_T, typeEquals, typeKey, unionContainerArmsOk, UNDEFINED_T, VOID } from "../ir/ir.js";
|
|
4
|
+
import { BYTES_ELEMENT_NAME, arrayOf, BOOL, bytesOf, canConvertToDyn, CHILD_T, CRYPTOHASH_T, CRYPTOHMAC_T, DATE_T, DYN, F64, funcOf, isSupportedArrayElem, isSupportedIndexValue, isSupportedMapKey, isSupportedMapValue, isSupportedSetElem, isUnitType, JSVAL, mapOf, NULL_T, PROCSTREAM_T, RUNTIME_EMITTER_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, setOf, STRING, SYMBOL_T, typeEquals, typeKey, unionContainerArmsOk, UNDEFINED_T, VOID, } from "../ir/ir.js";
|
|
5
5
|
import { BIGINT_T } from "../ir/ir.js";
|
|
6
6
|
import { literalValues } from "./literal-values.js";
|
|
7
7
|
import { remapUnionDiscriminant } from "./union-discriminants.js";
|
|
@@ -19,18 +19,28 @@ export function jsOpenObjectType(decl, type, shapes, unions) {
|
|
|
19
19
|
return type;
|
|
20
20
|
const arms = type.kind === "union" ? unions.get(type.unionId)?.arms : [type];
|
|
21
21
|
const present = arms?.filter((arm) => arm.kind !== "undefinedT");
|
|
22
|
-
const parameter = ts.isParameter(decl)
|
|
22
|
+
const parameter = ts.isParameter(decl)
|
|
23
|
+
? decl
|
|
24
|
+
: decl.parent && ts.isParameter(decl.parent)
|
|
25
|
+
? decl.parent
|
|
26
|
+
: null;
|
|
23
27
|
// Array parameters in JavaScript also accept typed arrays. Keep
|
|
24
28
|
// their runtime storage at the boundary, including default [] parameters.
|
|
25
|
-
if (parameter &&
|
|
29
|
+
if (parameter &&
|
|
30
|
+
!parameter.dotDotDotToken &&
|
|
31
|
+
present?.length === 1 &&
|
|
26
32
|
present[0].kind === "array")
|
|
27
33
|
return DYN;
|
|
28
|
-
if (parameter &&
|
|
34
|
+
if (parameter &&
|
|
35
|
+
!parameter.dotDotDotToken &&
|
|
36
|
+
present?.length === 1 &&
|
|
37
|
+
present[0].kind === "bytes")
|
|
29
38
|
return DYN;
|
|
30
39
|
// An unannotated JavaScript parameter's object default is a fallback,
|
|
31
40
|
// not a closed class contract. Published code routinely passes another
|
|
32
41
|
// implementation of the same protocol through a boxed callable.
|
|
33
|
-
if (parameter?.initializer &&
|
|
42
|
+
if (parameter?.initializer &&
|
|
43
|
+
!parameter.type &&
|
|
34
44
|
present?.some((arm) => arm.kind === "object") &&
|
|
35
45
|
arms?.every((arm) => canConvertToDyn(arm, (id) => shapes.get(id), (id) => unions.get(id))))
|
|
36
46
|
return DYN;
|
|
@@ -41,10 +51,15 @@ export function jsOpenObjectType(decl, type, shapes, unions) {
|
|
|
41
51
|
// A typed index slot cannot represent either of those reads faithfully.
|
|
42
52
|
if (shape?.indexValue && !shape.tuple)
|
|
43
53
|
return DYN;
|
|
44
|
-
const unitOnly = (field) => isUnitType(field) ||
|
|
45
|
-
field.kind === "
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
const unitOnly = (field) => isUnitType(field) ||
|
|
55
|
+
field.kind === "void" ||
|
|
56
|
+
(field.kind === "union" && unions.get(field.unionId)?.arms.every(isUnitType) === true);
|
|
57
|
+
return shape &&
|
|
58
|
+
!shape.tuple &&
|
|
59
|
+
!shape.indexValue &&
|
|
60
|
+
(shape.fields.length === 0 || shape.fields.some((field) => unitOnly(field.type)))
|
|
61
|
+
? DYN
|
|
62
|
+
: type;
|
|
48
63
|
}
|
|
49
64
|
/** The ambient TYPE names of the fetch slice. Under --dynamic their
|
|
50
65
|
* values live in the embedded engine and map to island handles (jsval).
|
|
@@ -75,9 +90,12 @@ function isAmbientAbortHandleType(type, ctx) {
|
|
|
75
90
|
if (type.isUnionType())
|
|
76
91
|
return ts.constituentTypes(type).some((part) => isAmbientAbortHandleType(part, ctx));
|
|
77
92
|
const symbol = type.getSymbol();
|
|
78
|
-
return !!symbol &&
|
|
93
|
+
return (!!symbol &&
|
|
79
94
|
(symbol.name === "AbortSignal" || symbol.name === "AbortController") &&
|
|
80
|
-
ctx.checker
|
|
95
|
+
ctx.checker
|
|
96
|
+
.declarationsOf(symbol)
|
|
97
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
98
|
+
ctx.isStdlibFile(d.getSourceFile())));
|
|
81
99
|
}
|
|
82
100
|
/** node:util.parseArgs's public and @types/node helper type names. Values
|
|
83
101
|
* behind this surface use the checked-dynamic tree; see mapTypeInner. */
|
|
@@ -195,7 +213,8 @@ export class ShapeRegistry {
|
|
|
195
213
|
else
|
|
196
214
|
this.declaredOrderCandidates.set(shape.id, [candidate]);
|
|
197
215
|
const previous = this.declaredOrderPriority.get(shape.id);
|
|
198
|
-
if (previous !== undefined &&
|
|
216
|
+
if (previous !== undefined &&
|
|
217
|
+
comparePriority(previous, this.currentDeclaredOrderPriority) <= 0) {
|
|
199
218
|
return;
|
|
200
219
|
}
|
|
201
220
|
shape.declaredOrder = declaredOrder;
|
|
@@ -798,12 +817,16 @@ function genChannels(yieldTs, retTs, nextTs, ctx) {
|
|
|
798
817
|
return null;
|
|
799
818
|
const retT = retTs === undefined || retTs.flags & UNITISH
|
|
800
819
|
? VOID
|
|
801
|
-
: retTs.flags & ANYISH
|
|
820
|
+
: retTs.flags & ANYISH
|
|
821
|
+
? DYN
|
|
822
|
+
: mapType(retTs, ctx);
|
|
802
823
|
if (!retT || (retT.kind !== "void" && isUnitType(retT)))
|
|
803
824
|
return null;
|
|
804
825
|
const nextT = nextTs === undefined || nextTs.flags & UNITISH
|
|
805
826
|
? UNDEFINED_T
|
|
806
|
-
: nextTs.flags & ANYISH
|
|
827
|
+
: nextTs.flags & ANYISH
|
|
828
|
+
? DYN
|
|
829
|
+
: mapType(nextTs, ctx);
|
|
807
830
|
if (!nextT || nextT.kind === "void" || nextT.kind === "nullT")
|
|
808
831
|
return null;
|
|
809
832
|
const dynMix = (yieldT.kind === "dyn" && retT.kind !== "dyn" && retT.kind !== "void") ||
|
|
@@ -875,7 +898,9 @@ function mapTypeInner(type, ctx) {
|
|
|
875
898
|
// TypeScript's intrinsic globalThis symbol has no declaration. A stored
|
|
876
899
|
// reference needs native object identity, including var's undefined state.
|
|
877
900
|
const intrinsic = type.getSymbol();
|
|
878
|
-
if (!ctx.dynamic &&
|
|
901
|
+
if (!ctx.dynamic &&
|
|
902
|
+
intrinsic?.name === "globalThis" &&
|
|
903
|
+
checker.declarationsOf(intrinsic).length === 0)
|
|
879
904
|
return DYN;
|
|
880
905
|
if (!ctx.dynamic) {
|
|
881
906
|
const moduleId = ctx.moduleNamespaceId?.(type) ?? null;
|
|
@@ -971,14 +996,16 @@ function mapTypeInner(type, ctx) {
|
|
|
971
996
|
}
|
|
972
997
|
return false;
|
|
973
998
|
};
|
|
974
|
-
if (parseArgsSym &&
|
|
999
|
+
if (parseArgsSym &&
|
|
1000
|
+
PARSE_ARGS_DYN_TYPES.has(parseArgsSym.name) &&
|
|
975
1001
|
checker.declarationsOf(parseArgsSym).some(belongs))
|
|
976
1002
|
return DYN;
|
|
977
1003
|
// ReturnType and instantiated conditional types can erase the alias.
|
|
978
1004
|
// Require every member to retain the util declaration provenance so
|
|
979
1005
|
// unrelated records with similar property names keep their own layout.
|
|
980
1006
|
const members = checker.getPropertiesOfType(widened);
|
|
981
|
-
if (members.length > 0 &&
|
|
1007
|
+
if (members.length > 0 &&
|
|
1008
|
+
members.every((member) => checker.declarationsOf(member).some(belongs)))
|
|
982
1009
|
return DYN;
|
|
983
1010
|
}
|
|
984
1011
|
// The lib's BOXED wrapper interfaces used as TYPES (`const n: Number =
|
|
@@ -1012,7 +1039,11 @@ function mapTypeInner(type, ctx) {
|
|
|
1012
1039
|
ctorSym.name === "NumberConstructor" ||
|
|
1013
1040
|
ctorSym.name === "BooleanConstructor") &&
|
|
1014
1041
|
checker.declarationsOf(ctorSym).some((d) => ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1015
|
-
return funcOf([STRING], ctorSym.name === "StringConstructor"
|
|
1042
|
+
return funcOf([STRING], ctorSym.name === "StringConstructor"
|
|
1043
|
+
? STRING
|
|
1044
|
+
: ctorSym.name === "NumberConstructor"
|
|
1045
|
+
? F64
|
|
1046
|
+
: BOOL);
|
|
1016
1047
|
}
|
|
1017
1048
|
}
|
|
1018
1049
|
// `symbol` and `unique symbol` (the type of `const k = Symbol(...)` —
|
|
@@ -1034,17 +1065,19 @@ function mapTypeInner(type, ctx) {
|
|
|
1034
1065
|
// Generic visitors can instantiate `T | undefined` as `void | undefined`.
|
|
1035
1066
|
// It has the same return convention as standalone void; value positions
|
|
1036
1067
|
// still substitute the unit-only slot through isUnitOnlyTsType below.
|
|
1037
|
-
if (widened.isUnionType() &&
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1068
|
+
if (widened.isUnionType() &&
|
|
1069
|
+
ts.constituentTypes(widened).every((part) => {
|
|
1070
|
+
if ((part.flags & (ts.TypeFlags.Void | ts.TypeFlags.Undefined)) !== 0)
|
|
1071
|
+
return true;
|
|
1072
|
+
// A forwarding generic call keeps its caller's symbolic T in the
|
|
1073
|
+
// resolved signature. Its current instantiation can still be void.
|
|
1074
|
+
if ((part.flags & ts.TypeFlags.TypeParameter) !== 0 &&
|
|
1075
|
+
resolveTypeParam?.(part)?.kind === "void") {
|
|
1076
|
+
contextResolutions++;
|
|
1077
|
+
return true;
|
|
1078
|
+
}
|
|
1079
|
+
return false;
|
|
1080
|
+
}))
|
|
1048
1081
|
return VOID;
|
|
1049
1082
|
// Standalone `null` (a `const x = null` binding, a `{ value: null }`
|
|
1050
1083
|
// field, a `(): null` return): the unit-only union — the value is always
|
|
@@ -1295,7 +1328,13 @@ function mapTypeInner(type, ctx) {
|
|
|
1295
1328
|
// no class identity of its own.
|
|
1296
1329
|
if (widened.isIntersectionType()) {
|
|
1297
1330
|
const HANDLE_KINDS = new Set([
|
|
1298
|
-
"netServer",
|
|
1331
|
+
"netServer",
|
|
1332
|
+
"netSocket",
|
|
1333
|
+
"httpReq",
|
|
1334
|
+
"httpRes",
|
|
1335
|
+
"httpClientReq",
|
|
1336
|
+
"dgramSocket",
|
|
1337
|
+
"childWriter",
|
|
1299
1338
|
// process.stdout's own type IS the refined intersection
|
|
1300
1339
|
// `WriteStream & { fd: 1 }` — the scalar stream kind rides the same
|
|
1301
1340
|
// refinement rule.
|
|
@@ -1376,7 +1415,8 @@ function mapTypeInner(type, ctx) {
|
|
|
1376
1415
|
// INSTANTIATION's class (`Box%0`), registered on demand — the Lowerer
|
|
1377
1416
|
// hook owns the instance table (monomorphization by flow).
|
|
1378
1417
|
if (classDecl.typeParameters) {
|
|
1379
|
-
const instance = ctx.genericClassInstance?.(classDecl, widened, (argument) => mapType(argument, ctx)) ??
|
|
1418
|
+
const instance = ctx.genericClassInstance?.(classDecl, widened, (argument) => mapType(argument, ctx)) ??
|
|
1419
|
+
null;
|
|
1380
1420
|
// Before the generic declaration's collection turn, the hook can only
|
|
1381
1421
|
// return its family shell; after collection the same checker type names
|
|
1382
1422
|
// a concrete registered instance. Never memoize either phase's answer.
|
|
@@ -1455,7 +1495,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1455
1495
|
// naming the offending half, as does the `new Map` lowering per site.
|
|
1456
1496
|
const psym = widened.getSymbol();
|
|
1457
1497
|
const isStdlibInterface = (name) => psym?.name === name &&
|
|
1458
|
-
checker
|
|
1498
|
+
checker
|
|
1499
|
+
.declarationsOf(psym)
|
|
1500
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()));
|
|
1459
1501
|
// The builtin Error classes: references to the lib's Error interfaces map to the runtime-provided class
|
|
1460
1502
|
// hierarchy (provenance, not the name — a user's own `class Error`
|
|
1461
1503
|
// resolved through the class-instance branch above, and a user
|
|
@@ -1481,7 +1523,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1481
1523
|
// representation. The node:module class's merged instance interface is
|
|
1482
1524
|
// included, while unrelated user interfaces named Module stay structural.
|
|
1483
1525
|
if ((psym?.name === "ScriptcModule" || psym?.name === "Module") &&
|
|
1484
|
-
checker
|
|
1526
|
+
checker
|
|
1527
|
+
.declarationsOf(psym)
|
|
1528
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1485
1529
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1486
1530
|
(psym.name === "ScriptcModule" ||
|
|
1487
1531
|
isDeclaredInAmbientNamespace(d, "NodeJS") ||
|
|
@@ -1496,7 +1540,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1496
1540
|
// NodeJS.EventEmitter interface (the structural surface net.Socket
|
|
1497
1541
|
// et al. extend) is the same runtime value. Provenance-checked.
|
|
1498
1542
|
if (psym?.name === "EventEmitter" &&
|
|
1499
|
-
checker
|
|
1543
|
+
checker
|
|
1544
|
+
.declarationsOf(psym)
|
|
1545
|
+
.some((d) => (ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) &&
|
|
1500
1546
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1501
1547
|
(isDeclaredInAmbientModule(d, "events") || isDeclaredInAmbientNamespace(d, "NodeJS")))) {
|
|
1502
1548
|
return { kind: "object", className: RUNTIME_EMITTER_CLASS };
|
|
@@ -1507,7 +1553,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1507
1553
|
// net.Server (@types/node also declares Interface in
|
|
1508
1554
|
// readline/promises — that one stays unmapped and fences).
|
|
1509
1555
|
if (psym?.name === "Interface" &&
|
|
1510
|
-
checker
|
|
1556
|
+
checker
|
|
1557
|
+
.declarationsOf(psym)
|
|
1558
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1511
1559
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1512
1560
|
isDeclaredInAmbientModule(d, "readline"))) {
|
|
1513
1561
|
return F64;
|
|
@@ -1519,7 +1567,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1519
1567
|
// plus the ambient module suffices for both the fallback declarations
|
|
1520
1568
|
// and @types/node's class Channel<StoreType, ContextType>.
|
|
1521
1569
|
if (psym?.name === "Channel" &&
|
|
1522
|
-
checker
|
|
1570
|
+
checker
|
|
1571
|
+
.declarationsOf(psym)
|
|
1572
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1523
1573
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1524
1574
|
isDeclaredInAmbientModule(d, "diagnostics_channel"))) {
|
|
1525
1575
|
return F64;
|
|
@@ -1528,7 +1578,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1528
1578
|
// the runtime's store id space (the Channel story — stores are
|
|
1529
1579
|
// process-lived; contexts ride the fiber machinery).
|
|
1530
1580
|
if (psym?.name === "AsyncLocalStorage" &&
|
|
1531
|
-
checker
|
|
1581
|
+
checker
|
|
1582
|
+
.declarationsOf(psym)
|
|
1583
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1532
1584
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1533
1585
|
isDeclaredInAmbientModule(d, "async_hooks"))) {
|
|
1534
1586
|
return F64;
|
|
@@ -1536,31 +1588,57 @@ function mapTypeInner(type, ctx) {
|
|
|
1536
1588
|
// diagnostics_channel.TracingChannel: the same f64-handle story over the
|
|
1537
1589
|
// runtime's tracing registry (five event channels per entry).
|
|
1538
1590
|
if (psym?.name === "TracingChannel" &&
|
|
1539
|
-
checker
|
|
1591
|
+
checker
|
|
1592
|
+
.declarationsOf(psym)
|
|
1593
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1540
1594
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1541
1595
|
isDeclaredInAmbientModule(d, "diagnostics_channel"))) {
|
|
1542
1596
|
return F64;
|
|
1543
1597
|
}
|
|
1544
1598
|
// Node names this result; the ambient WHATWG declaration uses a type literal.
|
|
1545
|
-
const encodeResult = psym &&
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1599
|
+
const encodeResult = psym &&
|
|
1600
|
+
checker.declarationsOf(psym).some((decl) => {
|
|
1601
|
+
if (!ctx.isStdlibFile(decl.getSourceFile()))
|
|
1602
|
+
return false;
|
|
1603
|
+
if (ts.isInterfaceDeclaration(decl) && decl.name.text === "EncodeIntoResult")
|
|
1604
|
+
return true;
|
|
1605
|
+
const parent = decl.parent;
|
|
1606
|
+
return (ts.isTypeLiteralNode(decl) &&
|
|
1607
|
+
parent?.kind === ts.SyntaxKind.MethodSignature &&
|
|
1608
|
+
parent.name &&
|
|
1609
|
+
ts.isIdentifier(parent.name) &&
|
|
1610
|
+
parent.name.text === "encodeInto" &&
|
|
1611
|
+
parent.parent &&
|
|
1612
|
+
ts.isInterfaceDeclaration(parent.parent) &&
|
|
1613
|
+
parent.parent.name.text === "TextEncoder");
|
|
1614
|
+
});
|
|
1555
1615
|
if (encodeResult)
|
|
1556
|
-
return {
|
|
1616
|
+
return {
|
|
1617
|
+
kind: "record",
|
|
1618
|
+
shapeId: ctx.shapes.intern([
|
|
1619
|
+
{ name: "read", type: F64 },
|
|
1620
|
+
{ name: "written", type: F64 },
|
|
1621
|
+
]),
|
|
1622
|
+
};
|
|
1557
1623
|
// WHATWG codec instances have ordinary reference identity and ownership.
|
|
1558
1624
|
// Their private encoding slot is omitted from enumeration and JSON.
|
|
1559
1625
|
if ((psym?.name === "TextEncoder" || psym?.name === "TextDecoder") &&
|
|
1560
|
-
checker
|
|
1626
|
+
checker
|
|
1627
|
+
.declarationsOf(psym)
|
|
1628
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1629
|
+
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1561
1630
|
return {
|
|
1562
1631
|
kind: "record",
|
|
1563
|
-
shapeId: ctx.shapes.intern([
|
|
1632
|
+
shapeId: ctx.shapes.intern([
|
|
1633
|
+
{ name: `%${psym.name}`, type: F64 },
|
|
1634
|
+
...(psym.name === "TextDecoder"
|
|
1635
|
+
? [
|
|
1636
|
+
{ name: "%fatal", type: BOOL },
|
|
1637
|
+
{ name: "%ignoreBOM", type: BOOL },
|
|
1638
|
+
{ name: "%state", type: DYN },
|
|
1639
|
+
]
|
|
1640
|
+
: []),
|
|
1641
|
+
], false, undefined, []),
|
|
1564
1642
|
};
|
|
1565
1643
|
}
|
|
1566
1644
|
// string_decoder.StringDecoder: the decoder value is a two-field record
|
|
@@ -1571,7 +1649,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1571
1649
|
// special-cased in lowerNew / lowerStringDecoderMethodCall, so the
|
|
1572
1650
|
// record shape never surfaces.
|
|
1573
1651
|
if (psym?.name === "StringDecoder" &&
|
|
1574
|
-
checker
|
|
1652
|
+
checker
|
|
1653
|
+
.declarationsOf(psym)
|
|
1654
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1575
1655
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1576
1656
|
return {
|
|
1577
1657
|
kind: "record",
|
|
@@ -1608,7 +1688,11 @@ function mapTypeInner(type, ctx) {
|
|
|
1608
1688
|
{ name: "promise", type: promT },
|
|
1609
1689
|
{
|
|
1610
1690
|
name: "reject",
|
|
1611
|
-
type: {
|
|
1691
|
+
type: {
|
|
1692
|
+
kind: "func",
|
|
1693
|
+
params: [{ kind: "object", className: "%Error" }],
|
|
1694
|
+
ret: VOID,
|
|
1695
|
+
},
|
|
1612
1696
|
},
|
|
1613
1697
|
{
|
|
1614
1698
|
name: "resolve",
|
|
@@ -1646,14 +1730,11 @@ function mapTypeInner(type, ctx) {
|
|
|
1646
1730
|
const alias = widened.getAliasSymbol();
|
|
1647
1731
|
if (!ctx.dynamic &&
|
|
1648
1732
|
alias?.name === "ReadableStreamReadResult" &&
|
|
1649
|
-
checker
|
|
1650
|
-
|
|
1733
|
+
checker
|
|
1734
|
+
.declarationsOf(alias)
|
|
1735
|
+
.some((d) => ts.isTypeAliasDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1651
1736
|
const elemTs = widened.getAliasTypeArguments()?.[0];
|
|
1652
|
-
const elem = elemTs && elemTs.flags & ts.TypeFlags.Any
|
|
1653
|
-
? DYN
|
|
1654
|
-
: elemTs
|
|
1655
|
-
? mapType(elemTs, ctx)
|
|
1656
|
-
: null;
|
|
1737
|
+
const elem = elemTs && elemTs.flags & ts.TypeFlags.Any ? DYN : elemTs ? mapType(elemTs, ctx) : null;
|
|
1657
1738
|
if (!elem)
|
|
1658
1739
|
return null;
|
|
1659
1740
|
return genResultRecord(elem, VOID, ctx.shapes, ctx.unions);
|
|
@@ -1663,14 +1744,11 @@ function mapTypeInner(type, ctx) {
|
|
|
1663
1744
|
psym &&
|
|
1664
1745
|
(psym.name === "ReadableStreamReadValueResult" ||
|
|
1665
1746
|
psym.name === "ReadableStreamReadDoneResult") &&
|
|
1666
|
-
checker
|
|
1667
|
-
|
|
1747
|
+
checker
|
|
1748
|
+
.declarationsOf(psym)
|
|
1749
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1668
1750
|
const elemTs = checker.getTypeArguments(widened)[0];
|
|
1669
|
-
const elem = elemTs && elemTs.flags & ts.TypeFlags.Any
|
|
1670
|
-
? DYN
|
|
1671
|
-
: elemTs
|
|
1672
|
-
? mapType(elemTs, ctx)
|
|
1673
|
-
: null;
|
|
1751
|
+
const elem = elemTs && elemTs.flags & ts.TypeFlags.Any ? DYN : elemTs ? mapType(elemTs, ctx) : null;
|
|
1674
1752
|
if (!elem)
|
|
1675
1753
|
return null;
|
|
1676
1754
|
return genResultRecord(elem, VOID, ctx.shapes, ctx.unions);
|
|
@@ -1678,8 +1756,12 @@ function mapTypeInner(type, ctx) {
|
|
|
1678
1756
|
if (psym &&
|
|
1679
1757
|
ISLAND_AMBIENT_TYPES.includes(psym.name) &&
|
|
1680
1758
|
!(psym.name === "ReadableStream" &&
|
|
1681
|
-
checker
|
|
1682
|
-
|
|
1759
|
+
checker
|
|
1760
|
+
.declarationsOf(psym)
|
|
1761
|
+
.some((d) => ts.isInterfaceDeclaration(d) && isDeclaredInAmbientNamespace(d, "NodeJS"))) &&
|
|
1762
|
+
checker
|
|
1763
|
+
.declarationsOf(psym)
|
|
1764
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1683
1765
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1684
1766
|
return ctx.dynamic ? JSVAL : DYN;
|
|
1685
1767
|
}
|
|
@@ -1692,7 +1774,8 @@ function mapTypeInner(type, ctx) {
|
|
|
1692
1774
|
if (args.length !== 2)
|
|
1693
1775
|
return null;
|
|
1694
1776
|
const key = !ctx.dynamic && (args[0].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[0], ctx);
|
|
1695
|
-
if (!key ||
|
|
1777
|
+
if (!key ||
|
|
1778
|
+
!isSupportedMapKey(key, key.kind === "union" ? ctx.unions.get(key.unionId)?.arms : undefined))
|
|
1696
1779
|
return null;
|
|
1697
1780
|
const value = !ctx.dynamic && (args[1].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[1], ctx);
|
|
1698
1781
|
if (!value || !isSupportedMapValue(value))
|
|
@@ -1711,7 +1794,8 @@ function mapTypeInner(type, ctx) {
|
|
|
1711
1794
|
if (args.length !== 1)
|
|
1712
1795
|
return null;
|
|
1713
1796
|
const elem = !ctx.dynamic && (args[0].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[0], ctx);
|
|
1714
|
-
if (!elem ||
|
|
1797
|
+
if (!elem ||
|
|
1798
|
+
!isSupportedSetElem(elem, elem.kind === "union" ? ctx.unions.get(elem.unionId)?.arms : undefined))
|
|
1715
1799
|
return null;
|
|
1716
1800
|
return setOf(elem);
|
|
1717
1801
|
}
|
|
@@ -1731,7 +1815,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1731
1815
|
if (isStdlibInterface("RegExp")) {
|
|
1732
1816
|
return { kind: "regex" };
|
|
1733
1817
|
}
|
|
1734
|
-
if (isStdlibInterface("Segmenter") ||
|
|
1818
|
+
if (isStdlibInterface("Segmenter") ||
|
|
1819
|
+
isStdlibInterface("Segments") ||
|
|
1820
|
+
isStdlibInterface("SegmentData"))
|
|
1735
1821
|
return DYN;
|
|
1736
1822
|
// Typed arrays: references to the lib's Uint8Array/Uint32Array/
|
|
1737
1823
|
// Float32Array/Float64Array interfaces (provenance, not names). The es2022+ lib
|
|
@@ -1771,7 +1857,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1771
1857
|
// space, so clearTimeout of an Immediate no-ops like Node.
|
|
1772
1858
|
if (isStdlibInterface("Immediate"))
|
|
1773
1859
|
return F64;
|
|
1774
|
-
if (isStdlibInterface("ArrayBuffer") ||
|
|
1860
|
+
if (isStdlibInterface("ArrayBuffer") ||
|
|
1861
|
+
isStdlibInterface("PropertyDescriptor") ||
|
|
1862
|
+
isStdlibInterface("ProcessVersions"))
|
|
1775
1863
|
return DYN;
|
|
1776
1864
|
if (Object.values(BYTES_ELEMENT_NAME).some((name) => isStdlibInterface(`${name}Constructor`)))
|
|
1777
1865
|
return DYN;
|
|
@@ -1808,7 +1896,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1808
1896
|
// fallback and by @types/node (whose NonSharedBuffer alias resolves to
|
|
1809
1897
|
// the same symbol); provenance-checked like URL.
|
|
1810
1898
|
if (psym?.name === "Buffer" &&
|
|
1811
|
-
checker
|
|
1899
|
+
checker
|
|
1900
|
+
.declarationsOf(psym)
|
|
1901
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1812
1902
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1813
1903
|
return bytesOf("u8");
|
|
1814
1904
|
}
|
|
@@ -1818,7 +1908,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1818
1908
|
// instance type). Provenance, not the name: a user's own URL maps as a
|
|
1819
1909
|
// record/class like any other.
|
|
1820
1910
|
if (psym?.name === "URL" &&
|
|
1821
|
-
checker
|
|
1911
|
+
checker
|
|
1912
|
+
.declarationsOf(psym)
|
|
1913
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1822
1914
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1823
1915
|
return { kind: "url" };
|
|
1824
1916
|
}
|
|
@@ -1826,28 +1918,39 @@ function mapTypeInner(type, ctx) {
|
|
|
1826
1918
|
// interface by the shipped fallback and by @types/node (plus `class
|
|
1827
1919
|
// URLSearchParams` in the "url" module). Provenance-checked like URL.
|
|
1828
1920
|
if (psym?.name === "URLSearchParams" &&
|
|
1829
|
-
checker
|
|
1921
|
+
checker
|
|
1922
|
+
.declarationsOf(psym)
|
|
1923
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1830
1924
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1831
1925
|
return { kind: "searchParams" };
|
|
1832
1926
|
}
|
|
1833
1927
|
// fs.Stats: @types/node's `class Stats` (module "fs") or the fallback
|
|
1834
1928
|
// declarations' interface. Provenance-checked like URL.
|
|
1835
1929
|
if (psym?.name === "Stats" &&
|
|
1836
|
-
checker
|
|
1930
|
+
checker
|
|
1931
|
+
.declarationsOf(psym)
|
|
1932
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1837
1933
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1838
1934
|
return { kind: "stats" };
|
|
1839
1935
|
}
|
|
1840
1936
|
// Capacity snapshots and options keep their live object representation
|
|
1841
1937
|
// across numeric/BigInt overloads, runtime options, and callbacks.
|
|
1842
|
-
if ((psym?.name === "StatsFs" ||
|
|
1843
|
-
|
|
1844
|
-
|
|
1938
|
+
if ((psym?.name === "StatsFs" ||
|
|
1939
|
+
psym?.name === "BigIntStatsFs" ||
|
|
1940
|
+
psym?.name === "StatFsOptions") &&
|
|
1941
|
+
checker
|
|
1942
|
+
.declarationsOf(psym)
|
|
1943
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1944
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1945
|
+
isDeclaredInAmbientModule(d, "fs")))
|
|
1845
1946
|
return DYN;
|
|
1846
1947
|
// fs/promises.FileHandle: an owned descriptor object. Module provenance
|
|
1847
1948
|
// distinguishes it from user interfaces with the same name; both the
|
|
1848
1949
|
// fallback and @types/node declare it in "fs/promises".
|
|
1849
1950
|
if (psym?.name === "FileHandle" &&
|
|
1850
|
-
checker
|
|
1951
|
+
checker
|
|
1952
|
+
.declarationsOf(psym)
|
|
1953
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
1851
1954
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1852
1955
|
isDeclaredInAmbientModule(d, "fs/promises"))) {
|
|
1853
1956
|
return { kind: "fileHandle" };
|
|
@@ -1857,7 +1960,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1857
1960
|
// reads work either way) or the fallback declarations' plain interface.
|
|
1858
1961
|
// Provenance-checked like Stats.
|
|
1859
1962
|
if (psym?.name === "SpawnSyncReturns" &&
|
|
1860
|
-
checker
|
|
1963
|
+
checker
|
|
1964
|
+
.declarationsOf(psym)
|
|
1965
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1861
1966
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1862
1967
|
return { kind: "spawnRes" };
|
|
1863
1968
|
}
|
|
@@ -1868,7 +1973,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1868
1973
|
(psym.name === "ChildProcess" ||
|
|
1869
1974
|
psym.name === "ChildProcessWithoutNullStreams" ||
|
|
1870
1975
|
psym.name === "ChildProcessByStdio") &&
|
|
1871
|
-
checker
|
|
1976
|
+
checker
|
|
1977
|
+
.declarationsOf(psym)
|
|
1978
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1872
1979
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1873
1980
|
isDeclaredInAmbientModule(d, "child_process"))) {
|
|
1874
1981
|
return { kind: "child" };
|
|
@@ -1902,20 +2009,29 @@ function mapTypeInner(type, ctx) {
|
|
|
1902
2009
|
// @types/node declares `interface SecureContext` inside `declare module
|
|
1903
2010
|
// "tls"`, and the shipped fallback mirrors it.
|
|
1904
2011
|
if (psym?.name === "SecureContext" &&
|
|
1905
|
-
checker
|
|
2012
|
+
checker
|
|
2013
|
+
.declarationsOf(psym)
|
|
2014
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1906
2015
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1907
2016
|
isDeclaredInAmbientModule(d, "tls"))) {
|
|
1908
2017
|
return { kind: "secureCtx" };
|
|
1909
2018
|
}
|
|
1910
2019
|
// Scrypt's runtime options retain property accessors and aliases. Use
|
|
1911
2020
|
// checked values so presence probes and repeated getter reads match Node.
|
|
1912
|
-
if (psym?.name === "ScryptOptions" &&
|
|
2021
|
+
if (psym?.name === "ScryptOptions" &&
|
|
2022
|
+
checker
|
|
2023
|
+
.declarationsOf(psym)
|
|
2024
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
2025
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2026
|
+
isDeclaredInAmbientModule(d, "crypto")))
|
|
1913
2027
|
return DYN;
|
|
1914
2028
|
// crypto.Hash / crypto.Hmac: native incremental digest handles. Keep
|
|
1915
2029
|
// provenance module-qualified so user classes with these common names
|
|
1916
2030
|
// retain their ordinary structural/class representation.
|
|
1917
2031
|
if ((psym?.name === "Hash" || psym?.name === "Hmac") &&
|
|
1918
|
-
checker
|
|
2032
|
+
checker
|
|
2033
|
+
.declarationsOf(psym)
|
|
2034
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1919
2035
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1920
2036
|
isDeclaredInAmbientModule(d, "crypto"))) {
|
|
1921
2037
|
return psym.name === "Hash" ? CRYPTOHASH_T : CRYPTOHMAC_T;
|
|
@@ -1925,7 +2041,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1925
2041
|
// EventEmitter` inside `declare module "fs"`, and the shipped fallback
|
|
1926
2042
|
// mirrors it.
|
|
1927
2043
|
if (psym?.name === "FSWatcher" &&
|
|
1928
|
-
checker
|
|
2044
|
+
checker
|
|
2045
|
+
.declarationsOf(psym)
|
|
2046
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1929
2047
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1930
2048
|
isDeclaredInAmbientModule(d, "fs"))) {
|
|
1931
2049
|
return { kind: "fsWatcher" };
|
|
@@ -1948,11 +2066,15 @@ function mapTypeInner(type, ctx) {
|
|
|
1948
2066
|
// prefixStream's `output` param). The representation is the raw fd
|
|
1949
2067
|
// scalar; the lowered surface is write(string).
|
|
1950
2068
|
if ((psym?.name === "WriteStream" &&
|
|
1951
|
-
checker
|
|
2069
|
+
checker
|
|
2070
|
+
.declarationsOf(psym)
|
|
2071
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1952
2072
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1953
2073
|
isDeclaredInAmbientModule(d, "tty"))) ||
|
|
1954
2074
|
(psym?.name === "WritableStream" &&
|
|
1955
|
-
checker
|
|
2075
|
+
checker
|
|
2076
|
+
.declarationsOf(psym)
|
|
2077
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
1956
2078
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1957
2079
|
isDeclaredInAmbientNamespace(d, "NodeJS")))) {
|
|
1958
2080
|
return PROCSTREAM_T;
|
|
@@ -1962,11 +2084,15 @@ function mapTypeInner(type, ctx) {
|
|
|
1962
2084
|
// stream.Writable. As with stream.Readable below, unsupported producers
|
|
1963
2085
|
// of the broad @types class fence where they are constructed.
|
|
1964
2086
|
if ((psym?.name === "ChildStdin" &&
|
|
1965
|
-
checker
|
|
2087
|
+
checker
|
|
2088
|
+
.declarationsOf(psym)
|
|
2089
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
1966
2090
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1967
2091
|
isDeclaredInAmbientModule(d, "child_process"))) ||
|
|
1968
2092
|
(psym?.name === "Writable" &&
|
|
1969
|
-
checker
|
|
2093
|
+
checker
|
|
2094
|
+
.declarationsOf(psym)
|
|
2095
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1970
2096
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1971
2097
|
isNodeTypesPath(d.getSourceFile().fileName) &&
|
|
1972
2098
|
isDeclaredInAmbientModule(d, "stream")))) {
|
|
@@ -1981,7 +2107,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1981
2107
|
// branch below), so the two never collide.
|
|
1982
2108
|
for (const [irName, rec] of RUNTIME_STREAM_CLASSES) {
|
|
1983
2109
|
if (psym?.name === rec.lib &&
|
|
1984
|
-
checker
|
|
2110
|
+
checker
|
|
2111
|
+
.declarationsOf(psym)
|
|
2112
|
+
.some((d) => ts.isClassDeclaration(d) &&
|
|
1985
2113
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1986
2114
|
!isNodeTypesPath(d.getSourceFile().fileName) &&
|
|
1987
2115
|
isDeclaredInAmbientModule(d, "stream"))) {
|
|
@@ -1989,11 +2117,15 @@ function mapTypeInner(type, ctx) {
|
|
|
1989
2117
|
}
|
|
1990
2118
|
}
|
|
1991
2119
|
if ((psym?.name === "Readable" &&
|
|
1992
|
-
checker
|
|
2120
|
+
checker
|
|
2121
|
+
.declarationsOf(psym)
|
|
2122
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1993
2123
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1994
2124
|
isDeclaredInAmbientModule(d, "stream"))) ||
|
|
1995
2125
|
(psym?.name === "ReadableStream" &&
|
|
1996
|
-
checker
|
|
2126
|
+
checker
|
|
2127
|
+
.declarationsOf(psym)
|
|
2128
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
1997
2129
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1998
2130
|
isDeclaredInAmbientNamespace(d, "NodeJS")))) {
|
|
1999
2131
|
return { kind: "childStream" };
|
|
@@ -2003,7 +2135,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2003
2135
|
// EventEmitter` and the fallback declarations' interface both live
|
|
2004
2136
|
// inside `declare module "dgram"`.
|
|
2005
2137
|
if (psym?.name === "Socket" &&
|
|
2006
|
-
checker
|
|
2138
|
+
checker
|
|
2139
|
+
.declarationsOf(psym)
|
|
2140
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2007
2141
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2008
2142
|
isDeclaredInAmbientModule(d, "dgram"))) {
|
|
2009
2143
|
return { kind: "dgramSocket" };
|
|
@@ -2013,7 +2147,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2013
2147
|
// declarations' interface both live inside `declare module "node:test"`
|
|
2014
2148
|
// (isDeclaredInAmbientModule answers for both spellings).
|
|
2015
2149
|
if (psym?.name === "TestContext" &&
|
|
2016
|
-
checker
|
|
2150
|
+
checker
|
|
2151
|
+
.declarationsOf(psym)
|
|
2152
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2017
2153
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2018
2154
|
isDeclaredInAmbientModule(d, "test"))) {
|
|
2019
2155
|
return { kind: "testCtx" };
|
|
@@ -2024,7 +2160,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2024
2160
|
// above; the optional errno/code/path/syscall extras fence per member
|
|
2025
2161
|
// (the .stack stance). Provenance-checked like the rest.
|
|
2026
2162
|
if (psym?.name === "ErrnoException" &&
|
|
2027
|
-
checker
|
|
2163
|
+
checker
|
|
2164
|
+
.declarationsOf(psym)
|
|
2165
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2028
2166
|
return { kind: "object", className: "%Error" };
|
|
2029
2167
|
}
|
|
2030
2168
|
// http.Agent / https.Agent — the Agent VALUE is a checked-dynamic
|
|
@@ -2034,7 +2172,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2034
2172
|
// of fencing at the declaration. Module-checked like the rest (https'
|
|
2035
2173
|
// Agent extends http's; both live in their ambient modules).
|
|
2036
2174
|
if (psym?.name === "Agent" &&
|
|
2037
|
-
checker
|
|
2175
|
+
checker
|
|
2176
|
+
.declarationsOf(psym)
|
|
2177
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2038
2178
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2039
2179
|
(isDeclaredInAmbientModule(d, "http") || isDeclaredInAmbientModule(d, "https")))) {
|
|
2040
2180
|
return { kind: "dyn" };
|
|
@@ -2043,7 +2183,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2043
2183
|
// net.Server (the names repeat nowhere today, but provenance stays the
|
|
2044
2184
|
// rule).
|
|
2045
2185
|
if ((psym?.name === "IncomingMessage" || psym?.name === "ServerResponse") &&
|
|
2046
|
-
checker
|
|
2186
|
+
checker
|
|
2187
|
+
.declarationsOf(psym)
|
|
2188
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2047
2189
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2048
2190
|
isDeclaredInAmbientModule(d, "http"))) {
|
|
2049
2191
|
return psym.name === "IncomingMessage" ? { kind: "httpReq" } : { kind: "httpRes" };
|
|
@@ -2059,7 +2201,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2059
2201
|
if ((psym?.name === "Http2SecureServer" ||
|
|
2060
2202
|
psym?.name === "Http2ServerRequest" ||
|
|
2061
2203
|
psym?.name === "Http2ServerResponse") &&
|
|
2062
|
-
checker
|
|
2204
|
+
checker
|
|
2205
|
+
.declarationsOf(psym)
|
|
2206
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2063
2207
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2064
2208
|
isDeclaredInAmbientModule(d, "http2"))) {
|
|
2065
2209
|
return psym.name === "Http2SecureServer"
|
|
@@ -2072,10 +2216,15 @@ function mapTypeInner(type, ctx) {
|
|
|
2072
2216
|
// like the secure one; sessions and streams are first-class handle
|
|
2073
2217
|
// kinds (client and server flavors share a kind — the runtime handle
|
|
2074
2218
|
// carries the role). Module-checked like the rest.
|
|
2075
|
-
if ((psym?.name === "Http2Server" ||
|
|
2076
|
-
psym?.name === "
|
|
2077
|
-
psym?.name === "
|
|
2078
|
-
|
|
2219
|
+
if ((psym?.name === "Http2Server" ||
|
|
2220
|
+
psym?.name === "Http2Session" ||
|
|
2221
|
+
psym?.name === "ClientHttp2Session" ||
|
|
2222
|
+
psym?.name === "ServerHttp2Session" ||
|
|
2223
|
+
psym?.name === "ClientHttp2Stream" ||
|
|
2224
|
+
psym?.name === "ServerHttp2Stream") &&
|
|
2225
|
+
checker
|
|
2226
|
+
.declarationsOf(psym)
|
|
2227
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2079
2228
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2080
2229
|
isDeclaredInAmbientModule(d, "http2"))) {
|
|
2081
2230
|
return psym.name === "Http2Server"
|
|
@@ -2087,7 +2236,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2087
2236
|
// http.ClientRequest (http.request/http.get results) — module-checked
|
|
2088
2237
|
// like IncomingMessage.
|
|
2089
2238
|
if (psym?.name === "ClientRequest" &&
|
|
2090
|
-
checker
|
|
2239
|
+
checker
|
|
2240
|
+
.declarationsOf(psym)
|
|
2241
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2091
2242
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2092
2243
|
isDeclaredInAmbientModule(d, "http"))) {
|
|
2093
2244
|
return { kind: "httpClientReq" };
|
|
@@ -2101,7 +2252,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2101
2252
|
// declarations' anonymous env type takes the pureIndexShape path below
|
|
2102
2253
|
// and interns the SAME shape.
|
|
2103
2254
|
if (psym?.name === "ProcessEnv" &&
|
|
2104
|
-
checker
|
|
2255
|
+
checker
|
|
2256
|
+
.declarationsOf(psym)
|
|
2257
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2105
2258
|
const value = withUndefinedArm(STRING, ctx.unions);
|
|
2106
2259
|
if (!value)
|
|
2107
2260
|
return null;
|
|
@@ -2154,7 +2307,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2154
2307
|
// argument — fenced at the call).
|
|
2155
2308
|
// Mixed dyn/concrete value channels share checked storage, so either
|
|
2156
2309
|
// branch of the result record has the same representation.
|
|
2157
|
-
if (isStdlibInterface("Generator") ||
|
|
2310
|
+
if (isStdlibInterface("Generator") ||
|
|
2311
|
+
isStdlibInterface("AsyncGenerator") ||
|
|
2312
|
+
isStdlibInterface("IterableIterator")) {
|
|
2158
2313
|
const args = checker.getTypeArguments(widened);
|
|
2159
2314
|
const channels = genChannels(args[0], args[1], args[2], ctx);
|
|
2160
2315
|
if (!channels)
|
|
@@ -2176,7 +2331,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2176
2331
|
{
|
|
2177
2332
|
const alias = widened.getAliasSymbol();
|
|
2178
2333
|
if (alias?.name === "IteratorResult" &&
|
|
2179
|
-
checker
|
|
2334
|
+
checker
|
|
2335
|
+
.declarationsOf(alias)
|
|
2336
|
+
.some((d) => ts.isTypeAliasDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2180
2337
|
const targs = widened.getAliasTypeArguments() ?? [];
|
|
2181
2338
|
const channels = genChannels(targs[0], targs[1], undefined, ctx);
|
|
2182
2339
|
if (!channels)
|
|
@@ -2216,7 +2373,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2216
2373
|
const optStr = withUndefinedArm(STRING, ctx.unions);
|
|
2217
2374
|
const optNum = withUndefinedArm(F64, ctx.unions);
|
|
2218
2375
|
const optBool = withUndefinedArm(BOOL, ctx.unions);
|
|
2219
|
-
const stdioArms = [arrayOf(STRING), STRING, UNDEFINED_T].sort((a, b) =>
|
|
2376
|
+
const stdioArms = [arrayOf(STRING), STRING, UNDEFINED_T].sort((a, b) => typeKey(a) < typeKey(b) ? -1 : 1);
|
|
2220
2377
|
const stdio = { kind: "union", unionId: ctx.unions.intern(stdioArms) };
|
|
2221
2378
|
if (!optStr || !optNum || !optBool)
|
|
2222
2379
|
return null;
|
|
@@ -2245,8 +2402,14 @@ function mapTypeInner(type, ctx) {
|
|
|
2245
2402
|
}
|
|
2246
2403
|
// Filesystem options are data records. Keep their declared optional fields
|
|
2247
2404
|
// instead of allowing arbitrary standard-library interfaces into records.
|
|
2248
|
-
if ((psym?.name === "FileReadOptions" ||
|
|
2249
|
-
|
|
2405
|
+
if ((psym?.name === "FileReadOptions" ||
|
|
2406
|
+
psym?.name === "ReadOptions" ||
|
|
2407
|
+
psym?.name === "ReadOptionsWithBuffer" ||
|
|
2408
|
+
psym?.name === "WriteOptions") &&
|
|
2409
|
+
checker
|
|
2410
|
+
.declarationsOf(psym)
|
|
2411
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
2412
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2250
2413
|
(isDeclaredInAmbientModule(d, "fs/promises") || isDeclaredInAmbientModule(d, "fs")))) {
|
|
2251
2414
|
const fields = [];
|
|
2252
2415
|
for (const property of checker.getPropertiesOfType(widened)) {
|
|
@@ -2258,31 +2421,48 @@ function mapTypeInner(type, ctx) {
|
|
|
2258
2421
|
fields.push({ name: property.name, type });
|
|
2259
2422
|
}
|
|
2260
2423
|
const order = fields.map((field) => field.name);
|
|
2261
|
-
fields.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
2424
|
+
fields.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
2262
2425
|
return { kind: "record", shapeId: ctx.shapes.intern(fields, false, undefined, order) };
|
|
2263
2426
|
}
|
|
2264
2427
|
// fs/promises FileReadResult<T> / FileWriteResult<T>: the two-field
|
|
2265
2428
|
// null-prototype objects returned by FileHandle.read/write. The native
|
|
2266
2429
|
// record does not model the prototype (unobservable through the lowered
|
|
2267
2430
|
// surface); it preserves the caller buffer/string by reference.
|
|
2268
|
-
if ((psym?.name === "FileReadResult" ||
|
|
2269
|
-
|
|
2431
|
+
if ((psym?.name === "FileReadResult" ||
|
|
2432
|
+
psym?.name === "FileWriteResult" ||
|
|
2433
|
+
psym?.name === "FileReadvResult" ||
|
|
2434
|
+
psym?.name === "FileWritevResult" ||
|
|
2435
|
+
psym?.name === "ReadVResult" ||
|
|
2436
|
+
psym?.name === "WriteVResult") &&
|
|
2437
|
+
checker
|
|
2438
|
+
.declarationsOf(psym)
|
|
2439
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
2270
2440
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2271
2441
|
(isDeclaredInAmbientModule(d, "fs/promises") ||
|
|
2272
|
-
((psym.name === "ReadVResult" || psym.name === "WriteVResult") &&
|
|
2442
|
+
((psym.name === "ReadVResult" || psym.name === "WriteVResult") &&
|
|
2443
|
+
isDeclaredInAmbientModule(d, "fs"))))) {
|
|
2273
2444
|
const args = checker.getTypeArguments(widened);
|
|
2274
2445
|
if (args.length !== 1)
|
|
2275
2446
|
return null;
|
|
2276
|
-
const vector = psym.name === "FileReadvResult" ||
|
|
2277
|
-
|
|
2447
|
+
const vector = psym.name === "FileReadvResult" ||
|
|
2448
|
+
psym.name === "FileWritevResult" ||
|
|
2449
|
+
psym.name === "ReadVResult" ||
|
|
2450
|
+
psym.name === "WriteVResult";
|
|
2451
|
+
const emptyVector = vector &&
|
|
2452
|
+
checker.isArrayType(args[0]) &&
|
|
2278
2453
|
(checker.getTypeArguments(args[0])[0].flags & ts.TypeFlags.Never) !== 0;
|
|
2279
2454
|
const payload = emptyVector ? arrayOf(bytesOf("u8")) : mapType(args[0], ctx);
|
|
2280
|
-
if (!payload ||
|
|
2281
|
-
|
|
2282
|
-
|
|
2455
|
+
if (!payload ||
|
|
2456
|
+
(vector
|
|
2457
|
+
? !(payload.kind === "array" && payload.elem.kind === "bytes" && payload.elem.elem === "u8")
|
|
2458
|
+
: !(payload.kind === "string" || (payload.kind === "bytes" && payload.elem === "u8")))) {
|
|
2283
2459
|
return null;
|
|
2284
2460
|
}
|
|
2285
|
-
const count = psym.name === "FileReadResult" ||
|
|
2461
|
+
const count = psym.name === "FileReadResult" ||
|
|
2462
|
+
psym.name === "FileReadvResult" ||
|
|
2463
|
+
psym.name === "ReadVResult"
|
|
2464
|
+
? "bytesRead"
|
|
2465
|
+
: "bytesWritten";
|
|
2286
2466
|
const payloadName = vector ? "buffers" : "buffer";
|
|
2287
2467
|
return {
|
|
2288
2468
|
kind: "record",
|
|
@@ -2306,7 +2486,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2306
2486
|
// declares it concrete (an interface; @types/node uses a class — both
|
|
2307
2487
|
// provenance-checked, the Buffer/URL pattern).
|
|
2308
2488
|
if (psym?.name === "Dirent" &&
|
|
2309
|
-
checker
|
|
2489
|
+
checker
|
|
2490
|
+
.declarationsOf(psym)
|
|
2491
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2310
2492
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2311
2493
|
const args = checker.getTypeArguments(widened);
|
|
2312
2494
|
if (args.length > 1)
|
|
@@ -2364,7 +2546,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2364
2546
|
// JSON.stringify of one shows the three fields where Node's
|
|
2365
2547
|
// internal-slot object shows {} — the Dirent %dtype edge's cousin.
|
|
2366
2548
|
if (psym?.name === "X509Certificate" &&
|
|
2367
|
-
checker
|
|
2549
|
+
checker
|
|
2550
|
+
.declarationsOf(psym)
|
|
2551
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2368
2552
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2369
2553
|
isDeclaredInAmbientModule(d, "crypto"))) {
|
|
2370
2554
|
return {
|
|
@@ -2391,10 +2575,21 @@ function mapTypeInner(type, ctx) {
|
|
|
2391
2575
|
}
|
|
2392
2576
|
if (isStdlibInterface("ResourceUsage")) {
|
|
2393
2577
|
const names = [
|
|
2394
|
-
"userCPUTime",
|
|
2395
|
-
"
|
|
2396
|
-
"
|
|
2397
|
-
"
|
|
2578
|
+
"userCPUTime",
|
|
2579
|
+
"systemCPUTime",
|
|
2580
|
+
"maxRSS",
|
|
2581
|
+
"sharedMemorySize",
|
|
2582
|
+
"unsharedDataSize",
|
|
2583
|
+
"unsharedStackSize",
|
|
2584
|
+
"minorPageFault",
|
|
2585
|
+
"majorPageFault",
|
|
2586
|
+
"swappedOut",
|
|
2587
|
+
"fsRead",
|
|
2588
|
+
"fsWrite",
|
|
2589
|
+
"ipcSent",
|
|
2590
|
+
"ipcReceived",
|
|
2591
|
+
"signalsCount",
|
|
2592
|
+
"voluntaryContextSwitches",
|
|
2398
2593
|
"involuntaryContextSwitches",
|
|
2399
2594
|
];
|
|
2400
2595
|
return {
|
|
@@ -2421,7 +2616,8 @@ function mapTypeInner(type, ctx) {
|
|
|
2421
2616
|
// plain number. Declared order is Node's runtime insertion order
|
|
2422
2617
|
// (lib/os.js builds address..cidr then appends scopeid), so Object.keys
|
|
2423
2618
|
// over a row answers exactly Node.
|
|
2424
|
-
if (isStdlibInterface("NetworkInterfaceInfoIPv4") ||
|
|
2619
|
+
if (isStdlibInterface("NetworkInterfaceInfoIPv4") ||
|
|
2620
|
+
isStdlibInterface("NetworkInterfaceInfoIPv6")) {
|
|
2425
2621
|
const v6 = psym.name === "NetworkInterfaceInfoIPv6";
|
|
2426
2622
|
const cidrArms = [NULL_T, STRING].sort((a, b) => (typeKey(a) < typeKey(b) ? -1 : 1));
|
|
2427
2623
|
const cidr = { kind: "union", unionId: ctx.unions.intern(cidrArms) };
|
|
@@ -2440,12 +2636,17 @@ function mapTypeInner(type, ctx) {
|
|
|
2440
2636
|
return {
|
|
2441
2637
|
kind: "record",
|
|
2442
2638
|
shapeId: ctx.shapes.intern(fields, false, undefined, [
|
|
2443
|
-
"address",
|
|
2639
|
+
"address",
|
|
2640
|
+
"netmask",
|
|
2641
|
+
"family",
|
|
2642
|
+
"mac",
|
|
2643
|
+
"internal",
|
|
2644
|
+
"cidr",
|
|
2645
|
+
"scopeid",
|
|
2444
2646
|
]),
|
|
2445
2647
|
};
|
|
2446
2648
|
}
|
|
2447
|
-
if (isStdlibInterface("PromiseFulfilledResult") ||
|
|
2448
|
-
isStdlibInterface("PromiseRejectedResult")) {
|
|
2649
|
+
if (isStdlibInterface("PromiseFulfilledResult") || isStdlibInterface("PromiseRejectedResult")) {
|
|
2449
2650
|
return {
|
|
2450
2651
|
kind: "record",
|
|
2451
2652
|
shapeId: ctx.shapes.intern([{ name: "status", type: STRING }], false, undefined, ["status"]),
|
|
@@ -2480,7 +2681,8 @@ function mapTypeInner(type, ctx) {
|
|
|
2480
2681
|
return hybrid;
|
|
2481
2682
|
// Recursive and Symbol-keyed callable objects need their complete live
|
|
2482
2683
|
// property table; dropping those members into a plain closure loses data.
|
|
2483
|
-
if (!ctx.dynamic &&
|
|
2684
|
+
if (!ctx.dynamic &&
|
|
2685
|
+
checker.getCallSignatures(widened).length > 0 &&
|
|
2484
2686
|
checker.getPropertiesOfType(widened).length > 0)
|
|
2485
2687
|
return DYN;
|
|
2486
2688
|
}
|
|
@@ -2523,20 +2725,36 @@ function mapTypeInner(type, ctx) {
|
|
|
2523
2725
|
ts.isParameter(decl) &&
|
|
2524
2726
|
(decl.questionToken !== undefined || decl.initializer !== undefined);
|
|
2525
2727
|
let pt = mapType(checker.getTypeOfSymbol(p), ctx);
|
|
2526
|
-
if (decl &&
|
|
2728
|
+
if (decl &&
|
|
2729
|
+
ts.isParameter(decl) &&
|
|
2730
|
+
ts.isSetAccessorDeclaration(decl.parent) &&
|
|
2731
|
+
isJsSourceFile(decl.getSourceFile()))
|
|
2527
2732
|
pt = DYN;
|
|
2528
2733
|
// An inferred JavaScript binding pattern consumes an iterable; it
|
|
2529
2734
|
// does not require the caller's array to have exactly this length.
|
|
2530
2735
|
const executor = decl && ts.isParameter(decl) ? decl.parent : null;
|
|
2531
2736
|
const construction = executor?.parent;
|
|
2532
2737
|
const constructorSymbol = construction && ts.isNewExpression(construction)
|
|
2533
|
-
? checker.getSymbolAtLocation(construction.expression)
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
ts.
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2738
|
+
? checker.getSymbolAtLocation(construction.expression)
|
|
2739
|
+
: undefined;
|
|
2740
|
+
const nativeExecutor = executor &&
|
|
2741
|
+
(ts.isArrowFunction(executor) || ts.isFunctionExpression(executor)) &&
|
|
2742
|
+
construction &&
|
|
2743
|
+
ts.isNewExpression(construction) &&
|
|
2744
|
+
construction.arguments?.[0] === executor &&
|
|
2745
|
+
ts.isIdentifier(construction.expression) &&
|
|
2746
|
+
construction.expression.text === "Promise" &&
|
|
2747
|
+
constructorSymbol &&
|
|
2748
|
+
checker
|
|
2749
|
+
.declarationsOf(constructorSymbol)
|
|
2750
|
+
.some((site) => ctx.isStdlibFile(site.getSourceFile()));
|
|
2751
|
+
if (!nativeExecutor &&
|
|
2752
|
+
decl &&
|
|
2753
|
+
ts.isParameter(decl) &&
|
|
2754
|
+
!decl.dotDotDotToken &&
|
|
2755
|
+
!ts.isSetAccessorDeclaration(decl.parent) &&
|
|
2756
|
+
isJsSourceFile(decl.getSourceFile()) &&
|
|
2757
|
+
!decl.type &&
|
|
2540
2758
|
!/@(?:param|type)\b/.test(decl.getSourceFile().text.slice(decl.parent?.pos ?? decl.pos, decl.getStart())))
|
|
2541
2759
|
pt = DYN;
|
|
2542
2760
|
if (pt)
|
|
@@ -2570,22 +2788,38 @@ function mapTypeInner(type, ctx) {
|
|
|
2570
2788
|
// returns can read mutable fields, so callable values use the same
|
|
2571
2789
|
// checked-native return ABI as their implementations.
|
|
2572
2790
|
const sigDecl = checker.signatureDeclaration(sig);
|
|
2573
|
-
const jsUnitReturn = sigDecl !== undefined &&
|
|
2791
|
+
const jsUnitReturn = sigDecl !== undefined &&
|
|
2792
|
+
isJsSourceFile(sigDecl.getSourceFile()) &&
|
|
2574
2793
|
(retT.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) !== 0;
|
|
2575
2794
|
let ret = jsUnitReturn || (!ctx.dynamic && (retT.flags & ts.TypeFlags.Any) !== 0)
|
|
2576
|
-
? DYN
|
|
2795
|
+
? DYN
|
|
2796
|
+
: retT.flags & ts.TypeFlags.Never
|
|
2797
|
+
? VOID
|
|
2798
|
+
: mapType(retT, ctx);
|
|
2577
2799
|
if (sigDecl && ts.isGetAccessorDeclaration(sigDecl) && isJsSourceFile(sigDecl.getSourceFile()))
|
|
2578
2800
|
ret = DYN;
|
|
2579
2801
|
if (sigDecl && isJsSourceFile(sigDecl.getSourceFile()) && ret?.kind === "array")
|
|
2580
2802
|
ret = DYN;
|
|
2581
|
-
if (sigDecl &&
|
|
2582
|
-
|
|
2803
|
+
if (sigDecl &&
|
|
2804
|
+
ts.isFunctionLike(sigDecl) &&
|
|
2805
|
+
isJsSourceFile(sigDecl.getSourceFile()) &&
|
|
2806
|
+
!sigDecl.type &&
|
|
2807
|
+
!/@returns?\b/.test(sigDecl.getSourceFile().text.slice(sigDecl.pos, sigDecl.getStart())) &&
|
|
2808
|
+
ret?.kind === "record")
|
|
2583
2809
|
ret = DYN;
|
|
2584
|
-
if (sigDecl &&
|
|
2810
|
+
if (sigDecl &&
|
|
2811
|
+
ts.isFunctionLike(sigDecl) &&
|
|
2812
|
+
isJsSourceFile(sigDecl.getSourceFile()) &&
|
|
2813
|
+
!sigDecl.type &&
|
|
2585
2814
|
!/@returns?\b/.test(sigDecl.getSourceFile().text.slice(sigDecl.pos, sigDecl.getStart())) &&
|
|
2586
|
-
(ret?.kind === "date" ||
|
|
2815
|
+
(ret?.kind === "date" ||
|
|
2816
|
+
(ret?.kind === "union" &&
|
|
2817
|
+
ctx.unions.get(ret.unionId)?.arms.some((arm) => arm.kind === "func"))))
|
|
2587
2818
|
ret = DYN;
|
|
2588
|
-
if (ret &&
|
|
2819
|
+
if (ret &&
|
|
2820
|
+
sigDecl &&
|
|
2821
|
+
isJsSourceFile(sigDecl.getSourceFile()) &&
|
|
2822
|
+
functionCanReturnUndefined(sigDecl))
|
|
2589
2823
|
ret = withUndefinedArm(ret, ctx.unions) ?? ret;
|
|
2590
2824
|
if (!ret)
|
|
2591
2825
|
return null;
|
|
@@ -2630,29 +2864,66 @@ function mapTypeInner(type, ctx) {
|
|
|
2630
2864
|
callSigs.length === 0 &&
|
|
2631
2865
|
psym !== undefined &&
|
|
2632
2866
|
checker.declarationsOf(psym).length > 0 &&
|
|
2633
|
-
checker
|
|
2867
|
+
checker
|
|
2868
|
+
.declarationsOf(psym)
|
|
2869
|
+
.every((d) => ts.isInterfaceDeclaration(d) && !ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2634
2870
|
const CHILD_SURFACE = new Set([
|
|
2635
|
-
"pid",
|
|
2636
|
-
"
|
|
2637
|
-
"
|
|
2871
|
+
"pid",
|
|
2872
|
+
"exitCode",
|
|
2873
|
+
"killed",
|
|
2874
|
+
"kill",
|
|
2875
|
+
"on",
|
|
2876
|
+
"once",
|
|
2877
|
+
"off",
|
|
2878
|
+
"removeListener",
|
|
2879
|
+
"unref",
|
|
2880
|
+
"ref",
|
|
2881
|
+
"stdin",
|
|
2882
|
+
"stdout",
|
|
2883
|
+
"stderr",
|
|
2884
|
+
"send",
|
|
2885
|
+
"connected",
|
|
2886
|
+
"disconnect",
|
|
2887
|
+
]);
|
|
2888
|
+
const CHILD_CORE = new Set([
|
|
2889
|
+
"kill",
|
|
2890
|
+
"on",
|
|
2891
|
+
"stdin",
|
|
2892
|
+
"stdout",
|
|
2893
|
+
"stderr",
|
|
2894
|
+
"unref",
|
|
2895
|
+
"exitCode",
|
|
2896
|
+
"send",
|
|
2897
|
+
"connected",
|
|
2638
2898
|
]);
|
|
2639
|
-
const CHILD_CORE = new Set(["kill", "on", "stdin", "stdout", "stderr", "unref", "exitCode", "send", "connected"]);
|
|
2640
2899
|
const props = checker.getPropertiesOfType(widened);
|
|
2641
2900
|
let core = 0;
|
|
2642
2901
|
const childMemberType = (p) => {
|
|
2643
2902
|
if (["kill", "on", "once", "off", "removeListener", "unref", "ref"].includes(p.name)) {
|
|
2644
2903
|
return checker.getCallSignatures(checker.getTypeOfSymbol(p)).length > 0;
|
|
2645
2904
|
}
|
|
2646
|
-
const expected = p.name === "stdout" || p.name === "stderr"
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2905
|
+
const expected = p.name === "stdout" || p.name === "stderr"
|
|
2906
|
+
? "childStream"
|
|
2907
|
+
: p.name === "stdin"
|
|
2908
|
+
? "childWriter"
|
|
2909
|
+
: p.name === "killed"
|
|
2910
|
+
? "bool"
|
|
2911
|
+
: "f64";
|
|
2912
|
+
const unit = p.name === "pid"
|
|
2913
|
+
? "undefinedT"
|
|
2914
|
+
: p.name === "exitCode" ||
|
|
2915
|
+
p.name === "stdin" ||
|
|
2916
|
+
p.name === "stdout" ||
|
|
2917
|
+
p.name === "stderr"
|
|
2918
|
+
? "nullT"
|
|
2919
|
+
: null;
|
|
2650
2920
|
const mapped = mapType(checker.getTypeOfSymbol(p), ctx);
|
|
2651
2921
|
if (!mapped)
|
|
2652
2922
|
return false;
|
|
2653
2923
|
const arms = mapped.kind === "union" ? ctx.unions.get(mapped.unionId)?.arms : [mapped];
|
|
2654
|
-
return arms !== undefined &&
|
|
2655
|
-
arms.
|
|
2924
|
+
return (arms !== undefined &&
|
|
2925
|
+
arms.some((arm) => arm.kind === expected) &&
|
|
2926
|
+
arms.every((arm) => arm.kind === expected || arm.kind === unit));
|
|
2656
2927
|
};
|
|
2657
2928
|
const childShaped = props.length > 0 &&
|
|
2658
2929
|
props.every((p) => {
|
|
@@ -2790,9 +3061,12 @@ function mapTypeInner(type, ctx) {
|
|
|
2790
3061
|
!unions.recursivePending(widened)) {
|
|
2791
3062
|
return DYN;
|
|
2792
3063
|
}
|
|
2793
|
-
if (arms.some((a) => a.kind === "void" ||
|
|
2794
|
-
a.kind === "
|
|
2795
|
-
a.kind === "
|
|
3064
|
+
if (arms.some((a) => a.kind === "void" ||
|
|
3065
|
+
a.kind === "union" ||
|
|
3066
|
+
a.kind === "date" ||
|
|
3067
|
+
a.kind === "dyn" ||
|
|
3068
|
+
a.kind === "generator") ||
|
|
3069
|
+
!unionContainerArmsOk(arms)) {
|
|
2796
3070
|
return null;
|
|
2797
3071
|
}
|
|
2798
3072
|
arms.sort((a, b) => (typeKey(a) < typeKey(b) ? -1 : 1));
|
|
@@ -2837,7 +3111,9 @@ function unionDiscriminant(parts, arms, ctx) {
|
|
|
2837
3111
|
let complete = true;
|
|
2838
3112
|
for (const part of parts) {
|
|
2839
3113
|
const prop = checker.getPropertyOfType(part.source, candidate.name);
|
|
2840
|
-
if (!prop ||
|
|
3114
|
+
if (!prop ||
|
|
3115
|
+
prop.flags &
|
|
3116
|
+
(ts.SymbolFlags.Optional | ts.SymbolFlags.GetAccessor | ts.SymbolFlags.SetAccessor)) {
|
|
2841
3117
|
complete = false;
|
|
2842
3118
|
break;
|
|
2843
3119
|
}
|
|
@@ -2866,8 +3142,15 @@ function unionDiscriminant(parts, arms, ctx) {
|
|
|
2866
3142
|
if (complete) {
|
|
2867
3143
|
return {
|
|
2868
3144
|
field: candidate.name,
|
|
2869
|
-
cases: [...byTag]
|
|
2870
|
-
|
|
3145
|
+
cases: [...byTag]
|
|
3146
|
+
.sort(([a], [b]) => a - b)
|
|
3147
|
+
.map(([tag, values]) => ({
|
|
3148
|
+
tag,
|
|
3149
|
+
values: values.sort((a, b) => JSON.stringify(a) < JSON.stringify(b)
|
|
3150
|
+
? -1
|
|
3151
|
+
: JSON.stringify(a) > JSON.stringify(b)
|
|
3152
|
+
? 1
|
|
3153
|
+
: 0),
|
|
2871
3154
|
})),
|
|
2872
3155
|
};
|
|
2873
3156
|
}
|
|
@@ -2892,7 +3175,8 @@ function mapClassView(type, ctx, seen = new Set()) {
|
|
|
2892
3175
|
else {
|
|
2893
3176
|
const symbol = type.getSymbol();
|
|
2894
3177
|
const declarations = symbol ? checker.declarationsOf(symbol) : [];
|
|
2895
|
-
if (declarations.length === 0 ||
|
|
3178
|
+
if (declarations.length === 0 ||
|
|
3179
|
+
!declarations.every((decl) => ts.isInterfaceDeclaration(decl) && !ctx.isStdlibFile(decl.getSourceFile())))
|
|
2896
3180
|
return undefined;
|
|
2897
3181
|
const target = type.isTypeReference() ? type.getTarget() : type;
|
|
2898
3182
|
if (target === undefined || !target.isClassOrInterface())
|
|
@@ -2907,12 +3191,14 @@ function mapClassView(type, ctx, seen = new Set()) {
|
|
|
2907
3191
|
resolveTypeParam: (param) => {
|
|
2908
3192
|
const index = params.indexOf(param);
|
|
2909
3193
|
const arg = index >= 0 ? args[index] : undefined;
|
|
2910
|
-
return arg && arg !== param ? mapType(arg, ctx) : ctx.resolveTypeParam?.(param) ?? null;
|
|
3194
|
+
return arg && arg !== param ? mapType(arg, ctx) : (ctx.resolveTypeParam?.(param) ?? null);
|
|
2911
3195
|
},
|
|
2912
3196
|
resolveTypeParamTs: (param) => {
|
|
2913
3197
|
const index = params.indexOf(param);
|
|
2914
3198
|
const arg = index >= 0 ? args[index] : undefined;
|
|
2915
|
-
return arg && arg !== param
|
|
3199
|
+
return arg && arg !== param
|
|
3200
|
+
? (ctx.resolveTypeParamTs?.(arg) ?? arg)
|
|
3201
|
+
: (ctx.resolveTypeParamTs?.(param) ?? null);
|
|
2916
3202
|
},
|
|
2917
3203
|
};
|
|
2918
3204
|
}
|
|
@@ -2924,7 +3210,8 @@ function mapClassView(type, ctx, seen = new Set()) {
|
|
|
2924
3210
|
for (const base of bases) {
|
|
2925
3211
|
const symbol = base.getSymbol();
|
|
2926
3212
|
const declaration = symbol ? checker.valueDeclarationOf(symbol) : undefined;
|
|
2927
|
-
const classBase = declaration &&
|
|
3213
|
+
const classBase = declaration &&
|
|
3214
|
+
(ts.isClassDeclaration(declaration) || ts.isClassExpression(declaration)) &&
|
|
2928
3215
|
!declaration.getSourceFile().isDeclarationFile;
|
|
2929
3216
|
const mapped = classBase ? mapType(base, viewCtx) : mapClassView(base, viewCtx, seen);
|
|
2930
3217
|
if (mapped === null)
|
|
@@ -2938,7 +3225,8 @@ function mapClassView(type, ctx, seen = new Set()) {
|
|
|
2938
3225
|
}
|
|
2939
3226
|
if (!representation || !baseType)
|
|
2940
3227
|
return undefined;
|
|
2941
|
-
if (checker.getCallSignatures(type).length ||
|
|
3228
|
+
if (checker.getCallSignatures(type).length ||
|
|
3229
|
+
checker.getConstructSignatures(type).length ||
|
|
2942
3230
|
checker.getIndexInfosOfType(type).length)
|
|
2943
3231
|
return null;
|
|
2944
3232
|
for (const property of checker.getPropertiesOfType(type)) {
|
|
@@ -2951,7 +3239,8 @@ function mapClassView(type, ctx, seen = new Set()) {
|
|
|
2951
3239
|
const declarations = checker.declarationsOf(property);
|
|
2952
3240
|
// Instantiating an inherited member can create a new symbol without
|
|
2953
3241
|
// changing its declaration or ABI. Only refinements need validation.
|
|
2954
|
-
if (declarations.length > 0 &&
|
|
3242
|
+
if (declarations.length > 0 &&
|
|
3243
|
+
declarations.length === originalDeclarations.length &&
|
|
2955
3244
|
declarations.every((declaration, index) => declaration === originalDeclarations[index]))
|
|
2956
3245
|
continue;
|
|
2957
3246
|
const before = checker.getTypeOfSymbol(original);
|
|
@@ -2983,15 +3272,20 @@ function mapCollectionView(type, ctx, seen = new Set()) {
|
|
|
2983
3272
|
const { checker } = ctx;
|
|
2984
3273
|
const symbol = type.getSymbol();
|
|
2985
3274
|
const declarations = symbol ? checker.declarationsOf(symbol) : [];
|
|
2986
|
-
if (declarations.length === 0 ||
|
|
3275
|
+
if (declarations.length === 0 ||
|
|
3276
|
+
!declarations.every((decl) => ts.isInterfaceDeclaration(decl) && !ctx.isStdlibFile(decl.getSourceFile())))
|
|
2987
3277
|
return null;
|
|
2988
3278
|
const target = type.getTarget();
|
|
2989
|
-
if (target === undefined ||
|
|
3279
|
+
if (target === undefined ||
|
|
3280
|
+
!target.isClassOrInterface() ||
|
|
3281
|
+
seen.has(target) ||
|
|
3282
|
+
seen.size >= MAP_TYPE_MAX_DEPTH)
|
|
2990
3283
|
return null;
|
|
2991
3284
|
const bases = checker.getBaseTypes(target);
|
|
2992
3285
|
if (bases.length !== 1)
|
|
2993
3286
|
return null;
|
|
2994
|
-
if (checker.getCallSignatures(type).length ||
|
|
3287
|
+
if (checker.getCallSignatures(type).length ||
|
|
3288
|
+
checker.getConstructSignatures(type).length ||
|
|
2995
3289
|
checker.getIndexInfosOfType(type).length)
|
|
2996
3290
|
return null;
|
|
2997
3291
|
// Base declarations contain the interface's parameters, even when this
|
|
@@ -3005,29 +3299,37 @@ function mapCollectionView(type, ctx, seen = new Set()) {
|
|
|
3005
3299
|
resolveTypeParam: (param) => {
|
|
3006
3300
|
const index = params.indexOf(param);
|
|
3007
3301
|
const arg = index >= 0 ? args[index] : undefined;
|
|
3008
|
-
return arg && arg !== param ? mapType(arg, ctx) : ctx.resolveTypeParam?.(param) ?? null;
|
|
3302
|
+
return arg && arg !== param ? mapType(arg, ctx) : (ctx.resolveTypeParam?.(param) ?? null);
|
|
3009
3303
|
},
|
|
3010
3304
|
resolveTypeParamTs: (param) => {
|
|
3011
3305
|
const index = params.indexOf(param);
|
|
3012
3306
|
const arg = index >= 0 ? args[index] : undefined;
|
|
3013
|
-
return arg && arg !== param
|
|
3307
|
+
return arg && arg !== param
|
|
3308
|
+
? (ctx.resolveTypeParamTs?.(arg) ?? arg)
|
|
3309
|
+
: (ctx.resolveTypeParamTs?.(param) ?? null);
|
|
3014
3310
|
},
|
|
3015
3311
|
};
|
|
3016
3312
|
seen.add(target);
|
|
3017
3313
|
try {
|
|
3018
3314
|
const base = bases[0];
|
|
3019
3315
|
const baseSymbol = base.getSymbol();
|
|
3020
|
-
const native = baseSymbol &&
|
|
3021
|
-
|
|
3316
|
+
const native = baseSymbol &&
|
|
3317
|
+
["Map", "ReadonlyMap", "Set", "ReadonlySet"].includes(baseSymbol.name) &&
|
|
3318
|
+
checker
|
|
3319
|
+
.declarationsOf(baseSymbol)
|
|
3320
|
+
.some((decl) => ts.isInterfaceDeclaration(decl) && ctx.isStdlibFile(decl.getSourceFile()));
|
|
3022
3321
|
const mapped = native ? mapType(base, baseCtx) : mapCollectionView(base, baseCtx, seen);
|
|
3023
3322
|
if (mapped?.kind !== "map" && mapped?.kind !== "set")
|
|
3024
3323
|
return null;
|
|
3025
3324
|
const hasType = funcOf([mapped.kind === "map" ? mapped.key : mapped.elem], BOOL);
|
|
3026
3325
|
for (const property of checker.getPropertiesOfType(type)) {
|
|
3027
|
-
const own = checker
|
|
3326
|
+
const own = checker
|
|
3327
|
+
.declarationsOf(property)
|
|
3328
|
+
.filter((decl) => !ctx.isStdlibFile(decl.getSourceFile()));
|
|
3028
3329
|
if (own.length === 0)
|
|
3029
3330
|
continue;
|
|
3030
|
-
if (property.name !== "has" ||
|
|
3331
|
+
if (property.name !== "has" ||
|
|
3332
|
+
property.flags & ts.SymbolFlags.Optional ||
|
|
3031
3333
|
!own.every((decl) => decl.kind === ts.SyntaxKind.MethodSignature))
|
|
3032
3334
|
return null;
|
|
3033
3335
|
const method = mapType(checker.getTypeOfSymbol(property), ctx);
|
|
@@ -3207,7 +3509,9 @@ function mapGenericAwaitedAlias(type, ctx) {
|
|
|
3207
3509
|
if (!(arg.flags & ts.TypeFlags.TypeParameter))
|
|
3208
3510
|
return null;
|
|
3209
3511
|
// Provenance: the STANDARD LIBRARY's alias, not a user's shadowing one.
|
|
3210
|
-
const isLibAlias = ctx.checker
|
|
3512
|
+
const isLibAlias = ctx.checker
|
|
3513
|
+
.declarationsOf(alias)
|
|
3514
|
+
.some((d) => ts.isTypeAliasDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()));
|
|
3211
3515
|
if (!isLibAlias)
|
|
3212
3516
|
return null;
|
|
3213
3517
|
const bound = resolveTypeParam(arg);
|
|
@@ -3253,7 +3557,8 @@ function mapGenericIndexedAccess(type, ctx) {
|
|
|
3253
3557
|
covered = f ? [f.type] : shape.indexValue ? [shape.indexValue] : null;
|
|
3254
3558
|
}
|
|
3255
3559
|
else {
|
|
3256
|
-
const allKeys = ((idx.flags & ts.TypeFlags.TypeParameter) !== 0 &&
|
|
3560
|
+
const allKeys = ((idx.flags & ts.TypeFlags.TypeParameter) !== 0 &&
|
|
3561
|
+
resolveTypeParam(idx)?.kind === "string") ||
|
|
3257
3562
|
(idx.isIndexType() && idx.getTarget() === obj);
|
|
3258
3563
|
if (allKeys) {
|
|
3259
3564
|
covered = shape.fields.map((f) => f.type);
|
|
@@ -3280,7 +3585,9 @@ function mapGenericUtilityAlias(widened, ctx) {
|
|
|
3280
3585
|
if (!(arg.flags & ts.TypeFlags.TypeParameter))
|
|
3281
3586
|
return null;
|
|
3282
3587
|
// Provenance: the STANDARD LIBRARY's alias, not a user's shadowing one.
|
|
3283
|
-
const isLibAlias = ctx.checker
|
|
3588
|
+
const isLibAlias = ctx.checker
|
|
3589
|
+
.declarationsOf(alias)
|
|
3590
|
+
.some((d) => ts.isTypeAliasDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()));
|
|
3284
3591
|
if (!isLibAlias)
|
|
3285
3592
|
return null;
|
|
3286
3593
|
const bound = resolveTypeParam(arg);
|
|
@@ -3352,8 +3659,7 @@ export function genResultRecord(yieldT, retT, shapes, unions) {
|
|
|
3352
3659
|
byKey.set(typeKey(a), a);
|
|
3353
3660
|
return true;
|
|
3354
3661
|
}
|
|
3355
|
-
if (t.kind === "regex" || t.kind === "date" ||
|
|
3356
|
-
t.kind === "jsval" || t.kind === "generator") {
|
|
3662
|
+
if (t.kind === "regex" || t.kind === "date" || t.kind === "jsval" || t.kind === "generator") {
|
|
3357
3663
|
return false; // no legal union arm exists for these kinds
|
|
3358
3664
|
}
|
|
3359
3665
|
byKey.set(typeKey(t), t);
|
|
@@ -3365,7 +3671,8 @@ export function genResultRecord(yieldT, retT, shapes, unions) {
|
|
|
3365
3671
|
const arms = [...byKey.values()];
|
|
3366
3672
|
// Containers keep the shared nullable-only rule. Generator function
|
|
3367
3673
|
// payloads retain their existing unit-only boundary too.
|
|
3368
|
-
if (!unionContainerArmsOk(arms) ||
|
|
3674
|
+
if (!unionContainerArmsOk(arms) ||
|
|
3675
|
+
arms.some((a) => a.kind === "func" && !arms.every((b) => b === a || isUnitType(b)))) {
|
|
3369
3676
|
return null;
|
|
3370
3677
|
}
|
|
3371
3678
|
if (arms.every(isUnitType) && arms.length < 2) {
|
|
@@ -3424,7 +3731,9 @@ export function withUnitArm(t, kind, unions) {
|
|
|
3424
3731
|
arms.sort((a, b) => (typeKey(a) < typeKey(b) ? -1 : 1));
|
|
3425
3732
|
return { kind: "union", unionId: unions.transform(def, arms) };
|
|
3426
3733
|
}
|
|
3427
|
-
if (t.kind === "void" ||
|
|
3734
|
+
if (t.kind === "void" ||
|
|
3735
|
+
t.kind === "date" ||
|
|
3736
|
+
t.kind === "dyn" ||
|
|
3428
3737
|
// A bare unit field type cannot occur (units live only inside unions),
|
|
3429
3738
|
// but guard against constructing a single-arm union from one.
|
|
3430
3739
|
isUnitType(t)) {
|
|
@@ -3517,7 +3826,12 @@ function mapBrandedPrimitiveIntersection(widened, ctx) {
|
|
|
3517
3826
|
return BIGINT_T;
|
|
3518
3827
|
if (base.flags & ts.TypeFlags.TypeParameter) {
|
|
3519
3828
|
const bound = resolveTypeParam?.(base) ?? null;
|
|
3520
|
-
if (bound &&
|
|
3829
|
+
if (bound &&
|
|
3830
|
+
(bound.kind === "f64" ||
|
|
3831
|
+
bound.kind === "bigint" ||
|
|
3832
|
+
bound.kind === "string" ||
|
|
3833
|
+
bound.kind === "bool" ||
|
|
3834
|
+
bound.kind === "symbol")) {
|
|
3521
3835
|
contextResolutions++;
|
|
3522
3836
|
return bound;
|
|
3523
3837
|
}
|
|
@@ -3597,11 +3911,11 @@ function recordProvenanceOk(t, ctx) {
|
|
|
3597
3911
|
if (t.isIntersectionType()) {
|
|
3598
3912
|
return ts.constituentTypes(t).every((part) => {
|
|
3599
3913
|
const partSym = part.getSymbol();
|
|
3600
|
-
return (part.flags & ts.TypeFlags.Object) !== 0 &&
|
|
3914
|
+
return ((part.flags & ts.TypeFlags.Object) !== 0 &&
|
|
3601
3915
|
!(partSym && partSym.flags & ts.SymbolFlags.Class) &&
|
|
3602
3916
|
checker.getCallSignatures(part).length === 0 &&
|
|
3603
3917
|
checker.getConstructSignatures(part).length === 0 &&
|
|
3604
|
-
recordProvenanceOk(part, ctx);
|
|
3918
|
+
recordProvenanceOk(part, ctx));
|
|
3605
3919
|
});
|
|
3606
3920
|
}
|
|
3607
3921
|
if (isMappedShape(t))
|
|
@@ -3611,7 +3925,12 @@ function recordProvenanceOk(t, ctx) {
|
|
|
3611
3925
|
if (!decls || decls.length === 0) {
|
|
3612
3926
|
// Inferred destructuring parameters can have a synthesized anonymous
|
|
3613
3927
|
// shape with no declaration or member symbols to trace to a source.
|
|
3614
|
-
return checker
|
|
3928
|
+
return checker
|
|
3929
|
+
.getPropertiesOfType(t)
|
|
3930
|
+
.every((property) => checker
|
|
3931
|
+
.declarationsOf(property)
|
|
3932
|
+
.every((decl) => !decl.getSourceFile().isDeclarationFile ||
|
|
3933
|
+
ctx.isExternalTypeFile(decl.getSourceFile())));
|
|
3615
3934
|
}
|
|
3616
3935
|
return !decls.some((d) => {
|
|
3617
3936
|
const sf = d.getSourceFile();
|
|
@@ -3690,7 +4009,10 @@ function mapRecordType(widened, ctx) {
|
|
|
3690
4009
|
inner.fields.every((field) => field.type.kind === "dyn") &&
|
|
3691
4010
|
(inner.indexValue === undefined || inner.indexValue.kind === "dyn"))
|
|
3692
4011
|
return DYN;
|
|
3693
|
-
return {
|
|
4012
|
+
return {
|
|
4013
|
+
kind: "record",
|
|
4014
|
+
shapeId: shapes.intern(inner.fields, false, inner.indexValue, inner.declaredOrder),
|
|
4015
|
+
};
|
|
3694
4016
|
}
|
|
3695
4017
|
finally {
|
|
3696
4018
|
shapes.inProgress.delete(widened);
|
|
@@ -3734,7 +4056,9 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3734
4056
|
if (indexInfos.length > 0) {
|
|
3735
4057
|
const stringKey = (k) => (k.flags & ts.TypeFlags.String) !== 0 ||
|
|
3736
4058
|
(k.isIntersectionType() &&
|
|
3737
|
-
ts
|
|
4059
|
+
ts
|
|
4060
|
+
.constituentTypes(k)
|
|
4061
|
+
.every((p) => (p.flags & ts.TypeFlags.String) !== 0 ||
|
|
3738
4062
|
((p.flags & ts.TypeFlags.Object) !== 0 &&
|
|
3739
4063
|
checker.getPropertiesOfType(p).length === 0 &&
|
|
3740
4064
|
checker.getCallSignatures(p).length === 0 &&
|
|
@@ -3777,7 +4101,9 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3777
4101
|
// merge machinery cannot do.
|
|
3778
4102
|
if (indexValue?.kind === "union") {
|
|
3779
4103
|
const slotDef = ctx.unions.get(indexValue.unionId);
|
|
3780
|
-
const armOk = (a) => a.kind === "f64" ||
|
|
4104
|
+
const armOk = (a) => a.kind === "f64" ||
|
|
4105
|
+
a.kind === "string" ||
|
|
4106
|
+
a.kind === "undefinedT" ||
|
|
3781
4107
|
(a.kind === "array" && a.elem.kind === "string");
|
|
3782
4108
|
// A pure Dict<string[]> is the distinct-header shape, not a general
|
|
3783
4109
|
// outgoing-header slot: retain its precise string[] | undefined value
|
|
@@ -3788,7 +4114,8 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3788
4114
|
slotDef.arms.length === 2 &&
|
|
3789
4115
|
slotDef.arms.some((a) => a.kind === "array" && a.elem.kind === "string") &&
|
|
3790
4116
|
slotDef.arms.some((a) => a.kind === "undefinedT");
|
|
3791
|
-
if (slotDef !== undefined &&
|
|
4117
|
+
if (slotDef !== undefined &&
|
|
4118
|
+
!distinctOnly &&
|
|
3792
4119
|
slotDef.arms.some((a) => a.kind === "array" && a.elem.kind === "string") &&
|
|
3793
4120
|
slotDef.arms.every(armOk)) {
|
|
3794
4121
|
const armsRaw = [F64, STRING, arrayOf(STRING), UNDEFINED_T];
|
|
@@ -3803,7 +4130,9 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3803
4130
|
}
|
|
3804
4131
|
return armOk(t);
|
|
3805
4132
|
};
|
|
3806
|
-
if (checker
|
|
4133
|
+
if (checker
|
|
4134
|
+
.getPropertiesOfType(widened)
|
|
4135
|
+
.every((p) => fits(mapType(checker.getTypeOfSymbol(p), ctx)))) {
|
|
3807
4136
|
return { kind: "record", shapeId: shapes.intern([], false, canonical, []) };
|
|
3808
4137
|
}
|
|
3809
4138
|
}
|
|
@@ -3862,7 +4191,8 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3862
4191
|
indexValue === undefined &&
|
|
3863
4192
|
checker.getCallSignatures(widened).length === 0 &&
|
|
3864
4193
|
checker.getConstructSignatures(widened).length === 0 &&
|
|
3865
|
-
!(anonSym !== undefined &&
|
|
4194
|
+
!(anonSym !== undefined &&
|
|
4195
|
+
checker.declarationsOf(anonSym).some((d) => ts.isObjectLiteralExpression(d)))) {
|
|
3866
4196
|
return DYN;
|
|
3867
4197
|
}
|
|
3868
4198
|
const fields = [];
|
|
@@ -3917,7 +4247,10 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3917
4247
|
// A void/unit-typed write slot has no value form; DIVERGENT
|
|
3918
4248
|
// getter/setter types stay out too (one property, one type —
|
|
3919
4249
|
// the class-accessor stance).
|
|
3920
|
-
if (writeT === null ||
|
|
4250
|
+
if (writeT === null ||
|
|
4251
|
+
writeT.kind === "void" ||
|
|
4252
|
+
writeT.kind === "jsval" ||
|
|
4253
|
+
isUnitType(writeT))
|
|
3921
4254
|
return null;
|
|
3922
4255
|
if (readT !== null && typeKey(readT) !== typeKey(writeT))
|
|
3923
4256
|
return null;
|
|
@@ -3954,7 +4287,9 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3954
4287
|
// initializer is an EMPTY array literal inside a const assertion IS
|
|
3955
4288
|
// the empty tuple — map it exactly as the tuple branch does (the
|
|
3956
4289
|
// unit-element array; see the `[] as const` rule there).
|
|
3957
|
-
if ((pt === null || pt.kind === "jsval") &&
|
|
4290
|
+
if ((pt === null || pt.kind === "jsval") &&
|
|
4291
|
+
(fieldTs.flags & ts.TypeFlags.Any) !== 0 &&
|
|
4292
|
+
constAssertedEmptyArrayProp(p, ctx)) {
|
|
3958
4293
|
pt = arrayOf(unitOnlyUnion(ctx.unions));
|
|
3959
4294
|
}
|
|
3960
4295
|
if (pt === null && !ctx.dynamic && (fieldTs.flags & ts.TypeFlags.Any) !== 0)
|
|
@@ -4081,7 +4416,9 @@ export function describeComponentBlocker(widened, ctx) {
|
|
|
4081
4416
|
const psym = widened.getSymbol();
|
|
4082
4417
|
const container = psym !== undefined &&
|
|
4083
4418
|
Object.prototype.hasOwnProperty.call(STDLIB_CONTAINERS, psym.name) &&
|
|
4084
|
-
checker
|
|
4419
|
+
checker
|
|
4420
|
+
.declarationsOf(psym)
|
|
4421
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))
|
|
4085
4422
|
? psym.name
|
|
4086
4423
|
: undefined;
|
|
4087
4424
|
if (container !== undefined) {
|
|
@@ -4094,13 +4431,18 @@ export function describeComponentBlocker(widened, ctx) {
|
|
|
4094
4431
|
if (!mapped) {
|
|
4095
4432
|
return `the ${container} shape is supported, but its ${role} type '${text(arg)}' does not compile`;
|
|
4096
4433
|
}
|
|
4097
|
-
if ((container === "Map" || container === "ReadonlyMap") &&
|
|
4434
|
+
if ((container === "Map" || container === "ReadonlyMap") &&
|
|
4435
|
+
i === 0 &&
|
|
4436
|
+
!isSupportedMapKey(mapped, mapped.kind === "union" ? ctx.unions.get(mapped.unionId)?.arms : undefined)) {
|
|
4098
4437
|
return `the ${container} shape is supported, but '${text(arg)}' is outside its supported key domain (numbers, strings, booleans, bigints, identity references, or supported unions)`;
|
|
4099
4438
|
}
|
|
4100
|
-
if ((container === "Map" || container === "ReadonlyMap") &&
|
|
4439
|
+
if ((container === "Map" || container === "ReadonlyMap") &&
|
|
4440
|
+
i === 1 &&
|
|
4441
|
+
!isSupportedMapValue(mapped)) {
|
|
4101
4442
|
return `the ${container} shape is supported, but '${text(arg)}' values have no Map slot yet`;
|
|
4102
4443
|
}
|
|
4103
|
-
if ((container === "Set" || container === "ReadonlySet") &&
|
|
4444
|
+
if ((container === "Set" || container === "ReadonlySet") &&
|
|
4445
|
+
!isSupportedSetElem(mapped, mapped.kind === "union" ? ctx.unions.get(mapped.unionId)?.arms : undefined)) {
|
|
4104
4446
|
return `the ${container} shape is supported, but '${text(arg)}' is outside its supported element domain (numbers, strings, booleans, bigints, identity references, or supported unions)`;
|
|
4105
4447
|
}
|
|
4106
4448
|
}
|
|
@@ -4181,8 +4523,7 @@ export function describeComponentBlocker(widened, ctx) {
|
|
|
4181
4523
|
const sigDecl = checker.signatureDeclaration(sig);
|
|
4182
4524
|
if (sigDecl !== undefined &&
|
|
4183
4525
|
ts.isFunctionLike(sigDecl) &&
|
|
4184
|
-
(sigDecl.parameters.length !== sig.getParameters().length ||
|
|
4185
|
-
bodyReadsArguments(sigDecl))) {
|
|
4526
|
+
(sigDecl.parameters.length !== sig.getParameters().length || bodyReadsArguments(sigDecl))) {
|
|
4186
4527
|
return `the function shape is supported, but its signature is variadic ('arguments'-reading), and a compiled signature is fixed-arity`;
|
|
4187
4528
|
}
|
|
4188
4529
|
for (const p of sig.getParameters()) {
|