@scriptc/compiler 0.3.2 → 0.3.4
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 +1202 -64
- package/dist/backend/cycle-analysis.js +6 -1
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-mutability.d.ts +5 -0
- package/dist/backend/cycle-mutability.js +62 -3
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.js +1 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/library-pack.js +1 -0
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/llvm/alloc.js +24 -10
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/alloc.test.js +47 -1
- package/dist/backend/llvm/alloc.test.js.map +1 -1
- package/dist/backend/llvm/array-search.d.ts +8 -0
- package/dist/backend/llvm/array-search.js +52 -0
- package/dist/backend/llvm/array-search.js.map +1 -0
- package/dist/backend/llvm/array-search.test.d.ts +1 -0
- package/dist/backend/llvm/array-search.test.js +72 -0
- package/dist/backend/llvm/array-search.test.js.map +1 -0
- package/dist/backend/llvm/call-lifetimes.d.ts +12 -1
- package/dist/backend/llvm/call-lifetimes.js +41 -11
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +85 -1
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/classes.js +87 -36
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +6 -1
- package/dist/backend/llvm/common.js +8 -1
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +5 -0
- package/dist/backend/llvm/dense-array-access.js +3 -3
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +44 -1
- package/dist/backend/llvm/dyn.js +251 -36
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +77 -14
- package/dist/backend/llvm/emitter.js +461 -108
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +26 -3
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +52 -1
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +9 -0
- package/dist/backend/llvm/expr-bytes.js +169 -63
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +16 -2
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +3 -1
- package/dist/backend/llvm/expr-calls.js +57 -2
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +57 -19
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +19 -8
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +28 -30
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +8 -4
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +35 -32
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +13 -2
- package/dist/backend/llvm/expr-stream-callbacks.js +80 -5
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/inline-unions.d.ts +48 -0
- package/dist/backend/llvm/inline-unions.js +134 -0
- package/dist/backend/llvm/inline-unions.js.map +1 -0
- package/dist/backend/llvm/inline-unions.test.d.ts +1 -0
- package/dist/backend/llvm/inline-unions.test.js +124 -0
- package/dist/backend/llvm/inline-unions.test.js.map +1 -0
- package/dist/backend/llvm/integer-remainder.d.ts +28 -5
- package/dist/backend/llvm/integer-remainder.js +80 -9
- package/dist/backend/llvm/integer-remainder.js.map +1 -1
- package/dist/backend/llvm/intern-tables.test.d.ts +1 -0
- package/dist/backend/llvm/intern-tables.test.js +77 -0
- package/dist/backend/llvm/intern-tables.test.js.map +1 -0
- package/dist/backend/llvm/lib-datagram.js +10 -0
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +255 -29
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +176 -7
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +25 -6
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +2 -2
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.d.ts +5 -0
- package/dist/backend/llvm/lib-shared.js +212 -1
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +184 -0
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-test.js +9 -0
- package/dist/backend/llvm/lib-test.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +7 -3
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +6 -3
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.d.ts +2 -0
- package/dist/backend/llvm/local-union-storage.js +5 -0
- package/dist/backend/llvm/local-union-storage.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +1 -0
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/loop-array-borrows.d.ts +8 -2
- package/dist/backend/llvm/loop-array-borrows.js +93 -13
- package/dist/backend/llvm/loop-array-borrows.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +24 -0
- package/dist/backend/llvm/map-number-lookup.js +88 -0
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.d.ts +1 -0
- package/dist/backend/llvm/map-number-lookup.test.js +158 -0
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -0
- package/dist/backend/llvm/map-read-lifetimes.d.ts +9 -0
- package/dist/backend/llvm/map-read-lifetimes.js +90 -1
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +129 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/publish.d.ts +9 -0
- package/dist/backend/llvm/publish.js +25 -4
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/record-results.d.ts +8 -5
- package/dist/backend/llvm/record-results.js +20 -12
- package/dist/backend/llvm/record-results.js.map +1 -1
- package/dist/backend/llvm/reference-effects.js +13 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +19 -2
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/regions.d.ts +5 -1
- package/dist/backend/llvm/regions.js +24 -10
- package/dist/backend/llvm/regions.js.map +1 -1
- package/dist/backend/llvm/serialized-ir-emission.test.js +2 -0
- package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +56 -10
- package/dist/backend/llvm/shapes.js +178 -39
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +61 -3
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/stack-objects.js +16 -4
- package/dist/backend/llvm/stack-objects.js.map +1 -1
- package/dist/backend/llvm/stack-objects.test.js +3 -0
- package/dist/backend/llvm/stack-objects.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.js +2 -2
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/string-slices.js +2 -2
- package/dist/backend/llvm/string-slices.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +11 -0
- package/dist/backend/llvm/walkers.js +106 -10
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/may-throw.js +13 -4
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +5 -2
- package/dist/backend/native/executable.js +27 -8
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +2 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native-codegen-core.d.ts +4 -4
- package/dist/backend/native-codegen-core.js +4 -6
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.test.js +7 -8
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +3 -0
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +1 -1
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/publication.js +3 -1
- package/dist/backend/publication.js.map +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-targets.test.js +2 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +2 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.js +11 -1
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +4 -1
- package/dist/backend/target-diagnostics.test.js.map +1 -1
- package/dist/backend/warm-cache.js +1 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/compat/fetch-profile.js +4 -4
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/contracts/check.js +2 -0
- package/dist/contracts/check.js.map +1 -1
- package/dist/coverage/report.js +1 -1
- package/dist/coverage/report.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +6 -5
- package/dist/diagnostics/diagnostic.js +7 -6
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +1 -0
- package/dist/executable/executable-cache.js +1 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +1 -0
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/frontend/builtin-modules.d.ts +1 -1
- package/dist/frontend/builtin-modules.js +1 -0
- package/dist/frontend/builtin-modules.js.map +1 -1
- package/dist/frontend/comptime-node.js +2 -2
- package/dist/frontend/comptime-node.js.map +1 -1
- package/dist/frontend/experimental-import.d.ts +5 -1
- package/dist/frontend/experimental-import.js +28 -3
- package/dist/frontend/experimental-import.js.map +1 -1
- package/dist/frontend/lowering/assert-instances.d.ts +38 -0
- package/dist/frontend/lowering/assert-instances.js +269 -0
- package/dist/frontend/lowering/assert-instances.js.map +1 -0
- package/dist/frontend/lowering/binding-analysis.d.ts +1 -1
- package/dist/frontend/lowering/binding-analysis.js +1 -1
- package/dist/frontend/lowering/builtins/arguments.d.ts +4 -0
- package/dist/frontend/lowering/builtins/arguments.js +8 -4
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/blob.d.ts +20 -0
- package/dist/frontend/lowering/builtins/blob.js +167 -0
- package/dist/frontend/lowering/builtins/blob.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-async.d.ts +2 -2
- package/dist/frontend/lowering/builtins/child-process-async.js +2 -2
- package/dist/frontend/lowering/builtins/child-process-methods.js +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-sync.js +1 -1
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
- package/dist/frontend/lowering/builtins/compression.d.ts +18 -0
- package/dist/frontend/lowering/builtins/compression.js +178 -4
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/constants.js +7 -2
- package/dist/frontend/lowering/builtins/constants.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +6 -0
- package/dist/frontend/lowering/builtins/crypto.js +526 -121
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/errors.js +23 -0
- package/dist/frontend/lowering/builtins/errors.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +10 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js +89 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem.d.ts +16 -7
- package/dist/frontend/lowering/builtins/filesystem.js +97 -15
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-glob.d.ts +23 -0
- package/dist/frontend/lowering/builtins/fs-glob.js +224 -0
- package/dist/frontend/lowering/builtins/fs-glob.js.map +1 -0
- package/dist/frontend/lowering/builtins/key-object.d.ts +13 -0
- package/dist/frontend/lowering/builtins/key-object.js +56 -0
- package/dist/frontend/lowering/builtins/key-object.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-calls.js +44 -11
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/performance.d.ts +25 -3
- package/dist/frontend/lowering/builtins/performance.js +340 -5
- package/dist/frontend/lowering/builtins/performance.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.d.ts +2 -2
- package/dist/frontend/lowering/builtins/process.js +107 -14
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/properties.d.ts +0 -7
- package/dist/frontend/lowering/builtins/properties.js +39 -11
- package/dist/frontend/lowering/builtins/properties.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +23 -8
- package/dist/frontend/lowering/builtins/readline.js +266 -90
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/timers.d.ts +3 -0
- package/dist/frontend/lowering/builtins/timers.js +109 -23
- package/dist/frontend/lowering/builtins/timers.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.d.ts +8 -0
- package/dist/frontend/lowering/builtins/url.js +36 -0
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.js +1 -1
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.js +26 -2
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +2 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +171 -13
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-protocol-dispatch.d.ts +45 -0
- package/dist/frontend/lowering/class-protocol-dispatch.js +516 -0
- package/dist/frontend/lowering/class-protocol-dispatch.js.map +1 -0
- package/dist/frontend/lowering/coercions/structural-plans.js +2 -1
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +3 -3
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/collation-repertoire.js +6 -5
- package/dist/frontend/lowering/collation-repertoire.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +4 -7
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.d.ts +0 -7
- package/dist/frontend/lowering/containers/array-methods.js +43 -2
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +38 -26
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/for-of.d.ts +1 -1
- package/dist/frontend/lowering/containers/for-of.js +5 -1
- package/dist/frontend/lowering/containers/for-of.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/crypto-tables.d.ts +3 -3
- package/dist/frontend/lowering/crypto-tables.js +77 -12
- package/dist/frontend/lowering/crypto-tables.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +10 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +16 -12
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +2 -2
- package/dist/frontend/lowering/generic-functions.js +2 -2
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/http2-constants.js +1 -1
- package/dist/frontend/lowering/intern-tables.d.ts +13 -0
- package/dist/frontend/lowering/intern-tables.js +536 -0
- package/dist/frontend/lowering/intern-tables.js.map +1 -0
- package/dist/frontend/lowering/lower-array-sort.d.ts +12 -1
- package/dist/frontend/lowering/lower-array-sort.js +561 -191
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.test.js +4 -2
- package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +702 -63
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.d.ts +6 -3
- package/dist/frontend/lowering/lower-async-iteration.js +259 -4
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +118 -12
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +11 -2
- package/dist/frontend/lowering/lower-classes.js +76 -9
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +1 -1
- package/dist/frontend/lowering/lower-comptime.js +4 -4
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +77 -52
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-event-target.d.ts +63 -0
- package/dist/frontend/lowering/lower-event-target.js +362 -0
- package/dist/frontend/lowering/lower-event-target.js.map +1 -0
- package/dist/frontend/lowering/lower-expando.js +2 -2
- package/dist/frontend/lowering/lower-exprs.js +124 -22
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +6 -0
- package/dist/frontend/lowering/lower-inspect.js +240 -49
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +1 -1
- package/dist/frontend/lowering/lower-mock.d.ts +11 -0
- package/dist/frontend/lowering/lower-mock.js +504 -0
- package/dist/frontend/lowering/lower-mock.js.map +1 -0
- package/dist/frontend/lowering/lower-modules.d.ts +1 -1
- package/dist/frontend/lowering/lower-modules.js +14 -3
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +2 -2
- package/dist/frontend/lowering/lower-namespaces.js +2 -2
- package/dist/frontend/lowering/lower-server.d.ts +3 -0
- package/dist/frontend/lowering/lower-server.js +419 -44
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +7 -1
- package/dist/frontend/lowering/lower-stdlib.js +10 -3
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +2 -2
- package/dist/frontend/lowering/lower-stmts.js +69 -14
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +10 -6
- package/dist/frontend/lowering/lower-stream.js +1020 -49
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-test.js +86 -8
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +45 -5
- package/dist/frontend/lowering/lowerer.js +317 -48
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/native-ffi.js +2 -2
- package/dist/frontend/lowering/native-ffi.js.map +1 -1
- package/dist/frontend/lowering/pairs-snapshot.d.ts +6 -0
- package/dist/frontend/lowering/pairs-snapshot.js +49 -0
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-records.d.ts +115 -0
- package/dist/frontend/lowering/runtime-optional-records.js +715 -0
- package/dist/frontend/lowering/runtime-optional-records.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-records.test.d.ts +1 -0
- package/dist/frontend/lowering/runtime-optional-records.test.js +175 -0
- package/dist/frontend/lowering/runtime-optional-records.test.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +11 -3
- package/dist/frontend/lowering/surfaces.js +334 -37
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/zlib-constants.d.ts +1 -0
- package/dist/frontend/lowering/zlib-constants.js +181 -0
- package/dist/frontend/lowering/zlib-constants.js.map +1 -0
- package/dist/frontend/mock-shapes.d.ts +10 -0
- package/dist/frontend/mock-shapes.js +76 -0
- package/dist/frontend/mock-shapes.js.map +1 -0
- package/dist/frontend/module-syntax.d.ts +1 -1
- package/dist/frontend/module-syntax.js +1 -1
- package/dist/frontend/npm-static-prune.js +1 -1
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +4 -3
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/pipeline.js +6 -4
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program.d.ts +3 -3
- package/dist/frontend/program.js +25 -18
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.d.ts +4 -0
- package/dist/frontend/resolve.js +15 -1
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/ts7/adapter.js +1 -1
- package/dist/frontend/ts7/ast-bytes.d.ts +1 -1
- package/dist/frontend/ts7/ast-bytes.js +1 -1
- package/dist/frontend/ts7/semantic-json.d.ts +1 -1
- package/dist/frontend/ts7/semantic-json.js +1 -1
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/ts7/world-check.js +1 -1
- package/dist/frontend/tsc-codes.js +3 -2
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +21 -1
- package/dist/frontend/type-mapper.js +245 -27
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.d.ts +12 -6
- package/dist/ir/analysis.js +26 -10
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/analysis.test.js +15 -3
- package/dist/ir/analysis.test.js.map +1 -1
- package/dist/ir/builtin-effects.js +115 -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 +438 -46
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/int32-slots.js +1 -0
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/ir.d.ts +84 -17
- package/dist/ir/ir.js +54 -1
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +1 -0
- package/dist/ir/runtime-features.js +111 -7
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/serialize.js +1 -1
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/traverse.js +1 -0
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +295 -14
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +60 -0
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/fence-eval.d.ts +1 -1
- package/dist/library/fence-eval.js +5 -4
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/ir-policy.js +11 -4
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/library/library-profile.js +13 -13
- package/dist/library/library-profile.js.map +1 -1
- package/dist/library/prepare.js +1 -1
- package/dist/library/prepare.js.map +1 -1
- package/dist/library/sidecar.js +3 -3
- package/dist/library/sidecar.js.map +1 -1
- package/dist/native/cli.js +1 -0
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +1 -3
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/prepare.js +4 -2
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.test.js +1 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +1279 -221
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { lifetimeRegionType, lowerLifetimeRegionCall, lowerLifetimeRegionNew, } from "./lifetime-regions.js";
|
|
2
|
+
import { internTableType, lowerInternTableCall, lowerInternTableNew } from "./intern-tables.js";
|
|
2
3
|
import { isExperimentalDeclarationFile } from "../experimental-import.js";
|
|
3
4
|
import { checkCycleBindingAccesses, refuseUncheckedCycleReads, } from "./cycle-initialization.js";
|
|
4
5
|
import { identityPreservingWidening } from "./coercions/identity.js";
|
|
@@ -9,6 +10,8 @@ import { isOptionalProcessStreamProperty } from "./builtins/process.js";
|
|
|
9
10
|
import { isSettledIteratorValueRead } from "./lower-generators.js";
|
|
10
11
|
import { concreteCollectionNarrow } from "./collection-narrowing.js";
|
|
11
12
|
import { lowerWorkerMetadata } from "./builtins/workers.js";
|
|
13
|
+
import { fenceStaticBlobMember, lowerBlobNew, lowerStaticBlobCall } from "./builtins/blob.js";
|
|
14
|
+
import { lowerKeyObjectCall } from "./builtins/key-object.js";
|
|
12
15
|
import { dynUndefinedExpr, nodeThrowExpr, numLit, varRef } from "../../ir/build.js";
|
|
13
16
|
import { iteratorSlotAdapter } from "./iterator-adapters.js";
|
|
14
17
|
import { lowerBuiltinCall } from "./builtin-calls.js";
|
|
@@ -26,6 +29,7 @@ import { NarrowingStability } from "./narrowing-stability.js";
|
|
|
26
29
|
import { ArrayElementStates } from "./runtime-optional-elements.js";
|
|
27
30
|
import { indexReadInBounds } from "./runtime-optional-bounds.js";
|
|
28
31
|
import { ArrayOwnership } from "./runtime-optional-ownership.js";
|
|
32
|
+
import { RecordFlowClasses } from "./runtime-optional-records.js";
|
|
29
33
|
import { StringIndexBounds } from "./string-index-bounds.js";
|
|
30
34
|
import { NanCodedReads } from "./nan-coded-reads.js";
|
|
31
35
|
import { RuntimeOptionalLocals } from "./runtime-optional-locals.js";
|
|
@@ -35,6 +39,7 @@ import { UnregisteredClassTypes } from "./unregistered-class-types.js";
|
|
|
35
39
|
import { bindingInContext, captureContextBinding, declareContextLocal, declareContextThis, } from "./function-context.js";
|
|
36
40
|
import { InternalCompilerError } from "../../errors.js";
|
|
37
41
|
import { defaultAfterUndefined, lowerStaticallyUndefinedArgument } from "./optional-arguments.js";
|
|
42
|
+
import {} from "./class-protocol-dispatch.js";
|
|
38
43
|
import { ClassDynamicDispatch, trackClassFieldCreation } from "./class-dynamic-dispatch.js";
|
|
39
44
|
import { ClassProtocols } from "./class-protocols.js";
|
|
40
45
|
import { earlyReadVarSymbols } from "./var-hoisting.js";
|
|
@@ -70,6 +75,7 @@ import { containsRecord, containsUnion, describeComponentBlocker, describeRecord
|
|
|
70
75
|
import { builtinConstLit, builtinModuleConstOf, builtinModulesArrayLit, builtinFenceHintOf, builtinModuleFnOf, stdlibMemberFence, isStdlibMember, isStdlibSymbol, isStdlibGlobal, stdlibGlobalNameOf, stdlibGlobalMember, nodeTypesOnlySymbol, } from "./surfaces.js";
|
|
71
76
|
import { splitFiles, collectProgram, collectNpmImports, collectJsonImports, moduleArtifacts, collectGlobals, declSymbolOf, defaultExportSymbolOf, lowerFileInit, lowerDefaultExport, buildMain, appendDynamicImportModules, appendForkModules, appendWorkerModules, } from "./lower-modules.js";
|
|
72
77
|
import { prepareCjsModuleGraph } from "./lower-node-module.js";
|
|
78
|
+
import { registerBuiltinEventTargetClasses } from "./lower-event-target.js";
|
|
73
79
|
import { registerBuiltinErrorClasses, registerBuiltinEmitterClass, registerBuiltinStreamClasses, builtinErrorInfoOf, builtinEmitterInfoOf, builtinStreamInfoOf, analyzeClassDecoration, classIteratorDrainCall, classIteratorNextCall, classIteratorOf, classIteratorOpenCall, classIteratorRestDrainCall, classMemberNameOf, classValueRef, collectClassShape, exactClassOfReceiver, collectClassShapeInner, ctorAbiEquals, findMethodOn, findStaticOn, genericClassInstanceType, isSubclassOf, inHierarchy, overrideBelow, staticShadowBelow, upcastTo, lowerClassMembers, lowerClassCtor, lowerClassExpression, lowerClassExpressionInfo, lowerClassMethodMember, lowerClassValueProperty, lowerStaticMethod, throwingSetterFn, fieldInitStmts, lowerStaticFieldInits, lowerStaticFieldRead, lowerDerivedCtorBody, superCallStmt, lowerSuperMethodCall, superThisRef, lowerSuperAccessorRead, lowerSuperAccessorWrite, inheritsBuiltinErrorCtor, inheritsBuiltinEmitterCtor, errorConstructorArgs, lowerNew, accessorCall, } from "./lower-classes.js";
|
|
74
80
|
import { mixinCallClassInfoOf, mixinIntersectionInstanceType, } from "./lower-mixins.js";
|
|
75
81
|
import { tryLowerExpression } from "./expressions/try-lower-expression.js";
|
|
@@ -117,7 +123,7 @@ import { lowerDateCall } from "./builtins/dates.js";
|
|
|
117
123
|
import { lowerFsConstantsProperty, lowerBuiltinConstantsProperty, builtinConstantBindingOf, builtinConstantsDestructureDecl, } from "./builtins/constants.js";
|
|
118
124
|
import { lowerStringStaticCall, lowerStringLastIndexOfCall } from "./builtins/strings.js";
|
|
119
125
|
import { lowerPromiseStaticCall } from "./builtins/promises.js";
|
|
120
|
-
import { fenceFetchObjectAssignment, fenceFetchObjectBinding, fenceStaticAbortControllerMemberRead, fenceStaticHeadersIteration, fenceStaticHeadersMember, fenceStaticReadableStreamMember, fenceStaticResponseMember, fenceUnsupportedFetchConstructorMember, refuseUnsupportedApi, stdlibGlobalFnOf, lowerAbortControllerNew, lowerEventTargetNew, lowerDynamicImportCall, lowerFetchCall, lowerFetchElementMethodCall, lowerResponseNew, lowerFetchWebNew, lowerStaticFetchCompanionCall, lowerStaticAbortControllerCall, lowerStaticAbortSignalListenerCall, lowerStaticReadableStreamCancelCall, lowerStaticReadableStreamControllerCall, lowerStaticReadableStreamNew, lowerStaticReadableStreamReaderCall, lowerStaticResponseCall, lowerStdlibMethodCall, lowerMathProperty, npmPackageOf, npmMemberFence, npmPackageOfSymbol, } from "./lower-stdlib.js";
|
|
126
|
+
import { fenceFetchObjectAssignment, fenceFetchObjectBinding, fenceStaticAbortControllerMemberRead, fenceStaticHeadersIteration, fenceStaticHeadersMember, fenceStaticReadableStreamMember, fenceStaticResponseMember, fenceUnsupportedFetchConstructorMember, refuseUnsupportedApi, stdlibGlobalFnOf, lowerAbortControllerNew, lowerEventTargetNew, lowerLiveWebValue, lowerDynamicImportCall, lowerFetchCall, lowerFetchElementMethodCall, lowerResponseNew, lowerFetchWebNew, lowerStaticFetchCompanionCall, lowerStaticAbortControllerCall, lowerStaticAbortSignalListenerCall, lowerStaticReadableStreamCancelCall, lowerStaticReadableStreamControllerCall, lowerStaticReadableStreamNew, lowerStaticReadableStreamReaderCall, lowerStaticResponseCall, lowerStdlibMethodCall, lowerMathProperty, npmPackageOf, npmMemberFence, npmPackageOfSymbol, } from "./lower-stdlib.js";
|
|
121
127
|
import { lowerHttpHeadersElement, lowerNetModuleCall, lowerServerMethodCall, lowerServerProperty, lowerTlsRootCertificates, } from "./lower-server.js";
|
|
122
128
|
import { lowerDgramDnsModuleCall, lowerDgramMethodCall } from "./lower-dgram.js";
|
|
123
129
|
import { lowerNodeTestModuleCall, lowerTestDirectCall, lowerTestMethodCall, lowerTestCtxProperty, } from "./lower-test.js";
|
|
@@ -501,8 +507,8 @@ export function neverTaintedJsType(lowerer, node, t) {
|
|
|
501
507
|
* per-statement runtime fence would have thrown (message + "[code at
|
|
502
508
|
* file:line]"), rendered eagerly so the runtime can throw it verbatim
|
|
503
509
|
* (scr_throw_lowering_fence). The diagnostic joins the runtime-fence
|
|
504
|
-
* ledger exactly like a deferred statement fence
|
|
505
|
-
*
|
|
510
|
+
* ledger exactly like a deferred statement fence, so every fence appears
|
|
511
|
+
* on the coverage report. */
|
|
506
512
|
export function ladderFenceExpr(lowerer, surface, node, hint) {
|
|
507
513
|
const loc = locOf(node);
|
|
508
514
|
const d = noLoweringDiag(surface, loc, hint);
|
|
@@ -526,8 +532,18 @@ export function dynFallbackType(lowerer, node, t) {
|
|
|
526
532
|
const args = symbol && lowerer.isStdlibSymbol(symbol)
|
|
527
533
|
? lowerer.checker.getTypeArguments(t)
|
|
528
534
|
: [];
|
|
529
|
-
|
|
530
|
-
|
|
535
|
+
// Promise<any> and Promise<any[]> (an any[] is itself a checked
|
|
536
|
+
// value below): a promise of a checked value.
|
|
537
|
+
const anyArray = (x) => lowerer.checker.isArrayType(x) &&
|
|
538
|
+
((lowerer.checker.getTypeArguments(x)[0]?.flags ?? 0) &
|
|
539
|
+
ts.TypeFlags.Any) !==
|
|
540
|
+
0;
|
|
541
|
+
if (symbol?.name === "Promise" &&
|
|
542
|
+
args[0] &&
|
|
543
|
+
(args[0].flags & ts.TypeFlags.Any || anyArray(args[0])))
|
|
544
|
+
return symbol.name === "Promise" && anyArray(args[0])
|
|
545
|
+
? { kind: "promise", inner: DYN }
|
|
546
|
+
: jsFallbackPromiseType(lowerer, t);
|
|
531
547
|
if (symbol &&
|
|
532
548
|
["Generator", "AsyncGenerator", "IterableIterator"].includes(symbol.name) &&
|
|
533
549
|
args.some((arg) => arg.flags & ts.TypeFlags.Any))
|
|
@@ -836,6 +852,14 @@ export function jsFuncNameOf(node, lowerer) {
|
|
|
836
852
|
return null;
|
|
837
853
|
}
|
|
838
854
|
/** Answers `fallback` when a checker query panics inside the type checker. */
|
|
855
|
+
/** The storage of a global whose binding type widened. A lexical binding's
|
|
856
|
+
* TDZ guard needs pointer, record or checked-value storage, so a guarded
|
|
857
|
+
* function binding that may now hold undefined is a checked value. */
|
|
858
|
+
function tdzStorage(global, type) {
|
|
859
|
+
return global.tdz && type.kind !== "record" && type.kind !== "func" && type.kind !== "dyn"
|
|
860
|
+
? DYN
|
|
861
|
+
: type;
|
|
862
|
+
}
|
|
839
863
|
function panicSafe(query, fallback) {
|
|
840
864
|
try {
|
|
841
865
|
return query();
|
|
@@ -1107,6 +1131,9 @@ export class Lowerer {
|
|
|
1107
1131
|
requestInitPropMutatedSyms = null;
|
|
1108
1132
|
emitterEventTable = null;
|
|
1109
1133
|
emitterComputedPatterns = [];
|
|
1134
|
+
/** The EventTarget engine's handleEvent reader was lifted
|
|
1135
|
+
* (lower-event-target.ts noteEventListeners). */
|
|
1136
|
+
handleEventReader = false;
|
|
1110
1137
|
/** Locals widened beyond the checker's type because an inferred indexed
|
|
1111
1138
|
* read can be absent at runtime. Bare reads preserve that union until a
|
|
1112
1139
|
* surrounding JavaScript guard/default consumes it. */
|
|
@@ -1138,6 +1165,11 @@ export class Lowerer {
|
|
|
1138
1165
|
* prepass. This includes explicit annotations: unchecked TS annotations do
|
|
1139
1166
|
* not prove that an array property read produced a value. */
|
|
1140
1167
|
runtimeOptionalBindingTypes = new Map();
|
|
1168
|
+
/** A pipeline() function stage's `source` parameter: the IR type of what
|
|
1169
|
+
* the pipeline passes it (the previous stage as an async iterable), set
|
|
1170
|
+
* while the stage lowers. Parameter typing and `for await` heads read
|
|
1171
|
+
* it before the checker's `AsyncIterable<T>`. */
|
|
1172
|
+
stageSourceTypes = new Map();
|
|
1141
1173
|
/** Set when a match result lowers to execGroups/matchGroups, the inputs
|
|
1142
1174
|
* of regex span folding. */
|
|
1143
1175
|
regexGroupResults = false;
|
|
@@ -1159,6 +1191,10 @@ export class Lowerer {
|
|
|
1159
1191
|
/** Record fields promoted to an undefined-armed union by an indexed-read
|
|
1160
1192
|
* value. The key is the concrete emitted shape and field name. */
|
|
1161
1193
|
runtimeOptionalFields = new Set();
|
|
1194
|
+
/** Record bindings whose flow class reaches storage outside the class:
|
|
1195
|
+
* they keep the declared layout, so an initializer from unchecked reads
|
|
1196
|
+
* converts once instead of the binding adopting the widened variant. */
|
|
1197
|
+
runtimeOptionalRecordsKeptDeclared = new Set();
|
|
1162
1198
|
/** Callback pattern parameters carry an optional source without making
|
|
1163
1199
|
* every name destructured from a present source optional. */
|
|
1164
1200
|
runtimeOptionalPatternTypes = new Map();
|
|
@@ -1174,6 +1210,9 @@ export class Lowerer {
|
|
|
1174
1210
|
/** for-of loops over arrays that can hold neither holes nor undefined:
|
|
1175
1211
|
* each pass reads the element payload directly. */
|
|
1176
1212
|
presentElementLoops = new Set();
|
|
1213
|
+
/** The fs/promises glob() call lowerForOf is lowering as a for await
|
|
1214
|
+
* head; other glob() calls have no lowering. */
|
|
1215
|
+
fspGlobHead = null;
|
|
1177
1216
|
/** Capture entries and their origin share one mutable box. Normalize each
|
|
1178
1217
|
* entry to the origin so writes and flow proofs stay synchronized. */
|
|
1179
1218
|
runtimeOptionalRoots = new Map();
|
|
@@ -1190,8 +1229,10 @@ export class Lowerer {
|
|
|
1190
1229
|
if (!symbol)
|
|
1191
1230
|
return fallback ?? null;
|
|
1192
1231
|
const known = this.runtimeOptionalBindingTypes.get(symbol);
|
|
1193
|
-
if (known)
|
|
1194
|
-
|
|
1232
|
+
if (known) {
|
|
1233
|
+
const global = this.globalsBySymbol.get(symbol);
|
|
1234
|
+
return global ? tdzStorage(global, known) : known;
|
|
1235
|
+
}
|
|
1195
1236
|
// A module-scope function alias is collected as a global before the
|
|
1196
1237
|
// optional-read fixed point settles. Derive its promoted function ABI
|
|
1197
1238
|
// directly from the aliased declaration as a final read-side hook, so
|
|
@@ -1451,6 +1492,10 @@ export class Lowerer {
|
|
|
1451
1492
|
return type;
|
|
1452
1493
|
}
|
|
1453
1494
|
const shapeId = this.shapes.intern(shape.fields.map((f) => ({ name: f.name, type: f.name === field ? fieldType : f.type })), shape.tuple === true, shape.indexValue, shape.declaredOrder);
|
|
1495
|
+
// The widened shape keeps the fields this one already widened.
|
|
1496
|
+
for (const f of shape.fields)
|
|
1497
|
+
if (this.isRuntimeOptionalField(type.shapeId, f.name))
|
|
1498
|
+
this.runtimeOptionalFields.add(this.runtimeOptionalFieldKey(shapeId, f.name));
|
|
1454
1499
|
this.runtimeOptionalFields.add(this.runtimeOptionalFieldKey(shapeId, field));
|
|
1455
1500
|
return { kind: "record", shapeId };
|
|
1456
1501
|
}
|
|
@@ -1516,6 +1561,12 @@ export class Lowerer {
|
|
|
1516
1561
|
* typeKey, throws wrappers keyed by callback type + expected class) —
|
|
1517
1562
|
* the valueHelpers pattern with its own namespace. */
|
|
1518
1563
|
assertHelpers = new Map();
|
|
1564
|
+
/** Static node:assert Assert instances by declaration (assert-instances.ts);
|
|
1565
|
+
* null for declarations that are not one. */
|
|
1566
|
+
assertInstances = new Map();
|
|
1567
|
+
/** The options of the Assert instance whose method call is being lowered,
|
|
1568
|
+
* or null for module calls. */
|
|
1569
|
+
assertCallOptions = null;
|
|
1519
1570
|
/** util.inspect's per-type traversal helpers (%util.insp.N), interned
|
|
1520
1571
|
* by typeKey — the assertHelpers pattern with its own namespace. */
|
|
1521
1572
|
inspectHelpers = new Map();
|
|
@@ -1534,8 +1585,9 @@ export class Lowerer {
|
|
|
1534
1585
|
* runtime closure pointer: a coercion adapter allocates a different
|
|
1535
1586
|
* closure at the registration and release sites, so lowerFfiCall must
|
|
1536
1587
|
* refuse these forms at compile time (SC5003). Any new closure-minting
|
|
1537
|
-
* adapter helper MUST add its name here, or the identity guard
|
|
1538
|
-
*
|
|
1588
|
+
* adapter helper MUST add its name here, or the identity guard reopens
|
|
1589
|
+
* without a diagnostic and the mismatch surfaces as a runtime release
|
|
1590
|
+
* trap instead. */
|
|
1539
1591
|
freshClosureAdapters = new Set();
|
|
1540
1592
|
/** Symbols bound by `const process = globalThis.process` (and the other
|
|
1541
1593
|
* stdlib-global snapshot spellings): pure alias plumbing — receiver
|
|
@@ -1611,6 +1663,11 @@ export class Lowerer {
|
|
|
1611
1663
|
/** Named method slots observed before class collection need a callable
|
|
1612
1664
|
* ABI and shared prototype descriptors instead of call-site specialization. */
|
|
1613
1665
|
prototypeMethodAccesses = new Map();
|
|
1666
|
+
/** Typed calls through class-backed protocols, by signature; class
|
|
1667
|
+
* dynamic dispatch adds their native arms (class-protocol-dispatch.ts). */
|
|
1668
|
+
protocolDispatches = new Map();
|
|
1669
|
+
/** Bindings no other function assigns (class-protocol-dispatch.ts). */
|
|
1670
|
+
protocolOwnedBindings = new Map();
|
|
1614
1671
|
/** Field names whose complete source census stores only lexical arrows. */
|
|
1615
1672
|
receiverFreeCallbackFields = new Set();
|
|
1616
1673
|
/** Inferred JS methods participating in an override chain keep a vtable
|
|
@@ -1673,6 +1730,10 @@ export class Lowerer {
|
|
|
1673
1730
|
experimentalFiles = new Map();
|
|
1674
1731
|
/** Interned LifetimeRegion.run helpers, by callback type key. */
|
|
1675
1732
|
regionRunHelpers = new Map();
|
|
1733
|
+
/** Interned InternTable helpers, by member and type keys (intern-tables.ts). */
|
|
1734
|
+
internTableHelpers = new Map();
|
|
1735
|
+
/** Each InternTable name's type arguments and first construction site. */
|
|
1736
|
+
internTableNames = new Map();
|
|
1676
1737
|
forkTargetIdByPath = new Map();
|
|
1677
1738
|
/** Namespace ModuleBlocks this program lowers, filled by splitFiles:
|
|
1678
1739
|
* "flattened" — an instantiated namespace whose body joined the file's
|
|
@@ -1990,6 +2051,9 @@ export class Lowerer {
|
|
|
1990
2051
|
lifetimeRegionClass: (decl) => isExperimentalDeclarationFile(decl.getSourceFile(), this.experimentalFiles)
|
|
1991
2052
|
? lifetimeRegionType(this)
|
|
1992
2053
|
: null,
|
|
2054
|
+
internTableClass: (decl) => isExperimentalDeclarationFile(decl.getSourceFile(), this.experimentalFiles)
|
|
2055
|
+
? internTableType(this)
|
|
2056
|
+
: null,
|
|
1993
2057
|
moduleNamespaceId: (type) => this.moduleNamespaceIdOfType(type),
|
|
1994
2058
|
};
|
|
1995
2059
|
// Modules reachable only through literal import() joined
|
|
@@ -2004,6 +2068,7 @@ export class Lowerer {
|
|
|
2004
2068
|
this.registerBuiltinErrorClasses();
|
|
2005
2069
|
registerBuiltinEmitterClass(this);
|
|
2006
2070
|
registerBuiltinStreamClasses(this);
|
|
2071
|
+
registerBuiltinEventTargetClasses(this);
|
|
2007
2072
|
}
|
|
2008
2073
|
registerBuiltinErrorClasses() {
|
|
2009
2074
|
return registerBuiltinErrorClasses(this);
|
|
@@ -3049,6 +3114,57 @@ export class Lowerer {
|
|
|
3049
3114
|
}
|
|
3050
3115
|
}
|
|
3051
3116
|
const mappedOrNull = (node) => panicSafe(() => this.mapTypeOf(this.typeOf(node)), null);
|
|
3117
|
+
const admitsUndefined = (type) => typeEquals(addUndefined(type), type);
|
|
3118
|
+
const plainRecordShape = (type) => {
|
|
3119
|
+
if (type?.kind !== "record")
|
|
3120
|
+
return null;
|
|
3121
|
+
const shape = this.shapes.get(type.shapeId);
|
|
3122
|
+
return shape && !shape.tuple && !shape.indexValue && shape.fields.length > 0
|
|
3123
|
+
? type.shapeId
|
|
3124
|
+
: null;
|
|
3125
|
+
};
|
|
3126
|
+
// Parameters and results read the signatures collected above; bindings
|
|
3127
|
+
// ask the checker, so the scan builds no layout of its own.
|
|
3128
|
+
const parameterType = (node) => {
|
|
3129
|
+
const parameter = node.parent;
|
|
3130
|
+
if (!parameter || !ts.isParameter(parameter))
|
|
3131
|
+
return null;
|
|
3132
|
+
const fn = parameter.parent;
|
|
3133
|
+
const symbol = (ts.isFunctionDeclaration(fn) || ts.isMethodDeclaration(fn)) && fn.name
|
|
3134
|
+
? symbolOf(fn.name)
|
|
3135
|
+
: null;
|
|
3136
|
+
const index = fn.parameters.indexOf(parameter);
|
|
3137
|
+
return (symbol && signatureBySymbol.get(symbol)?.params[index]?.type) ?? null;
|
|
3138
|
+
};
|
|
3139
|
+
const returnTypeOf = (fn) => {
|
|
3140
|
+
const symbol = fn.name ? symbolOf(fn.name) : null;
|
|
3141
|
+
return (symbol && signatureBySymbol.get(symbol)?.returnType) ?? null;
|
|
3142
|
+
};
|
|
3143
|
+
const recordFlows = new RecordFlowClasses(sourceFiles, {
|
|
3144
|
+
symbolOf,
|
|
3145
|
+
declarationOf: (symbol) => this.checker.valueDeclarationOf(symbol),
|
|
3146
|
+
mayBeRecord: (node) => {
|
|
3147
|
+
if (node.parent && ts.isParameter(node.parent))
|
|
3148
|
+
return plainRecordShape(parameterType(node)) !== null;
|
|
3149
|
+
const t = panicSafe(() => this.typeOf(node), null);
|
|
3150
|
+
return (t !== null &&
|
|
3151
|
+
(t.flags & ts.TypeFlags.Object) !== 0 &&
|
|
3152
|
+
!this.checker.isArrayType(t) &&
|
|
3153
|
+
this.checker.getCallSignatures(t).length === 0 &&
|
|
3154
|
+
this.checker.getConstructSignatures(t).length === 0);
|
|
3155
|
+
},
|
|
3156
|
+
prefetchTypes: (nodes) => this.checker.prefetchCollectionTypes(nodes),
|
|
3157
|
+
mayReturnRecord: (fn) => plainRecordShape(returnTypeOf(fn)) !== null,
|
|
3158
|
+
familyOf: (method) => familyBySymbol.get(method),
|
|
3159
|
+
recordShape: (node) => plainRecordShape(node.parent && ts.isParameter(node.parent) ? parameterType(node) : mappedOrNull(node)),
|
|
3160
|
+
returnShape: (fn) => plainRecordShape(returnTypeOf(fn)),
|
|
3161
|
+
isGlobal: (node, name) => this.isStdlibGlobal(node, name),
|
|
3162
|
+
});
|
|
3163
|
+
/** Optional fields of the records a visible function returns. */
|
|
3164
|
+
const returnFields = new Map();
|
|
3165
|
+
/** Record parameters that receive a value with optional fields, by the
|
|
3166
|
+
* parameter's own symbol. */
|
|
3167
|
+
const recordParameterSlots = new Map();
|
|
3052
3168
|
const nanCoded = new NanCodedReads({
|
|
3053
3169
|
symbolOf,
|
|
3054
3170
|
declarationOf: (symbol) => this.checker.valueDeclarationOf(symbol),
|
|
@@ -3327,10 +3443,8 @@ export class Lowerer {
|
|
|
3327
3443
|
if (op === ts.SyntaxKind.AmpersandAmpersandToken)
|
|
3328
3444
|
return mayBeOptional(e.left) || mayBeOptional(e.right);
|
|
3329
3445
|
}
|
|
3330
|
-
if (ts.isPropertyAccessExpression(e)
|
|
3331
|
-
|
|
3332
|
-
const fields = symbol === null ? undefined : optionalFields.get(symbol);
|
|
3333
|
-
return fields?.has(fieldName(e)) ?? false;
|
|
3446
|
+
if (ts.isPropertyAccessExpression(e)) {
|
|
3447
|
+
return fieldsOfValue(e.expression)?.has(fieldName(e)) ?? false;
|
|
3334
3448
|
}
|
|
3335
3449
|
return false;
|
|
3336
3450
|
};
|
|
@@ -3439,10 +3553,40 @@ export class Lowerer {
|
|
|
3439
3553
|
// a spread or a parameter receives the source's optional fields.
|
|
3440
3554
|
const fieldsOfValue = (node) => {
|
|
3441
3555
|
const e = peel(node);
|
|
3442
|
-
if (
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3556
|
+
if (ts.isIdentifier(e)) {
|
|
3557
|
+
const symbol = symbolOf(e);
|
|
3558
|
+
// A binding whose class reaches other storage keeps the declared
|
|
3559
|
+
// layout, so its fields read as present.
|
|
3560
|
+
return symbol === null || recordFlows.opened(symbol)
|
|
3561
|
+
? undefined
|
|
3562
|
+
: optionalFields.get(symbol);
|
|
3563
|
+
}
|
|
3564
|
+
// A fresh literal carries the fields its values can leave undefined.
|
|
3565
|
+
if (ts.isObjectLiteralExpression(e)) {
|
|
3566
|
+
const out = spreadFieldsOf(e);
|
|
3567
|
+
for (const prop of e.properties) {
|
|
3568
|
+
if (!ts.isPropertyAssignment(prop) && !ts.isShorthandPropertyAssignment(prop))
|
|
3569
|
+
continue;
|
|
3570
|
+
const name = prop.name;
|
|
3571
|
+
if (!(ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNumericLiteral(name)))
|
|
3572
|
+
continue;
|
|
3573
|
+
const value = ts.isPropertyAssignment(prop) ? prop.initializer : name;
|
|
3574
|
+
if (mayBeOptional(value))
|
|
3575
|
+
out.add(name.text);
|
|
3576
|
+
}
|
|
3577
|
+
return out.size > 0 ? out : undefined;
|
|
3578
|
+
}
|
|
3579
|
+
if (ts.isCallExpression(e) &&
|
|
3580
|
+
(ts.isIdentifier(e.expression) || ts.isPropertyAccessExpression(e.expression))) {
|
|
3581
|
+
const symbol = symbolOf(ts.isIdentifier(e.expression) ? e.expression : e.expression.name);
|
|
3582
|
+
return symbol === null ? undefined : returnFields.get(symbol);
|
|
3583
|
+
}
|
|
3584
|
+
if (ts.isConditionalExpression(e)) {
|
|
3585
|
+
const a = fieldsOfValue(e.whenTrue);
|
|
3586
|
+
const b = fieldsOfValue(e.whenFalse);
|
|
3587
|
+
return a && b ? new Set([...a, ...b]) : (a ?? b);
|
|
3588
|
+
}
|
|
3589
|
+
return undefined;
|
|
3446
3590
|
};
|
|
3447
3591
|
const noteFieldsFrom = (symbol, source) => {
|
|
3448
3592
|
const fields = fieldsOfValue(source);
|
|
@@ -3852,7 +3996,19 @@ export class Lowerer {
|
|
|
3852
3996
|
// Checker answers for the fixed point's repeated element-ABI queries.
|
|
3853
3997
|
// Only a binding's widened storage can change between passes.
|
|
3854
3998
|
const checkerTypes = new Map();
|
|
3855
|
-
|
|
3999
|
+
// Mapping a type can lower a local class expression. When that class is
|
|
4000
|
+
// unsupported, its diagnostic is already recorded and the element ABI
|
|
4001
|
+
// is unknown here; the program fails with that diagnostic.
|
|
4002
|
+
const arrayKeysOf = (node) => panicSafe(() => {
|
|
4003
|
+
try {
|
|
4004
|
+
return arrayKeysUnsafe(node);
|
|
4005
|
+
}
|
|
4006
|
+
catch (e) {
|
|
4007
|
+
if (e instanceof PoisonError)
|
|
4008
|
+
return null;
|
|
4009
|
+
throw e;
|
|
4010
|
+
}
|
|
4011
|
+
}, null);
|
|
3856
4012
|
const arrayKeysUnsafe = (node) => {
|
|
3857
4013
|
let checkerType = checkerTypes.get(node);
|
|
3858
4014
|
if (checkerType === undefined) {
|
|
@@ -4470,23 +4626,21 @@ export class Lowerer {
|
|
|
4470
4626
|
const bound = symbolOf(parameter.name);
|
|
4471
4627
|
if (!bound)
|
|
4472
4628
|
continue;
|
|
4473
|
-
|
|
4629
|
+
const declared = this.shapes.get(parameterShape.type.shapeId);
|
|
4630
|
+
// The parameter's layout settles with its flow class once
|
|
4631
|
+
// the fixed point ends. A literal or call argument only adds
|
|
4632
|
+
// fields the declaration calls present.
|
|
4633
|
+
const fresh = !ts.isIdentifier(peel(arg));
|
|
4474
4634
|
for (const field of fields) {
|
|
4475
|
-
const
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
if (
|
|
4479
|
-
|
|
4480
|
-
}
|
|
4481
|
-
if (noteFieldSymbol(bound, field))
|
|
4635
|
+
const slot = declared?.fields.find((f) => f.name === field);
|
|
4636
|
+
if (!slot || (fresh && admitsUndefined(slot.type)))
|
|
4637
|
+
continue;
|
|
4638
|
+
if (noteFieldSymbol(bound, field)) {
|
|
4639
|
+
provenance?.note("record-parameter", parameter, arg);
|
|
4482
4640
|
changed = true;
|
|
4641
|
+
}
|
|
4483
4642
|
}
|
|
4484
|
-
|
|
4485
|
-
parameterShape.type = promoted;
|
|
4486
|
-
this.runtimeOptionalBindingTypes.set(bound, promoted);
|
|
4487
|
-
provenance?.note("record-parameter", parameter, arg);
|
|
4488
|
-
changed = true;
|
|
4489
|
-
}
|
|
4643
|
+
recordParameterSlots.set(bound, { target, index: i });
|
|
4490
4644
|
}
|
|
4491
4645
|
}
|
|
4492
4646
|
if (ts.isSpreadElement(arg) || !shape)
|
|
@@ -4570,7 +4724,27 @@ export class Lowerer {
|
|
|
4570
4724
|
};
|
|
4571
4725
|
const scanReturns = (symbol, decl) => {
|
|
4572
4726
|
let changed = false;
|
|
4727
|
+
const recordReturn = recordFlows.returnClass(symbol) !== null;
|
|
4728
|
+
const returned = signatureBySymbol.get(symbol)?.returnType;
|
|
4729
|
+
const returnedShape = returned?.kind === "record" ? this.shapes.get(returned.shapeId) : null;
|
|
4573
4730
|
for (const expression of returnsOf(decl)) {
|
|
4731
|
+
const fields = recordReturn ? fieldsOfValue(expression) : undefined;
|
|
4732
|
+
if (fields) {
|
|
4733
|
+
for (const field of fields) {
|
|
4734
|
+
// A result field that already admits undefined keeps the
|
|
4735
|
+
// checker's narrowing.
|
|
4736
|
+
const slot = returnedShape?.fields.find((f) => f.name === field);
|
|
4737
|
+
if (slot && admitsUndefined(slot.type))
|
|
4738
|
+
continue;
|
|
4739
|
+
const set = returnFields.get(symbol) ?? new Set();
|
|
4740
|
+
if (set.has(field))
|
|
4741
|
+
continue;
|
|
4742
|
+
set.add(field);
|
|
4743
|
+
returnFields.set(symbol, set);
|
|
4744
|
+
provenance?.note("record-return", decl.name ?? decl, expression);
|
|
4745
|
+
changed = true;
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4574
4748
|
if (mayBeOptional(expression) && !optionalReturns.has(symbol)) {
|
|
4575
4749
|
optionalReturns.add(symbol);
|
|
4576
4750
|
provenance?.note("return", decl.name ?? decl, expression);
|
|
@@ -4749,6 +4923,72 @@ export class Lowerer {
|
|
|
4749
4923
|
this.runtimeOptionalGlobals.add(global);
|
|
4750
4924
|
}
|
|
4751
4925
|
}
|
|
4926
|
+
// Record layouts settle per flow class: a closed class widens every
|
|
4927
|
+
// member to the union of its members' optional fields, and a class that
|
|
4928
|
+
// reaches other storage keeps the declared layout for every member.
|
|
4929
|
+
const classFields = new Map();
|
|
4930
|
+
const addClassFields = (id, fields) => {
|
|
4931
|
+
if (id === null)
|
|
4932
|
+
return;
|
|
4933
|
+
const set = classFields.get(id) ?? new Set();
|
|
4934
|
+
for (const field of fields)
|
|
4935
|
+
set.add(field);
|
|
4936
|
+
classFields.set(id, set);
|
|
4937
|
+
};
|
|
4938
|
+
for (const [symbol, fields] of optionalFields)
|
|
4939
|
+
addClassFields(recordFlows.bindingClass(symbol), fields);
|
|
4940
|
+
for (const [symbol, fields] of returnFields)
|
|
4941
|
+
addClassFields(recordFlows.returnClass(symbol), fields);
|
|
4942
|
+
const settledFields = (id, own) => id === null
|
|
4943
|
+
? own
|
|
4944
|
+
: classFields.has(id) && recordFlows.closed(id)
|
|
4945
|
+
? classFields.get(id)
|
|
4946
|
+
: undefined;
|
|
4947
|
+
const widenRecordFields = (type, fields) => {
|
|
4948
|
+
let promoted = type;
|
|
4949
|
+
for (const field of fields) {
|
|
4950
|
+
const source = promoted.kind === "record"
|
|
4951
|
+
? this.shapes.get(promoted.shapeId)?.fields.find((f) => f.name === field)
|
|
4952
|
+
: undefined;
|
|
4953
|
+
if (source)
|
|
4954
|
+
promoted = this.runtimeOptionalRecordField(promoted, field, addUndefined(source.type));
|
|
4955
|
+
}
|
|
4956
|
+
return promoted;
|
|
4957
|
+
};
|
|
4958
|
+
for (const [symbol, id] of recordFlows.bindings())
|
|
4959
|
+
if (classFields.has(id) && !recordFlows.closed(id))
|
|
4960
|
+
this.runtimeOptionalRecordsKeptDeclared.add(symbol);
|
|
4961
|
+
// Every tracked parameter settles with its class, including one that
|
|
4962
|
+
// only receives plain records. An untracked one (a function used as a
|
|
4963
|
+
// value, a method another member name or view can reach) widens to the
|
|
4964
|
+
// fields its own arguments carry.
|
|
4965
|
+
for (const { symbol, fn, index } of recordFlows.parameters())
|
|
4966
|
+
recordParameterSlots.set(symbol, { target: fn, index });
|
|
4967
|
+
for (const [bound, { target, index }] of recordParameterSlots) {
|
|
4968
|
+
const shape = signatureBySymbol.get(target)?.params[index];
|
|
4969
|
+
if (!shape || shape.type.kind !== "record")
|
|
4970
|
+
continue;
|
|
4971
|
+
const fields = settledFields(recordFlows.bindingClass(bound), optionalFields.get(bound));
|
|
4972
|
+
if (!fields)
|
|
4973
|
+
continue;
|
|
4974
|
+
const promoted = widenRecordFields(shape.type, fields);
|
|
4975
|
+
if (typeEquals(promoted, shape.type))
|
|
4976
|
+
continue;
|
|
4977
|
+
shape.type = promoted;
|
|
4978
|
+
this.runtimeOptionalBindingTypes.set(bound, promoted);
|
|
4979
|
+
}
|
|
4980
|
+
for (const [symbol, sig] of signatureBySymbol) {
|
|
4981
|
+
const id = recordFlows.returnClass(symbol);
|
|
4982
|
+
const fields = id === null ? undefined : settledFields(id, undefined);
|
|
4983
|
+
if (fields && sig.returnType.kind === "record") {
|
|
4984
|
+
const next = widenRecordFields(sig.returnType, fields);
|
|
4985
|
+
sig.returnType = next;
|
|
4986
|
+
if (sig.top)
|
|
4987
|
+
sig.top.returnType = next;
|
|
4988
|
+
if (sig.method)
|
|
4989
|
+
sig.method.ret = next;
|
|
4990
|
+
}
|
|
4991
|
+
}
|
|
4752
4992
|
for (const [symbol, sig] of signatureBySymbol) {
|
|
4753
4993
|
const params = optionalParams.get(symbol);
|
|
4754
4994
|
if (params) {
|
|
@@ -4832,7 +5072,7 @@ export class Lowerer {
|
|
|
4832
5072
|
global.type = promoted;
|
|
4833
5073
|
}
|
|
4834
5074
|
}
|
|
4835
|
-
const fields = optionalFields.get(symbol);
|
|
5075
|
+
const fields = settledFields(recordFlows.bindingClass(symbol), optionalFields.get(symbol));
|
|
4836
5076
|
if (!dynamicObjectEntryRows.has(symbol) && !optionalSymbols.has(symbol) && !fields)
|
|
4837
5077
|
return;
|
|
4838
5078
|
const current = this.mapTypeOf(this.typeOf(node.name));
|
|
@@ -4851,23 +5091,15 @@ export class Lowerer {
|
|
|
4851
5091
|
};
|
|
4852
5092
|
}
|
|
4853
5093
|
}
|
|
4854
|
-
if (fields && promoted.kind === "record")
|
|
4855
|
-
|
|
4856
|
-
const source = promoted.kind === "record"
|
|
4857
|
-
? this.shapes.get(promoted.shapeId)?.fields.find((f) => f.name === field)
|
|
4858
|
-
: undefined;
|
|
4859
|
-
if (!source)
|
|
4860
|
-
continue;
|
|
4861
|
-
promoted = this.runtimeOptionalRecordField(promoted, field, addUndefined(source.type));
|
|
4862
|
-
}
|
|
4863
|
-
}
|
|
5094
|
+
if (fields && promoted.kind === "record")
|
|
5095
|
+
promoted = widenRecordFields(promoted, fields);
|
|
4864
5096
|
if (!typeEquals(promoted, current)) {
|
|
4865
5097
|
this.runtimeOptionalBindingTypes.set(symbol, promoted);
|
|
4866
5098
|
const global = ts.isIdentifier(node.name)
|
|
4867
5099
|
? this.globalOf(node.name)
|
|
4868
5100
|
: this.globalsBySymbol.get(symbol);
|
|
4869
5101
|
if (global) {
|
|
4870
|
-
global.type = promoted;
|
|
5102
|
+
global.type = tdzStorage(global, promoted);
|
|
4871
5103
|
this.runtimeOptionalGlobals.add(global);
|
|
4872
5104
|
}
|
|
4873
5105
|
}
|
|
@@ -5362,7 +5594,7 @@ export class Lowerer {
|
|
|
5362
5594
|
for (const info of this.classes.values()) {
|
|
5363
5595
|
if (info.builtinError)
|
|
5364
5596
|
continue; // runtime-provided; nothing lowers
|
|
5365
|
-
if (info.lifetimeRegion)
|
|
5597
|
+
if (info.lifetimeRegion || info.internTable)
|
|
5366
5598
|
continue; // synthesized with the class
|
|
5367
5599
|
// Generic-class INSTANTIATIONS (and mixin instantiations) are
|
|
5368
5600
|
// demand-driven, not units: their members lower unconditionally in
|
|
@@ -5803,7 +6035,7 @@ export class Lowerer {
|
|
|
5803
6035
|
: diag;
|
|
5804
6036
|
const pending = this.pendingFlushes.get(diag);
|
|
5805
6037
|
// Deferred collection: the wrapper decides whether these ever report
|
|
5806
|
-
// (a reference flushes them; unreferenced declarations
|
|
6038
|
+
// (a reference flushes them; unreferenced declarations report nothing in
|
|
5807
6039
|
// builds and report under coverage's unreached group).
|
|
5808
6040
|
if (this.diagSink) {
|
|
5809
6041
|
if (pending && d !== diag)
|
|
@@ -6017,7 +6249,7 @@ export class Lowerer {
|
|
|
6017
6249
|
return stdlibMemberFence(this, access);
|
|
6018
6250
|
}
|
|
6019
6251
|
fenceStaticResponseMember(access, use) {
|
|
6020
|
-
return fenceStaticResponseMember(this, access, use);
|
|
6252
|
+
return fenceStaticResponseMember(this, access, use) ?? fenceStaticBlobMember(this, access, use);
|
|
6021
6253
|
}
|
|
6022
6254
|
fenceUnsupportedFetchConstructorMember(access) {
|
|
6023
6255
|
return fenceUnsupportedFetchConstructorMember(this, access);
|
|
@@ -6774,6 +7006,21 @@ export class Lowerer {
|
|
|
6774
7006
|
return this.checkedNarrowCall(helper, expr, expected, expr.loc);
|
|
6775
7007
|
}
|
|
6776
7008
|
}
|
|
7009
|
+
// A record arm beside unit arms flowing into another layout of that
|
|
7010
|
+
// record (`R | undefined` into the runtime-optional variant of R): the
|
|
7011
|
+
// same checked extraction of the record arm, then the record's width
|
|
7012
|
+
// lift into the destination layout.
|
|
7013
|
+
if (expr.type.kind === "union" && expected.kind === "record") {
|
|
7014
|
+
const arms = this.unions.get(expr.type.unionId)?.arms ?? [];
|
|
7015
|
+
const records = arms.filter((arm) => !isUnitType(arm));
|
|
7016
|
+
const arm = records.length === 1 && records[0].kind === "record" ? records[0] : null;
|
|
7017
|
+
const lift = arm ? this.widthLiftPlan(arm, expected) : null;
|
|
7018
|
+
const helper = arm && lift ? this.narrowedArmHelper(expr.type.unionId, arm, expr.loc) : null;
|
|
7019
|
+
if (arm && lift && helper) {
|
|
7020
|
+
const narrowed = this.checkedNarrowCall(helper, expr, arm, expr.loc);
|
|
7021
|
+
return this.applyWidthLift(lift, narrowed, expected, expr.loc);
|
|
7022
|
+
}
|
|
7023
|
+
}
|
|
6777
7024
|
if (!typeEquals(expr.type, expected)) {
|
|
6778
7025
|
const w = this.widthCoerce(expr, expected);
|
|
6779
7026
|
if (w)
|
|
@@ -7372,6 +7619,8 @@ export class Lowerer {
|
|
|
7372
7619
|
builtinOption("RequestInit") ||
|
|
7373
7620
|
builtinOption("ErrorOptions") ||
|
|
7374
7621
|
builtinOption("SpawnOptions") ||
|
|
7622
|
+
builtinOption("UrlObject") ||
|
|
7623
|
+
builtinOption("URLFormatOptions") ||
|
|
7375
7624
|
!this.mapTypeOf(this.typeOf(x))) {
|
|
7376
7625
|
return lowerDynObjectLiteral(this, x);
|
|
7377
7626
|
}
|
|
@@ -7674,6 +7923,18 @@ export class Lowerer {
|
|
|
7674
7923
|
paramShape(param) {
|
|
7675
7924
|
return paramShape(this, param);
|
|
7676
7925
|
}
|
|
7926
|
+
/** The pipeline stage source type bound to `node` (a parameter name or
|
|
7927
|
+
* a reference to it), or null. */
|
|
7928
|
+
stageSourceType(node) {
|
|
7929
|
+
if (this.stageSourceTypes.size === 0)
|
|
7930
|
+
return null;
|
|
7931
|
+
while (ts.isParenthesizedExpression(node))
|
|
7932
|
+
node = node.expression;
|
|
7933
|
+
if (!ts.isIdentifier(node))
|
|
7934
|
+
return null;
|
|
7935
|
+
const symbol = this.checker.getSymbolAtLocation(node);
|
|
7936
|
+
return (symbol && this.stageSourceTypes.get(symbol)) ?? null;
|
|
7937
|
+
}
|
|
7677
7938
|
checkDefaultParamBodyType(param, bodyType) {
|
|
7678
7939
|
return checkDefaultParamBodyType(this, param, bodyType);
|
|
7679
7940
|
}
|
|
@@ -8695,7 +8956,7 @@ export class Lowerer {
|
|
|
8695
8956
|
* lowered — set by lowerLabeled around lowering the labeled construct,
|
|
8696
8957
|
* consumed exactly once by the construct's own lowering (takeLabels).
|
|
8697
8958
|
* A lowering that never consumes them signals lowerLabeled to fence:
|
|
8698
|
-
*
|
|
8959
|
+
* dropping a label without a diagnostic would compile `break lbl` wrong. */
|
|
8699
8960
|
pendingLabels = null;
|
|
8700
8961
|
takeLabels() {
|
|
8701
8962
|
const labels = this.pendingLabels;
|
|
@@ -8902,6 +9163,9 @@ export class Lowerer {
|
|
|
8902
9163
|
lowerElementWrite(expr) {
|
|
8903
9164
|
return lowerElementWrite(this, expr);
|
|
8904
9165
|
}
|
|
9166
|
+
lowerLiveWebValue(node) {
|
|
9167
|
+
return lowerLiveWebValue(this, node);
|
|
9168
|
+
}
|
|
8905
9169
|
ensureString(e, node) {
|
|
8906
9170
|
return ensureString(this, e, node);
|
|
8907
9171
|
}
|
|
@@ -9044,6 +9308,7 @@ export class Lowerer {
|
|
|
9044
9308
|
// promise-returning ambient global, and `import` is a keyword callee no
|
|
9045
9309
|
// identifier path matches.
|
|
9046
9310
|
return (lowerLifetimeRegionCall(this, expr) ??
|
|
9311
|
+
lowerInternTableCall(this, expr) ??
|
|
9047
9312
|
lowerFfiCall(this, expr) ??
|
|
9048
9313
|
lowerFetchCall(this, expr) ??
|
|
9049
9314
|
lowerStaticFetchCompanionCall(this, expr) ??
|
|
@@ -9053,6 +9318,8 @@ export class Lowerer {
|
|
|
9053
9318
|
lowerStaticReadableStreamControllerCall(this, expr) ??
|
|
9054
9319
|
lowerStaticReadableStreamReaderCall(this, expr) ??
|
|
9055
9320
|
lowerStaticResponseCall(this, expr) ??
|
|
9321
|
+
lowerStaticBlobCall(this, expr) ??
|
|
9322
|
+
lowerKeyObjectCall(this, expr) ??
|
|
9056
9323
|
lowerFetchElementMethodCall(this, expr) ??
|
|
9057
9324
|
lowerDynamicImportCall(this, expr) ??
|
|
9058
9325
|
lowerCall(this, expr));
|
|
@@ -9180,10 +9447,12 @@ export class Lowerer {
|
|
|
9180
9447
|
}
|
|
9181
9448
|
lowerNew(expr) {
|
|
9182
9449
|
const builtin = lowerLifetimeRegionNew(this, expr) ??
|
|
9450
|
+
lowerInternTableNew(this, expr) ??
|
|
9183
9451
|
lowerAbortControllerNew(this, expr) ??
|
|
9184
9452
|
lowerEventTargetNew(this, expr) ??
|
|
9185
9453
|
lowerFetchWebNew(this, expr) ??
|
|
9186
9454
|
lowerResponseNew(this, expr) ??
|
|
9455
|
+
lowerBlobNew(this, expr) ??
|
|
9187
9456
|
lowerStaticReadableStreamNew(this, expr) ??
|
|
9188
9457
|
lowerConsoleNew(this, expr);
|
|
9189
9458
|
return (builtin ?? this.withRuntimeOptionalClassValue(expr.expression, () => lowerNew(this, expr)));
|