@scriptc/compiler 0.2.10 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ambient/scriptc-node-fallback.d.ts +7 -38
- package/ambient/scriptc-overrides.d.ts +1 -25
- package/ambient/scriptc.d.ts +1 -9
- package/dist/backend/cycle-analysis.test.js +1 -1
- package/dist/backend/cycle-mutability.d.ts +1 -1
- package/dist/backend/cycle-mutability.js +1 -18
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.d.ts +1 -1
- package/dist/backend/executable-features.js +3 -8
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.d.ts +1 -1
- package/dist/backend/immutability.js +1 -1
- package/dist/backend/immutability.test.js +1 -1
- package/dist/backend/library-pack.js +0 -2
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/linker.js +1 -1
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/llvm/bigint-wrap.d.ts +4 -0
- package/dist/backend/llvm/bigint-wrap.js +590 -0
- package/dist/backend/llvm/bigint-wrap.js.map +1 -0
- package/dist/backend/llvm/blocks.d.ts +2 -0
- package/dist/backend/llvm/blocks.js +4 -0
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.js +15 -4
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +14 -3
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/checked-narrows.test.js +2 -2
- package/dist/backend/llvm/checked-narrows.test.js.map +1 -1
- package/dist/backend/llvm/classes.js +60 -21
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +11 -11
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +7 -5
- package/dist/backend/llvm/common.js +7 -5
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.d.ts +1 -1
- package/dist/backend/llvm/constant-callbacks.js +13 -31
- package/dist/backend/llvm/constant-callbacks.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.test.js +1 -1
- package/dist/backend/llvm/dense-array-access.js +133 -45
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +54 -2
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +2 -1
- package/dist/backend/llvm/dyn.js +4 -73
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +123 -23
- package/dist/backend/llvm/emitter.js +729 -258
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +17 -10
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +120 -43
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-async.test.js +2 -2
- package/dist/backend/llvm/expr-async.test.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +51 -36
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +72 -3
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +1 -1
- package/dist/backend/llvm/expr-calls.js +159 -30
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-calls.test.js +132 -0
- package/dist/backend/llvm/expr-calls.test.js.map +1 -0
- package/dist/backend/llvm/expr-containers.js +25 -8
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +2 -0
- package/dist/backend/llvm/expr-control.js +4 -107
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.d.ts +1 -2
- package/dist/backend/llvm/expr-dispatch.js +3 -41
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.d.ts +1 -1
- package/dist/backend/llvm/expr-dynamic.js +39 -31
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.d.ts +7 -0
- package/dist/backend/llvm/expr-primitives.js +80 -22
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +97 -7
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.d.ts +9 -0
- package/dist/backend/llvm/expr-records.js +134 -16
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.d.ts +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +80 -1
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +51 -2
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
- package/dist/backend/llvm/int32-abi.d.ts +31 -0
- package/dist/backend/llvm/int32-abi.js +62 -0
- package/dist/backend/llvm/int32-abi.js.map +1 -0
- package/dist/backend/llvm/int32-abi.test.js +107 -0
- package/dist/backend/llvm/int32-abi.test.js.map +1 -0
- package/dist/backend/llvm/int32-locals.d.ts +30 -0
- package/dist/backend/llvm/int32-locals.js +95 -0
- package/dist/backend/llvm/int32-locals.js.map +1 -0
- package/dist/backend/llvm/integer-values.d.ts +4 -0
- package/dist/backend/llvm/integer-values.js +30 -1
- package/dist/backend/llvm/integer-values.js.map +1 -1
- package/dist/backend/llvm/integer-views.d.ts +8 -1
- package/dist/backend/llvm/integer-views.js +47 -2
- package/dist/backend/llvm/integer-views.js.map +1 -1
- package/dist/backend/llvm/lazy-captures.d.ts +16 -0
- package/dist/backend/llvm/lazy-captures.js +88 -2
- package/dist/backend/llvm/lazy-captures.js.map +1 -1
- package/dist/backend/llvm/lazy-captures.test.js +48 -0
- package/dist/backend/llvm/lazy-captures.test.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +14 -1
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +3 -13
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +7 -8
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +21 -2
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +4 -3
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +3 -3
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +7 -0
- package/dist/backend/llvm/map-number-lookup.js +16 -2
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.js +7 -1
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +25 -8
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/reference-effects.js +2 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-writes.d.ts +3 -0
- package/dist/backend/llvm/reference-writes.js +10 -2
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.d.ts +39 -0
- package/dist/backend/llvm/regex-matchers.js +1649 -0
- package/dist/backend/llvm/regex-matchers.js.map +1 -0
- package/dist/backend/llvm/regex-matchers.test.js +96 -0
- package/dist/backend/llvm/regex-matchers.test.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +36 -1
- package/dist/backend/llvm/shapes.js +128 -16
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +3 -3
- package/dist/backend/llvm/stack-unions.test.js +2 -2
- package/dist/backend/llvm/stack-unions.test.js.map +1 -1
- package/dist/backend/llvm/string-construction.test.js +3 -3
- package/dist/backend/llvm/string-construction.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +6 -6
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-literal-equality.d.ts +22 -0
- package/dist/backend/llvm/string-literal-equality.js +78 -0
- package/dist/backend/llvm/string-literal-equality.js.map +1 -0
- package/dist/backend/llvm/switch-dispatch.js +59 -13
- package/dist/backend/llvm/switch-dispatch.js.map +1 -1
- package/dist/backend/llvm/switch-dispatch.test.js +72 -7
- package/dist/backend/llvm/switch-dispatch.test.js.map +1 -1
- package/dist/backend/llvm/union-retype.test.d.ts +1 -0
- package/dist/backend/llvm/union-retype.test.js +229 -0
- package/dist/backend/llvm/union-retype.test.js.map +1 -0
- package/dist/backend/llvm/wrapping-sums.d.ts +17 -0
- package/dist/backend/llvm/wrapping-sums.js +113 -0
- package/dist/backend/llvm/wrapping-sums.js.map +1 -0
- package/dist/backend/loop-polls.js +1 -0
- package/dist/backend/loop-polls.js.map +1 -1
- package/dist/backend/mangle.d.ts +9 -0
- package/dist/backend/mangle.js +15 -0
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/may-throw.js +6 -12
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +1 -1
- package/dist/backend/native/artifact-stamps.js +0 -2
- package/dist/backend/native/artifact-stamps.js.map +1 -1
- package/dist/backend/native/cache-warm.d.ts +1 -1
- package/dist/backend/native/cache-warm.js +2 -3
- package/dist/backend/native/cache-warm.js.map +1 -1
- package/dist/backend/native/compiler-fingerprint.d.ts +1 -1
- package/dist/backend/native/compiler-fingerprint.js +4 -7
- package/dist/backend/native/compiler-fingerprint.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +3 -28
- package/dist/backend/native/driver.js +1 -3
- package/dist/backend/native/driver.js.map +1 -1
- package/dist/backend/native/executable.d.ts +0 -15
- package/dist/backend/native/executable.js +17 -172
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/tool-identity.js +0 -1
- package/dist/backend/native/tool-identity.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native/vendor.js +1 -1
- package/dist/backend/native/vendor.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +0 -2
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +23 -33
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/publication.test.js +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-core.d.ts +1 -2
- package/dist/backend/runtime-pack-core.js +5 -14
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +3 -8
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +22 -19
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.d.ts +0 -5
- package/dist/backend/target-diagnostics.js +1 -11
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +1 -1
- package/dist/backend/vendor-archives.d.ts +1 -7
- package/dist/backend/vendor-archives.js +9 -189
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +0 -1
- package/dist/backend/vendor-inputs.js +0 -1
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/warm-cache.js +3 -5
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +4 -8
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/host.d.ts +1 -1
- package/dist/cli/usage.d.ts +1 -5
- package/dist/cli/usage.js +4 -9
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +2 -2
- package/dist/compat/fetch-profile.js +16 -25
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +2 -17
- package/dist/contracts/check.js +6 -6
- package/dist/contracts/check.js.map +1 -1
- package/dist/coverage/report.d.ts +5 -22
- package/dist/coverage/report.js +12 -76
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.d.ts +3 -3
- package/dist/coverage/surface-manifest.js +22 -27
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +1 -3
- package/dist/coverage/verdict-cache.js +2 -7
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +11 -60
- package/dist/diagnostics/diagnostic.js +39 -118
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +3 -4
- package/dist/diagnostics/envelope.js +0 -9
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/diagnostics/envelope.test.js +1 -1
- package/dist/diagnostics/envelope.test.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +0 -3
- package/dist/executable/executable-cache.js +2 -4
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +0 -4
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +5 -2
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +10 -10
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/cjs-syntax.js +0 -88
- package/dist/frontend/cjs-syntax.js.map +1 -1
- package/dist/frontend/dts-paths.d.ts +1 -1
- package/dist/frontend/dts-paths.js +1 -1
- package/dist/frontend/lowering/abstract-equality.js +1 -4
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-values.d.ts +14 -0
- package/dist/frontend/lowering/array-values.js +33 -11
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/builtins/arguments.js +0 -13
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +0 -4
- package/dist/frontend/lowering/builtins/crypto.js +0 -4
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +1 -39
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +0 -15
- package/dist/frontend/lowering/builtins/module-resolution.js +5 -44
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.d.ts +0 -6
- package/dist/frontend/lowering/builtins/numbers.js +6 -57
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +4 -67
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/workers.js +1 -1
- package/dist/frontend/lowering/builtins/workers.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.d.ts +1 -37
- package/dist/frontend/lowering/call-arguments.js +11 -94
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.d.ts +1 -6
- package/dist/frontend/lowering/call-signatures.js +16 -68
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +19 -4
- package/dist/frontend/lowering/class-dynamic-dispatch.js +168 -98
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +44 -4
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +0 -2
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.js +1 -1
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/coercions/function-adapters.js +5 -35
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +0 -1
- package/dist/frontend/lowering/coercions/state.js +0 -1
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +2 -4
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +2 -12
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.js +0 -1
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +49 -28
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +2 -3
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +10 -54
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.d.ts +54 -0
- package/dist/frontend/lowering/containers/array-pipelines.js +1827 -0
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -0
- package/dist/frontend/lowering/containers/bytes.js +0 -1
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +2 -10
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +1 -6
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/exec-result-uses.d.ts +10 -0
- package/dist/frontend/lowering/containers/exec-result-uses.js +88 -0
- package/dist/frontend/lowering/containers/exec-result-uses.js.map +1 -0
- package/dist/frontend/lowering/containers/indexed-objects.js +0 -2
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +0 -6
- package/dist/frontend/lowering/containers/string-and-regexp.js +17 -17
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.d.ts +2 -1
- package/dist/frontend/lowering/containers/string-replacement.js +32 -136
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/devirtualize.d.ts +33 -0
- package/dist/frontend/lowering/devirtualize.js +199 -0
- package/dist/frontend/lowering/devirtualize.js.map +1 -0
- package/dist/frontend/lowering/expressions/evaluation-safety.js +0 -3
- package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +55 -8
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +0 -8
- package/dist/frontend/lowering/expressions/object-literals.js +8 -35
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +0 -4
- package/dist/frontend/lowering/expressions/optional-chains.js +3 -66
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/function-context.js +0 -1
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.js +0 -1
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/identifier-uses.d.ts +7 -0
- package/dist/frontend/lowering/identifier-uses.js +23 -0
- package/dist/frontend/lowering/identifier-uses.js.map +1 -0
- package/dist/frontend/lowering/iterator-adapters.js +51 -3
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.js +10 -77
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.js +14 -10
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.test.js +2 -2
- package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +2 -3
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +2 -27
- package/dist/frontend/lowering/lower-calls.js +111 -493
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +12 -60
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.js +2 -3
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-console.d.ts +14 -0
- package/dist/frontend/lowering/lower-console.js +195 -0
- package/dist/frontend/lowering/lower-console.js.map +1 -0
- package/dist/frontend/lowering/lower-enums.js +5 -8
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +3 -4
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.js +3 -5
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +0 -8
- package/dist/frontend/lowering/lower-exprs.js +180 -905
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +9 -8
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.d.ts +10 -0
- package/dist/frontend/lowering/lower-generators.js +108 -41
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +1 -50
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +0 -43
- package/dist/frontend/lowering/lower-modules.js +29 -329
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.js +5 -5
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +0 -30
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +98 -0
- package/dist/frontend/lowering/{lower-island.js → lower-stdlib.js} +97 -1160
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -0
- package/dist/frontend/lowering/lower-stmts.d.ts +0 -16
- package/dist/frontend/lowering/lower-stmts.js +58 -1016
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +14 -13
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +42 -155
- package/dist/frontend/lowering/lowerer.js +192 -816
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +4 -51
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/nan-coded-reads.d.ts +16 -0
- package/dist/frontend/lowering/nan-coded-reads.js +108 -1
- package/dist/frontend/lowering/nan-coded-reads.js.map +1 -1
- package/dist/frontend/lowering/narrowing-stability.js +1 -1
- package/dist/frontend/lowering/narrowing-stability.js.map +1 -1
- package/dist/frontend/lowering/optional-arguments.js +0 -2
- package/dist/frontend/lowering/optional-arguments.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-bounds.d.ts +4 -0
- package/dist/frontend/lowering/runtime-optional-bounds.js +2 -0
- package/dist/frontend/lowering/runtime-optional-bounds.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-bounds.test.js +27 -0
- package/dist/frontend/lowering/runtime-optional-bounds.test.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.test.js +2 -2
- package/dist/frontend/lowering/split-consumers.js +2 -18
- package/dist/frontend/lowering/split-consumers.js.map +1 -1
- package/dist/frontend/lowering/strict-equality.js +1 -1
- package/dist/frontend/lowering/strict-equality.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +6 -45
- package/dist/frontend/lowering/surfaces.js +8 -73
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/union-retag.d.ts +6 -1
- package/dist/frontend/lowering/union-retag.js +64 -1
- package/dist/frontend/lowering/union-retag.js.map +1 -1
- package/dist/frontend/lowering/union-retag.test.js +46 -0
- package/dist/frontend/lowering/union-retag.test.js.map +1 -1
- package/dist/frontend/module-syntax.d.ts +0 -3
- package/dist/frontend/module-syntax.js.map +1 -1
- package/dist/frontend/npm-node.d.ts +0 -7
- package/dist/frontend/npm-node.js +0 -7
- package/dist/frontend/npm-node.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.d.ts +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +6 -82
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/npm-static.d.ts +1 -1
- package/dist/frontend/npm-static.js +6 -71
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +3 -319
- package/dist/frontend/npm.js +6 -1007
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.js +2 -197
- package/dist/frontend/npm.test.js.map +1 -1
- package/dist/frontend/pipeline-native.js +1 -2
- package/dist/frontend/pipeline-native.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +3 -11
- package/dist/frontend/pipeline.js +37 -56
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/pipeline.test.js +12 -6
- package/dist/frontend/pipeline.test.js.map +1 -1
- package/dist/frontend/program.d.ts +0 -34
- package/dist/frontend/program.js +12 -97
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/provenance-core.d.ts +0 -4
- package/dist/frontend/provenance-core.js +4 -37
- package/dist/frontend/provenance-core.js.map +1 -1
- package/dist/frontend/provenance-registry.d.ts +0 -4
- package/dist/frontend/provenance-registry.js +0 -20
- package/dist/frontend/provenance-registry.js.map +1 -1
- package/dist/frontend/resolve.d.ts +0 -12
- package/dist/frontend/resolve.js +0 -34
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.js +2 -2
- package/dist/frontend/runtime-resolve.js.map +1 -1
- package/dist/frontend/services-node.js +2 -3
- package/dist/frontend/services-node.js.map +1 -1
- package/dist/frontend/services.d.ts +1 -8
- package/dist/frontend/services.js +2 -22
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/services.test.js +0 -38
- package/dist/frontend/services.test.js.map +1 -1
- package/dist/frontend/tsc-codes.js +0 -11
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +2 -27
- package/dist/frontend/type-mapper.js +58 -156
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -10
- package/dist/index.js.map +1 -1
- package/dist/ir/api.d.ts +1 -1
- package/dist/ir/api.js +1 -1
- package/dist/ir/api.js.map +1 -1
- package/dist/ir/builtin-effects.js +2 -5
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +13 -56
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/constant-globals.test.js +1 -1
- package/dist/ir/constant-tables.test.js +1 -1
- package/dist/ir/final-fields.test.js +1 -1
- package/dist/ir/function-references.d.ts +12 -0
- package/dist/ir/function-references.js +29 -0
- package/dist/ir/function-references.js.map +1 -0
- package/dist/ir/function-references.test.d.ts +1 -0
- package/dist/ir/function-references.test.js +276 -0
- package/dist/ir/function-references.test.js.map +1 -0
- package/dist/ir/initializer-bindings.test.js +1 -1
- package/dist/ir/int32-slots.d.ts +10 -7
- package/dist/ir/int32-slots.js +219 -68
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +39 -2
- package/dist/ir/int32-slots.test.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +4 -4
- package/dist/ir/integer-ranges.js +89 -64
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +71 -9
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/intrinsic-signatures.js +1 -0
- package/dist/ir/intrinsic-signatures.js.map +1 -1
- package/dist/ir/ir.d.ts +64 -290
- package/dist/ir/ir.js +11 -259
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +2 -7
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +3 -30
- package/dist/ir/runtime-features.js +8 -43
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/scalar-records.test.js +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +3 -3
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/traverse.js +4 -21
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/unshare.test.js +1 -1
- package/dist/ir/validate.js +66 -213
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +31 -13
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/fence-eval.test.js +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/library-cache.test.js +5 -5
- package/dist/library/prepare.js +5 -20
- package/dist/library/prepare.js.map +1 -1
- package/dist/native/cli.js +0 -2
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.test.js +2 -4
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/prepare.js +2 -4
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.js +2 -16
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +0 -3
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/startup-cache.js +0 -2
- package/dist/startup-cache.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +80 -104
- package/dist/backend/llvm/expr-island.d.ts +0 -15
- package/dist/backend/llvm/expr-island.js +0 -709
- package/dist/backend/llvm/expr-island.js.map +0 -1
- package/dist/frontend/lowering/coercions/island.d.ts +0 -37
- package/dist/frontend/lowering/coercions/island.js +0 -350
- package/dist/frontend/lowering/coercions/island.js.map +0 -1
- package/dist/frontend/lowering/lower-island.d.ts +0 -229
- package/dist/frontend/lowering/lower-island.js.map +0 -1
- package/dist/frontend/lowering/lower-island.test.js +0 -56
- package/dist/frontend/lowering/lower-island.test.js.map +0 -1
- package/dist/frontend/npm-fetch-analysis.d.ts +0 -17
- package/dist/frontend/npm-fetch-analysis.js +0 -109
- package/dist/frontend/npm-fetch-analysis.js.map +0 -1
- package/dist/frontend/npm-fetch-analysis.test.js +0 -130
- package/dist/frontend/npm-fetch-analysis.test.js.map +0 -1
- package/dist/frontend/npm-fetch-node.d.ts +0 -2
- package/dist/frontend/npm-fetch-node.js +0 -12
- package/dist/frontend/npm-fetch-node.js.map +0 -1
- package/dist/frontend/npm-fetch-syntax.d.ts +0 -6
- package/dist/frontend/npm-fetch-syntax.js +0 -202
- package/dist/frontend/npm-fetch-syntax.js.map +0 -1
- package/dist/native/runtime-typescript.d.ts +0 -4
- package/dist/native/runtime-typescript.js +0 -74
- package/dist/native/runtime-typescript.js.map +0 -1
- package/dist/native/runtime-typescript.test.js +0 -41
- package/dist/native/runtime-typescript.test.js.map +0 -1
- /package/dist/{frontend/lowering/lower-island.test.d.ts → backend/llvm/expr-calls.test.d.ts} +0 -0
- /package/dist/{frontend/npm-fetch-analysis.test.d.ts → backend/llvm/int32-abi.test.d.ts} +0 -0
- /package/dist/{native/runtime-typescript.test.d.ts → backend/llvm/regex-matchers.test.d.ts} +0 -0
|
@@ -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,
|
|
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, 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";
|
|
@@ -66,15 +66,7 @@ export function jsOpenObjectType(decl, type, shapes, unions) {
|
|
|
66
66
|
? DYN
|
|
67
67
|
: type;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
* values live in the embedded engine and map to island handles (jsval).
|
|
71
|
-
* Static fetch gives Response, RequestInit, AbortController/AbortSignal, response
|
|
72
|
-
* Headers, and the readable Web Streams slice native checked-dynamic
|
|
73
|
-
* handle representations. The Headers constructor itself remains
|
|
74
|
-
* dynamic-only even though response.headers is native.
|
|
75
|
-
* Declaration provenance is checked in mapType so user types with the
|
|
76
|
-
* same names keep their ordinary structural representation. */
|
|
77
|
-
export const ISLAND_AMBIENT_TYPES = [
|
|
69
|
+
export const FETCH_AMBIENT_TYPES = [
|
|
78
70
|
"Response",
|
|
79
71
|
"Request",
|
|
80
72
|
"ResponseInit",
|
|
@@ -91,17 +83,6 @@ export const ISLAND_AMBIENT_TYPES = [
|
|
|
91
83
|
"ReadableStreamReadValueResult",
|
|
92
84
|
"ReadableStreamReadDoneResult",
|
|
93
85
|
];
|
|
94
|
-
function isAmbientAbortHandleType(type, ctx) {
|
|
95
|
-
if (type.isUnionType())
|
|
96
|
-
return ts.constituentTypes(type).some((part) => isAmbientAbortHandleType(part, ctx));
|
|
97
|
-
const symbol = type.getSymbol();
|
|
98
|
-
return (!!symbol &&
|
|
99
|
-
(symbol.name === "AbortSignal" || symbol.name === "AbortController") &&
|
|
100
|
-
ctx.checker
|
|
101
|
-
.declarationsOf(symbol)
|
|
102
|
-
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
103
|
-
ctx.isStdlibFile(d.getSourceFile())));
|
|
104
|
-
}
|
|
105
86
|
/** node:util.parseArgs's public and @types/node helper type names. Values
|
|
106
87
|
* behind this surface use the checked-dynamic tree; see mapTypeInner. */
|
|
107
88
|
const PARSE_ARGS_DYN_TYPES = new Set([
|
|
@@ -640,8 +621,6 @@ export function formatIrType(t, shapes, unions, seen = new Set()) {
|
|
|
640
621
|
seen.delete(t.unionId);
|
|
641
622
|
}
|
|
642
623
|
}
|
|
643
|
-
case "jsval":
|
|
644
|
-
return append("any");
|
|
645
624
|
case "regex":
|
|
646
625
|
return append("RegExp");
|
|
647
626
|
case "date":
|
|
@@ -834,8 +813,9 @@ function genChannels(yieldTs, retTs, nextTs, ctx) {
|
|
|
834
813
|
: mapType(nextTs, ctx);
|
|
835
814
|
if (!nextT || nextT.kind === "void" || nextT.kind === "nullT")
|
|
836
815
|
return null;
|
|
837
|
-
const
|
|
838
|
-
|
|
816
|
+
const ownChannel = (t) => t.kind === "f64" || t.kind === "bool" || t.kind === "string";
|
|
817
|
+
const dynMix = (yieldT.kind === "dyn" && retT.kind !== "dyn" && retT.kind !== "void" && !ownChannel(retT)) ||
|
|
818
|
+
(retT.kind === "dyn" && yieldT.kind !== "dyn" && yieldT.kind !== "void" && !ownChannel(yieldT));
|
|
839
819
|
if (dynMix)
|
|
840
820
|
return { yieldT: DYN, retT: DYN, nextT };
|
|
841
821
|
return { yieldT, retT, nextT };
|
|
@@ -908,7 +888,7 @@ export function mapType(type, ctx) {
|
|
|
908
888
|
const topLevel = mapTypeDepth === 0;
|
|
909
889
|
const typeId = type.id;
|
|
910
890
|
const memoizable = typeId !== undefined && (ctx.canMemoizeType?.() ?? true);
|
|
911
|
-
const memoKey = memoizable ? `${
|
|
891
|
+
const memoKey = memoizable ? `${0}:${typeId}` : null;
|
|
912
892
|
if (memoKey !== null) {
|
|
913
893
|
const memo = ctx.typeMemo?.get(memoKey);
|
|
914
894
|
if (memo !== undefined)
|
|
@@ -945,11 +925,9 @@ function mapTypeInner(type, ctx) {
|
|
|
945
925
|
// TypeScript's intrinsic globalThis symbol has no declaration. A stored
|
|
946
926
|
// reference needs native object identity, including var's undefined state.
|
|
947
927
|
const intrinsic = type.getSymbol();
|
|
948
|
-
if (
|
|
949
|
-
intrinsic?.name === "globalThis" &&
|
|
950
|
-
checker.declarationsOf(intrinsic).length === 0)
|
|
928
|
+
if (intrinsic?.name === "globalThis" && checker.declarationsOf(intrinsic).length === 0)
|
|
951
929
|
return DYN;
|
|
952
|
-
|
|
930
|
+
{
|
|
953
931
|
const moduleId = ctx.moduleNamespaceId?.(type) ?? null;
|
|
954
932
|
if (moduleId !== null)
|
|
955
933
|
return { kind: "moduleNs", moduleId };
|
|
@@ -1159,12 +1137,10 @@ function mapTypeInner(type, ctx) {
|
|
|
1159
1137
|
// (the Object.prototype surface) fence at their use sites.
|
|
1160
1138
|
if (flags & ts.TypeFlags.NonPrimitive)
|
|
1161
1139
|
return DYN;
|
|
1162
|
-
// `any`
|
|
1163
|
-
//
|
|
1164
|
-
// per-site diagnostic tells the user about --dynamic and the static
|
|
1165
|
-
// alternative (`unknown` + a checked cast).
|
|
1140
|
+
// Context-free `any` has no concrete storage shape. The lowering site
|
|
1141
|
+
// chooses checked-value storage when its operations support that boundary.
|
|
1166
1142
|
if (flags & ts.TypeFlags.Any)
|
|
1167
|
-
return
|
|
1143
|
+
return null;
|
|
1168
1144
|
// Enum types and enum member literal types: an enum VALUE at runtime IS
|
|
1169
1145
|
// its underlying primitive (tsc's own emit stores plain numbers/strings
|
|
1170
1146
|
// on the enum object; const enums inline them), so the enum type maps to
|
|
@@ -1199,23 +1175,10 @@ function mapTypeInner(type, ctx) {
|
|
|
1199
1175
|
return hasStr ? STRING : F64;
|
|
1200
1176
|
}
|
|
1201
1177
|
}
|
|
1202
|
-
//
|
|
1203
|
-
//
|
|
1204
|
-
//
|
|
1205
|
-
//
|
|
1206
|
-
// --dynamic they are island handles (jsval), and every operation on them
|
|
1207
|
-
// rides the engine ops with validated exits at typed boundaries.
|
|
1208
|
-
// Primitives/arrays/etc. REACHED THROUGH such types keep their
|
|
1209
|
-
// structural mapping (they were handled above or recurse normally); this
|
|
1210
|
-
// rule fires only when the type's own identity is declaration-file-
|
|
1211
|
-
// declared — interfaces, classes, type literals, and aliases from the
|
|
1212
|
-
// .d.ts. The standard library's declaration files are carved out (their
|
|
1213
|
-
// surfaces have static lowerings), as are declarations explicitly mapped
|
|
1214
|
-
// by --external-types: those describe project-owned structural data while
|
|
1215
|
-
// the Lowerer fences their imported runtime bindings. The program's own
|
|
1216
|
-
// compiled modules are never declaration files. Without --dynamic this
|
|
1217
|
-
// stays unmapped; badType reports the per-package requires-dynamic
|
|
1218
|
-
// diagnostic for node_modules types and the generic story otherwise.
|
|
1178
|
+
// Declaration-only package types have no compiled implementation.
|
|
1179
|
+
// Primitive and container types retain their structural mappings; types
|
|
1180
|
+
// owned by the standard library or explicit host mappings are handled
|
|
1181
|
+
// by their dedicated native rules.
|
|
1219
1182
|
const npmSym = widened.getAliasSymbol() ?? widened.getSymbol();
|
|
1220
1183
|
const npmDecls = npmSym ? checker.declarationsOf(npmSym) : undefined;
|
|
1221
1184
|
if (npmDecls &&
|
|
@@ -1224,22 +1187,17 @@ function mapTypeInner(type, ctx) {
|
|
|
1224
1187
|
const sf = d.getSourceFile();
|
|
1225
1188
|
return sf.isDeclarationFile && !ctx.isStdlibFile(sf) && !ctx.isExternalTypeFile(sf);
|
|
1226
1189
|
})) {
|
|
1227
|
-
return
|
|
1190
|
+
return null;
|
|
1228
1191
|
}
|
|
1229
|
-
// Module
|
|
1230
|
-
//
|
|
1231
|
-
// or supported builtin in a static build. Declaration-only package
|
|
1232
|
-
// namespaces retain the npm rule above; dynamic builds retain their
|
|
1233
|
-
// jsval import-handle path.
|
|
1192
|
+
// Module namespaces were claimed above when they name compiled source
|
|
1193
|
+
// modules or supported builtins. Declaration-only namespaces remain refused.
|
|
1234
1194
|
// T[]: monomorphic arrays, recursively (number[][] works). An element type
|
|
1235
1195
|
// that doesn't map (never from a context-free `[]`) makes the whole array
|
|
1236
1196
|
// unsupported — null propagates. Record/object/union elements ride the
|
|
1237
1197
|
// runtime's REF element kind (per-array RC entry points, the map-value
|
|
1238
1198
|
// technique), and PROMISE elements ride it too (Promise<T>[] is
|
|
1239
1199
|
// Promise.all's food: promises are refcounted, cycle-headered values
|
|
1240
|
-
// with `_v` adapters like any other ref element
|
|
1241
|
-
// JSON-serialize or cross the island boundary, which the safety
|
|
1242
|
-
// predicates already refuse). FUNCTION elements ride REF too (closure
|
|
1200
|
+
// with `_v` adapters like any other ref element). FUNCTION elements ride REF too (closure
|
|
1243
1201
|
// `_v` adapters + scr_closure_trace_v — closures are cycle-headered):
|
|
1244
1202
|
// `f === f` identity through indexOf/includes is sound because a
|
|
1245
1203
|
// function VALUE is one ScrClosure for its whole life — top-level
|
|
@@ -1260,17 +1218,6 @@ function mapTypeInner(type, ctx) {
|
|
|
1260
1218
|
// VOID mapping is a return-position artifact, not a value.
|
|
1261
1219
|
if (elem?.kind === "void" && isUnitOnlyTsType(elemTs, ctx.resolveTypeParam))
|
|
1262
1220
|
elem = unitOnlyUnion(unions);
|
|
1263
|
-
// A jsval element ABSORBS the array — with one carve-out. An array
|
|
1264
|
-
// type entangled with package-declared ('npm-jsval') elements
|
|
1265
|
-
// (`GeneratedFile[]`, `ModelMessage[]`) describes ISLAND values: the
|
|
1266
|
-
// handles those APIs produce are engine arrays, never the static
|
|
1267
|
-
// ScrArr this mapping would otherwise claim, so the whole array is
|
|
1268
|
-
// one handle and every operation on it is an engine op. The carve-out
|
|
1269
|
-
// is literal `any[]`: an EXPLICIT static array of dynamic values —
|
|
1270
|
-
// the messages-building pattern (`const content: any[] = []`) — which
|
|
1271
|
-
// keeps its static array-of-handles representation.
|
|
1272
|
-
if (elem?.kind === "jsval" && !(elemTs.flags & ts.TypeFlags.Any))
|
|
1273
|
-
return JSVAL;
|
|
1274
1221
|
if (!elem)
|
|
1275
1222
|
return null;
|
|
1276
1223
|
// A dyn ELEMENT makes the WHOLE array the checked-dynamic value:
|
|
@@ -1328,17 +1275,13 @@ function mapTypeInner(type, ctx) {
|
|
|
1328
1275
|
return arrayOf(unitOnlyUnion(unions));
|
|
1329
1276
|
if (tupleShape?.elementFlags === undefined)
|
|
1330
1277
|
return null;
|
|
1331
|
-
// Optional/rest elements
|
|
1332
|
-
// have no fixed shape — the ARITY is a runtime fact. Under --dynamic
|
|
1333
|
-
// the value lives in the engine, a real JS array carrying its true
|
|
1334
|
-
// length (reads, destructuring, JSON, .length all exact); static
|
|
1335
|
-
// builds stay unmapped and badType tells the dynamic-tier story.
|
|
1278
|
+
// Optional/rest elements have no fixed native tuple layout.
|
|
1336
1279
|
if (tupleShape.elementFlags.some((f) => !(f & ts.ElementFlags.Required))) {
|
|
1337
|
-
return
|
|
1280
|
+
return null;
|
|
1338
1281
|
}
|
|
1339
1282
|
const fields = [];
|
|
1340
1283
|
for (let i = 0; i < args.length; i++) {
|
|
1341
|
-
let et =
|
|
1284
|
+
let et = (args[i].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[i], ctx);
|
|
1342
1285
|
// A unit-only element (`[number, undefined]`) rides the unit-only
|
|
1343
1286
|
// union, the record-field rule.
|
|
1344
1287
|
if (et?.kind === "void" && isUnitOnlyTsType(args[i], ctx.resolveTypeParam))
|
|
@@ -1349,10 +1292,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1349
1292
|
// plumbing, values arrive dyn or convert via dynFrom.
|
|
1350
1293
|
if (!et || et.kind === "void")
|
|
1351
1294
|
return null;
|
|
1352
|
-
// A jsval member keeps this tuple in the island as a real JS array.
|
|
1353
1295
|
// Object records may instead keep ambient abort handles in slots.
|
|
1354
|
-
if (et.kind === "jsval")
|
|
1355
|
-
return JSVAL;
|
|
1356
1296
|
fields.push({ name: String(i), type: et });
|
|
1357
1297
|
}
|
|
1358
1298
|
fields.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
@@ -1770,7 +1710,6 @@ function mapTypeInner(type, ctx) {
|
|
|
1770
1710
|
// stdio and env values. Keep it checked-dynamic for native normalization.
|
|
1771
1711
|
if (isStdlibInterface("SpawnOptions"))
|
|
1772
1712
|
return DYN;
|
|
1773
|
-
// The fetch ambient slice: under --dynamic these are island handles
|
|
1774
1713
|
// exactly like npm-declared types. Static fetch has one deliberately
|
|
1775
1714
|
// narrower native representation: Response is an opaque checked-
|
|
1776
1715
|
// dynamic capsule consumed only by the Response method lowerings, and
|
|
@@ -1783,8 +1722,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1783
1722
|
// interfaces; @types/node's undici-types declares Response as a class).
|
|
1784
1723
|
{
|
|
1785
1724
|
const alias = widened.getAliasSymbol();
|
|
1786
|
-
if (
|
|
1787
|
-
alias?.name === "ReadableStreamReadResult" &&
|
|
1725
|
+
if (alias?.name === "ReadableStreamReadResult" &&
|
|
1788
1726
|
checker
|
|
1789
1727
|
.declarationsOf(alias)
|
|
1790
1728
|
.some((d) => ts.isTypeAliasDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
@@ -1795,8 +1733,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1795
1733
|
return genResultRecord(elem, VOID, ctx.shapes, ctx.unions);
|
|
1796
1734
|
}
|
|
1797
1735
|
}
|
|
1798
|
-
if (
|
|
1799
|
-
psym &&
|
|
1736
|
+
if (psym &&
|
|
1800
1737
|
(psym.name === "ReadableStreamReadValueResult" ||
|
|
1801
1738
|
psym.name === "ReadableStreamReadDoneResult") &&
|
|
1802
1739
|
checker
|
|
@@ -1809,7 +1746,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1809
1746
|
return genResultRecord(elem, VOID, ctx.shapes, ctx.unions);
|
|
1810
1747
|
}
|
|
1811
1748
|
if (psym &&
|
|
1812
|
-
|
|
1749
|
+
FETCH_AMBIENT_TYPES.includes(psym.name) &&
|
|
1813
1750
|
!(psym.name === "ReadableStream" &&
|
|
1814
1751
|
checker
|
|
1815
1752
|
.declarationsOf(psym)
|
|
@@ -1818,7 +1755,16 @@ function mapTypeInner(type, ctx) {
|
|
|
1818
1755
|
.declarationsOf(psym)
|
|
1819
1756
|
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1820
1757
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1821
|
-
return
|
|
1758
|
+
return DYN;
|
|
1759
|
+
}
|
|
1760
|
+
// The stdlib Console interface (the global console and node:console
|
|
1761
|
+
// Console instances) is a native handle carried by the checked-dynamic
|
|
1762
|
+
// representation and consumed by the console method lowerings.
|
|
1763
|
+
if (psym?.name === "Console" &&
|
|
1764
|
+
checker
|
|
1765
|
+
.declarationsOf(psym)
|
|
1766
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1767
|
+
return DYN;
|
|
1822
1768
|
}
|
|
1823
1769
|
// ReadonlyMap/ReadonlySet are the SAME runtime values as Map/Set — the
|
|
1824
1770
|
// readonly-ness is a checker-only view (no mutating members on the
|
|
@@ -1828,11 +1774,11 @@ function mapTypeInner(type, ctx) {
|
|
|
1828
1774
|
const args = checker.getTypeArguments(widened);
|
|
1829
1775
|
if (args.length !== 2)
|
|
1830
1776
|
return null;
|
|
1831
|
-
const key =
|
|
1777
|
+
const key = (args[0].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[0], ctx);
|
|
1832
1778
|
if (!key ||
|
|
1833
1779
|
!isSupportedMapKey(key, key.kind === "union" ? ctx.unions.get(key.unionId)?.arms : undefined))
|
|
1834
1780
|
return null;
|
|
1835
|
-
const value =
|
|
1781
|
+
const value = (args[1].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[1], ctx);
|
|
1836
1782
|
if (!value || !isSupportedMapValue(value))
|
|
1837
1783
|
return null;
|
|
1838
1784
|
return mapOf(key, value);
|
|
@@ -1840,7 +1786,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1840
1786
|
// Native WeakMap keeps reference identities in checked-dynamic storage.
|
|
1841
1787
|
// The runtime rejects reference kinds without a weak lifetime contract.
|
|
1842
1788
|
if (isStdlibInterface("WeakMap") || isStdlibInterface("WeakSet"))
|
|
1843
|
-
return
|
|
1789
|
+
return DYN;
|
|
1844
1790
|
// Set<T>: Map's sibling — same provenance rule and key domain.
|
|
1845
1791
|
// Anything else stays unmapped;
|
|
1846
1792
|
// the `new Set` lowering names the offending element type specifically.
|
|
@@ -1848,7 +1794,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1848
1794
|
const args = checker.getTypeArguments(widened);
|
|
1849
1795
|
if (args.length !== 1)
|
|
1850
1796
|
return null;
|
|
1851
|
-
const elem =
|
|
1797
|
+
const elem = (args[0].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[0], ctx);
|
|
1852
1798
|
if (!elem ||
|
|
1853
1799
|
!isSupportedSetElem(elem, elem.kind === "union" ? ctx.unions.get(elem.unionId)?.arms : undefined))
|
|
1854
1800
|
return null;
|
|
@@ -2336,10 +2282,8 @@ function mapTypeInner(type, ctx) {
|
|
|
2336
2282
|
// Promise<any> in a STATIC build (untyped JS entries: `new
|
|
2337
2283
|
// Promise((resolve) => ...)` infers any): the settled value rides the
|
|
2338
2284
|
// dyn arm exactly like Promise<unknown> — every use of the awaited
|
|
2339
|
-
// value is checked-dynamic, the same
|
|
2340
|
-
|
|
2341
|
-
// handle).
|
|
2342
|
-
if (arg.flags & ts.TypeFlags.Any && !ctx.dynamic)
|
|
2285
|
+
// value is checked-dynamic, the same checks `unknown` gets.
|
|
2286
|
+
if (arg.flags & ts.TypeFlags.Any)
|
|
2343
2287
|
return { kind: "promise", inner: DYN };
|
|
2344
2288
|
const inner = mapType(arg, ctx);
|
|
2345
2289
|
if (!inner)
|
|
@@ -2377,7 +2321,10 @@ function mapTypeInner(type, ctx) {
|
|
|
2377
2321
|
// else the mapped type (`.next(v)` requires its
|
|
2378
2322
|
// argument — fenced at the call).
|
|
2379
2323
|
// Mixed dyn/concrete value channels share checked storage, so either
|
|
2380
|
-
// branch of the result record has the same representation.
|
|
2324
|
+
// branch of the result record has the same representation. A number,
|
|
2325
|
+
// boolean or string channel keeps its own type beside a dyn one (the
|
|
2326
|
+
// `Generator<number>` defaults): its values ride OUT typed and box only
|
|
2327
|
+
// when the result record is built.
|
|
2381
2328
|
if (isStdlibInterface("Generator") ||
|
|
2382
2329
|
isStdlibInterface("AsyncGenerator") ||
|
|
2383
2330
|
isStdlibInterface("IterableIterator") ||
|
|
@@ -2417,9 +2364,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2417
2364
|
}
|
|
2418
2365
|
// PromiseSettledResult<T>'s parts: the lib's PromiseFulfilledResult<T> /
|
|
2419
2366
|
// PromiseRejectedResult interfaces map to the documented HONEST SUBSET
|
|
2420
|
-
// record { status: string }
|
|
2421
|
-
// record-field representation here (void fields don't exist; a jsval
|
|
2422
|
-
// field would absorb the record), and the manual-allSettled pattern this
|
|
2367
|
+
// record { status: string }. The manual-allSettled pattern this
|
|
2423
2368
|
// mapping exists for (pMap) discards them. Construction literals still
|
|
2424
2369
|
// EVALUATE a dropped initializer for its effects — the awaited mapper —
|
|
2425
2370
|
// via the object-literal lowering's drop path. Both interfaces intern
|
|
@@ -2755,8 +2700,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2755
2700
|
return hybrid;
|
|
2756
2701
|
// Recursive and Symbol-keyed callable objects need their complete live
|
|
2757
2702
|
// property table; dropping those members into a plain closure loses data.
|
|
2758
|
-
if (
|
|
2759
|
-
checker.getCallSignatures(widened).length > 0 &&
|
|
2703
|
+
if (checker.getCallSignatures(widened).length > 0 &&
|
|
2760
2704
|
checker.getPropertiesOfType(widened).length > 0)
|
|
2761
2705
|
return DYN;
|
|
2762
2706
|
}
|
|
@@ -2790,7 +2734,6 @@ function mapTypeInner(type, ctx) {
|
|
|
2790
2734
|
for (const p of sig.getParameters()) {
|
|
2791
2735
|
const decl = checker.valueDeclarationOf(p);
|
|
2792
2736
|
const rest = decl !== undefined && ts.isParameter(decl) && decl.dotDotDotToken !== undefined;
|
|
2793
|
-
// JavaScript rest values retain the checked-dynamic/island runtime-
|
|
2794
2737
|
// arity ABI selected by lambdaSignature. Treating an inferred any[]
|
|
2795
2738
|
// declaration as a typed packed-array closure would bypass its boxed
|
|
2796
2739
|
// spread/error semantics and change coverage classification.
|
|
@@ -2837,7 +2780,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2837
2780
|
// Belt and braces for non-strict type worlds: an optional param's
|
|
2838
2781
|
// ABI slot is always the undefined-armed union (strictNullChecks
|
|
2839
2782
|
// already spells it that way; arm it here if the world didn't).
|
|
2840
|
-
if (optional && pt && pt.kind !== "void" && pt.kind !== "
|
|
2783
|
+
if (optional && pt && pt.kind !== "void" && pt.kind !== "dyn") {
|
|
2841
2784
|
const armed = withUndefinedArm(pt, ctx.unions);
|
|
2842
2785
|
if (!armed)
|
|
2843
2786
|
return null;
|
|
@@ -2866,7 +2809,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2866
2809
|
const jsUnitReturn = sigDecl !== undefined &&
|
|
2867
2810
|
isJsSourceFile(sigDecl.getSourceFile()) &&
|
|
2868
2811
|
(retT.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) !== 0;
|
|
2869
|
-
let ret = jsUnitReturn || (
|
|
2812
|
+
let ret = jsUnitReturn || (retT.flags & ts.TypeFlags.Any) !== 0
|
|
2870
2813
|
? DYN
|
|
2871
2814
|
: retT.flags & ts.TypeFlags.Never
|
|
2872
2815
|
? VOID
|
|
@@ -3068,24 +3011,7 @@ function mapTypeInner(type, ctx) {
|
|
|
3068
3011
|
continue;
|
|
3069
3012
|
}
|
|
3070
3013
|
const mapped = mapType(part, ctx);
|
|
3071
|
-
// A jsval PART absorbs the union: `GeneratedFile | undefined` (a
|
|
3072
|
-
// package-declared arm) is one island handle — the engine's
|
|
3073
|
-
// undefined/null ARE handle values, and any data sibling is
|
|
3074
|
-
// representable in the engine too, so the handle is the one
|
|
3075
|
-
// runtime representation. Exactly tsc's own collapse for `any | T`
|
|
3076
|
-
// (which never even reaches here as a union). Sibling arms that
|
|
3077
|
-
// already mapped don't matter — and ones that would NOT map on
|
|
3078
|
-
// their own don't block the absorb either: a STATIC value of such
|
|
3079
|
-
// an arm flowing in still fences per-site at the marshal
|
|
3080
|
-
// (jsvalIn's boundary message).
|
|
3081
|
-
if (mapped?.kind === "jsval")
|
|
3082
|
-
return JSVAL;
|
|
3083
3014
|
if (!mapped) {
|
|
3084
|
-
// Before failing the whole union, let a LATER jsval part absorb.
|
|
3085
|
-
for (const rest of ts.constituentTypes(widened)) {
|
|
3086
|
-
if (mapType(rest, ctx)?.kind === "jsval")
|
|
3087
|
-
return JSVAL;
|
|
3088
|
-
}
|
|
3089
3015
|
return null;
|
|
3090
3016
|
}
|
|
3091
3017
|
if (mapped.kind === "void") {
|
|
@@ -3131,10 +3057,8 @@ function mapTypeInner(type, ctx) {
|
|
|
3131
3057
|
// DYN WHOLESALE — the checked-dynamic tree's scalar kinds ARE the scalar arms (===,
|
|
3132
3058
|
// typeof, switch dispatch all exact), typeof/Array.isArray/unit
|
|
3133
3059
|
// narrowing on dyn already dispatches natively (dynTest +
|
|
3134
|
-
// maybeNarrow's validated scalar extraction),
|
|
3135
|
-
//
|
|
3136
|
-
// tag is ever needed and the component fence retires at these
|
|
3137
|
-
// sites. The domain is dynSubsumableUnionArm's: scalars, units, dyn
|
|
3060
|
+
// maybeNarrow's validated scalar extraction), so no union tag is
|
|
3061
|
+
// needed. The domain is dynSubsumableUnionArm's: scalars, units, dyn
|
|
3138
3062
|
// itself, and records/arrays inside the dynFrom conversion domain
|
|
3139
3063
|
// (those enter as dyn data — the deep-copy stance, so identity and
|
|
3140
3064
|
// mutation coupling with the source value end at the slot;
|
|
@@ -3543,11 +3467,6 @@ function mapBoundIndexedAccess(type, ctx) {
|
|
|
3543
3467
|
* (`{a?: string}` and `{a: string | undefined}` are ONE shape) — those stay
|
|
3544
3468
|
* unmapped inside generic bodies; their concrete uses resolve structurally
|
|
3545
3469
|
* through mapRecordType. */
|
|
3546
|
-
/** `Awaited<T>` where T is a STILL-GENERIC type parameter, resolved against
|
|
3547
|
-
* the lowerer's binding: promise kinds unwrap recursively (the alias's own
|
|
3548
|
-
* recursion), everything else is already its awaited self — including
|
|
3549
|
-
* jsval (the engine's await handles thenables natively). Null off the
|
|
3550
|
-
* shape (not the lib's Awaited over a bound parameter). */
|
|
3551
3470
|
/** True for a TypeNode spelling the `const` assertion (`e as const`). */
|
|
3552
3471
|
export function isConstAssertionTypeNode(t) {
|
|
3553
3472
|
return (t.kind === ts.SyntaxKind.TypeReference &&
|
|
@@ -3751,7 +3670,7 @@ export function genResultRecord(yieldT, retT, shapes, unions) {
|
|
|
3751
3670
|
byKey.set(typeKey(a), a);
|
|
3752
3671
|
return true;
|
|
3753
3672
|
}
|
|
3754
|
-
if (t.kind === "regex" || t.kind === "date" || t.kind === "
|
|
3673
|
+
if (t.kind === "regex" || t.kind === "date" || t.kind === "generator") {
|
|
3755
3674
|
return false; // no legal union arm exists for these kinds
|
|
3756
3675
|
}
|
|
3757
3676
|
byKey.set(typeKey(t), t);
|
|
@@ -3809,8 +3728,6 @@ export function withUndefinedArm(t, unions) {
|
|
|
3809
3728
|
/** Preserve a nullish runtime value that JavaScript inference omitted. */
|
|
3810
3729
|
export function withUnitArm(t, kind, unions) {
|
|
3811
3730
|
const unit = { kind };
|
|
3812
|
-
if (t.kind === "jsval")
|
|
3813
|
-
return t;
|
|
3814
3731
|
if (t.kind === "union") {
|
|
3815
3732
|
const def = unions.get(t.unionId);
|
|
3816
3733
|
if (!def)
|
|
@@ -3878,8 +3795,7 @@ function mapHybridCallableIntersection(widened, ctx) {
|
|
|
3878
3795
|
if (p.flags & (ts.SymbolFlags.GetAccessor | ts.SymbolFlags.SetAccessor))
|
|
3879
3796
|
return null;
|
|
3880
3797
|
const pt = mapType(checker.getTypeOfSymbol(p), ctx);
|
|
3881
|
-
|
|
3882
|
-
if (!pt || pt.kind === "void" || pt.kind === "jsval")
|
|
3798
|
+
if (!pt || pt.kind === "void")
|
|
3883
3799
|
return null;
|
|
3884
3800
|
fields.push({ name: p.name, type: pt });
|
|
3885
3801
|
declaredOrder.push(p.name);
|
|
@@ -4163,11 +4079,10 @@ function mapRecordType(widened, ctx) {
|
|
|
4163
4079
|
if (inner === null)
|
|
4164
4080
|
return null; // a pending placeholder, if minted, stays unfinalized (prunes as unreachable)
|
|
4165
4081
|
if (!("fields" in inner)) {
|
|
4166
|
-
// A whole-type answer (the jsval/dyn absorbs, the header-family
|
|
4167
4082
|
// canonical shape). If a back-reference minted a placeholder for
|
|
4168
4083
|
// this very type meanwhile, the two answers disagree — fence rather
|
|
4169
4084
|
// than leave references to a shape that is not this type's mapping.
|
|
4170
|
-
if (shapes.recursivePending(widened) && inner.kind !== "
|
|
4085
|
+
if (shapes.recursivePending(widened) && inner.kind !== "dyn")
|
|
4171
4086
|
return null;
|
|
4172
4087
|
return inner;
|
|
4173
4088
|
}
|
|
@@ -4294,12 +4209,7 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4294
4209
|
if (!stringKey(info.keyType) && !(info.keyType.flags & ts.TypeFlags.Number))
|
|
4295
4210
|
return null;
|
|
4296
4211
|
const iv = mapType(info.valueType, ctx);
|
|
4297
|
-
// A jsval-valued signature absorbs the shape: `Record<string,
|
|
4298
4212
|
// JSONValue>` (a package's own JSON alias) and `Record<string, any>`
|
|
4299
|
-
// are one island object — the overflow map has no handle slot, and
|
|
4300
|
-
// island objects hold arbitrary engine values natively.
|
|
4301
|
-
if (iv?.kind === "jsval")
|
|
4302
|
-
return JSVAL;
|
|
4303
4213
|
if (!iv || !isSupportedIndexValue(iv))
|
|
4304
4214
|
return null;
|
|
4305
4215
|
if (v !== null && !typeEquals(v, iv))
|
|
@@ -4463,7 +4373,7 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4463
4373
|
let readT = null;
|
|
4464
4374
|
if (getDecl) {
|
|
4465
4375
|
readT = mapType(checker.getTypeOfSymbol(p), ctx);
|
|
4466
|
-
if (readT === null
|
|
4376
|
+
if (readT === null)
|
|
4467
4377
|
return null;
|
|
4468
4378
|
}
|
|
4469
4379
|
let writeT = null;
|
|
@@ -4475,10 +4385,7 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4475
4385
|
// A void/unit-typed write slot has no value form; DIVERGENT
|
|
4476
4386
|
// getter/setter types stay out too (one property, one type —
|
|
4477
4387
|
// the class-accessor stance).
|
|
4478
|
-
if (writeT === null ||
|
|
4479
|
-
writeT.kind === "void" ||
|
|
4480
|
-
writeT.kind === "jsval" ||
|
|
4481
|
-
isUnitType(writeT))
|
|
4388
|
+
if (writeT === null || writeT.kind === "void" || isUnitType(writeT))
|
|
4482
4389
|
return null;
|
|
4483
4390
|
if (readT !== null && typeKey(readT) !== typeKey(writeT))
|
|
4484
4391
|
return null;
|
|
@@ -4515,12 +4422,12 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4515
4422
|
// initializer is an EMPTY array literal inside a const assertion IS
|
|
4516
4423
|
// the empty tuple — map it exactly as the tuple branch does (the
|
|
4517
4424
|
// unit-element array; see the `[] as const` rule there).
|
|
4518
|
-
if (
|
|
4425
|
+
if (pt === null &&
|
|
4519
4426
|
(fieldTs.flags & ts.TypeFlags.Any) !== 0 &&
|
|
4520
4427
|
constAssertedEmptyArrayProp(p, ctx)) {
|
|
4521
4428
|
pt = arrayOf(unitOnlyUnion(ctx.unions));
|
|
4522
4429
|
}
|
|
4523
|
-
if (pt === null &&
|
|
4430
|
+
if (pt === null && (fieldTs.flags & ts.TypeFlags.Any) !== 0)
|
|
4524
4431
|
pt = DYN;
|
|
4525
4432
|
// Unit-only FIELDS (`{ msg?: undefined }` — the discriminated-union
|
|
4526
4433
|
// absent-field idiom — and `{ p: undefined }` spellings): the
|
|
@@ -4540,12 +4447,7 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4540
4447
|
// accessor dispatch, so the shape stays unmapped.
|
|
4541
4448
|
if (accessorSlotProp(p.name) !== null)
|
|
4542
4449
|
return null;
|
|
4543
|
-
// Keep ambient abort handles in a native record slot under --dynamic:
|
|
4544
4450
|
// an options record with `signal?: AbortSignal` must not turn its
|
|
4545
|
-
// unrelated static fields into island properties. Other bare jsval
|
|
4546
|
-
// fields still absorb the record into one island object.
|
|
4547
|
-
if (pt.kind === "jsval" && !(ctx.dynamic && isAmbientAbortHandleType(fieldTs, ctx)))
|
|
4548
|
-
return JSVAL;
|
|
4549
4451
|
fields.push({ name: p.name, type: pt });
|
|
4550
4452
|
}
|
|
4551
4453
|
// getPropertiesOfType yields DECLARATION order (interface/alias/literal
|