@scriptc/compiler 0.4.8 → 0.4.9
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/node-fallback/buffer.d.ts +2 -0
- package/ambient/node-fallback/child_process.d.ts +9 -3
- package/ambient/node-fallback/dns-promises.d.ts +25 -0
- package/ambient/node-fallback/dns.d.ts +29 -0
- package/ambient/node-fallback/test.d.ts +7 -0
- package/ambient/scriptc-node-fallback.d.ts +145 -2
- package/ambient/scriptc-overrides.d.ts +22 -13
- package/dist/backend/build-cache.d.ts +1 -1
- package/dist/backend/build-cache.js +1 -1
- package/dist/backend/build-cache.js.map +1 -1
- package/dist/backend/cache-root.d.ts +7 -0
- package/dist/backend/cache-root.js +27 -0
- package/dist/backend/cache-root.js.map +1 -1
- package/dist/backend/executable-features.js +5 -1
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/link-plan.js +7 -1
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.d.ts +12 -1
- package/dist/backend/llvm/bytes-loop-versions.js +107 -30
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +96 -0
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/checked-value-lifetimes.js +1 -0
- package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +16 -5
- package/dist/backend/llvm/classes.js +34 -6
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +21 -2
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +9 -0
- package/dist/backend/llvm/common.js +9 -0
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/cpu-dispatch.d.ts +36 -2
- package/dist/backend/llvm/cpu-dispatch.js +96 -2
- package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +5 -2
- package/dist/backend/llvm/dense-array-access.js +16 -12
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +3 -1
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +24 -0
- package/dist/backend/llvm/dyn.js +117 -3
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +6 -0
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-journal.d.ts +1 -0
- package/dist/backend/llvm/emit-journal.js.map +1 -1
- package/dist/backend/llvm/emit-module.js +48 -5
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-module.test.js +41 -0
- package/dist/backend/llvm/emit-module.test.js.map +1 -1
- package/dist/backend/llvm/emit-statements.js +11 -0
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +87 -7
- package/dist/backend/llvm/emitter.js +136 -15
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +28 -6
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +19 -5
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +29 -1
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +104 -6
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +15 -1
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +53 -5
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/inline-arrays.js +1 -1
- package/dist/backend/llvm/inline-arrays.js.map +1 -1
- package/dist/backend/llvm/js-ic.js +126 -2
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/lanes.d.ts +38 -0
- package/dist/backend/llvm/lanes.js +778 -0
- package/dist/backend/llvm/lanes.js.map +1 -0
- package/dist/backend/llvm/lanes.test.d.ts +1 -0
- package/dist/backend/llvm/lanes.test.js +402 -0
- package/dist/backend/llvm/lanes.test.js.map +1 -0
- package/dist/backend/llvm/lib-dispatch.js +9 -4
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +20 -0
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +27 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-test.js +11 -0
- package/dist/backend/llvm/lib-test.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +2 -2
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.js +8 -2
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.js +5 -2
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/publish.d.ts +3 -0
- package/dist/backend/llvm/publish.js +2 -2
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +1 -0
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/region-groups.js +43 -4
- package/dist/backend/llvm/region-groups.js.map +1 -1
- package/dist/backend/llvm/region-groups.test.js +79 -0
- package/dist/backend/llvm/region-groups.test.js.map +1 -1
- package/dist/backend/llvm/runtime-registries.test.js +32 -1
- package/dist/backend/llvm/runtime-registries.test.js.map +1 -1
- package/dist/backend/llvm/shapes.js +10 -1
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +1 -1
- package/dist/backend/llvm/string-reads.js +1 -1
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.js +24 -2
- package/dist/backend/llvm/unwind-abi.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.test.js +38 -0
- package/dist/backend/llvm/unwind-abi.test.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +3 -0
- package/dist/backend/llvm/walkers.js +20 -2
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +15 -3
- package/dist/backend/native/executable.js +19 -5
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native-codegen-core.d.ts +20 -0
- package/dist/backend/native-codegen-core.js +15 -0
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +5 -0
- package/dist/backend/native-codegen.js +62 -8
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +48 -8
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +27 -3
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-link-info.test.js +17 -1
- package/dist/backend/native-link-info.test.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +1 -1
- package/dist/backend/native-toolchain.js +1 -1
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +14 -1
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/runtime-pack-core.d.ts +9 -3
- package/dist/backend/runtime-pack-core.js +6 -1
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +32 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/targets.d.ts +9 -1
- package/dist/backend/targets.js +11 -2
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +6 -0
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/cli/command.js +15 -1
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/host.d.ts +6 -0
- package/dist/cli/mcp.d.ts +72 -0
- package/dist/cli/mcp.js +601 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/mcp.test.d.ts +1 -0
- package/dist/cli/mcp.test.js +380 -0
- package/dist/cli/mcp.test.js.map +1 -0
- package/dist/cli/output-options.d.ts +1 -0
- package/dist/cli/output-options.js +3 -0
- package/dist/cli/output-options.js.map +1 -1
- package/dist/cli/usage.d.ts +51 -1
- package/dist/cli/usage.js +709 -186
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.js +9 -4
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +17 -0
- package/dist/coverage/report.d.ts +5 -9
- package/dist/coverage/report.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +17 -3
- package/dist/executable/executable-cache.js +17 -3
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/prepare.js +87 -10
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +3 -2
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/canon-map.js +13 -8
- package/dist/frontend/canon-map.js.map +1 -1
- package/dist/frontend/decl-projection.d.ts +18 -0
- package/dist/frontend/decl-projection.js +90 -22
- package/dist/frontend/decl-projection.js.map +1 -1
- package/dist/frontend/decl-projection.test.js +47 -1
- package/dist/frontend/decl-projection.test.js.map +1 -1
- package/dist/frontend/default-library.d.ts +10 -0
- package/dist/frontend/default-library.js +43 -0
- package/dist/frontend/default-library.js.map +1 -0
- package/dist/frontend/fork-target.js +54 -9
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/fork-target.test.js +82 -0
- package/dist/frontend/fork-target.test.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.test.js +73 -0
- package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
- package/dist/frontend/lowering/abstract-equality.d.ts +2 -1
- package/dist/frontend/lowering/abstract-equality.js +7 -1
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +2 -2
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/assertion-members.js +52 -2
- package/dist/frontend/lowering/assertion-members.js.map +1 -1
- package/dist/frontend/lowering/builtin-namespaces.d.ts +5 -0
- package/dist/frontend/lowering/builtin-namespaces.js +19 -12
- package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
- package/dist/frontend/lowering/builtins/callable-aliases.js +42 -6
- package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process.d.ts +12 -11
- package/dist/frontend/lowering/builtins/child-process.js +235 -38
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
- package/dist/frontend/lowering/builtins/compression.d.ts +6 -1
- package/dist/frontend/lowering/builtins/compression.js +3 -3
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/constants.js +2 -2
- package/dist/frontend/lowering/builtins/constants.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +3 -1
- package/dist/frontend/lowering/builtins/crypto.js +9 -1
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/dates.js +26 -6
- package/dist/frontend/lowering/builtins/dates.js.map +1 -1
- package/dist/frontend/lowering/builtins/environment.d.ts +13 -1
- package/dist/frontend/lowering/builtins/environment.js +15 -4
- package/dist/frontend/lowering/builtins/environment.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-bindings.d.ts +33 -0
- package/dist/frontend/lowering/builtins/module-bindings.js +213 -11
- package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +9 -2
- package/dist/frontend/lowering/builtins/module-resolution.js +187 -19
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/performance.js +1 -1
- package/dist/frontend/lowering/builtins/performance.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.js +40 -2
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +33 -0
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +9 -5
- package/dist/frontend/lowering/builtins/readline.js +184 -75
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.d.ts +4 -0
- package/dist/frontend/lowering/builtins/url.js +6 -0
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.js +15 -0
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/callable-properties.d.ts +34 -0
- package/dist/frontend/lowering/callable-properties.js +210 -0
- package/dist/frontend/lowering/callable-properties.js.map +1 -0
- package/dist/frontend/lowering/cjs-inline-require.d.ts +16 -0
- package/dist/frontend/lowering/cjs-inline-require.js +105 -0
- package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
- package/dist/frontend/lowering/cjs-inline-require.test.d.ts +1 -0
- package/dist/frontend/lowering/cjs-inline-require.test.js +61 -0
- package/dist/frontend/lowering/cjs-inline-require.test.js.map +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +82 -2
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +57 -4
- package/dist/frontend/lowering/class-protocols.js +597 -30
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/class-unions.js +2 -2
- package/dist/frontend/lowering/class-unions.js.map +1 -1
- package/dist/frontend/lowering/coercions/function-adapters.d.ts +12 -0
- package/dist/frontend/lowering/coercions/function-adapters.js +62 -0
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +56 -1
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +9 -4
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/collection-ingestion.d.ts +9 -0
- package/dist/frontend/lowering/collection-ingestion.js +115 -41
- package/dist/frontend/lowering/collection-ingestion.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +16 -0
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +66 -10
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +61 -5
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/filter-predicates.js +11 -0
- package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.d.ts +15 -0
- package/dist/frontend/lowering/containers/indexed-objects.js +213 -30
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/error-name-order.d.ts +16 -0
- package/dist/frontend/lowering/error-name-order.js +61 -0
- package/dist/frontend/lowering/error-name-order.js.map +1 -1
- package/dist/frontend/lowering/expressions/asserted-receiver.d.ts +17 -0
- package/dist/frontend/lowering/expressions/asserted-receiver.js +123 -1
- package/dist/frontend/lowering/expressions/asserted-receiver.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +147 -20
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +63 -14
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/erased-delete.d.ts +59 -0
- package/dist/frontend/lowering/expressions/erased-delete.js +247 -0
- package/dist/frontend/lowering/expressions/erased-delete.js.map +1 -0
- package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +10 -0
- package/dist/frontend/lowering/expressions/hosted-narrowing.js +48 -1
- package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +20 -0
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.d.ts +7 -2
- package/dist/frontend/lowering/expressions/narrowing.js +77 -45
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +62 -19
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +19 -0
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +7 -7
- package/dist/frontend/lowering/expressions/property-access.js +247 -48
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.d.ts +1 -0
- package/dist/frontend/lowering/expressions/relational.js +18 -8
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-fields.js +11 -5
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +121 -11
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/function-context.d.ts +10 -0
- package/dist/frontend/lowering/function-context.js +36 -0
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/function-returns.js +8 -8
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/handle-properties.d.ts +62 -3
- package/dist/frontend/lowering/handle-properties.js +674 -26
- package/dist/frontend/lowering/handle-properties.js.map +1 -1
- package/dist/frontend/lowering/handle-properties.test.js +95 -2
- package/dist/frontend/lowering/handle-properties.test.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.d.ts +12 -0
- package/dist/frontend/lowering/lower-builtin-values.js +44 -0
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +328 -136
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +82 -17
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +113 -9
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.d.ts +13 -21
- package/dist/frontend/lowering/lower-expando.js +90 -126
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +2 -2
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +65 -0
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +471 -0
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +36 -10
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-node-island.js +28 -0
- package/dist/frontend/lowering/lower-node-island.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +53 -7
- package/dist/frontend/lowering/lower-server.js +213 -42
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.js +50 -7
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +24 -0
- package/dist/frontend/lowering/lower-stmts.js +463 -220
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +2 -2
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-test.js +71 -2
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +81 -10
- package/dist/frontend/lowering/lowerer.js +319 -72
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/new-target.js +10 -2
- package/dist/frontend/lowering/new-target.js.map +1 -1
- package/dist/frontend/lowering/nullish-empty-pattern.js +3 -3
- package/dist/frontend/lowering/nullish-empty-pattern.js.map +1 -1
- package/dist/frontend/lowering/partial-assertions.js +30 -5
- package/dist/frontend/lowering/partial-assertions.js.map +1 -1
- package/dist/frontend/lowering/primitive-throws.js +91 -1
- package/dist/frontend/lowering/primitive-throws.js.map +1 -1
- package/dist/frontend/lowering/primitive-wrappers.d.ts +9 -0
- package/dist/frontend/lowering/primitive-wrappers.js +2 -2
- package/dist/frontend/lowering/primitive-wrappers.js.map +1 -1
- package/dist/frontend/lowering/promise-executor-adapter.js +5 -2
- package/dist/frontend/lowering/promise-executor-adapter.js.map +1 -1
- package/dist/frontend/lowering/record-links.js +7 -2
- package/dist/frontend/lowering/record-links.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +4 -0
- package/dist/frontend/lowering/surfaces.js +118 -2
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/surfaces.test.d.ts +1 -0
- package/dist/frontend/lowering/surfaces.test.js +31 -0
- package/dist/frontend/lowering/surfaces.test.js.map +1 -0
- package/dist/frontend/mock-shapes.js +3 -3
- package/dist/frontend/mock-shapes.js.map +1 -1
- package/dist/frontend/npm-static-ladder.d.ts +21 -0
- package/dist/frontend/npm-static-ladder.js +2 -0
- package/dist/frontend/npm-static-ladder.js.map +1 -0
- package/dist/frontend/npm-static-ladder.test.d.ts +1 -0
- package/dist/frontend/npm-static-ladder.test.js +138 -0
- package/dist/frontend/npm-static-ladder.test.js.map +1 -0
- package/dist/frontend/npm-static-status.d.ts +15 -0
- package/dist/frontend/npm-static-status.js +2 -0
- package/dist/frontend/npm-static-status.js.map +1 -0
- package/dist/frontend/package-shims.js +1 -1
- package/dist/frontend/package-shims.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +1 -1
- package/dist/frontend/pipeline.js +222 -25
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +4 -0
- package/dist/frontend/program-analysis.js +6 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program.js +258 -32
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +30 -0
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/resolve.js +29 -5
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/resolve.test.js +40 -0
- package/dist/frontend/resolve.test.js.map +1 -1
- package/dist/frontend/services.d.ts +8 -0
- package/dist/frontend/services.js +7 -0
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +7 -0
- package/dist/frontend/ts7/checker.js +12 -0
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.js +1 -0
- package/dist/frontend/ts7/checker.test.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +39 -2
- package/dist/frontend/ts7/program-host.js +62 -8
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/program-host.test.js +33 -0
- package/dist/frontend/ts7/program-host.test.js.map +1 -1
- package/dist/frontend/ts7/session-cache.d.ts +5 -1
- package/dist/frontend/ts7/session-cache.js +7 -1
- package/dist/frontend/ts7/session-cache.js.map +1 -1
- package/dist/frontend/ts7/session-cache.test.js +37 -0
- package/dist/frontend/ts7/session-cache.test.js.map +1 -1
- package/dist/frontend/ts7/session.js +19 -1
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/ts7/source-parser.d.ts +17 -2
- package/dist/frontend/ts7/source-parser.js +61 -2
- package/dist/frontend/ts7/source-parser.js.map +1 -1
- package/dist/frontend/ts7/source-parser.test.js +55 -2
- package/dist/frontend/ts7/source-parser.test.js.map +1 -1
- package/dist/frontend/tsc-codes.d.ts +3 -2
- package/dist/frontend/tsc-codes.js +129 -22
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +5 -11
- package/dist/frontend/type-mapper.js +380 -70
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +67 -7
- package/dist/index.js.map +1 -1
- package/dist/ir/builtin-effects.js +29 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +72 -6
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/codec.generated.d.ts +1 -1
- package/dist/ir/codec.generated.js +321 -263
- package/dist/ir/codec.generated.js.map +1 -1
- package/dist/ir/constant-length-clones.d.ts +26 -0
- package/dist/ir/constant-length-clones.js +589 -0
- package/dist/ir/constant-length-clones.js.map +1 -0
- package/dist/ir/constant-length-clones.test.d.ts +1 -0
- package/dist/ir/constant-length-clones.test.js +292 -0
- package/dist/ir/constant-length-clones.test.js.map +1 -0
- package/dist/ir/constant-tables.d.ts +10 -5
- package/dist/ir/constant-tables.js +83 -17
- package/dist/ir/constant-tables.js.map +1 -1
- package/dist/ir/constant-tables.test.js +58 -1
- package/dist/ir/constant-tables.test.js.map +1 -1
- package/dist/ir/fields.generated.js +5 -2
- package/dist/ir/fields.generated.js.map +1 -1
- package/dist/ir/function-references.js +2 -0
- package/dist/ir/function-references.js.map +1 -1
- package/dist/ir/function-references.test.js +13 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/integer-loops.js +1 -0
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +16 -0
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/ir.d.ts +50 -6
- package/dist/ir/ir.js +44 -2
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +83 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/js-groups.js +5 -1
- package/dist/ir/js-groups.js.map +1 -1
- package/dist/ir/js-ic.d.ts +20 -0
- package/dist/ir/js-ic.js +81 -4
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +8 -1
- package/dist/ir/js-ic.test.js.map +1 -1
- package/dist/ir/lane-plans.d.ts +86 -0
- package/dist/ir/lane-plans.js +589 -0
- package/dist/ir/lane-plans.js.map +1 -0
- package/dist/ir/lane-plans.test.d.ts +1 -0
- package/dist/ir/lane-plans.test.js +549 -0
- package/dist/ir/lane-plans.test.js.map +1 -0
- package/dist/ir/runtime-features.d.ts +68 -10
- package/dist/ir/runtime-features.js +285 -17
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/runtime-features.test.js +190 -1
- package/dist/ir/runtime-features.test.js.map +1 -1
- package/dist/ir/validate.js +61 -24
- package/dist/ir/validate.js.map +1 -1
- package/dist/native/cache.d.ts +5 -0
- package/dist/native/cache.js +23 -1
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cache.test.js +29 -1
- package/dist/native/cache.test.js.map +1 -1
- package/dist/native/cli.js +4 -2
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.d.ts +11 -3
- package/dist/native/compiler.js +102 -16
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/compiler.test.js +244 -2
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/prepare.d.ts +14 -1
- package/dist/native/prepare.js +79 -29
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.test.js +3 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/unchanged.d.ts +80 -0
- package/dist/native/unchanged.js +301 -0
- package/dist/native/unchanged.js.map +1 -0
- package/dist/native/unchanged.test.d.ts +1 -0
- package/dist/native/unchanged.test.js +249 -0
- package/dist/native/unchanged.test.js.map +1 -0
- package/dist/node-islands/boundary.d.ts +16 -0
- package/dist/node-islands/boundary.js +70 -7
- package/dist/node-islands/boundary.js.map +1 -1
- package/dist/node-islands/boundary.test.js +59 -14
- package/dist/node-islands/boundary.test.js.map +1 -1
- package/dist/node-islands/detect.js +203 -47
- package/dist/node-islands/detect.js.map +1 -1
- package/dist/node-islands/detect.test.js +45 -0
- package/dist/node-islands/detect.test.js.map +1 -1
- package/dist/node-islands/growth.js +4 -16
- package/dist/node-islands/growth.js.map +1 -1
- package/dist/node-islands/modules.d.ts +3 -0
- package/dist/node-islands/modules.js +143 -12
- package/dist/node-islands/modules.js.map +1 -1
- package/dist/node-islands/modules.test.js +125 -0
- package/dist/node-islands/modules.test.js.map +1 -1
- package/dist/node-islands/report.d.ts +1 -1
- package/dist/node-islands/report.js +2 -1
- package/dist/node-islands/report.js.map +1 -1
- package/package.json +20 -20
- package/shims/undici/core/request.ts +7 -1
- package/surface-manifest.json +380 -2
|
@@ -13,6 +13,7 @@ import { checkedTable, countTable, fixedScalar, flagScalar, functionTable, irDat
|
|
|
13
13
|
import { UnitReuse, unitReuseVerify, verifyStoredUnit } from "./unit-reuse.js";
|
|
14
14
|
import { moduleNamespaceDynValue, moduleNamespaceObject, moduleNamespaceValue, } from "./module-namespace-elements.js";
|
|
15
15
|
import { keyedHelperName, moduleTagNumber, portableRelativePath } from "./stable-names.js";
|
|
16
|
+
import { noteCodecMode, ZLIB_STREAM_FACTORIES, ZLIB_STREAM_T } from "./builtins/compression.js";
|
|
16
17
|
import { positionTag, StructuralPositions } from "./structural-positions.js";
|
|
17
18
|
import { activeNodeIslands, setActiveNodeIslands, } from "../../node-islands/boundary.js";
|
|
18
19
|
import { bindingSymbolOfRead, onlyForwarded, stripTypeWrappers } from "./typed-arguments.js";
|
|
@@ -64,7 +65,7 @@ import { lowerBuiltinCall } from "./builtin-calls.js";
|
|
|
64
65
|
import { CoercionState } from "./coercions/state.js";
|
|
65
66
|
import { widthLiftPlan, unitOnlyElem, recordWidthPlan, describeRecordWidthBlocker, objToRecordPlan, recordToClassPlan, } from "./coercions/structural-plans.js";
|
|
66
67
|
import { widthCoerce, applyWidthLift, unionRecordWidthHelper, unionArrayWidthHelper, recordWidthHelper, tupleArrayWidthHelper, emptyArrayLiftHelper, arrayWidthHelper, objRecordWidthHelper, recordClassWidthHelper, classStaticsProjection, } from "./coercions/structural.js";
|
|
67
|
-
import { funcReturnWidthAdapter, coercibleValue, cleanFuncAdaptable, funcCoerceAdapter, spawnResFnAdapterPlan, spawnResFnAdapter, } from "./coercions/function-adapters.js";
|
|
68
|
+
import { funcReturnWidthAdapter, coercibleValue, cleanFuncAdaptable, funcCoerceAdapter, sortComparatorResultAdapter, spawnResFnAdapterPlan, spawnResFnAdapter, } from "./coercions/function-adapters.js";
|
|
68
69
|
import { unionRetagMappable, narrowedRetagHelper, uninhabitedArmRetagHelper, strandedUnitTrap, strandedCoercionTrap, recordUnionRouteHelper, recordUnionWrapHelper, unionRetagHelper, narrowedArmHelper, checkedNarrowCall, checkedNarrowOperand, deferredReadHelper, widthNarrowHelper, } from "./coercions/unions.js";
|
|
69
70
|
import { assertedConversion } from "./coercions/asserted.js";
|
|
70
71
|
import { boxBuiltinValuesChecked, lowerUtilTypeValue, checkedNativeCallableValue, pathModuleValue, utilTypesModuleValue, } from "./lower-builtin-values.js";
|
|
@@ -85,7 +86,7 @@ import { RuntimeOptionalLocals } from "./runtime-optional-locals.js";
|
|
|
85
86
|
import { collectContractAnnotations } from "../contract-types.js";
|
|
86
87
|
import { sanitizeUnregisteredClassTypes } from "./sanitize-class-types.js";
|
|
87
88
|
import { UnregisteredClassTypes } from "./unregistered-class-types.js";
|
|
88
|
-
import { bindingInContext, captureContextBinding, declareContextLocal, declareContextThis, newFnCtx, } from "./function-context.js";
|
|
89
|
+
import { bindingInContext, captureContextBinding, captureContextLocal, declareContextLocal, declareContextThis, newFnCtx, } from "./function-context.js";
|
|
89
90
|
import { InternalCompilerError } from "../../errors.js";
|
|
90
91
|
import { defaultAfterUndefined, lowerStaticallyUndefinedArgument } from "./optional-arguments.js";
|
|
91
92
|
import {} from "./class-protocol-dispatch.js";
|
|
@@ -94,12 +95,12 @@ import { addUntypedIntegrityWords, guardClassAttributeWrites } from "./class-att
|
|
|
94
95
|
import { inferredCollectionType } from "./js-collection-types.js";
|
|
95
96
|
import { sloppyDynamicWrites } from "./frozen-records.js";
|
|
96
97
|
import { guardFrozenWrites, markSloppyRecordWrites } from "./frozen-records.js";
|
|
97
|
-
import { applyHandleProperties } from "./handle-properties.js";
|
|
98
|
+
import { alignHandlePropertyChildFact, applyHandleProperties, handlePropertyScanRoots, } from "./handle-properties.js";
|
|
98
99
|
import { installBufferValue } from "./containers/bytes.js";
|
|
99
100
|
import { installMutableBuffersArm } from "./buffers.js";
|
|
100
101
|
import { ClassProtocols } from "./class-protocols.js";
|
|
101
102
|
import { earlyReadVarSymbols } from "./var-hoisting.js";
|
|
102
|
-
import { recordTextCodecClass } from "../../ir/ir.js";
|
|
103
|
+
import { recordTextCodecClass, sortArms } from "../../ir/ir.js";
|
|
103
104
|
import { assignLegacyTiers } from "../../ir/tiers.js";
|
|
104
105
|
import { dynamicSlotOperationCounts, dynamicTierWarning } from "./dynamic-tier.js";
|
|
105
106
|
import { promoteJsvals } from "../../ir/jsval.js";
|
|
@@ -137,11 +138,11 @@ import { discriminantOwners, literalUnionArm } from "../union-discriminants.js";
|
|
|
137
138
|
import { declarationGroupKey, typeFailureOf } from "./type-failure.js";
|
|
138
139
|
import { dynamicSlotDiag } from "../../diagnostics/dynamic-slots.js";
|
|
139
140
|
import { unsupportedAnyOperationDiag, blockedBindingUseDiag, checkerPanicDiag, componentTypeDiag, isCheckerPanic, genericSignatureTypeDiag, hostGlobalDiag, indexSignatureTypeDiag, intersectionTypeDiag, noLoweringDiag, overloadedSignatureTypeDiag, recordShapeMismatchDiag, stdlibSnapshotValueUseDiag, unsupportedNativeApiDiag, unsupportedPackageValueDiag, unionMismatchDiag, UNSUPPORTED, unsupportedDiag, unsupportedTypeDiag, } from "../../diagnostics/diagnostic.js";
|
|
140
|
-
import { arrayOf, BOOL, canAdaptDynFuncTo, canBoxFuncIntoDyn, canDynCheckTo, canConvertToDyn, DYN,
|
|
141
|
+
import { arrayOf, BOOL, canAdaptDynFuncTo, canBoxFuncIntoDyn, canDynCheckTo, canConvertToDyn, DYN, F64, isDynTypedRefType, isJsonSafeType, isJsonStringifySafeType, isPrimitiveCollectionKey, isSupportedMapKey, isSupportedMapValue, isUndefinedArmedUnion, isUnitType, NULL_T, RUNTIME_ERROR_CLASSES, STRING, typeEquals, UNDEFINED_T, VOID, } from "../../ir/ir.js";
|
|
141
142
|
import { provenanceActive } from "../provenance-registry.js";
|
|
142
143
|
import { canonicalBuiltinModule, cjsExportAssignmentOf, cjsExportDiscardReason, cjsExportsAssignedInFunctions, cjsReexportedModules, cjsNamespaceExportNames, isCheckedJsSourceFile, isCjsExportTableLiteral, isCjsJsFile, isJsSourceFile, isNodeEsmFile, locOf, orderedImportsOf, npmStaticDepSf7, requireSpecOf, isJsWriteTarget7, isStrictCode, resolveImport, workspacePackageOfPath, } from "../program.js";
|
|
143
144
|
import { containsRecord, containsUnion, describeComponentBlocker, describeRecordMemberBlocker, erasedOverloadMemberType, formatIrType, FETCH_AMBIENT_TYPES, isOsConstantsSymbol, isOverloadedCallableMemberType, isUnitOnlyTsType, isWorkerHandleType, isFetchHandleType, jsOpenObjectType, mapType, computeSymbolProvenance, declaresLegacyUrl, declaresWebAssemblyNamespace, ShapeRegistry, noteScopeSensitiveMapping, typeKey, UnionRegistry, withUndefinedArm as withUndefinedArmCanonical, } from "../type-mapper.js";
|
|
144
|
-
import { builtinConstLit, builtinModuleConstOf, builtinModulesArrayLit, builtinFenceHintOf, builtinModuleFnOf, stdlibMemberFence, isStdlibMember, isStdlibSymbol, isStdlibGlobal, stdlibGlobalNameOf, stdlibGlobalMember, nodeTypesOnlySymbol, } from "./surfaces.js";
|
|
145
|
+
import { builtinConstLit, builtinModuleConstOf, builtinModulesArrayLit, builtinFenceHintOf, builtinModuleFnOf, FS_CALLBACK_VALUE_LENGTHS, stdlibMemberFence, isStdlibMember, isStdlibSymbol, isStdlibGlobal, stdlibGlobalNameOf, stdlibGlobalMember, nodeTypesOnlySymbol, } from "./surfaces.js";
|
|
145
146
|
import { builtinClassAliasOf, runtimeClassValueOfType, } from "./builtins/class-values.js";
|
|
146
147
|
import { splitFiles, collectProgram, collectNpmImports, collectJsonImports, moduleArtifacts, collectGlobals, declSymbolOf, defaultExportSymbolOf, lowerFileInit, lowerDefaultExport, buildMain, appendDynamicImportModules, appendForkModules, appendWorkerModules, } from "./lower-modules.js";
|
|
147
148
|
import { prepareCjsModuleGraph, usesCjsTopLevelThis } from "./lower-node-module.js";
|
|
@@ -177,10 +178,10 @@ import { lowerTimersPromisesSetInterval, lowerTimeoutMethodCall } from "./builti
|
|
|
177
178
|
import { lowerFsToUnixTimestampCall, lowerFsLadderCall, lowerStatsMethodCall, } from "./builtins/filesystem.js";
|
|
178
179
|
import { lowerSpawnSyncCall, lowerSpawnCall, lowerExecFileCall } from "./builtins/child-process.js";
|
|
179
180
|
import { lowerExecSyncCall } from "./builtins/child-process-sync.js";
|
|
180
|
-
import {
|
|
181
|
+
import { isAmbientProcessEnv, envValueType, lowerProcessEnvGet, refuseHeldEnvWrite, } from "./builtins/environment.js";
|
|
181
182
|
import { lowerJsonMethodCall, lowerJsonProperty } from "./builtins/json.js";
|
|
182
183
|
import { lowerCryptoComposedCall, lowerCryptoModuleCall } from "./builtins/crypto.js";
|
|
183
|
-
import { lowerUrlMethodCall, lowerSearchParamsMethodCall } from "./builtins/url.js";
|
|
184
|
+
import { legacyUrlClassValue, lowerUrlMethodCall, lowerSearchParamsMethodCall, } from "./builtins/url.js";
|
|
184
185
|
import { lowerChildMethodCall } from "./builtins/child-process-methods.js";
|
|
185
186
|
import { lowerAtomicsCall } from "./builtins/atomics.js";
|
|
186
187
|
import { lowerBuiltinExtraProperty } from "./builtins/properties.js";
|
|
@@ -208,7 +209,7 @@ import { assertFunctionValue, lowerAssertModuleCall, lowerAssertDirectCall, } fr
|
|
|
208
209
|
import { lowerUtilModuleCall } from "./lower-inspect.js";
|
|
209
210
|
import { lowerSystemErrorMapValue } from "./lower-system-errors.js";
|
|
210
211
|
import { lowerComptime, comptimeBakeable, rejectComptimeCaptures, comptimeValueToIr, } from "./lower-comptime.js";
|
|
211
|
-
import { lowerStmts, hasJsTypeAnnotation, noteBlockedBindings, isBlockedBinding, lowerScopedBlock, predeclareForwardCapture, predeclareForwardFnDecl, predeclareForwardVar, lowerStmt, lowerVarStatement, lowerDestructuringDecl, lowerDestructuringAssignParts, lowerBindingPattern, checkBindingElement, bindPatternTarget, isParseArgsDynCheckerType, lowerVarDeclList, lowerVarDecl, lowerSwitch, lowerTry, lowerExprStatement, lowerForOf, lowerForStatement, matchGroupsPatternSource, isGuardedRecordRead, holdsEvolvingArray, } from "./lower-stmts.js";
|
|
212
|
+
import { lowerStmts, hasJsTypeAnnotation, noteBlockedBindings, isBlockedBinding, lowerScopedBlock, predeclareForwardCapture, predeclareForwardFnDecl, predeclareForwardVar, lowerStmt, lowerVarStatement, lowerDestructuringDecl, lowerDestructuringAssignParts, lowerBindingPattern, assertedOnlyFieldRead, checkBindingElement, bindPatternTarget, isParseArgsDynCheckerType, lowerVarDeclList, lowerVarDecl, lowerSwitch, lowerTry, lowerExprStatement, lowerForOf, lowerForStatement, matchGroupsPatternSource, isGuardedRecordRead, holdsEvolvingArray, } from "./lower-stmts.js";
|
|
212
213
|
import { lowerExpr, maybeNarrow, lowerUnitComparison, lowerNullishCoalesce, lowerCondition, ensureBool, requireTruthyUnion, eqComparableUnion, lowerIntrinsicProperty, lowerArrayLiteral, lowerElementAccess, lowerElementWrite, lowerRecordKeyRead, ensureString, lowerTemplate, lowerAsExpression, lowerPrefixUnary, lowerBinary, lowerCaughtTypeofTest, caughtRead, caughtLocalOf, caughtToString, lowerInstanceOf, lowerRegexLiteral, lowerFieldRead, lowerUnionProperty, fieldTarget, fieldGetExpr, fieldSetStmt, lowerFieldCompound, uniqueSymbolKeyOf, matchCallbackParamGroupsOf, } from "./lower-exprs.js";
|
|
213
214
|
import { finishOptionalChain, isOptionalChainTail, lowerOptionalChain, } from "./expressions/optional-chains.js";
|
|
214
215
|
import { foldedStringKeyOf, lowerDynObjectLiteral, lowerObjectLiteral, lowerShorthandValue, rejectThisInObjectMethod, } from "./expressions/object-literals.js";
|
|
@@ -490,6 +491,7 @@ function lowerToIrWithIslands(program, entry, moduleOrder, options) {
|
|
|
490
491
|
projectCheckJs: options.projectCheckJs ?? false,
|
|
491
492
|
targetPlatform,
|
|
492
493
|
startupCrash,
|
|
494
|
+
admittedOpinions: options.admittedOpinions,
|
|
493
495
|
inlineRequireCycleCalls,
|
|
494
496
|
dynamicImportRejections: options.dynamicImportRejections,
|
|
495
497
|
ffiImports,
|
|
@@ -538,13 +540,23 @@ function lowerToIrWithIslands(program, entry, moduleOrder, options) {
|
|
|
538
540
|
let result = emitted.result;
|
|
539
541
|
let resultLowerer = reachableEmit;
|
|
540
542
|
timing("reachable-emit", { reachable: reachable.size });
|
|
543
|
+
// The general stream representation (TypeMapperCtx.generalNodeStreams)
|
|
544
|
+
// is a per-program decision: only a program whose reachable code moved
|
|
545
|
+
// a general stream into a stdio-represented stream slot lowers again
|
|
546
|
+
// with it. Every other program keeps the single pass above unchanged.
|
|
547
|
+
// The stream pass below replaces this pass's result outright, so the
|
|
548
|
+
// whole-slot comparison runs after it for those programs (it would
|
|
549
|
+
// otherwise pay for a result the stream pass throws away).
|
|
550
|
+
const generalNodeStreams = reachableEmit.requiresGeneralNodeStreams;
|
|
541
551
|
// Localized failure (stage L3): push-down must never cost a failing
|
|
542
552
|
// program more errors than the whole-slot checked dynamic. A pushed-down
|
|
543
553
|
// type is baked into the globals, fields and signatures that hold it, so
|
|
544
554
|
// when the program still fails, the emit runs once more with every
|
|
545
555
|
// degraded type held whole, and the pass with fewer errors wins (ties
|
|
546
556
|
// keep push-down). A program that compiles never takes this path.
|
|
547
|
-
if (
|
|
557
|
+
if (!generalNodeStreams &&
|
|
558
|
+
result.diagnostics.length > 0 &&
|
|
559
|
+
reachableEmit.hasPartialDegradedTypes()) {
|
|
548
560
|
const whole = new Lowerer(program, entry, moduleOrder, {
|
|
549
561
|
facts,
|
|
550
562
|
frontendServices: options.frontendServices,
|
|
@@ -576,11 +588,6 @@ function lowerToIrWithIslands(program, entry, moduleOrder, options) {
|
|
|
576
588
|
}
|
|
577
589
|
timing("whole-slot-relower", { reachable: wholeEmitted.reachable.size });
|
|
578
590
|
}
|
|
579
|
-
// The general stream representation (TypeMapperCtx.generalNodeStreams)
|
|
580
|
-
// is a per-program decision: only a program whose reachable code moved
|
|
581
|
-
// a general stream into a stdio-represented stream slot lowers again
|
|
582
|
-
// with it. Every other program keeps the single pass above unchanged.
|
|
583
|
-
const generalNodeStreams = reachableEmit.requiresGeneralNodeStreams;
|
|
584
591
|
// Checked-dynamic stream slots (dyn-streams.ts) are a further per-program
|
|
585
592
|
// decision under the general representation: only a program that moves an
|
|
586
593
|
// untyped value into a stream slot lowers again with them.
|
|
@@ -665,6 +672,48 @@ function lowerToIrWithIslands(program, entry, moduleOrder, options) {
|
|
|
665
672
|
resultLowerer = emit;
|
|
666
673
|
timing("historical-order-relower");
|
|
667
674
|
}
|
|
675
|
+
// A stream program whose passes still fail takes the whole-slot
|
|
676
|
+
// comparison here, against the pass whose result stands: the stream pass
|
|
677
|
+
// replaces the earlier result outright, so the comparison is only worth
|
|
678
|
+
// paying for on the pass it would judge. The rule is unchanged — the
|
|
679
|
+
// whole-slot pass is kept only when it has strictly fewer errors.
|
|
680
|
+
if (generalNodeStreams &&
|
|
681
|
+
result.diagnostics.length > 0 &&
|
|
682
|
+
resultLowerer.hasPartialDegradedTypes()) {
|
|
683
|
+
const whole = new Lowerer(program, entry, moduleOrder, {
|
|
684
|
+
facts,
|
|
685
|
+
frontendServices: options.frontendServices,
|
|
686
|
+
projectCheckJs: options.projectCheckJs ?? false,
|
|
687
|
+
generalNodeStreams: true,
|
|
688
|
+
...(dynNodeStreams ? { dynNodeStreams: true } : {}),
|
|
689
|
+
targetPlatform,
|
|
690
|
+
startupCrash,
|
|
691
|
+
admittedOpinions: options.admittedOpinions,
|
|
692
|
+
inlineRequireCycleCalls,
|
|
693
|
+
dynamicImportRejections: options.dynamicImportRejections,
|
|
694
|
+
ffiImports,
|
|
695
|
+
libraryCallbacks,
|
|
696
|
+
forkTargets,
|
|
697
|
+
workerTargets,
|
|
698
|
+
ffiBindingSymbols: ffiValidation.symbolsByName,
|
|
699
|
+
externalTypes,
|
|
700
|
+
externalTypeSpecifiersByFile,
|
|
701
|
+
tierMode,
|
|
702
|
+
runtimeOptionalReport,
|
|
703
|
+
wholeSlotDegradation: true,
|
|
704
|
+
});
|
|
705
|
+
for (const d of extraModuleCycleDiags)
|
|
706
|
+
whole.pushDiag(d);
|
|
707
|
+
for (const d of ffiValidation.diagnostics)
|
|
708
|
+
whole.pushDiag(d);
|
|
709
|
+
const wholeEmitted = whole.emitReachable(options.libRoots);
|
|
710
|
+
if (wholeEmitted.result.diagnostics.length < result.diagnostics.length) {
|
|
711
|
+
reachable = wholeEmitted.reachable;
|
|
712
|
+
result = wholeEmitted.result;
|
|
713
|
+
resultLowerer = whole;
|
|
714
|
+
}
|
|
715
|
+
timing("whole-slot-relower", { reachable: wholeEmitted.reachable.size });
|
|
716
|
+
}
|
|
668
717
|
// LIBRARY mode: the profile's export names resolved to the units that
|
|
669
718
|
// supply them — the entry's own unit for a direct export, the declaring
|
|
670
719
|
// module's tagged unit for a re-exported one. The export-map resolution
|
|
@@ -1952,6 +2001,14 @@ export class Lowerer {
|
|
|
1952
2001
|
* program's JavaScript adds to them (handle-properties.ts). */
|
|
1953
2002
|
writesOntoChildren = false;
|
|
1954
2003
|
childAdditions = null;
|
|
2004
|
+
/** Whether the program's JavaScript adds own properties to handles, asks
|
|
2005
|
+
* their integrity, and which class members it shadows
|
|
2006
|
+
* (handle-properties.ts). */
|
|
2007
|
+
handleAdditions = undefined;
|
|
2008
|
+
/** Whether the program has a JavaScript implementation file, the only kind
|
|
2009
|
+
* that can add own properties to a handle, so a typed handle operation of
|
|
2010
|
+
* a program without one keeps its own lowering (handle-properties.ts). */
|
|
2011
|
+
handleJsSources = undefined;
|
|
1955
2012
|
/** Bindings whose unchecked string arithmetic can produce either a number
|
|
1956
2013
|
* (NaN for an absent read) or a string. Preserve that result union at bare
|
|
1957
2014
|
* reads instead of applying the checker-bare string narrowing adapter. */
|
|
@@ -2299,7 +2356,16 @@ export class Lowerer {
|
|
|
2299
2356
|
this.armTag(signature.returnType.unionId, UNDEFINED_T) >= 0));
|
|
2300
2357
|
}
|
|
2301
2358
|
if (ts.isIdentifier(origin)) {
|
|
2302
|
-
|
|
2359
|
+
// The whole-program analyses ask this question before any body lowers
|
|
2360
|
+
// (speculativeTypeQueries around analyzeRuntimeOptionalArrayReads), so
|
|
2361
|
+
// there is no function context and no local binding to consult yet: a
|
|
2362
|
+
// binding's storage class settles when its declaration (or its
|
|
2363
|
+
// parameter ABI) lowers, and a query must never mint a capture. Until
|
|
2364
|
+
// then the module global's storage is the only one readable. Every
|
|
2365
|
+
// other caller lowers a body, where an empty stack stays a lowerer bug.
|
|
2366
|
+
const local = this.speculativeTypeQueryDepth > 0 && this.fnStack.length === 0
|
|
2367
|
+
? null
|
|
2368
|
+
: this.resolveLocal(origin);
|
|
2303
2369
|
const root = local ? this.runtimeOptionalRootOf(local) : null;
|
|
2304
2370
|
const global = this.globalOf(origin);
|
|
2305
2371
|
return ((!!root && this.runtimeOptionalStorageLocals.has(root)) ||
|
|
@@ -2951,7 +3017,8 @@ export class Lowerer {
|
|
|
2951
3017
|
* record types (finalizeRecordLinks checks them against link sources). */
|
|
2952
3018
|
recordMethodCalls = [];
|
|
2953
3019
|
/** Completions of "custom" linked helpers (record-links.ts), which
|
|
2954
|
-
* finalizeRecordLinks runs once the links are known
|
|
3020
|
+
* finalizeRecordLinks runs once the links are known, with the record
|
|
3021
|
+
* shapes a checked conversion can leave holding a kept source. */
|
|
2955
3022
|
linkedHelperFinalizers = [];
|
|
2956
3023
|
/** Helpers over record types that finalizeRecordLinks completes. */
|
|
2957
3024
|
linkedHelpers = [];
|
|
@@ -3755,6 +3822,10 @@ export class Lowerer {
|
|
|
3755
3822
|
// are checked against.
|
|
3756
3823
|
"ownClassProtocols",
|
|
3757
3824
|
"verifySymbolProvenance",
|
|
3825
|
+
// Whether the program has a JavaScript implementation file depends only on
|
|
3826
|
+
// its modules, so the answer is a memo computed on first use and the
|
|
3827
|
+
// census in handle-properties.ts reads it again when a unit replays.
|
|
3828
|
+
"handleJsSources",
|
|
3758
3829
|
// The whole-program prepass analyzeJsWidenedBindings computes this set
|
|
3759
3830
|
// before lowering begins: a pure function of the program's modules.
|
|
3760
3831
|
"jsWidenedBindings",
|
|
@@ -3902,6 +3973,7 @@ export class Lowerer {
|
|
|
3902
3973
|
fixed("errorMethodDispatchRevision", () => this.errorMethodDispatchRevision),
|
|
3903
3974
|
fixed("errorPropertyDispatchRevision", () => this.errorPropertyDispatchRevision),
|
|
3904
3975
|
fixed("childAdditions", () => this.childAdditions),
|
|
3976
|
+
fixed("handleAdditions", () => this.handleAdditions),
|
|
3905
3977
|
fixed("emitterEventTable", () => this.emitterEventTable),
|
|
3906
3978
|
fixed("emitterAnyNameListener", () => this.emitterAnyNameListener),
|
|
3907
3979
|
fixed("globalThisWrittenNames", () => this.globalThisWrittenNames),
|
|
@@ -5257,6 +5329,30 @@ export class Lowerer {
|
|
|
5257
5329
|
}
|
|
5258
5330
|
return createRequireProgramModuleOf(this, decl.initializer)?.dep ?? null;
|
|
5259
5331
|
}
|
|
5332
|
+
/** The table module a top-level CommonJS `const { a, ...rest } =
|
|
5333
|
+
* require("./m")` pattern's rest elements copy from: Node builds `rest`
|
|
5334
|
+
* from the module's own enumerable export properties at the require, and
|
|
5335
|
+
* the table's statically known members are exactly those properties.
|
|
5336
|
+
* Null when the pattern has no rest element or the target is not a
|
|
5337
|
+
* table module. */
|
|
5338
|
+
cjsRequireRestTableOf(decl) {
|
|
5339
|
+
if (!ts.isObjectBindingPattern(decl.name))
|
|
5340
|
+
return null;
|
|
5341
|
+
if (!decl.name.elements.nodes.some((e) => e.dotDotDotToken !== undefined))
|
|
5342
|
+
return null;
|
|
5343
|
+
const stmt = decl.parent?.parent;
|
|
5344
|
+
if (stmt === undefined || !ts.isVariableStatement(stmt) || !ts.isSourceFile(stmt.parent))
|
|
5345
|
+
return null;
|
|
5346
|
+
if (!isJsSourceFile(stmt.parent) || decl.initializer === undefined)
|
|
5347
|
+
return null;
|
|
5348
|
+
const spec = requireSpecOf(decl.initializer);
|
|
5349
|
+
if (spec === null)
|
|
5350
|
+
return null;
|
|
5351
|
+
const sf = stmt.parent;
|
|
5352
|
+
const dep = resolveImport(this.program, sf, spec, "require") ??
|
|
5353
|
+
npmStaticDepSf7(this.program, sf, spec, "require");
|
|
5354
|
+
return dep !== null && cjsNamespaceModule(this, dep) ? dep : null;
|
|
5355
|
+
}
|
|
5260
5356
|
createRequireBindingTargets = new Map();
|
|
5261
5357
|
createRequireElementTargets = new Map();
|
|
5262
5358
|
/** The program module a `const x = createRequire(...)("./m")` binding
|
|
@@ -5493,7 +5589,19 @@ export class Lowerer {
|
|
|
5493
5589
|
* calls of these names. Runs in every pass so the ids are
|
|
5494
5590
|
* deterministic. */
|
|
5495
5591
|
prepareModuleInits(parts) {
|
|
5496
|
-
|
|
5592
|
+
// The entry module's %init is %init.0; every other module's number comes
|
|
5593
|
+
// from its stable file name, so adding or reordering modules leaves every
|
|
5594
|
+
// other module's init name unchanged.
|
|
5595
|
+
const initNumbers = new Set([0]);
|
|
5596
|
+
for (const fp of parts) {
|
|
5597
|
+
if (fp.sf === this.entry) {
|
|
5598
|
+
this.initNameOf.set(fp.sf, "%init.0");
|
|
5599
|
+
continue;
|
|
5600
|
+
}
|
|
5601
|
+
const n = moduleTagNumber(this.stableFileName(fp.sf), initNumbers);
|
|
5602
|
+
initNumbers.add(n);
|
|
5603
|
+
this.initNameOf.set(fp.sf, `%init.${n}`);
|
|
5604
|
+
}
|
|
5497
5605
|
for (const fp of parts) {
|
|
5498
5606
|
const rawTag = this.fileTag.get(fp.sf) ?? "";
|
|
5499
5607
|
const tag = rawTag === "" ? "e." : rawTag.replace(/^%/, "");
|
|
@@ -6522,7 +6630,7 @@ export class Lowerer {
|
|
|
6522
6630
|
const right = this.mapTypeOf(this.typeOf(e.right));
|
|
6523
6631
|
const primitive = (t) => t?.kind === "f64" || t?.kind === "string" || t?.kind === "bool";
|
|
6524
6632
|
if (primitive(left) && primitive(right) && !typeEquals(left, right)) {
|
|
6525
|
-
const arms = [left, right]
|
|
6633
|
+
const arms = sortArms([left, right]);
|
|
6526
6634
|
return { kind: "union", unionId: this.unions.intern(arms) };
|
|
6527
6635
|
}
|
|
6528
6636
|
return null;
|
|
@@ -9212,6 +9320,12 @@ export class Lowerer {
|
|
|
9212
9320
|
// becomes its js twin), so coverage's dynamic statements are unchanged.
|
|
9213
9321
|
if (module && this.dynamicFunctions.length > 0)
|
|
9214
9322
|
promoteJsvals(module);
|
|
9323
|
+
// The child wrapper a handle-property table asks for must match the
|
|
9324
|
+
// module fact that links scr_child.c (the emitter's childProcess
|
|
9325
|
+
// feature): the census that requests it scans files the program may not
|
|
9326
|
+
// reach. Aligned on the final module, so both sides read one fact.
|
|
9327
|
+
if (module)
|
|
9328
|
+
alignHandlePropertyChildFact(module);
|
|
9215
9329
|
// A program that replaces a process output stream's write method beside
|
|
9216
9330
|
// Node islands is refused by the executable planner (SC8006): an
|
|
9217
9331
|
// island's process.stdout is its own object. Only island builds pay for
|
|
@@ -9405,6 +9519,11 @@ export class Lowerer {
|
|
|
9405
9519
|
// Establish the same managed header/top-level batch here before
|
|
9406
9520
|
// collection, while the production path simply finds warm memos.
|
|
9407
9521
|
this.checker.prefetchSourceFileStructures(parts.map((fp) => fp.sf));
|
|
9522
|
+
// The own-property census decides whether a program's JavaScript may
|
|
9523
|
+
// add properties to a handle. It visits every body, reached or not, so
|
|
9524
|
+
// batch the receiver types it reads before collection; the census then
|
|
9525
|
+
// makes no per-node checker request inside a deferred body.
|
|
9526
|
+
this.checker.prefetchCollectionTypes(handlePropertyScanRoots(parts.map((fp) => fp.sf)));
|
|
9408
9527
|
// Signature collection may read the initializer type of a default whose
|
|
9409
9528
|
// body type still admits undefined (for example `value =
|
|
9410
9529
|
// process.env.VALUE`). The expression executes only when reached, but
|
|
@@ -11461,7 +11580,8 @@ export class Lowerer {
|
|
|
11461
11580
|
// (constructing a dyn from static values is deliberately out this
|
|
11462
11581
|
// round; only JSON.parse results are dyn).
|
|
11463
11582
|
if (actual.kind === "dyn") {
|
|
11464
|
-
this.unsupported("SC1100", node, `passing 'unknown' values where '${this.fmt(expected)}' is expected`
|
|
11583
|
+
this.unsupported("SC1100", node, `passing 'unknown' values where '${this.fmt(expected)}' is expected ` +
|
|
11584
|
+
`(${this.dynCheckBlocker(expected) ?? "this target"} is outside the checked conversion's domain)`);
|
|
11465
11585
|
}
|
|
11466
11586
|
if (expected.kind === "dyn") {
|
|
11467
11587
|
// Function values BOX into dyn when their signature crosses
|
|
@@ -11865,33 +11985,10 @@ export class Lowerer {
|
|
|
11865
11985
|
// forgiven chains): the VALIDATED extraction — dynCheck, the
|
|
11866
11986
|
// checked-cast machinery, applied automatically. A value outside the
|
|
11867
11987
|
// slot's type throws a catchable TypeError instead of misreading the
|
|
11868
|
-
// payload.
|
|
11869
|
-
//
|
|
11870
|
-
//
|
|
11988
|
+
// payload. The domain is EXACTLY the explicit cast's (canDynCheckTo),
|
|
11989
|
+
// so the two crossings can never disagree about what converts;
|
|
11990
|
+
// everything else keeps requireExactShape's SC1100 fence.
|
|
11871
11991
|
if (expr.type.kind === "dyn" && expected.kind !== "dyn") {
|
|
11872
|
-
const undefArmedOk = expected.kind === "union" &&
|
|
11873
|
-
(this.unions
|
|
11874
|
-
.get(expected.unionId)
|
|
11875
|
-
?.arms.every((a) => a.kind === "undefinedT" ||
|
|
11876
|
-
this.jsonSafe(a) ||
|
|
11877
|
-
isDynTypedRefType(a) ||
|
|
11878
|
-
DYN_HANDLE_KINDS.has(a.kind)) ??
|
|
11879
|
-
false);
|
|
11880
|
-
const bytesOk = expected.kind === "bytes" && expected.elem === "u8";
|
|
11881
|
-
const errorOk = expected.kind === "object" && expected.className === "%Error";
|
|
11882
|
-
// Program and runtime class instances can return only from a
|
|
11883
|
-
// compiler-owned typed-reference capsule. A parsed/plain dyn object
|
|
11884
|
-
// fails the runtime check; an exact capsule unwraps the original
|
|
11885
|
-
// instance and preserves identity.
|
|
11886
|
-
const classOk = isDynTypedRefType(expected);
|
|
11887
|
-
// ADAPTABLE function targets (the checked-dynamic function
|
|
11888
|
-
// boundary's OUT direction — `const wrapped: F = mustCall(fn)`):
|
|
11889
|
-
// check callable-kind, then unwrap an identical boxed signature
|
|
11890
|
-
// directly or adapt through a per-target shim that dynChecks
|
|
11891
|
-
// arguments/results per F.
|
|
11892
|
-
const funcOk = expected.kind === "func" &&
|
|
11893
|
-
canAdaptDynFuncTo(expected, (id) => this.shapes.get(id), (id) => this.unions.get(id));
|
|
11894
|
-
const handleOk = DYN_HANDLE_KINDS.has(expected.kind);
|
|
11895
11992
|
noteUntypedStreamFlow(this, expected);
|
|
11896
11993
|
// `[EventEmitter]` in JavaScript builds an untyped array of the
|
|
11897
11994
|
// untyped constructor, which a typed array of the class cannot
|
|
@@ -11903,13 +12000,7 @@ export class Lowerer {
|
|
|
11903
12000
|
this.pushDiag(unsupportedDiag("SC1090", expr.loc, `holding runtime-provided class values ('${expected.elem.className.slice(1)}') in a typed array`));
|
|
11904
12001
|
throw new PoisonError();
|
|
11905
12002
|
}
|
|
11906
|
-
if (canDynCheckTo(expected, (id) => this.shapes.get(id), (id) => this.unions.get(id))
|
|
11907
|
-
undefArmedOk ||
|
|
11908
|
-
bytesOk ||
|
|
11909
|
-
errorOk ||
|
|
11910
|
-
classOk ||
|
|
11911
|
-
funcOk ||
|
|
11912
|
-
handleOk) {
|
|
12003
|
+
if (canDynCheckTo(expected, (id) => this.shapes.get(id), (id) => this.unions.get(id))) {
|
|
11913
12004
|
return { kind: "dynCheck", value: expr, type: expected, loc: expr.loc };
|
|
11914
12005
|
}
|
|
11915
12006
|
return expr;
|
|
@@ -12369,6 +12460,9 @@ export class Lowerer {
|
|
|
12369
12460
|
funcCoerceAdapter(fromT, toT, loc) {
|
|
12370
12461
|
return funcCoerceAdapter(this, fromT, toT, loc);
|
|
12371
12462
|
}
|
|
12463
|
+
sortComparatorResultAdapter(fromT, loc) {
|
|
12464
|
+
return sortComparatorResultAdapter(this, fromT, loc);
|
|
12465
|
+
}
|
|
12372
12466
|
spawnResFnAdapterPlan(fromT, toT) {
|
|
12373
12467
|
return spawnResFnAdapterPlan(this, fromT, toT);
|
|
12374
12468
|
}
|
|
@@ -13043,6 +13137,65 @@ export class Lowerer {
|
|
|
13043
13137
|
return (this.dynConvertible(from) &&
|
|
13044
13138
|
canDynCheckTo(to, (id) => this.shapes.get(id), (id) => this.unions.get(id)));
|
|
13045
13139
|
}
|
|
13140
|
+
/** The first reason `t` lies outside the checked conversion's domain
|
|
13141
|
+
* (canDynCheckTo), phrased for a diagnostic; null when it converts. Names
|
|
13142
|
+
* the blocking member rather than restating the whole domain, so an
|
|
13143
|
+
* SC1090/SC1100 fence points at the part that has to change. */
|
|
13144
|
+
dynCheckBlocker(t, seen = new Set()) {
|
|
13145
|
+
const shapes = (id) => this.shapes.get(id);
|
|
13146
|
+
const unions = (id) => this.unions.get(id);
|
|
13147
|
+
if (canDynCheckTo(t, shapes, unions))
|
|
13148
|
+
return null;
|
|
13149
|
+
if (seen.has(typeKey(t)))
|
|
13150
|
+
return `a recursive '${this.fmt(t)}' value`;
|
|
13151
|
+
seen.add(typeKey(t));
|
|
13152
|
+
switch (t.kind) {
|
|
13153
|
+
case "array": {
|
|
13154
|
+
const inner = this.dynCheckBlocker(t.elem, seen);
|
|
13155
|
+
return inner ? `an array whose element is ${inner}` : null;
|
|
13156
|
+
}
|
|
13157
|
+
case "record": {
|
|
13158
|
+
const shape = this.shapes.get(t.shapeId);
|
|
13159
|
+
const field = shape?.fields.find((f) => !canDynCheckTo(f.type, shapes, unions));
|
|
13160
|
+
if (field) {
|
|
13161
|
+
const inner = this.dynCheckBlocker(field.type, seen);
|
|
13162
|
+
return inner
|
|
13163
|
+
? `a record whose member '${field.name}' is ${inner}`
|
|
13164
|
+
: `a record whose member '${field.name}' is '${this.fmt(field.type)}'`;
|
|
13165
|
+
}
|
|
13166
|
+
if (shape?.indexValue && !canDynCheckTo(shape.indexValue, shapes, unions)) {
|
|
13167
|
+
return `a record whose indexed value is '${this.fmt(shape.indexValue)}'`;
|
|
13168
|
+
}
|
|
13169
|
+
return `a '${this.fmt(t)}' record (a layout a dyn value cannot be checked into)`;
|
|
13170
|
+
}
|
|
13171
|
+
case "func": {
|
|
13172
|
+
const param = t.params.find((p) => p.kind !== "dyn" && !canConvertToDyn(p, shapes, unions));
|
|
13173
|
+
if (param) {
|
|
13174
|
+
return (`a function whose parameter is '${this.fmt(param)}' ` +
|
|
13175
|
+
`(an argument cannot be converted from the dynamic tier)`);
|
|
13176
|
+
}
|
|
13177
|
+
if (t.rest === true && t.restAbi !== undefined && t.params.at(-1)?.kind !== "array") {
|
|
13178
|
+
return `a function whose rest parameter is not an array`;
|
|
13179
|
+
}
|
|
13180
|
+
return `a function returning '${this.fmt(t.ret)}' (a result no checked conversion produces)`;
|
|
13181
|
+
}
|
|
13182
|
+
case "promise": {
|
|
13183
|
+
const inner = this.dynCheckBlocker(t.inner, seen);
|
|
13184
|
+
return inner ? `a promise of ${inner}` : null;
|
|
13185
|
+
}
|
|
13186
|
+
case "union": {
|
|
13187
|
+
const arms = this.unions.get(t.unionId)?.arms ?? [];
|
|
13188
|
+
const arm = arms.find((a) => !isUnitType(a) && !canDynCheckTo(a, shapes, unions));
|
|
13189
|
+
if (arm) {
|
|
13190
|
+
const inner = this.dynCheckBlocker(arm, seen);
|
|
13191
|
+
return inner ? `a union with an arm that is ${inner}` : null;
|
|
13192
|
+
}
|
|
13193
|
+
return `a '${this.fmt(t)}' union`;
|
|
13194
|
+
}
|
|
13195
|
+
default:
|
|
13196
|
+
return `a '${this.fmt(t)}' value`;
|
|
13197
|
+
}
|
|
13198
|
+
}
|
|
13046
13199
|
/** True when a static type converts to a dyn value (the dynFrom
|
|
13047
13200
|
* walker's domain): JSON-safe, bytes<u8> (Uint8Array/Buffer — the checked-dynamic tree's
|
|
13048
13201
|
* bytes kind, payload copied; stdin chunks into unknown-typed helpers),
|
|
@@ -13374,7 +13527,7 @@ export class Lowerer {
|
|
|
13374
13527
|
* miss (process.env reads). "undefined" sorts last among all arm typeKeys,
|
|
13375
13528
|
* so the sorted pair is always [t, undefined]. */
|
|
13376
13529
|
withUndefinedArm(t) {
|
|
13377
|
-
const arms = [t, UNDEFINED_T]
|
|
13530
|
+
const arms = sortArms([t, UNDEFINED_T]);
|
|
13378
13531
|
return { kind: "union", unionId: this.unions.intern(arms) };
|
|
13379
13532
|
}
|
|
13380
13533
|
paramShape(param) {
|
|
@@ -13405,14 +13558,23 @@ export class Lowerer {
|
|
|
13405
13558
|
return wrappedUndefined(this, type, loc);
|
|
13406
13559
|
}
|
|
13407
13560
|
/** The value an OMITTED or deleted property leaves in a record field
|
|
13408
|
-
* slot
|
|
13409
|
-
*
|
|
13410
|
-
*
|
|
13411
|
-
*
|
|
13412
|
-
|
|
13561
|
+
* slot: the ABSENT state for undefined-armed unions (the slot reads as
|
|
13562
|
+
* undefined but the property does not exist), the absent dyn marker for
|
|
13563
|
+
* an OPTIONAL checked-dynamic slot (`optional: true` on the shape field —
|
|
13564
|
+
* an omitted `?: unknown` property is absent, not present-and-undefined),
|
|
13565
|
+
* the dyn undefined for a required 'unknown' slot, and null when the
|
|
13566
|
+
* slot cannot be missing. Pass the shape FIELD when the caller has one:
|
|
13567
|
+
* the bare dyn type cannot tell optional from required. Only legal as a
|
|
13568
|
+
* direct field-slot write (IR fieldAbsent). */
|
|
13569
|
+
absentFieldValue(field, loc) {
|
|
13570
|
+
const type = "kind" in field ? field : field.type;
|
|
13571
|
+
const optional = "kind" in field ? false : field.optional === true;
|
|
13413
13572
|
if (type.kind === "union" && this.armTag(type.unionId, UNDEFINED_T) >= 0) {
|
|
13414
13573
|
return { kind: "fieldAbsent", unionId: type.unionId, type, loc };
|
|
13415
13574
|
}
|
|
13575
|
+
if (type.kind === "dyn" && optional) {
|
|
13576
|
+
return { kind: "fieldAbsent", type, loc };
|
|
13577
|
+
}
|
|
13416
13578
|
return this.wrappedUndefined(type, loc);
|
|
13417
13579
|
}
|
|
13418
13580
|
/** A field copy that keeps absence: `value` (the converted read of
|
|
@@ -13420,26 +13582,32 @@ export class Lowerer {
|
|
|
13420
13582
|
* property exists, else the target slot's ABSENT state. Fields that are
|
|
13421
13583
|
* always present, and targets that cannot be absent, copy `value`
|
|
13422
13584
|
* as-is. Only legal as a direct field-slot write. */
|
|
13423
|
-
presenceKeepingCopy(obj, shapeId, field, value, loc
|
|
13585
|
+
presenceKeepingCopy(obj, shapeId, field, value, loc,
|
|
13586
|
+
/** The destination field, when the copy changes shape: its optional dyn
|
|
13587
|
+
* flag decides whether an absent source keeps the marker or writes an
|
|
13588
|
+
* ordinary dyn undefined. Defaults to the source field. */
|
|
13589
|
+
target) {
|
|
13424
13590
|
const present = this.recordFieldPresent(obj, shapeId, field, loc);
|
|
13425
13591
|
if (present.kind !== "recordHas")
|
|
13426
13592
|
return value;
|
|
13427
|
-
const absent = this.absentFieldValue(value.type, loc);
|
|
13593
|
+
const absent = this.absentFieldValue(target ?? value.type, loc);
|
|
13428
13594
|
if (absent?.kind !== "fieldAbsent")
|
|
13429
13595
|
return value;
|
|
13430
13596
|
return { kind: "ternary", cond: present, then: value, else_: absent, type: value.type, loc };
|
|
13431
13597
|
}
|
|
13432
13598
|
/** Own-property presence of declared field `field` on record `obj`
|
|
13433
13599
|
* (borrowed — callers pass a repeatable receiver): a runtime test for
|
|
13434
|
-
* undefined-armed union fields
|
|
13435
|
-
* every other declared field. */
|
|
13600
|
+
* undefined-armed union fields and for optional checked-dynamic fields,
|
|
13601
|
+
* which can be absent, and `true` for every other declared field. */
|
|
13436
13602
|
recordFieldPresent(obj, shapeId, field, loc) {
|
|
13437
13603
|
// A partial record view (partial-assertions.ts) can lack a field its
|
|
13438
13604
|
// asserted literal never wrote, whatever the field's required type.
|
|
13439
13605
|
if (partialAssertionFields(this, shapeId).has(field))
|
|
13440
13606
|
return { kind: "recordHas", obj, shapeId, field, type: BOOL, loc };
|
|
13441
13607
|
const f = this.shapes.get(shapeId)?.fields.find((x) => x.name === field);
|
|
13442
|
-
if (f &&
|
|
13608
|
+
if (f &&
|
|
13609
|
+
((f.type.kind === "union" && this.armTag(f.type.unionId, UNDEFINED_T) >= 0) ||
|
|
13610
|
+
(f.optional === true && f.type.kind === "dyn"))) {
|
|
13443
13611
|
return { kind: "recordHas", obj, shapeId, field, type: BOOL, loc };
|
|
13444
13612
|
}
|
|
13445
13613
|
return { kind: "boolLit", value: true, type: BOOL, loc };
|
|
@@ -14169,6 +14337,12 @@ export class Lowerer {
|
|
|
14169
14337
|
declareHiddenLocal(name, type) {
|
|
14170
14338
|
return declareContextLocal(this.ctx, name, type, false, undefined, undefined);
|
|
14171
14339
|
}
|
|
14340
|
+
/** Read a hidden slot from the current function: the slot itself when it
|
|
14341
|
+
* was declared here, a threaded capture when the read sits in a function
|
|
14342
|
+
* the declaring one encloses. Null when the owner context is gone. */
|
|
14343
|
+
captureHiddenLocal(local, owner) {
|
|
14344
|
+
return captureContextLocal(this.fnStack, local, owner);
|
|
14345
|
+
}
|
|
14172
14346
|
/** The body binding of a fixed-tuple rest parameter: one native slot per
|
|
14173
14347
|
* position (the flattened ABI), rebuilt into the tuple the source names.
|
|
14174
14348
|
* The empty tuple rides the empty-array representation. */
|
|
@@ -14832,6 +15006,12 @@ export class Lowerer {
|
|
|
14832
15006
|
lowerDestructuringAssignParts(target, rhs, loc) {
|
|
14833
15007
|
return lowerDestructuringAssignParts(this, target, rhs, loc);
|
|
14834
15008
|
}
|
|
15009
|
+
/** The asserted-only member answer (lower-stmts.ts): the value one
|
|
15010
|
+
* element reads from a record shape for a property only an asserted
|
|
15011
|
+
* intersection declares, answered from the shape's kept source. */
|
|
15012
|
+
assertedOnlyFieldRead(propName, srcType, srcRef, bodyT, loc) {
|
|
15013
|
+
return assertedOnlyFieldRead(this, propName, srcType, srcRef, bodyT, loc);
|
|
15014
|
+
}
|
|
14835
15015
|
lowerBindingPattern(pattern, srcRef, srcType, isLet, out, dynSpell, allowDynObject = false) {
|
|
14836
15016
|
if (ts.isObjectBindingPattern(pattern)) {
|
|
14837
15017
|
fenceFetchObjectBinding(this, pattern);
|
|
@@ -15772,6 +15952,11 @@ export class Lowerer {
|
|
|
15772
15952
|
(bi.member === "posix" || bi.member === "win32")) {
|
|
15773
15953
|
return pathModuleValue(this, `path/${bi.member}`, loc);
|
|
15774
15954
|
}
|
|
15955
|
+
// url.Url as a value: the legacy Url constructor (JavaScript sources;
|
|
15956
|
+
// @types/node declares Url as a type only). Its prototype is the one
|
|
15957
|
+
// url.parse() results carry.
|
|
15958
|
+
if (bi.module === "url" && bi.member === "Url")
|
|
15959
|
+
return legacyUrlClassValue(loc);
|
|
15775
15960
|
// events.defaultMaxListeners READS the process-wide default (its
|
|
15776
15961
|
// write twin routes through emitter.setDefaultMaxChk). Through an ES
|
|
15777
15962
|
// module namespace it reads the namespace's copy instead.
|
|
@@ -15889,22 +16074,81 @@ export class Lowerer {
|
|
|
15889
16074
|
return lowerSystemErrorMapValue(this, loc);
|
|
15890
16075
|
if (bi.module === "fs" &&
|
|
15891
16076
|
builtinModuleFnOf(this, bi.module, bi.member)?.fn === "fs.callbackCall") {
|
|
15892
|
-
return
|
|
15893
|
-
kind: "libCall",
|
|
15894
|
-
fn: "fs.callbackValue",
|
|
15895
|
-
args: [{ kind: "strLit", value: bi.member, type: STRING, loc }],
|
|
15896
|
-
type: DYN,
|
|
15897
|
-
loc,
|
|
15898
|
-
};
|
|
16077
|
+
return this.lowerFsCallbackValue(bi.member, loc);
|
|
15899
16078
|
}
|
|
15900
16079
|
// The buffer module's Buffer is the global constructor's value.
|
|
15901
16080
|
if (bi.module === "buffer" && bi.member === "Buffer")
|
|
15902
16081
|
return { kind: "libCall", fn: "buffer.constructor", args: [], type: DYN, loc };
|
|
15903
16082
|
if (bi.module === "fs" && (bi.member === "realpathSync" || bi.member === "realpathSync.native"))
|
|
15904
16083
|
return fsRealpathValue(this, bi.member === "realpathSync.native", loc);
|
|
16084
|
+
if (bi.module === "zlib") {
|
|
16085
|
+
const mode = ZLIB_STREAM_FACTORIES[bi.member];
|
|
16086
|
+
if (mode !== undefined)
|
|
16087
|
+
return this.lowerZlibStreamFactoryValue(bi.member, mode, loc);
|
|
16088
|
+
}
|
|
15905
16089
|
const fn = builtinModuleFnOf(this, bi.module, bi.member);
|
|
15906
16090
|
return fn ? this.lowerNativeCallableValue(fn, `${bi.module}.${bi.member}`, loc) : null;
|
|
15907
16091
|
}
|
|
16092
|
+
/** An error-first filesystem function as a value: the checked-dynamic
|
|
16093
|
+
* function the runtime dispatches every argument through, carrying Node's
|
|
16094
|
+
* own name and length for the member. */
|
|
16095
|
+
lowerFsCallbackValue(member, loc) {
|
|
16096
|
+
return {
|
|
16097
|
+
kind: "libCall",
|
|
16098
|
+
fn: "fs.callbackValue",
|
|
16099
|
+
args: [
|
|
16100
|
+
{ kind: "strLit", value: member, type: STRING, loc },
|
|
16101
|
+
numLit(FS_CALLBACK_VALUE_LENGTHS[member] ?? 0, loc),
|
|
16102
|
+
],
|
|
16103
|
+
type: DYN,
|
|
16104
|
+
loc,
|
|
16105
|
+
};
|
|
16106
|
+
}
|
|
16107
|
+
/** A zlib stream factory as a value: the options argument reaches the
|
|
16108
|
+
* same runtime constructor the direct call uses, and the value keeps
|
|
16109
|
+
* Node's name and length. */
|
|
16110
|
+
lowerZlibStreamFactoryValue(member, mode, loc) {
|
|
16111
|
+
// The value is called later, often with no other Brotli or zstd call in
|
|
16112
|
+
// the program: connect the codec at the point the factory is read, the
|
|
16113
|
+
// same way a direct call does.
|
|
16114
|
+
noteCodecMode(this, mode, loc);
|
|
16115
|
+
const key = `zlib.streamNew:${member}`;
|
|
16116
|
+
let fnName = this.builtinCallableValueFns.get(key);
|
|
16117
|
+
if (!fnName) {
|
|
16118
|
+
fnName = keyedHelperName(this, "%builtin.value.zlib.streamNew", key);
|
|
16119
|
+
this.builtinCallableValueFns.set(key, fnName);
|
|
16120
|
+
this.builtinCallableValueNames.set(fnName, member);
|
|
16121
|
+
this.builtinCallableValueLengths.set(fnName, 1);
|
|
16122
|
+
const options = { localId: "options.0", name: "options", type: DYN };
|
|
16123
|
+
this.liftedFns.push({
|
|
16124
|
+
name: fnName,
|
|
16125
|
+
params: [options],
|
|
16126
|
+
returnType: ZLIB_STREAM_T,
|
|
16127
|
+
locals: [{ id: options.localId, name: options.name, type: options.type, mutable: false }],
|
|
16128
|
+
body: [
|
|
16129
|
+
{
|
|
16130
|
+
kind: "return",
|
|
16131
|
+
value: {
|
|
16132
|
+
kind: "libCall",
|
|
16133
|
+
fn: "zlib.streamNew",
|
|
16134
|
+
args: [numLit(mode, loc), varRef(options.localId, DYN, loc)],
|
|
16135
|
+
type: ZLIB_STREAM_T,
|
|
16136
|
+
loc,
|
|
16137
|
+
},
|
|
16138
|
+
loc,
|
|
16139
|
+
},
|
|
16140
|
+
],
|
|
16141
|
+
loc,
|
|
16142
|
+
});
|
|
16143
|
+
}
|
|
16144
|
+
return {
|
|
16145
|
+
kind: "closure",
|
|
16146
|
+
fnName,
|
|
16147
|
+
captures: [],
|
|
16148
|
+
type: { kind: "func", params: [DYN], ret: ZLIB_STREAM_T },
|
|
16149
|
+
loc,
|
|
16150
|
+
};
|
|
16151
|
+
}
|
|
15908
16152
|
lowerNativeCallableValue(fn, display, loc) {
|
|
15909
16153
|
const valueParams = fn.valueParams;
|
|
15910
16154
|
if (!valueParams)
|
|
@@ -16200,8 +16444,11 @@ export class Lowerer {
|
|
|
16200
16444
|
lowerProcessStreamProperty(expr) {
|
|
16201
16445
|
return lowerProcessStreamProperty(this, expr);
|
|
16202
16446
|
}
|
|
16447
|
+
/** Whether `node` is the ambient `process.env` object a receiver names:
|
|
16448
|
+
* parentheses and the erased wrappers (`as`, `!`, `satisfies`) are looked
|
|
16449
|
+
* through (environment.ts). */
|
|
16203
16450
|
isProcessEnv(node) {
|
|
16204
|
-
return
|
|
16451
|
+
return isAmbientProcessEnv(this, node);
|
|
16205
16452
|
}
|
|
16206
16453
|
envValueType() {
|
|
16207
16454
|
return envValueType(this);
|