@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
|
@@ -14,12 +14,11 @@ import { lowerGenMethodCall } from "./lower-generators.js";
|
|
|
14
14
|
import { lowerClassSymbolMethodCall } from "./symbol-methods.js";
|
|
15
15
|
import { errorToStringCall } from "./error-methods.js";
|
|
16
16
|
import { lowerClassPrototypeAssign, lowerClassPrototypeDescriptors } from "./class-prototypes.js";
|
|
17
|
-
import { BYTES_ELEMENT_NAME, BIGINT_T, BOOL, CAUGHT, DYN, F64,
|
|
17
|
+
import { BYTES_ELEMENT_NAME, BIGINT_T, BOOL, CAUGHT, DYN, F64, NULL_T, STRING, SYMBOL_T, UNDEFINED_T, VOID, arrayOf, canBoxFuncIntoDyn, canConvertToDyn, canDynCheckTo, funcOf, isDynTypedRefType, isUnitType, shapeHasAccessorSlots, typeEquals, } from "../../ir/ir.js";
|
|
18
18
|
import { isJsSourceFile, locOf, requireSpecOf } from "../program.js";
|
|
19
19
|
import { isGenericCallableMemberType, typeKey } from "../type-mapper.js";
|
|
20
|
-
import {
|
|
20
|
+
import { dynFallbackType, jsFuncNameOf, newFnCtx, staticImportNamespaceType } from "./lowerer.js";
|
|
21
21
|
import { NARROW_FIRST, STRING_INDEX_METHODS, STR_METHODS, stdlibGlobalNameOf } from "./surfaces.js";
|
|
22
|
-
import { requiresDynamicDiag } from "../../diagnostics/diagnostic.js";
|
|
23
22
|
import { dynStringReceiver } from "./containers/dynamic-receivers.js";
|
|
24
23
|
import { lowerArrayConstructor, lowerArrayFromCall, lowerArrayOfCall, } from "./containers/array-construction.js";
|
|
25
24
|
import { lowerDynArrayFilterCall, lowerDynArrayFlatMapCall } from "./containers/array-callbacks.js";
|
|
@@ -47,6 +46,7 @@ import { EMITTER_API_MEMBERS, exactClassOfReceiver, exactInstanceClassOf, findGe
|
|
|
47
46
|
import { classCallbackCall, isClassCallback } from "./class-callbacks.js";
|
|
48
47
|
import { emitterRooted, lowerEmitterMethodCall } from "./lower-event-emitter.js";
|
|
49
48
|
import { lowerConsoleInspectArg, lowerFormatCall } from "./lower-inspect.js";
|
|
49
|
+
import { lowerConsoleInstanceCall } from "./lower-console.js";
|
|
50
50
|
import { STREAM_API_MEMBERS, lowerStreamMethodCall, lowerStreamStaticCall, streamSidesOf, } from "./lower-stream.js";
|
|
51
51
|
import { ambientNsRootOf, ambientUndefReadType, ambientUndefVarRootOf, ambientUndefinedFnSymbolOf, contextualUndefReadType, fenceEarlyAliasUse, fenceEarlyNsMemberRef, nsMemberIdentOf, nsUndefRead, } from "./lower-namespaces.js";
|
|
52
52
|
import { expandoMemberRead } from "./lower-expando.js";
|
|
@@ -57,28 +57,10 @@ import { lowerClassDataDescriptor, lowerClassDescriptorRead } from "./class-desc
|
|
|
57
57
|
import { classStaticDataFor } from "./class-static-data.js";
|
|
58
58
|
import { lowerUrlFactory } from "./lower-url.js";
|
|
59
59
|
import { nullishValueUnitOf } from "./binding-analysis.js";
|
|
60
|
-
import { spreadNeedsRuntimeArity, completeFuncValueArgs, lowerSpreadArgsCall,
|
|
60
|
+
import { spreadNeedsRuntimeArity, completeFuncValueArgs, lowerSpreadArgsCall, completeArgs, } from "./call-arguments.js";
|
|
61
61
|
import { isThisParameter } from "./call-signatures.js";
|
|
62
62
|
import { checkedArmExtraction } from "./coercions/unions.js";
|
|
63
63
|
import { requireObjLitGenericReceiver, objLitGenericFnNodeOf, objLitGenericFnInfoOf, genericCallInstance, } from "./generic-functions.js";
|
|
64
|
-
/** An island call result the .d.ts DECLARES as a primitive exits eagerly
|
|
65
|
-
* to that static type — the member-read rule's call sibling (see the
|
|
66
|
-
* getProp lowering in lower-exprs.ts): primitives copy by value, every
|
|
67
|
-
* static consumer works on the result, and a lying declaration throws the
|
|
68
|
-
* catchable TypeError. Chain-handled forms stay jsval (the optChain's
|
|
69
|
-
* unit path is the engine's undefined). */
|
|
70
|
-
export function islandPrimitiveExit(lowerer, call, result) {
|
|
71
|
-
if (call.questionDotToken)
|
|
72
|
-
return result;
|
|
73
|
-
if (ts.isPropertyAccessExpression(call.expression) && call.expression.questionDotToken)
|
|
74
|
-
return result;
|
|
75
|
-
const declared = lowerer.mapTypeOf(lowerer.typeOf(call));
|
|
76
|
-
if (declared &&
|
|
77
|
-
(declared.kind === "f64" || declared.kind === "bool" || declared.kind === "string")) {
|
|
78
|
-
return { kind: "jsExit", value: result, type: declared, loc: result.loc };
|
|
79
|
-
}
|
|
80
|
-
return result;
|
|
81
|
-
}
|
|
82
64
|
export function lowerCall(lowerer, expr) {
|
|
83
65
|
const loc = locOf(expr);
|
|
84
66
|
// Object's checker return type is `any`. Claim known object inputs
|
|
@@ -280,12 +262,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
280
262
|
}
|
|
281
263
|
const args = expr.arguments.map((a) => {
|
|
282
264
|
const lowered = lowerer.lowerExpr(a);
|
|
283
|
-
if (lowered.type.kind === "jsval") {
|
|
284
|
-
// Node prints objects with util.inspect formatting, which
|
|
285
|
-
// String() cannot match — silent divergence is banned. Templates
|
|
286
|
-
// are ToString (Node-exact), casts are validated: both honest.
|
|
287
|
-
lowerer.unsupported("SC1090", a, `${surface} of 'any' values (wrap it: ${surface}(\`\${v}\`), or validate with 'as <type>' first)`);
|
|
288
|
-
}
|
|
289
265
|
// Checked-dynamic values carry their own shape, so the runtime
|
|
290
266
|
// renders them exactly like Node's console formatter renders a
|
|
291
267
|
// non-format argument: strings VERBATIM, everything else through
|
|
@@ -347,6 +323,9 @@ export function lowerCall(lowerer, expr) {
|
|
|
347
323
|
loc,
|
|
348
324
|
});
|
|
349
325
|
}
|
|
326
|
+
const consoleInstanceCall = lowerConsoleInstanceCall(lowerer, expr, loc);
|
|
327
|
+
if (consoleInstanceCall)
|
|
328
|
+
return consoleInstanceCall;
|
|
350
329
|
if (ts.isPropertyAccessExpression(expr.expression) &&
|
|
351
330
|
TIMER_MODULE_MEMBERS.has(expr.expression.name.text) &&
|
|
352
331
|
lowerer.stdlibGlobalMember(expr.expression, "globalThis") === expr.expression.name.text) {
|
|
@@ -580,20 +559,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
580
559
|
if (name === "String")
|
|
581
560
|
return lowerer.ensureString(arg, argNode);
|
|
582
561
|
}
|
|
583
|
-
// __island_eval: the internal island testing hook (eval in the embedded
|
|
584
|
-
// engine, String(result) back). Provenance-checked like setTimeout.
|
|
585
|
-
// Only meaningful when the engine is linked: without --dynamic it is a
|
|
586
|
-
// clean requires-dynamic diagnostic, never an ICE or a link error.
|
|
587
|
-
if (ts.isIdentifier(expr.expression) &&
|
|
588
|
-
expr.expression.text === "__island_eval" &&
|
|
589
|
-
lowerer.isStdlibSymbol(lowerer.resolveValueSymbol(expr.expression) ?? undefined)) {
|
|
590
|
-
if (!lowerer.dynamic) {
|
|
591
|
-
lowerer.pushDiag(requiresDynamicDiag("'__island_eval'", loc));
|
|
592
|
-
throw new PoisonError();
|
|
593
|
-
}
|
|
594
|
-
const code = lowerer.lowerExprExpecting(expr.arguments[0], STRING);
|
|
595
|
-
return { kind: "libCall", fn: "island.eval", args: [code], type: STRING, loc };
|
|
596
|
-
}
|
|
597
562
|
// Computed calls preserve their evaluated receiver just like dotted
|
|
598
563
|
// calls, including when the property is keyed by a native symbol.
|
|
599
564
|
if (ts.isElementAccessExpression(expr.expression) &&
|
|
@@ -640,129 +605,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
640
605
|
};
|
|
641
606
|
}
|
|
642
607
|
}
|
|
643
|
-
// Island calls. A property-access callee whose receiver is an 'any'
|
|
644
|
-
// value is an engine method call (this = receiver, JS-exact); any other
|
|
645
|
-
// 'any'-typed callee is an engine function call. Arguments marshal in;
|
|
646
|
-
// results stay island values.
|
|
647
|
-
// A questionDotToken here is always chain-handled (the gate at the top
|
|
648
|
-
// of lowerCall routed unhandled ones to the chain lowering), so
|
|
649
|
-
// `x?.y(...)` re-dispatches into this same method-call form with the
|
|
650
|
-
// receiver reading back as the chain's bound handle.
|
|
651
|
-
if (ts.isPropertyAccessExpression(expr.expression) &&
|
|
652
|
-
lowerer.isIslandExpr(expr.expression.expression)) {
|
|
653
|
-
// Typed fetch/Web Streams handles map to island values under
|
|
654
|
-
// --dynamic, but their inventory still owns which methods exist.
|
|
655
|
-
// Reject unsupported rows before the universal jsval method path.
|
|
656
|
-
lowerer.fenceStaticResponseMember(expr.expression, "call");
|
|
657
|
-
lowerer.fenceStaticHeadersMember(expr.expression, "call");
|
|
658
|
-
lowerer.fenceStaticReadableStreamMember(expr.expression, "call");
|
|
659
|
-
const receiver = lowerer.lowerExpr(expr.expression.expression);
|
|
660
|
-
// A checker-`any` receiver whose VALUE lives in the checked-dynamic tree (a
|
|
661
|
-
// checked-dynamic local behind the any-typed spelling — the JS
|
|
662
|
-
// WeakSet placeholder, rest-args arrays): the checked-dynamic
|
|
663
|
-
// method machinery owns it — receiver-kind dispatch, stored-member
|
|
664
|
-
// calls, honest fences — never an engine op over a dyn value.
|
|
665
|
-
if (receiver.type.kind === "dyn") {
|
|
666
|
-
const served = lowerDynReceiverMethodCall(lowerer, expr, expr.expression);
|
|
667
|
-
if (served)
|
|
668
|
-
return served;
|
|
669
|
-
lowerer.unsupported("SC1100", expr, `'.${expr.expression.name.text}()' calls through 'unknown'-valued receivers in dynamically-executed positions`);
|
|
670
|
-
}
|
|
671
|
-
const args = expr.arguments.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a));
|
|
672
|
-
const result = {
|
|
673
|
-
kind: "jsOp",
|
|
674
|
-
op: "callMethod",
|
|
675
|
-
name: expr.expression.name.text,
|
|
676
|
-
args: [receiver, ...args],
|
|
677
|
-
type: JSVAL,
|
|
678
|
-
loc,
|
|
679
|
-
};
|
|
680
|
-
return islandPrimitiveExit(lowerer, expr, result);
|
|
681
|
-
}
|
|
682
|
-
if (lowerer.isIslandExpr(expr.expression)) {
|
|
683
|
-
// `o.m(...)` where o LOWERS checked-dynamic and the checker types
|
|
684
|
-
// `o.m` 'any' (a member read behind an 'object'/'unknown'-typed
|
|
685
|
-
// bag): METHOD-CALL semantics — receiver-kind dispatch (dynInvoke),
|
|
686
|
-
// so `this` binds and a WRAPPED island receiver runs the ENGINE's
|
|
687
|
-
// own method (the routed-ops lane). A stored-member dynCall would
|
|
688
|
-
// call engine prototype methods receiverless — the this-less
|
|
689
|
-
// `list.slice()` ToObject TypeError. Spread arguments keep the
|
|
690
|
-
// stored-member path below (the runtime-arity lane owns them).
|
|
691
|
-
if (ts.isPropertyAccessExpression(expr.expression) &&
|
|
692
|
-
!expr.expression.questionDotToken &&
|
|
693
|
-
!expr.questionDotToken &&
|
|
694
|
-
!expr.arguments.some((a) => ts.isSpreadElement(a))) {
|
|
695
|
-
const recvProbe = tryLowerExpression(lowerer, expr.expression.expression);
|
|
696
|
-
if (recvProbe?.type.kind === "dyn") {
|
|
697
|
-
const args = expr.arguments.map((a) => lowerer.lowerExprExpecting(a, DYN));
|
|
698
|
-
return {
|
|
699
|
-
kind: "dynInvoke",
|
|
700
|
-
recv: recvProbe,
|
|
701
|
-
method: expr.expression.name.text,
|
|
702
|
-
calleeName: expr.expression.getText(),
|
|
703
|
-
args,
|
|
704
|
-
type: DYN,
|
|
705
|
-
loc,
|
|
706
|
-
};
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
const callee = lowerer.lowerExpr(expr.expression);
|
|
710
|
-
// A checker-`any` callee that LOWERED checked-dynamic (a dyn member
|
|
711
|
-
// chain's stored function): the checked-dynamic tree's own call — dynCall reads and
|
|
712
|
-
// calls the stored member with Node's is-not-a-function TypeError
|
|
713
|
-
// on refusal.
|
|
714
|
-
if (callee.type.kind === "dyn") {
|
|
715
|
-
const args = expr.arguments.map((a) => lowerer.lowerExprExpecting(a, DYN));
|
|
716
|
-
const calleeName = ts.isPropertyAccessExpression(expr.expression)
|
|
717
|
-
? expr.expression.getText()
|
|
718
|
-
: ts.isIdentifier(expr.expression)
|
|
719
|
-
? expr.expression.text
|
|
720
|
-
: "value";
|
|
721
|
-
return { kind: "dynCall", callee, calleeName, args, type: DYN, loc };
|
|
722
|
-
}
|
|
723
|
-
// `fn(...args)` — a TRAILING spread into an island call: the
|
|
724
|
-
// engine's own apply (`fn.apply(undefined, argsArray)`); leading
|
|
725
|
-
// plain arguments prepend through `[l1, l2].concat(argsArray)`
|
|
726
|
-
// (concat flattens the array argument one level — exactly the
|
|
727
|
-
// spread). Other spread shapes keep the syntax fence.
|
|
728
|
-
if (expr.arguments.length > 0 &&
|
|
729
|
-
ts.isSpreadElement(expr.arguments[expr.arguments.length - 1]) &&
|
|
730
|
-
expr.arguments.slice(0, -1).every((a) => !ts.isSpreadElement(a))) {
|
|
731
|
-
const spread = expr.arguments[expr.arguments.length - 1];
|
|
732
|
-
const spreadV = lowerer.jsvalIn(lowerer.lowerExpr(spread.expression), spread.expression);
|
|
733
|
-
const leading = expr.arguments
|
|
734
|
-
.slice(0, -1)
|
|
735
|
-
.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a));
|
|
736
|
-
const argsArr = leading.length === 0
|
|
737
|
-
? spreadV
|
|
738
|
-
: {
|
|
739
|
-
kind: "jsOp",
|
|
740
|
-
op: "callMethod",
|
|
741
|
-
name: "concat",
|
|
742
|
-
args: [{ kind: "jsOp", op: "arrLit", args: leading, type: JSVAL, loc }, spreadV],
|
|
743
|
-
type: JSVAL,
|
|
744
|
-
loc,
|
|
745
|
-
};
|
|
746
|
-
const result = {
|
|
747
|
-
kind: "jsOp",
|
|
748
|
-
op: "callMethod",
|
|
749
|
-
name: "apply",
|
|
750
|
-
args: [callee, { kind: "jsOp", op: "undefLit", args: [], type: JSVAL, loc }, argsArr],
|
|
751
|
-
type: JSVAL,
|
|
752
|
-
loc,
|
|
753
|
-
};
|
|
754
|
-
return islandPrimitiveExit(lowerer, expr, result);
|
|
755
|
-
}
|
|
756
|
-
const args = expr.arguments.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a));
|
|
757
|
-
const result = {
|
|
758
|
-
kind: "jsOp",
|
|
759
|
-
op: "callFn",
|
|
760
|
-
args: [callee, ...args],
|
|
761
|
-
type: JSVAL,
|
|
762
|
-
loc,
|
|
763
|
-
};
|
|
764
|
-
return islandPrimitiveExit(lowerer, expr, result);
|
|
765
|
-
}
|
|
766
608
|
// Builtin-module functions (fs, path, os, ...): named imports whose
|
|
767
609
|
// binding resolves to a supported builtin specifier lower to `libCall`.
|
|
768
610
|
// A user local shadowing an import has a different symbol and never
|
|
@@ -851,9 +693,8 @@ export function lowerCall(lowerer, expr) {
|
|
|
851
693
|
}
|
|
852
694
|
// STATIC parseInt/parseFloat/isNaN/isFinite (num.parseInt /
|
|
853
695
|
// num.parseFloat / num.isNaN / number.isFinite — scr_string.c,
|
|
854
|
-
// scr_lib.c; ECMA-exact, Node is the oracle).
|
|
855
|
-
//
|
|
856
|
-
// different, non-stdlib symbol. parseInt's omitted radix completes
|
|
696
|
+
// scr_lib.c; ECMA-exact, Node is the oracle). Declaration provenance
|
|
697
|
+
// excludes shadowed names. parseInt's omitted radix completes
|
|
857
698
|
// to 0 — the spec's "undefined" (base 10 with the 0x hex escape);
|
|
858
699
|
// parseFloat lowers the STRING form only (Node would ToString other
|
|
859
700
|
// values — no static story); isNaN/isFinite's arguments are
|
|
@@ -935,8 +776,7 @@ export function lowerCall(lowerer, expr) {
|
|
|
935
776
|
if (v.type.kind === "dyn") {
|
|
936
777
|
data = v;
|
|
937
778
|
}
|
|
938
|
-
else if (v.kind === "unitLit" ||
|
|
939
|
-
(v.type.kind !== "jsval" && lowerer.dynConvertible(v.type))) {
|
|
779
|
+
else if (v.kind === "unitLit" || lowerer.dynConvertible(v.type)) {
|
|
940
780
|
data = { kind: "dynFrom", value: v, type: DYN, loc };
|
|
941
781
|
}
|
|
942
782
|
else {
|
|
@@ -950,11 +790,10 @@ export function lowerCall(lowerer, expr) {
|
|
|
950
790
|
loc,
|
|
951
791
|
};
|
|
952
792
|
}
|
|
953
|
-
// Island-backed globals (parseFloat, isFinite): the engine's own
|
|
954
793
|
// global function executes — callFn(globalGet(name)) — and the
|
|
955
794
|
// result exits to the declared static type. A user function
|
|
956
795
|
// shadowing the name has a different, non-stdlib symbol.
|
|
957
|
-
const islFn = lowerer.
|
|
796
|
+
const islFn = lowerer.stdlibGlobalFnOf(expr.expression);
|
|
958
797
|
if (islFn && expr.arguments.length !== islFn.args.length) {
|
|
959
798
|
const name = expr.expression.text;
|
|
960
799
|
lowerer.noLowering(`${name} with ${expr.arguments.length} argument${expr.arguments.length === 1 ? "" : "s"}`, expr);
|
|
@@ -962,31 +801,14 @@ export function lowerCall(lowerer, expr) {
|
|
|
962
801
|
if (islFn && expr.arguments.length === islFn.args.length) {
|
|
963
802
|
// The static forms above already took the exactly-typed argument
|
|
964
803
|
// (a string for parseFloat, a number for isFinite): name the
|
|
965
|
-
// argument type that
|
|
966
|
-
//
|
|
967
|
-
//
|
|
968
|
-
const argText =
|
|
804
|
+
// argument type that refused the call, so the message states the
|
|
805
|
+
// condition rather than reading as if the global itself were
|
|
806
|
+
// unsupported.
|
|
807
|
+
const argText = loweredArgumentText(lowerer, expr.arguments[0]);
|
|
969
808
|
const exact = expr.expression.text === "isFinite" ? "number" : "string";
|
|
970
|
-
lowerer.
|
|
971
|
-
? "convert the argument explicitly first (for example String(x), or narrow the union)
|
|
972
|
-
: "
|
|
973
|
-
const callee = {
|
|
974
|
-
kind: "jsOp",
|
|
975
|
-
op: "globalGet",
|
|
976
|
-
name: expr.expression.text,
|
|
977
|
-
args: [],
|
|
978
|
-
type: JSVAL,
|
|
979
|
-
loc,
|
|
980
|
-
};
|
|
981
|
-
const args = expr.arguments.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a));
|
|
982
|
-
const result = {
|
|
983
|
-
kind: "jsOp",
|
|
984
|
-
op: "callFn",
|
|
985
|
-
args: [callee, ...args],
|
|
986
|
-
type: JSVAL,
|
|
987
|
-
loc,
|
|
988
|
-
};
|
|
989
|
-
return { kind: "jsExit", value: result, type: islFn.ret, loc };
|
|
809
|
+
lowerer.refuseUnsupportedApi(`'${expr.expression.text}' with a '${argText}' argument`, expr, exact === "string"
|
|
810
|
+
? "only a string argument compiles statically: convert the argument explicitly first (for example String(x), or narrow the union)"
|
|
811
|
+
: "only a number argument compiles statically: narrow the argument to a number first");
|
|
990
812
|
}
|
|
991
813
|
}
|
|
992
814
|
// A TYPE-GUARD call on a catch binding (`isErrnoException(err)` —
|
|
@@ -1254,8 +1076,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
1254
1076
|
lowerPromiseAllTupleCall(lowerer, expr, expr.expression) ??
|
|
1255
1077
|
lowerer.lowerPromiseStaticCall(expr, expr.expression) ??
|
|
1256
1078
|
lowerPromiseRejectCall(lowerer, expr, expr.expression) ??
|
|
1257
|
-
// Before the island path: regex-argument replace/replaceAll/split
|
|
1258
|
-
// lower STATICALLY; only the string-pattern overloads are island.
|
|
1259
1079
|
lowerRegexMethodCallWithOptionalArg(lowerer, expr, expr.expression) ??
|
|
1260
1080
|
lowerUrlStaticCall(lowerer, expr, expr.expression) ??
|
|
1261
1081
|
lowerer.lowerUrlMethodCall(expr, expr.expression) ??
|
|
@@ -1304,7 +1124,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
1304
1124
|
lowerStringPrototypeCall(lowerer, expr, expr.expression) ??
|
|
1305
1125
|
lowerStringMethodCallWithOptionalArgs(lowerer, expr, expr.expression) ??
|
|
1306
1126
|
// Typed-array/Buffer receivers and the Buffer statics — before the
|
|
1307
|
-
// island path (bytes never cross the boundary).
|
|
1308
1127
|
lowerer.lowerBytesMethodCall(expr, expr.expression) ??
|
|
1309
1128
|
lowerBytesStaticCall(lowerer, expr, expr.expression) ??
|
|
1310
1129
|
lowerBufferStaticCallWithNarrowedArg(lowerer, expr, expr.expression) ??
|
|
@@ -1312,7 +1131,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
1312
1131
|
// stdlib chokepoint claims the member).
|
|
1313
1132
|
lowerStreamStaticCall(lowerer, expr, expr.expression) ??
|
|
1314
1133
|
// Primitive toString calls, including numeric radices, use the
|
|
1315
|
-
// native formatters before the island method path.
|
|
1316
1134
|
lowerNumberToStringCall(lowerer, expr, expr.expression) ??
|
|
1317
1135
|
// Union receivers whose every arm has a text — the ngrok
|
|
1318
1136
|
// `(chunk: Buffer | string) => chunk.toString()` idiom.
|
|
@@ -1321,31 +1139,23 @@ export function lowerCall(lowerer, expr) {
|
|
|
1321
1139
|
// override-free program classes — "[object Object]", folded.
|
|
1322
1140
|
lowerDefaultToStringCall(lowerer, expr, expr.expression) ??
|
|
1323
1141
|
// The remaining primitive prototype statics — toExponential(),
|
|
1324
|
-
// both toFixed() forms, hasOwnProperty over literal keys.
|
|
1325
|
-
// the island path. Optional-chain spellings first enter the chain
|
|
1326
|
-
// machinery above, then re-enter here with a narrowed chainRecv.
|
|
1142
|
+
// both toFixed() forms, hasOwnProperty over literal keys.
|
|
1327
1143
|
lowerPrimitiveProtoCall(lowerer, expr, expr.expression.expression, expr.expression.name.text, lowerer.checker.getSymbolAtLocation(expr.expression.name)) ??
|
|
1328
1144
|
// hasOwnProperty on a program class CONSTRUCTOR — own statics are
|
|
1329
1145
|
// compile-time-known, so a literal key folds to a constant.
|
|
1330
1146
|
lowerClassHasOwnPropertyCall(lowerer, expr, expr.expression) ??
|
|
1331
1147
|
lowerObjectOwnMethodCall(lowerer, expr, expr.expression) ??
|
|
1332
|
-
// Response constructor
|
|
1333
|
-
//
|
|
1334
|
-
// and generic-call fallbacks (Response.json otherwise reports the
|
|
1335
|
-
// generic SC1090 fence).
|
|
1148
|
+
// Refuse Response constructor operations before generic-call
|
|
1149
|
+
// fallbacks can report an unrelated SC1090 diagnostic.
|
|
1336
1150
|
lowerer.fenceUnsupportedFetchConstructorMember(expr.expression) ??
|
|
1337
1151
|
// Static fetch responses are checked-dynamic handles, but the
|
|
1338
1152
|
// adopted undici declaration exposes a wider API than that handle.
|
|
1339
|
-
//
|
|
1340
|
-
// dyn receiver path can compile them into a runtime missing-method
|
|
1341
|
-
// failure. Dynamic-only rows pass through these checks unchanged.
|
|
1153
|
+
// Refuse unsupported members before generic checked-value dispatch.
|
|
1342
1154
|
lowerer.fenceStaticResponseMember(expr.expression, "call") ??
|
|
1343
1155
|
lowerer.fenceStaticHeadersMember(expr.expression, "call") ??
|
|
1344
1156
|
lowerer.fenceStaticReadableStreamMember(expr.expression, "call") ??
|
|
1345
|
-
lowerer.
|
|
1157
|
+
lowerer.lowerStdlibMethodCall(expr, expr.expression) ??
|
|
1346
1158
|
// Dyn receivers (JSON.parse-derived `unknown`/`any` values) —
|
|
1347
|
-
// validated-extract, then the static machinery. After the island
|
|
1348
|
-
// path (jsval receivers belong there), before the fences.
|
|
1349
1159
|
lowerDynReceiverMethodCall(lowerer, expr, expr.expression) ??
|
|
1350
1160
|
// Narrowing filters (inferred predicates, filter(Boolean)) claim
|
|
1351
1161
|
// their calls before the generic array HOF path types the result
|
|
@@ -1472,9 +1282,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
1472
1282
|
const symbolMethod = lowerClassSymbolMethodCall(lowerer, expr);
|
|
1473
1283
|
if (symbolMethod)
|
|
1474
1284
|
return symbolMethod;
|
|
1475
|
-
const headersIterator = lowerer.lowerDynamicHeadersIteratorCall(expr, expr.expression);
|
|
1476
|
-
if (headersIterator)
|
|
1477
|
-
return headersIterator;
|
|
1478
1285
|
lowerer.fenceUnsupportedFetchConstructorMember(expr.expression);
|
|
1479
1286
|
lowerer.fenceStaticResponseMember(expr.expression, "call");
|
|
1480
1287
|
lowerer.fenceStaticHeadersMember(expr.expression, "call");
|
|
@@ -1663,34 +1470,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
1663
1470
|
if (spreadServed)
|
|
1664
1471
|
return spreadServed;
|
|
1665
1472
|
}
|
|
1666
|
-
// An ISLAND-REST func value called directly (`f(1, 2)` where f is the
|
|
1667
|
-
// --dynamic `(...args) =>` lambda): the type SPELLS its trailing
|
|
1668
|
-
// engine-array param — complete the call exactly like completeArgs'
|
|
1669
|
-
// island pack (fixed slots positionally, missing ones with the
|
|
1670
|
-
// engine's undefined, the surplus marshaled into one fresh engine
|
|
1671
|
-
// array). JS arity, no runtime machinery.
|
|
1672
|
-
if (callee.type.rest === true &&
|
|
1673
|
-
callee.type.restAbi === "jsval" &&
|
|
1674
|
-
callee.type.params.length >= 1 &&
|
|
1675
|
-
callee.type.params[callee.type.params.length - 1].kind === "jsval" &&
|
|
1676
|
-
!expr.arguments.some((a) => ts.isSpreadElement(a))) {
|
|
1677
|
-
const fixed = callee.type.params.slice(0, -1);
|
|
1678
|
-
const args = fixed.map((p, i) => {
|
|
1679
|
-
const a = expr.arguments[i];
|
|
1680
|
-
if (a)
|
|
1681
|
-
return lowerer.lowerExprExpecting(a, p);
|
|
1682
|
-
const absent = omittedArgFor(lowerer, p, loc);
|
|
1683
|
-
if (!absent) {
|
|
1684
|
-
lowerer.unsupported("SC1090", expr, "calls omitting a non-optional parameter of the callee's type");
|
|
1685
|
-
}
|
|
1686
|
-
return absent;
|
|
1687
|
-
});
|
|
1688
|
-
const restArgs = expr.arguments
|
|
1689
|
-
.slice(fixed.length)
|
|
1690
|
-
.map((a) => lowerer.lowerExprExpecting(a, JSVAL));
|
|
1691
|
-
args.push({ kind: "jsOp", op: "arrLit", args: restArgs, type: JSVAL, loc });
|
|
1692
|
-
return { kind: "callValue", callee, args, type: callee.type.ret, loc };
|
|
1693
|
-
}
|
|
1694
1473
|
// A JS call with MORE arguments than the callee's lowered signature
|
|
1695
1474
|
// (`cb(1, 'x')` where the mustCall wrapper's inferred type declared
|
|
1696
1475
|
// fewer params — tsc's JS world doesn't police arity): ride the
|
|
@@ -2204,8 +1983,7 @@ const ARRAY_BORROW_METHODS = new Set([
|
|
|
2204
1983
|
"some",
|
|
2205
1984
|
]);
|
|
2206
1985
|
function lowerArrayPrototypeBorrowCall(lowerer, call, access) {
|
|
2207
|
-
if (
|
|
2208
|
-
!isJsSourceFile(call.getSourceFile()) ||
|
|
1986
|
+
if (!isJsSourceFile(call.getSourceFile()) ||
|
|
2209
1987
|
call.questionDotToken ||
|
|
2210
1988
|
access.questionDotToken ||
|
|
2211
1989
|
access.name.text !== "call" ||
|
|
@@ -2239,9 +2017,7 @@ function lowerArrayPrototypeBorrowCall(lowerer, call, access) {
|
|
|
2239
2017
|
};
|
|
2240
2018
|
}
|
|
2241
2019
|
function lowerObjectOwnPrototypeCall(lowerer, call, access) {
|
|
2242
|
-
if (
|
|
2243
|
-
access.name.text !== "call" ||
|
|
2244
|
-
!ts.isPropertyAccessExpression(access.expression))
|
|
2020
|
+
if (access.name.text !== "call" || !ts.isPropertyAccessExpression(access.expression))
|
|
2245
2021
|
return null;
|
|
2246
2022
|
const method = access.expression;
|
|
2247
2023
|
const enumerable = method.name.text === "propertyIsEnumerable";
|
|
@@ -2258,8 +2034,7 @@ function lowerObjectOwnPrototypeCall(lowerer, call, access) {
|
|
|
2258
2034
|
}
|
|
2259
2035
|
function lowerObjectOwnMethodCall(lowerer, call, access) {
|
|
2260
2036
|
const method = access.name.text;
|
|
2261
|
-
if (
|
|
2262
|
-
call.questionDotToken ||
|
|
2037
|
+
if (call.questionDotToken ||
|
|
2263
2038
|
access.questionDotToken ||
|
|
2264
2039
|
(method !== "hasOwnProperty" && method !== "propertyIsEnumerable") ||
|
|
2265
2040
|
call.arguments.some(ts.isSpreadElement))
|
|
@@ -2477,9 +2252,7 @@ function lowerObjectOwnCall(lowerer, call, receiverNode, keyNode, extraNodes, me
|
|
|
2477
2252
|
return { kind: "seqExpr", stmts, result, type: BOOL, loc };
|
|
2478
2253
|
}
|
|
2479
2254
|
function lowerObjectPrototypeCall(lowerer, call, access) {
|
|
2480
|
-
if (
|
|
2481
|
-
access.name.text !== "call" ||
|
|
2482
|
-
!ts.isPropertyAccessExpression(access.expression))
|
|
2255
|
+
if (access.name.text !== "call" || !ts.isPropertyAccessExpression(access.expression))
|
|
2483
2256
|
return null;
|
|
2484
2257
|
const method = access.expression;
|
|
2485
2258
|
const prototype = method.expression;
|
|
@@ -3578,12 +3351,11 @@ function lowerArrayIsArrayCall(lowerer, call, access) {
|
|
|
3578
3351
|
// (`Array.isArray(tlds)` on `string | readonly string[]` — the
|
|
3579
3352
|
// narrowing test tsc's control flow then builds on); several array
|
|
3580
3353
|
// arms OR their tag tests, and zero arms fold to false — both only
|
|
3581
|
-
// over side-effect-free reads
|
|
3582
|
-
//
|
|
3583
|
-
// static tag answer and keep the narrow-first fence.
|
|
3354
|
+
// over side-effect-free reads. Opaque arms have no static tag answer
|
|
3355
|
+
// and keep the narrow-first fence.
|
|
3584
3356
|
const unionId = arg.type.unionId;
|
|
3585
3357
|
const def = lowerer.unions.get(unionId);
|
|
3586
|
-
const opaque = !def || def.arms.some((a) => a.kind === "dyn" || a.kind === "caught"
|
|
3358
|
+
const opaque = !def || def.arms.some((a) => a.kind === "dyn" || a.kind === "caught");
|
|
3587
3359
|
const arrayTags = lowerer.arrayValueTags(arg.type.unionId);
|
|
3588
3360
|
const freeRead = arg.kind === "varRef" || arg.kind === "recordGet" || arg.kind === "fieldGet";
|
|
3589
3361
|
if (!opaque && arrayTags.length === 1) {
|
|
@@ -3615,7 +3387,7 @@ function lowerArrayIsArrayCall(lowerer, call, access) {
|
|
|
3615
3387
|
}
|
|
3616
3388
|
lowerer.unsupported("SC1090", argNode, `Array.isArray on '${lowerer.fmt(arg.type)}' values (narrow first: check a discriminant field, or compare with '!== undefined'/'!== null' for unit arms)`);
|
|
3617
3389
|
}
|
|
3618
|
-
if (arg.type.kind === "
|
|
3390
|
+
if (arg.type.kind === "caught")
|
|
3619
3391
|
return null;
|
|
3620
3392
|
if (arg.kind === "varRef" || arg.kind === "recordGet" || arg.kind === "fieldGet") {
|
|
3621
3393
|
return { kind: "boolLit", value: lowerer.isArrayValueType(arg.type), type: BOOL, loc };
|
|
@@ -4127,6 +3899,21 @@ function implicitReceiverOverloadReturn(lowerer, expr) {
|
|
|
4127
3899
|
* with no honest bridge keep coerceInto's exactness fences. Calls that
|
|
4128
3900
|
* resolved to the implementation itself (non-overloaded callees) pass
|
|
4129
3901
|
* through untouched. */
|
|
3902
|
+
/** A body-less abstract method that is its name's only declaration is the
|
|
3903
|
+
* virtual slot itself, not an overload signature: its lowered return is the
|
|
3904
|
+
* family ABI every override shares, so the call keeps that result instead
|
|
3905
|
+
* of narrowing it to the declared type. */
|
|
3906
|
+
function isSoleAbstractMethod(decl) {
|
|
3907
|
+
if (!ts.isMethodDeclaration(decl))
|
|
3908
|
+
return false;
|
|
3909
|
+
if (!ts.getModifiers(decl)?.some((m) => m.kind === ts.SyntaxKind.AbstractKeyword))
|
|
3910
|
+
return false;
|
|
3911
|
+
const owner = decl.parent;
|
|
3912
|
+
if (!ts.isClassDeclaration(owner) && !ts.isClassExpression(owner))
|
|
3913
|
+
return false;
|
|
3914
|
+
const name = decl.name.getText();
|
|
3915
|
+
return !owner.members.some((member) => member !== decl && ts.isMethodDeclaration(member) && member.name.getText() === name);
|
|
3916
|
+
}
|
|
4130
3917
|
function reconcileOverloadReturn(lowerer, expr, call) {
|
|
4131
3918
|
const rsig = lowerer.checker.getResolvedSignature(expr);
|
|
4132
3919
|
const rdecl = rsig ? lowerer.checker.signatureDeclaration(rsig) : undefined;
|
|
@@ -4142,7 +3929,8 @@ function reconcileOverloadReturn(lowerer, expr, call) {
|
|
|
4142
3929
|
const resolvedOverload = rsig &&
|
|
4143
3930
|
rdecl &&
|
|
4144
3931
|
(ts.isFunctionDeclaration(rdecl) || ts.isMethodDeclaration(rdecl)) &&
|
|
4145
|
-
!rdecl.body
|
|
3932
|
+
!rdecl.body &&
|
|
3933
|
+
!isSoleAbstractMethod(rdecl)
|
|
4146
3934
|
? lowerer.mapTypeOf(lowerer.checker.getReturnTypeOfSignature(rsig))
|
|
4147
3935
|
: null;
|
|
4148
3936
|
const rt = resolvedOverload ?? implicitReceiverOverloadReturn(lowerer, expr);
|
|
@@ -4152,24 +3940,13 @@ function reconcileOverloadReturn(lowerer, expr, call) {
|
|
|
4152
3940
|
// follows maybeNarrow's stance — a unit arm has no payload to extract.
|
|
4153
3941
|
if (!rt || rt.kind === "void" || isUnitType(rt) || typeEquals(rt, call.type))
|
|
4154
3942
|
return call;
|
|
4155
|
-
// An ISLAND-valued implementation return (`any` under --dynamic): the
|
|
4156
3943
|
// resolved overload's return type is a claim tsc never checked against
|
|
4157
3944
|
// the body — extracting it HERE would throw the boundary TypeError
|
|
4158
3945
|
// where Node just lets the value flow (functionOverloads35: the
|
|
4159
3946
|
// implementation returns its object argument under a number-returning
|
|
4160
3947
|
// overload signature; Node exits clean). The checker-trust trap keeps
|
|
4161
3948
|
// governing edges the checker actually vouches for; this edge it never
|
|
4162
|
-
// did. The
|
|
4163
|
-
// (uncheckedOverloadHandleCall's rule at the declaration sites), and
|
|
4164
|
-
// uses dispatch to engine ops like any island value.
|
|
4165
|
-
if (call.type.kind === "jsval")
|
|
4166
|
-
return call;
|
|
4167
|
-
// The CHECKED-DYNAMIC twin of the island rule: an `any`-returning
|
|
4168
|
-
// implementation under a typed overload signature is the same
|
|
4169
|
-
// never-vouched-for edge (functionOverloads35's shape without
|
|
4170
|
-
// --dynamic) — extracting the resolved type HERE would throw the
|
|
4171
|
-
// boundary TypeError where Node lets the value flow. Uses stay
|
|
4172
|
-
// checked per read like every any-origin value.
|
|
3949
|
+
// did. The checked value stays in bindings and is validated per use.
|
|
4173
3950
|
if (call.type.kind === "dyn")
|
|
4174
3951
|
return call;
|
|
4175
3952
|
if (call.type.kind === "union" && rt.kind !== "union") {
|
|
@@ -4224,24 +4001,6 @@ function templateEscapesValid(raw) {
|
|
|
4224
4001
|
}
|
|
4225
4002
|
return true;
|
|
4226
4003
|
}
|
|
4227
|
-
/** Tagged templates `tag\`a${x}b\`` — ES's call: tag(strings, ...values).
|
|
4228
|
-
* The strings object is a per-SITE lazily initialized hidden array global,
|
|
4229
|
-
* so the spec's identity contract holds — the same site evaluated twice
|
|
4230
|
-
* hands the tag the SAME array; two sites never share. TemplateStringsArray
|
|
4231
|
-
* maps to string[] (type-mapper.ts), so the array rides the ordinary
|
|
4232
|
-
* slot-directed coercion into whatever the tag's first parameter wants
|
|
4233
|
-
* — string[] exactly, an `any` slot through the dyn boundary, a rest
|
|
4234
|
-
* pack's first element. Checked tags receive frozen cooked and raw
|
|
4235
|
-
* arrays with the standard nonenumerable `.raw` descriptor. Typed direct
|
|
4236
|
-
* tags retain the string-array representation.
|
|
4237
|
-
*
|
|
4238
|
-
* Tag forms: a top-level declared function (the direct-call fast path —
|
|
4239
|
-
* overload sets reconcile through the resolved signature exactly like
|
|
4240
|
-
* plain calls), an island value under --dynamic (engine method/function
|
|
4241
|
-
* call with the engine's cooked/raw template object), and
|
|
4242
|
-
* a checked-dynamic value (the dynCall boundary — a non-function tag
|
|
4243
|
-
* throws Node's catchable TypeError). Everything else — generic tags,
|
|
4244
|
-
* method tags, function-value bindings — fences by name. */
|
|
4245
4004
|
export function lowerTaggedTemplate(lowerer, expr) {
|
|
4246
4005
|
const loc = locOf(expr);
|
|
4247
4006
|
const pieces = ts.isNoSubstitutionTemplateLiteral(expr.template)
|
|
@@ -4256,51 +4015,6 @@ export function lowerTaggedTemplate(lowerer, expr) {
|
|
|
4256
4015
|
const values = ts.isNoSubstitutionTemplateLiteral(expr.template)
|
|
4257
4016
|
? []
|
|
4258
4017
|
: expr.template.templateSpans.map((s) => s.expression);
|
|
4259
|
-
// Island tags (--dynamic): the engine call forms, mirroring lowerCall's
|
|
4260
|
-
// island paths — a property-access tag is a method call (this = the
|
|
4261
|
-
// receiver, JS-exact), any other island tag a function call. The
|
|
4262
|
-
// strings argument builds ENGINE-NATIVE with its `.raw` property (the
|
|
4263
|
-
// tplStrings op): a JSON marshal would drop `.raw`, and tags dispatch
|
|
4264
|
-
// on it (the outdent idiom treats a raw-less argument as its OPTIONS
|
|
4265
|
-
// form and answers a function). A fresh array per evaluation — tags
|
|
4266
|
-
// caching by strings identity re-compute per call (SEMANTICS.md).
|
|
4267
|
-
const islandStrings = () => ({
|
|
4268
|
-
kind: "jsOp",
|
|
4269
|
-
op: "tplStrings",
|
|
4270
|
-
args: [
|
|
4271
|
-
...pieces.map((p) => ({
|
|
4272
|
-
kind: "jsMarshal",
|
|
4273
|
-
value: { kind: "strLit", value: p.text, type: STRING, loc },
|
|
4274
|
-
type: JSVAL,
|
|
4275
|
-
loc,
|
|
4276
|
-
})),
|
|
4277
|
-
...pieces.map((p) => ({
|
|
4278
|
-
kind: "jsMarshal",
|
|
4279
|
-
value: { kind: "strLit", value: templateRawTextOf(p), type: STRING, loc },
|
|
4280
|
-
type: JSVAL,
|
|
4281
|
-
loc,
|
|
4282
|
-
})),
|
|
4283
|
-
],
|
|
4284
|
-
type: JSVAL,
|
|
4285
|
-
loc,
|
|
4286
|
-
});
|
|
4287
|
-
if (ts.isPropertyAccessExpression(expr.tag) && lowerer.isIslandExpr(expr.tag.expression)) {
|
|
4288
|
-
const receiver = lowerer.lowerExpr(expr.tag.expression);
|
|
4289
|
-
const args = [islandStrings(), ...values.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a))];
|
|
4290
|
-
return {
|
|
4291
|
-
kind: "jsOp",
|
|
4292
|
-
op: "callMethod",
|
|
4293
|
-
name: expr.tag.name.text,
|
|
4294
|
-
args: [receiver, ...args],
|
|
4295
|
-
type: JSVAL,
|
|
4296
|
-
loc,
|
|
4297
|
-
};
|
|
4298
|
-
}
|
|
4299
|
-
if (lowerer.isIslandExpr(expr.tag)) {
|
|
4300
|
-
const callee = lowerer.lowerExpr(expr.tag);
|
|
4301
|
-
const args = [islandStrings(), ...values.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a))];
|
|
4302
|
-
return { kind: "jsOp", op: "callFn", args: [callee, ...args], type: JSVAL, loc };
|
|
4303
|
-
}
|
|
4304
4018
|
// Direct call of a top-level declared function — the plain-call fast
|
|
4305
4019
|
// path with the strings array as the leading completed argument.
|
|
4306
4020
|
if (ts.isIdentifier(expr.tag) && !lowerer.isSelfReference(expr.tag)) {
|
|
@@ -4494,20 +4208,14 @@ function loweredTemplateStrings(lowerer, expr, cooked, loc, raw) {
|
|
|
4494
4208
|
* wrapper's await re-throws it), and a handler throw rejects the
|
|
4495
4209
|
* result — the spec's onFulfilled rules by construction. Null for
|
|
4496
4210
|
* non-promise receivers and other members. */
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
* `import("...")` call is the island promise itself; an identifier bound
|
|
4500
|
-
* to a promise-of-jsval local or module global answers the binding's
|
|
4501
|
-
* type. Null everywhere else. */
|
|
4502
|
-
function islandPromiseStorageTypeOf(lowerer, e) {
|
|
4503
|
-
const direct = lowerer.dynamic ? importCallHandleType(e) : staticImportNamespaceType(lowerer, e);
|
|
4211
|
+
function modulePromiseStorageTypeOf(lowerer, e) {
|
|
4212
|
+
const direct = staticImportNamespaceType(lowerer, e);
|
|
4504
4213
|
if (direct?.kind === "promise")
|
|
4505
4214
|
return direct;
|
|
4506
4215
|
if (!ts.isIdentifier(e))
|
|
4507
4216
|
return null;
|
|
4508
4217
|
const local = lowerer.resolveLocal(e);
|
|
4509
|
-
if (local?.type.kind === "promise" &&
|
|
4510
|
-
(local.type.inner.kind === "jsval" || local.type.inner.kind === "moduleNs"))
|
|
4218
|
+
if (local?.type.kind === "promise" && local.type.inner.kind === "moduleNs")
|
|
4511
4219
|
return local.type;
|
|
4512
4220
|
if (local)
|
|
4513
4221
|
return null;
|
|
@@ -4515,27 +4223,10 @@ function islandPromiseStorageTypeOf(lowerer, e) {
|
|
|
4515
4223
|
if (sym && sym.flags & ts.SymbolFlags.Alias)
|
|
4516
4224
|
sym = lowerer.checker.getAliasedSymbol(sym);
|
|
4517
4225
|
const g = sym ? lowerer.globalsBySymbol.get(sym) : undefined;
|
|
4518
|
-
if (g?.type.kind === "promise" &&
|
|
4519
|
-
(g.type.inner.kind === "jsval" || g.type.inner.kind === "moduleNs"))
|
|
4226
|
+
if (g?.type.kind === "promise" && g.type.inner.kind === "moduleNs")
|
|
4520
4227
|
return g.type;
|
|
4521
4228
|
return null;
|
|
4522
4229
|
}
|
|
4523
|
-
/** Marks an INLINE then-handler's unannotated identifier parameters for
|
|
4524
|
-
* the island-handle (jsval) binding type — paramShape's early-out. Only
|
|
4525
|
-
* the inline arrow/function forms qualify: a handler VALUE keeps its own
|
|
4526
|
-
* declared signature (and the settled-type equality check below). */
|
|
4527
|
-
function markJsvalHandlerParams(lowerer, handler) {
|
|
4528
|
-
let e = handler;
|
|
4529
|
-
while (ts.isParenthesizedExpression(e))
|
|
4530
|
-
e = e.expression;
|
|
4531
|
-
if (!ts.isArrowFunction(e) && !ts.isFunctionExpression(e))
|
|
4532
|
-
return;
|
|
4533
|
-
for (const p of e.parameters) {
|
|
4534
|
-
if (ts.isIdentifier(p.name) && p.type === undefined && !p.dotDotDotToken && !p.initializer) {
|
|
4535
|
-
lowerer.jsvalParamOverrides.add(p);
|
|
4536
|
-
}
|
|
4537
|
-
}
|
|
4538
|
-
}
|
|
4539
4230
|
function markModuleNsHandlerParams(lowerer, handler, type) {
|
|
4540
4231
|
let e = handler;
|
|
4541
4232
|
while (ts.isParenthesizedExpression(e))
|
|
@@ -4557,13 +4248,10 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4557
4248
|
let recvT = lowerer.mapTypeOf(lowerer.typeOf(access.expression)) ??
|
|
4558
4249
|
dynFallbackType(lowerer, access.expression, lowerer.typeOf(access.expression));
|
|
4559
4250
|
// A dynamic-import promise under an unmappable checker type
|
|
4560
|
-
// (`Promise<typeof import("./m")>`
|
|
4561
|
-
//
|
|
4562
|
-
// (importCallHandleType / the island-HANDLE var rules), so the storage
|
|
4563
|
-
// type is the receiver's truth. Direct `import("./m").then(...)`
|
|
4564
|
-
// spells the same promise with no binding at all.
|
|
4251
|
+
// (`Promise<typeof import("./m")>`) uses the module promise's native
|
|
4252
|
+
// storage type. Direct `import("./m").then(...)` needs no binding.
|
|
4565
4253
|
if (!recvT)
|
|
4566
|
-
recvT =
|
|
4254
|
+
recvT = modulePromiseStorageTypeOf(lowerer, access.expression);
|
|
4567
4255
|
if (recvT?.kind !== "promise")
|
|
4568
4256
|
return null;
|
|
4569
4257
|
if (!lowerer.isStdlibMember(access))
|
|
@@ -4597,20 +4285,6 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4597
4285
|
}
|
|
4598
4286
|
// The receiver evaluates FIRST, in the enclosing function, like JS.
|
|
4599
4287
|
let receiver = lowerer.lowerExpr(access.expression);
|
|
4600
|
-
// A PACKAGE-returned promise lowers as an island value (jsval): the
|
|
4601
|
-
// promise lives in the engine, so bridge it — a static promise the
|
|
4602
|
-
// engine promise settles (fulfillment = the retained handle or void,
|
|
4603
|
-
// rejection = the bridged reason) — and desugar over the BRIDGE
|
|
4604
|
-
// exactly like a native receiver. This is the classic CLI entry line,
|
|
4605
|
-
// `program.parseAsync(process.argv).catch(handler)`.
|
|
4606
|
-
if (receiver.type.kind === "jsval") {
|
|
4607
|
-
receiver = {
|
|
4608
|
-
kind: "jsBridgePromise",
|
|
4609
|
-
value: receiver,
|
|
4610
|
-
type: { kind: "promise", inner: recvT.inner.kind === "void" ? VOID : JSVAL },
|
|
4611
|
-
loc,
|
|
4612
|
-
};
|
|
4613
|
-
}
|
|
4614
4288
|
if (receiver.type.kind === "dyn" && lowerer.dynConvertible(recvT))
|
|
4615
4289
|
receiver = lowerer.coerceInto(access.expression, receiver, recvT);
|
|
4616
4290
|
if (receiver.type.kind !== "promise") {
|
|
@@ -4618,9 +4292,8 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4618
4292
|
// a lowering gap, named rather than ICEd on.
|
|
4619
4293
|
lowerer.unsupported("SC1090", call, `'.${member}' on this receiver`);
|
|
4620
4294
|
}
|
|
4621
|
-
//
|
|
4622
|
-
//
|
|
4623
|
-
// typed uses of the settled value exit through coerceInto below.
|
|
4295
|
+
// Wrapper types follow the receiver's promise type; typed uses of the
|
|
4296
|
+
// settled value convert through coerceInto below.
|
|
4624
4297
|
const promT = receiver.type;
|
|
4625
4298
|
const inner = promT.inner;
|
|
4626
4299
|
if (passthrough) {
|
|
@@ -4685,8 +4358,6 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4685
4358
|
lowerer.noLowering("then with these handlers", call, "the result must be a representable promise");
|
|
4686
4359
|
}
|
|
4687
4360
|
const R = resultT.inner;
|
|
4688
|
-
if (!fulfilledAbsent && inner.kind === "jsval")
|
|
4689
|
-
markJsvalHandlerParams(lowerer, fulfilledNode);
|
|
4690
4361
|
if (!fulfilledAbsent && inner.kind === "moduleNs")
|
|
4691
4362
|
markModuleNsHandlerParams(lowerer, fulfilledNode, inner);
|
|
4692
4363
|
const boxHandler = (node, allowDirect) => {
|
|
@@ -4744,17 +4415,46 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4744
4415
|
? [{ kind: "varDecl", localId: vLocal.id, init: awaitE, loc }]
|
|
4745
4416
|
: [{ kind: "exprStmt", expr: awaitE, loc }];
|
|
4746
4417
|
const resultOf = (value, returnsPromise = false) => {
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4418
|
+
if (value.type.kind === "promise")
|
|
4419
|
+
return [lowerer.adoptingReturn(value, R, (e) => lowerer.coerceInto(call, e, R))];
|
|
4420
|
+
if (returnsPromise) {
|
|
4421
|
+
// A boxed handler's promise result adopts too: the then job's
|
|
4422
|
+
// turn after the call, then the await of the returned value.
|
|
4423
|
+
const hLocal = lowerer.declareHiddenLocal("h", DYN);
|
|
4424
|
+
const settledDyn = {
|
|
4425
|
+
kind: "libCall",
|
|
4426
|
+
fn: "async.awaitDyn",
|
|
4427
|
+
args: [{ kind: "varRef", localId: hLocal.id, type: DYN, loc }],
|
|
4428
|
+
type: DYN,
|
|
4429
|
+
loc,
|
|
4430
|
+
};
|
|
4431
|
+
return [
|
|
4432
|
+
{ kind: "varDecl", localId: hLocal.id, init: value, loc },
|
|
4433
|
+
{
|
|
4434
|
+
kind: "exprStmt",
|
|
4435
|
+
expr: { kind: "libCall", fn: "async.hop", args: [], type: VOID, loc },
|
|
4436
|
+
loc,
|
|
4437
|
+
},
|
|
4438
|
+
...(R.kind === "void"
|
|
4439
|
+
? [
|
|
4440
|
+
{ kind: "exprStmt", expr: settledDyn, loc },
|
|
4441
|
+
{ kind: "return", value: null, loc },
|
|
4442
|
+
]
|
|
4443
|
+
: [
|
|
4444
|
+
{
|
|
4445
|
+
kind: "return",
|
|
4446
|
+
value: lowerer.coerceInto(call, settledDyn, R),
|
|
4447
|
+
loc,
|
|
4448
|
+
},
|
|
4449
|
+
]),
|
|
4450
|
+
];
|
|
4451
|
+
}
|
|
4752
4452
|
return R.kind === "void"
|
|
4753
4453
|
? [
|
|
4754
|
-
{ kind: "exprStmt", expr:
|
|
4454
|
+
{ kind: "exprStmt", expr: value, loc },
|
|
4755
4455
|
{ kind: "return", value: null, loc },
|
|
4756
4456
|
]
|
|
4757
|
-
: [{ kind: "return", value: lowerer.coerceInto(call,
|
|
4457
|
+
: [{ kind: "return", value: lowerer.coerceInto(call, value, R), loc }];
|
|
4758
4458
|
};
|
|
4759
4459
|
const rejectedCall = rLocal
|
|
4760
4460
|
? {
|
|
@@ -4864,12 +4564,8 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4864
4564
|
lowerer.fnStack.pop();
|
|
4865
4565
|
}
|
|
4866
4566
|
}
|
|
4867
|
-
// The settled value is an island HANDLE: an inline handler's
|
|
4868
|
-
// unannotated parameter binds it as jsval, whatever the checker's
|
|
4869
4567
|
// contextual type spelled (a module-namespace type has no mapping —
|
|
4870
4568
|
// the handle is the value's only story, isIslandExpr's local rule).
|
|
4871
|
-
if (inner.kind === "jsval")
|
|
4872
|
-
markJsvalHandlerParams(lowerer, call.arguments[0]);
|
|
4873
4569
|
if (inner.kind === "moduleNs")
|
|
4874
4570
|
markModuleNsHandlerParams(lowerer, call.arguments[0], inner);
|
|
4875
4571
|
let cb = lowerer.lowerExpr(call.arguments[0]);
|
|
@@ -5030,29 +4726,14 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
5030
4726
|
loc,
|
|
5031
4727
|
};
|
|
5032
4728
|
// The handler's result: promise returns flatten exactly like
|
|
5033
|
-
// `return p` in any async body (
|
|
5034
|
-
//
|
|
5035
|
-
if (
|
|
5036
|
-
|
|
5037
|
-
body.push({
|
|
5038
|
-
kind: "exprStmt",
|
|
5039
|
-
expr: { kind: "awaitExpr", value: handlerCall, type: handlerCall.type.inner, loc },
|
|
5040
|
-
loc,
|
|
5041
|
-
});
|
|
5042
|
-
}
|
|
5043
|
-
else {
|
|
5044
|
-
body.push({ kind: "exprStmt", expr: handlerCall, loc });
|
|
5045
|
-
}
|
|
5046
|
-
body.push({ kind: "return", value: null, loc });
|
|
4729
|
+
// `return p` in any async body (the spec's thenable adoption);
|
|
4730
|
+
// everything else coerces into R.
|
|
4731
|
+
if (handlerCall.type.kind === "promise" && R.kind !== "promise") {
|
|
4732
|
+
body.push(lowerer.adoptingReturn(handlerCall, R, (e) => lowerer.coerceInto(call, e, R)));
|
|
5047
4733
|
}
|
|
5048
|
-
else if (
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
value: handlerCall,
|
|
5052
|
-
type: handlerCall.type.inner,
|
|
5053
|
-
loc,
|
|
5054
|
-
};
|
|
5055
|
-
body.push({ kind: "return", value: lowerer.coerceInto(call, awaited, R), loc });
|
|
4734
|
+
else if (R.kind === "void") {
|
|
4735
|
+
body.push({ kind: "exprStmt", expr: handlerCall, loc });
|
|
4736
|
+
body.push({ kind: "return", value: null, loc });
|
|
5056
4737
|
}
|
|
5057
4738
|
else {
|
|
5058
4739
|
body.push({ kind: "return", value: lowerer.coerceInto(call, handlerCall, R), loc });
|
|
@@ -5389,18 +5070,6 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
5389
5070
|
// with the dyn undefined.
|
|
5390
5071
|
catchBody.push({ kind: "return", value: dynUndefinedExpr(loc), loc });
|
|
5391
5072
|
}
|
|
5392
|
-
else if (R.kind === "jsval") {
|
|
5393
|
-
// A package-typed result (Promise<Command> — the parseAsync().catch
|
|
5394
|
-
// entry line): falling off the handler's end resolves with
|
|
5395
|
-
// undefined, which on the island side is the engine's own
|
|
5396
|
-
// undefined. Also what makes a never-returning handler (ending in
|
|
5397
|
-
// process.exit) satisfy the always-returns analysis.
|
|
5398
|
-
catchBody.push({
|
|
5399
|
-
kind: "return",
|
|
5400
|
-
value: { kind: "jsOp", op: "globalGet", name: "undefined", args: [], type: JSVAL, loc },
|
|
5401
|
-
loc,
|
|
5402
|
-
});
|
|
5403
|
-
}
|
|
5404
5073
|
const ctx = lowerer.ctx;
|
|
5405
5074
|
const lifted = {
|
|
5406
5075
|
name: fnName,
|
|
@@ -5498,7 +5167,7 @@ export function lowerFilterNarrowCall(lowerer, call, access) {
|
|
|
5498
5167
|
// ToBoolean must be answerable per element (dyn/caught arms are not).
|
|
5499
5168
|
if (elem.kind === "union")
|
|
5500
5169
|
lowerer.requireTruthyUnion(elem.unionId, argNode);
|
|
5501
|
-
if (elem.kind === "dyn" || elem.kind === "
|
|
5170
|
+
if (elem.kind === "dyn" || elem.kind === "void" || isUnitType(elem)) {
|
|
5502
5171
|
lowerer.badType(argNode, lowerer.typeOf(argNode));
|
|
5503
5172
|
}
|
|
5504
5173
|
const receiver = lowerer.lowerExpr(access.expression);
|
|
@@ -6056,8 +5725,7 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6056
5725
|
member === "getOwnPropertySymbols" ||
|
|
6057
5726
|
member === "getOwnPropertyDescriptors") &&
|
|
6058
5727
|
call.arguments.length === 1 &&
|
|
6059
|
-
!call.arguments.some(ts.isSpreadElement)
|
|
6060
|
-
!lowerer.dynamic) {
|
|
5728
|
+
!call.arguments.some(ts.isSpreadElement)) {
|
|
6061
5729
|
let object = lowerer.lowerExpr(call.arguments[0]);
|
|
6062
5730
|
if (object.type.kind === "string" ||
|
|
6063
5731
|
object.type.kind === "f64" ||
|
|
@@ -6079,8 +5747,7 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6079
5747
|
}
|
|
6080
5748
|
if ((member === "getPrototypeOf" || member === "setPrototypeOf") &&
|
|
6081
5749
|
call.arguments.length === (member === "getPrototypeOf" ? 1 : 2) &&
|
|
6082
|
-
!call.arguments.some(ts.isSpreadElement)
|
|
6083
|
-
!lowerer.dynamic) {
|
|
5750
|
+
!call.arguments.some(ts.isSpreadElement)) {
|
|
6084
5751
|
let object = lowerer.lowerExpr(call.arguments[0]);
|
|
6085
5752
|
if (object.type.kind === "func") {
|
|
6086
5753
|
const fnName = jsFuncNameOf(call.arguments[0], lowerer);
|
|
@@ -6160,7 +5827,6 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6160
5827
|
// identity. Statically DISJOINT kind pairs answer the constant false
|
|
6161
5828
|
// with the operands still evaluated (tsc admits any pair — Object.is
|
|
6162
5829
|
// is (any, any) — and JS evaluates the arguments either way).
|
|
6163
|
-
// dyn/jsval operands keep strict equality's stance: validate first.
|
|
6164
5830
|
if (member === "is") {
|
|
6165
5831
|
if (call.arguments.length !== 2 || call.arguments.some((a) => ts.isSpreadElement(a))) {
|
|
6166
5832
|
lowerer.noLowering(`Object.is with ${call.arguments.length} arguments`, call, "exactly two arguments are the lowered form (JS treats a missing one as undefined — pass it explicitly)");
|
|
@@ -6184,7 +5850,7 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6184
5850
|
const unitTest = lowerer.lowerUnitComparison(left, right, false, loc);
|
|
6185
5851
|
if (unitTest)
|
|
6186
5852
|
return unitTest;
|
|
6187
|
-
if (lk === "dyn" || rk === "dyn"
|
|
5853
|
+
if (lk === "dyn" || rk === "dyn") {
|
|
6188
5854
|
return {
|
|
6189
5855
|
kind: "libCall",
|
|
6190
5856
|
fn: "dyn.sameValue",
|
|
@@ -6271,8 +5937,7 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6271
5937
|
lowerer.noLowering(`Object.is over '${lowerer.fmt(left.type)}' and '${lowerer.fmt(right.type)}' operands`, call, "the operands must share one comparable kind (numbers, strings, booleans, units, one union shape, or one reference type)");
|
|
6272
5938
|
}
|
|
6273
5939
|
// Native checked objects retain a live prototype and can install an
|
|
6274
|
-
// own-property descriptor table during creation.
|
|
6275
|
-
// use the engine's Object.create path below.
|
|
5940
|
+
// own-property descriptor table during creation.
|
|
6276
5941
|
if (member === "create") {
|
|
6277
5942
|
if (call.arguments.some((a) => ts.isSpreadElement(a))) {
|
|
6278
5943
|
lowerer.noLowering("Object.create with spread arguments", call);
|
|
@@ -6285,50 +5950,6 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6285
5950
|
while (ts.isParenthesizedExpression(protoNode))
|
|
6286
5951
|
protoNode = protoNode.expression;
|
|
6287
5952
|
const nullProto = protoNode.kind === ts.SyntaxKind.NullKeyword;
|
|
6288
|
-
if (lowerer.dynamic) {
|
|
6289
|
-
if (call.arguments.length === 2)
|
|
6290
|
-
lowerer.noLowering("Object.create with properties under --dynamic", call);
|
|
6291
|
-
// The checker types the result `any` — an ENGINE value under
|
|
6292
|
-
// --dynamic — and the engine's own Object.create answers with
|
|
6293
|
-
// REAL prototype semantics: reads delegate LIVE, writes shadow,
|
|
6294
|
-
// and inspect renders Node's exact shapes ("[Object: null
|
|
6295
|
-
// prototype]" included). null and engine-held (jsval) prototypes
|
|
6296
|
-
// route; checked-dynamic (dyn) prototypes keep the named fence —
|
|
6297
|
-
// their marshal into the engine is a DEEP COPY, so a later
|
|
6298
|
-
// prototype mutation would be invisible through the created
|
|
6299
|
-
// object where Node delegates live.
|
|
6300
|
-
const objectGlobal = () => ({
|
|
6301
|
-
kind: "jsOp",
|
|
6302
|
-
op: "globalGet",
|
|
6303
|
-
name: "Object",
|
|
6304
|
-
args: [],
|
|
6305
|
-
type: JSVAL,
|
|
6306
|
-
loc,
|
|
6307
|
-
});
|
|
6308
|
-
if (nullProto) {
|
|
6309
|
-
const nullIn = { kind: "jsOp", op: "nullLit", args: [], type: JSVAL, loc };
|
|
6310
|
-
return {
|
|
6311
|
-
kind: "jsOp",
|
|
6312
|
-
op: "callMethod",
|
|
6313
|
-
name: "create",
|
|
6314
|
-
args: [objectGlobal(), nullIn],
|
|
6315
|
-
type: JSVAL,
|
|
6316
|
-
loc,
|
|
6317
|
-
};
|
|
6318
|
-
}
|
|
6319
|
-
const proto = lowerer.lowerExpr(protoNode);
|
|
6320
|
-
if (proto.type.kind === "jsval") {
|
|
6321
|
-
return {
|
|
6322
|
-
kind: "jsOp",
|
|
6323
|
-
op: "callMethod",
|
|
6324
|
-
name: "create",
|
|
6325
|
-
args: [objectGlobal(), proto],
|
|
6326
|
-
type: JSVAL,
|
|
6327
|
-
loc,
|
|
6328
|
-
};
|
|
6329
|
-
}
|
|
6330
|
-
lowerer.noLowering(`Object.create over '${lowerer.fmt(proto.type)}' prototypes`, call, "prototype reads delegate LIVE in Node (mutating the prototype shows through the created object), which the boundary's deep copy cannot honor — only null and engine-held ('any') prototypes lower");
|
|
6331
|
-
}
|
|
6332
5953
|
if (nullProto && call.arguments.length === 1) {
|
|
6333
5954
|
return { kind: "libCall", fn: "dyn.objCreateNullProto", args: [], type: DYN, loc };
|
|
6334
5955
|
}
|
|
@@ -6979,7 +6600,6 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6979
6600
|
}
|
|
6980
6601
|
// unknown[] uses the checked-dynamic array representation. Enumerate
|
|
6981
6602
|
// a live view of the record so values retain their identities and the
|
|
6982
|
-
// result never pretends to be a native vector or an island array.
|
|
6983
6603
|
const enumerationType = lowerer.mapTypeOf(lowerer.typeOf(call));
|
|
6984
6604
|
if ((member === "values" || member === "entries") &&
|
|
6985
6605
|
(enumerationType?.kind === "dyn" ||
|
|
@@ -7683,7 +7303,6 @@ function lowerObjLitGenericMethodCall(lowerer, call, access) {
|
|
|
7683
7303
|
const provablyNot = thisT !== null &&
|
|
7684
7304
|
thisT.kind !== "searchParams" &&
|
|
7685
7305
|
thisT.kind !== "dyn" &&
|
|
7686
|
-
thisT.kind !== "jsval" &&
|
|
7687
7306
|
(!thisArg ||
|
|
7688
7307
|
ts.isIdentifier(thisArg) ||
|
|
7689
7308
|
ts.isLiteralExpression(thisArg) ||
|
|
@@ -8396,8 +8015,8 @@ function loweredArgumentText(lowerer, arg) {
|
|
|
8396
8015
|
}
|
|
8397
8016
|
/** The static global number parsers (parseInt/parseFloat/isNaN/isFinite),
|
|
8398
8017
|
* shared by the globals and their Number.* aliases. `call` blames arity
|
|
8399
|
-
* fences; null when the argument shape
|
|
8400
|
-
*
|
|
8018
|
+
* fences; null when the argument shape has no static form (the caller
|
|
8019
|
+
* reports the SC2012 refusal). */
|
|
8401
8020
|
export function lowerStaticNumberGlobal(lowerer, name, call, args, loc) {
|
|
8402
8021
|
if (name === "parseInt" || name === "isNaN") {
|
|
8403
8022
|
const maxArgs = name === "parseInt" ? 2 : 1;
|
|
@@ -8498,10 +8117,9 @@ export function lowerStaticNumberGlobal(lowerer, name, call, args, loc) {
|
|
|
8498
8117
|
// parseInt's siblings (num.parseFloat is ECMA 19.2.4's decimal-
|
|
8499
8118
|
// literal prefix parse in scr_string.c; a number-typed isFinite IS
|
|
8500
8119
|
// Number.isFinite — the global's ToNumber coercion is the identity
|
|
8501
|
-
// there, ms's `isFinite(val)` guard). Other argument types
|
|
8502
|
-
//
|
|
8503
|
-
//
|
|
8504
|
-
// territory. The probe never emits — lowering is IR construction.
|
|
8120
|
+
// there, ms's `isFinite(val)` guard). Other argument types retain
|
|
8121
|
+
// their native coercion checks or the SC2012 refusal. The probe never
|
|
8122
|
+
// emits — lowering is IR construction.
|
|
8505
8123
|
if ((name === "parseFloat" || name === "isFinite") && args.length === 1) {
|
|
8506
8124
|
if (name === "parseFloat") {
|
|
8507
8125
|
const optional = optionalCallValue(lowerer, args[0]);
|