@scriptc/compiler 0.4.5 → 0.4.6
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/assert-strict.d.ts +47 -0
- package/ambient/node-fallback/assert.d.ts +86 -0
- package/ambient/node-fallback/async_hooks.d.ts +41 -0
- package/ambient/node-fallback/buffer.d.ts +23 -0
- package/ambient/node-fallback/child_process.d.ts +242 -0
- package/ambient/node-fallback/cluster.d.ts +17 -0
- package/ambient/node-fallback/constants.d.ts +15 -0
- package/ambient/node-fallback/crypto.d.ts +837 -0
- package/ambient/node-fallback/dgram.d.ts +58 -0
- package/ambient/node-fallback/diagnostics_channel.d.ts +87 -0
- package/ambient/node-fallback/dns-promises.d.ts +27 -0
- package/ambient/node-fallback/dns.d.ts +65 -0
- package/ambient/node-fallback/events.d.ts +60 -0
- package/ambient/node-fallback/fs-promises.d.ts +225 -0
- package/ambient/node-fallback/fs.d.ts +641 -0
- package/ambient/node-fallback/graceful-fs.d.ts +9 -0
- package/ambient/node-fallback/http.d.ts +326 -0
- package/ambient/node-fallback/http2.d.ts +816 -0
- package/ambient/node-fallback/https.d.ts +59 -0
- package/ambient/node-fallback/module.d.ts +10 -0
- package/ambient/node-fallback/net.d.ts +374 -0
- package/ambient/node-fallback/os.d.ts +288 -0
- package/ambient/node-fallback/path-posix.d.ts +22 -0
- package/ambient/node-fallback/path-win32.d.ts +22 -0
- package/ambient/node-fallback/path.d.ts +55 -0
- package/ambient/node-fallback/process.d.ts +11 -0
- package/ambient/node-fallback/punycode.d.ts +18 -0
- package/ambient/node-fallback/querystring.d.ts +55 -0
- package/ambient/node-fallback/stream-consumers.d.ts +21 -0
- package/ambient/node-fallback/stream-promises.d.ts +28 -0
- package/ambient/node-fallback/stream-web.d.ts +36 -0
- package/ambient/node-fallback/stream.d.ts +644 -0
- package/ambient/node-fallback/string_decoder.d.ts +20 -0
- package/ambient/node-fallback/test.d.ts +236 -0
- package/ambient/node-fallback/timers-promises.d.ts +31 -0
- package/ambient/node-fallback/timers.d.ts +28 -0
- package/ambient/node-fallback/tls.d.ts +169 -0
- package/ambient/node-fallback/url.d.ts +95 -0
- package/ambient/node-fallback/util-types.d.ts +50 -0
- package/ambient/node-fallback/util.d.ts +416 -0
- package/ambient/node-fallback/v8.d.ts +43 -0
- package/ambient/node-fallback/worker_threads.d.ts +113 -0
- package/ambient/node-fallback/zlib.d.ts +422 -0
- package/ambient/scriptc-node-fallback.d.ts +224 -6688
- package/dist/backend/cycle-analysis.js +4 -0
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/executable-features.d.ts +1 -1
- package/dist/backend/executable-features.js +15 -2
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/huge-text.d.ts +16 -0
- package/dist/backend/huge-text.js +103 -0
- package/dist/backend/huge-text.js.map +1 -0
- package/dist/backend/huge-text.test.d.ts +1 -0
- package/dist/backend/huge-text.test.js +73 -0
- package/dist/backend/huge-text.test.js.map +1 -0
- package/dist/backend/library-pack.js +1 -1
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/link-plan-core.d.ts +10 -0
- package/dist/backend/link-plan-core.js +14 -2
- package/dist/backend/link-plan-core.js.map +1 -1
- package/dist/backend/link-plan-core.test.d.ts +1 -0
- package/dist/backend/link-plan-core.test.js +20 -0
- package/dist/backend/link-plan-core.test.js.map +1 -0
- package/dist/backend/link-plan.d.ts +8 -0
- package/dist/backend/link-plan.js +7 -0
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/linker.js +37 -14
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/lld.d.ts +13 -0
- package/dist/backend/lld.js +18 -1
- package/dist/backend/lld.js.map +1 -1
- package/dist/backend/lld.test.js +7 -1
- package/dist/backend/lld.test.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +2 -0
- package/dist/backend/llvm/alloc.js +1 -1
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/arenas.d.ts +78 -0
- package/dist/backend/llvm/arenas.js +313 -0
- package/dist/backend/llvm/arenas.js.map +1 -0
- package/dist/backend/llvm/arenas.test.d.ts +1 -0
- package/dist/backend/llvm/arenas.test.js +140 -0
- package/dist/backend/llvm/arenas.test.js.map +1 -0
- package/dist/backend/llvm/blocks.d.ts +11 -1
- package/dist/backend/llvm/blocks.js +23 -5
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/bytes-headers.d.ts +19 -0
- package/dist/backend/llvm/bytes-headers.js +55 -0
- package/dist/backend/llvm/bytes-headers.js.map +1 -0
- package/dist/backend/llvm/bytes-loop-versions.d.ts +4 -3
- package/dist/backend/llvm/bytes-loop-versions.js +42 -7
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +39 -4
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.d.ts +5 -0
- package/dist/backend/llvm/call-lifetimes.js +43 -8
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +26 -0
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/checked-narrows.d.ts +3 -0
- package/dist/backend/llvm/checked-narrows.js +8 -1
- package/dist/backend/llvm/checked-narrows.js.map +1 -1
- package/dist/backend/llvm/class-unions.d.ts +21 -0
- package/dist/backend/llvm/class-unions.js +141 -0
- package/dist/backend/llvm/class-unions.js.map +1 -0
- package/dist/backend/llvm/class-unions.test.d.ts +1 -0
- package/dist/backend/llvm/class-unions.test.js +137 -0
- package/dist/backend/llvm/class-unions.test.js.map +1 -0
- package/dist/backend/llvm/classes.d.ts +46 -8
- package/dist/backend/llvm/classes.js +259 -32
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +4 -0
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +23 -0
- package/dist/backend/llvm/common.js +34 -0
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.test.js +39 -0
- package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
- package/dist/backend/llvm/constant-choices.d.ts +32 -0
- package/dist/backend/llvm/constant-choices.js +209 -0
- package/dist/backend/llvm/constant-choices.js.map +1 -0
- package/dist/backend/llvm/constant-choices.test.d.ts +1 -0
- package/dist/backend/llvm/constant-choices.test.js +94 -0
- package/dist/backend/llvm/constant-choices.test.js.map +1 -0
- package/dist/backend/llvm/counted-loops.d.ts +14 -2
- package/dist/backend/llvm/counted-loops.js +60 -7
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/counted-loops.test.d.ts +1 -0
- package/dist/backend/llvm/counted-loops.test.js +34 -0
- package/dist/backend/llvm/counted-loops.test.js.map +1 -0
- package/dist/backend/llvm/cpu-dispatch.d.ts +26 -0
- package/dist/backend/llvm/cpu-dispatch.js +279 -0
- package/dist/backend/llvm/cpu-dispatch.js.map +1 -0
- package/dist/backend/llvm/dense-array-access.d.ts +13 -2
- package/dist/backend/llvm/dense-array-access.js +60 -6
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dyn-handle-tags.test.js +40 -14
- package/dist/backend/llvm/dyn-handle-tags.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +28 -2
- package/dist/backend/llvm/dyn.js +176 -27
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +25 -3
- 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.d.ts +5 -3
- package/dist/backend/llvm/emit-module.js +362 -74
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-statements.js +327 -59
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +223 -33
- package/dist/backend/llvm/emitter.js +713 -100
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +20 -1
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +32 -6
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +9 -1
- package/dist/backend/llvm/expr-bytes.js +105 -9
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.d.ts +1 -1
- package/dist/backend/llvm/expr-callbacks.js +29 -22
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +0 -4
- package/dist/backend/llvm/expr-calls.js +116 -14
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +77 -12
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +22 -0
- package/dist/backend/llvm/expr-control.d.ts +4 -0
- package/dist/backend/llvm/expr-control.js +485 -426
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.js +4 -0
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +3 -3
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.d.ts +6 -0
- package/dist/backend/llvm/expr-primitives.js +119 -58
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +11 -2
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.d.ts +36 -4
- package/dist/backend/llvm/expr-records.js +249 -37
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +124 -7
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.js +13 -14
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/frame-escapes.d.ts +11 -0
- package/dist/backend/llvm/frame-escapes.js +219 -0
- package/dist/backend/llvm/frame-escapes.js.map +1 -0
- package/dist/backend/llvm/function-layout.d.ts +15 -0
- package/dist/backend/llvm/function-layout.js +40 -0
- package/dist/backend/llvm/function-layout.js.map +1 -0
- package/dist/backend/llvm/heap-census.d.ts +34 -0
- package/dist/backend/llvm/heap-census.js +163 -0
- package/dist/backend/llvm/heap-census.js.map +1 -0
- package/dist/backend/llvm/inline-arrays.d.ts +41 -0
- package/dist/backend/llvm/inline-arrays.js +195 -0
- package/dist/backend/llvm/inline-arrays.js.map +1 -0
- package/dist/backend/llvm/int32-kind-loops.js +2 -0
- package/dist/backend/llvm/int32-kind-loops.js.map +1 -1
- package/dist/backend/llvm/integer-clones.d.ts +32 -5
- package/dist/backend/llvm/integer-clones.js +237 -44
- package/dist/backend/llvm/integer-clones.js.map +1 -1
- package/dist/backend/llvm/integer-clones.test.js +120 -0
- package/dist/backend/llvm/integer-clones.test.js.map +1 -1
- package/dist/backend/llvm/iterative-teardown.test.d.ts +1 -0
- package/dist/backend/llvm/iterative-teardown.test.js +62 -0
- package/dist/backend/llvm/iterative-teardown.test.js.map +1 -0
- package/dist/backend/llvm/js-ic.js +246 -62
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/lib-connect.js +1 -1
- package/dist/backend/llvm/lib-connect.js.map +1 -1
- package/dist/backend/llvm/lib-datagram.js +2 -2
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +153 -16
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.d.ts +8 -0
- package/dist/backend/llvm/lib-filesystem.js +48 -4
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.js +4 -3
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-lookup.js +1 -1
- package/dist/backend/llvm/lib-lookup.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +15 -1
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +32 -8
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.d.ts +3 -0
- package/dist/backend/llvm/lib-shared.js +191 -28
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +1 -1
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +15 -1
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +1 -1
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-extents.d.ts +22 -0
- package/dist/backend/llvm/local-extents.js +102 -0
- package/dist/backend/llvm/local-extents.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.js +15 -2
- package/dist/backend/llvm/local-union-storage.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +1 -1
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/loop-callees.d.ts +21 -0
- package/dist/backend/llvm/loop-callees.js +119 -0
- package/dist/backend/llvm/loop-callees.js.map +1 -0
- package/dist/backend/llvm/loop-callees.test.d.ts +1 -0
- package/dist/backend/llvm/loop-callees.test.js +65 -0
- package/dist/backend/llvm/loop-callees.test.js.map +1 -0
- package/dist/backend/llvm/loop-entry-versions.d.ts +17 -0
- package/dist/backend/llvm/loop-entry-versions.js +185 -0
- package/dist/backend/llvm/loop-entry-versions.js.map +1 -0
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.js +13 -4
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.d.ts +11 -0
- package/dist/backend/llvm/map-read-lifetimes.js +51 -1
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +6 -3
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.d.ts +67 -10
- package/dist/backend/llvm/nullable-unions.js +218 -22
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.test.js +124 -1
- package/dist/backend/llvm/nullable-unions.test.js.map +1 -1
- package/dist/backend/llvm/periodic-guards.d.ts +16 -0
- package/dist/backend/llvm/periodic-guards.js +91 -0
- package/dist/backend/llvm/periodic-guards.js.map +1 -0
- package/dist/backend/llvm/periodic-guards.test.d.ts +1 -0
- package/dist/backend/llvm/periodic-guards.test.js +64 -0
- package/dist/backend/llvm/periodic-guards.test.js.map +1 -0
- package/dist/backend/llvm/publish.d.ts +12 -2
- package/dist/backend/llvm/publish.js +15 -8
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/rebound-parameters.d.ts +4 -1
- package/dist/backend/llvm/rebound-parameters.js +17 -1
- package/dist/backend/llvm/rebound-parameters.js.map +1 -1
- package/dist/backend/llvm/receivers.d.ts +7 -0
- package/dist/backend/llvm/receivers.js +77 -10
- package/dist/backend/llvm/receivers.js.map +1 -1
- package/dist/backend/llvm/record-union-keys.test.js +29 -0
- package/dist/backend/llvm/record-union-keys.test.js.map +1 -1
- package/dist/backend/llvm/record-views.d.ts +29 -0
- package/dist/backend/llvm/record-views.js +249 -0
- package/dist/backend/llvm/record-views.js.map +1 -0
- package/dist/backend/llvm/record-views.test.d.ts +1 -0
- package/dist/backend/llvm/record-views.test.js +118 -0
- package/dist/backend/llvm/record-views.test.js.map +1 -0
- package/dist/backend/llvm/reference-writes.js +21 -0
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/reference-writes.test.js +42 -0
- package/dist/backend/llvm/reference-writes.test.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.d.ts +5 -1
- package/dist/backend/llvm/regex-matchers.js +173 -21
- package/dist/backend/llvm/regex-matchers.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.test.js +39 -1
- package/dist/backend/llvm/regex-matchers.test.js.map +1 -1
- package/dist/backend/llvm/region-groups.d.ts +67 -0
- package/dist/backend/llvm/region-groups.js +1719 -0
- package/dist/backend/llvm/region-groups.js.map +1 -0
- package/dist/backend/llvm/region-groups.test.d.ts +1 -0
- package/dist/backend/llvm/region-groups.test.js +197 -0
- package/dist/backend/llvm/region-groups.test.js.map +1 -0
- package/dist/backend/llvm/region-ir.d.ts +31 -0
- package/dist/backend/llvm/region-ir.js +256 -0
- package/dist/backend/llvm/region-ir.js.map +1 -0
- package/dist/backend/llvm/region-sites.d.ts +20 -0
- package/dist/backend/llvm/region-sites.js +327 -0
- package/dist/backend/llvm/region-sites.js.map +1 -0
- package/dist/backend/llvm/region-sites.test.d.ts +1 -0
- package/dist/backend/llvm/region-sites.test.js +216 -0
- package/dist/backend/llvm/region-sites.test.js.map +1 -0
- package/dist/backend/llvm/repr-report.d.ts +9 -0
- package/dist/backend/llvm/repr-report.js +143 -0
- package/dist/backend/llvm/repr-report.js.map +1 -0
- package/dist/backend/llvm/repr-report.test.d.ts +1 -0
- package/dist/backend/llvm/repr-report.test.js +62 -0
- package/dist/backend/llvm/repr-report.test.js.map +1 -0
- package/dist/backend/llvm/runtime-registries.test.d.ts +1 -0
- package/dist/backend/llvm/runtime-registries.test.js +88 -0
- package/dist/backend/llvm/runtime-registries.test.js.map +1 -0
- package/dist/backend/llvm/serialized-ir-emission.test.js +1 -0
- package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
- package/dist/backend/llvm/shape-union-tags.test.d.ts +1 -0
- package/dist/backend/llvm/shape-union-tags.test.js +75 -0
- package/dist/backend/llvm/shape-union-tags.test.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +60 -10
- package/dist/backend/llvm/shapes.js +233 -51
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +37 -18
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.d.ts +3 -0
- package/dist/backend/llvm/speculative-integers.js +20 -8
- package/dist/backend/llvm/speculative-integers.js.map +1 -1
- package/dist/backend/llvm/split.js +6 -1
- package/dist/backend/llvm/split.js.map +1 -1
- package/dist/backend/llvm/split.test.js +23 -0
- package/dist/backend/llvm/split.test.js.map +1 -1
- package/dist/backend/llvm/stack-callbacks.js +4 -2
- package/dist/backend/llvm/stack-callbacks.js.map +1 -1
- package/dist/backend/llvm/stack-objects.d.ts +12 -3
- package/dist/backend/llvm/stack-objects.js +110 -22
- package/dist/backend/llvm/stack-objects.js.map +1 -1
- package/dist/backend/llvm/stack-objects.test.js +144 -0
- package/dist/backend/llvm/stack-objects.test.js.map +1 -1
- package/dist/backend/llvm/stack-unions.test.js +24 -1
- package/dist/backend/llvm/stack-unions.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.js +2 -1
- package/dist/backend/llvm/string-lifetimes.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +4 -0
- package/dist/backend/llvm/string-reads.js +27 -0
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/test-boxed-unions.d.ts +10 -8
- package/dist/backend/llvm/test-boxed-unions.js +20 -25
- package/dist/backend/llvm/test-boxed-unions.js.map +1 -1
- package/dist/backend/llvm/union-repr.js +9 -8
- package/dist/backend/llvm/union-repr.js.map +1 -1
- package/dist/backend/llvm/union-retype.test.js +45 -2
- package/dist/backend/llvm/union-retype.test.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.d.ts +20 -8
- package/dist/backend/llvm/unwind-abi.js +177 -70
- package/dist/backend/llvm/unwind-abi.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.test.js +90 -3
- package/dist/backend/llvm/unwind-abi.test.js.map +1 -1
- package/dist/backend/llvm/walk-borrows.d.ts +3 -2
- package/dist/backend/llvm/walk-borrows.js +2 -2
- package/dist/backend/llvm/walk-borrows.js.map +1 -1
- package/dist/backend/llvm/walk-borrows.test.js +18 -0
- package/dist/backend/llvm/walk-borrows.test.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +14 -1
- package/dist/backend/llvm/walkers.js +103 -11
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/llvm/wrapping-sums.d.ts +26 -6
- package/dist/backend/llvm/wrapping-sums.js +64 -12
- package/dist/backend/llvm/wrapping-sums.js.map +1 -1
- package/dist/backend/loop-polls.d.ts +4 -2
- package/dist/backend/loop-polls.js +11 -2
- package/dist/backend/loop-polls.js.map +1 -1
- package/dist/backend/mangle.d.ts +0 -5
- package/dist/backend/mangle.js +0 -9
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/may-throw.d.ts +10 -9
- package/dist/backend/may-throw.js +189 -27
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +44 -7
- package/dist/backend/may-throw.test.js.map +1 -1
- package/dist/backend/native/compiler-fingerprint.d.ts +5 -0
- package/dist/backend/native/compiler-fingerprint.js +62 -16
- package/dist/backend/native/compiler-fingerprint.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +31 -8
- package/dist/backend/native/executable.js +56 -32
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/library.js +3 -4
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native/object-merge.d.ts +3 -1
- package/dist/backend/native/object-merge.js +24 -11
- package/dist/backend/native/object-merge.js.map +1 -1
- package/dist/backend/native/program-shards.js +6 -3
- package/dist/backend/native/program-shards.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +3 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native-codegen-core.d.ts +15 -6
- package/dist/backend/native-codegen-core.js +20 -9
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.js +51 -5
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +82 -8
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +30 -0
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-profile.d.ts +68 -4
- package/dist/backend/native-profile.js +86 -14
- package/dist/backend/native-profile.js.map +1 -1
- package/dist/backend/native-profile.test.js +127 -4
- package/dist/backend/native-profile.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 +58 -4
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/native-tools.d.ts +17 -3
- package/dist/backend/native-tools.js +12 -4
- package/dist/backend/native-tools.js.map +1 -1
- package/dist/backend/native-tools.test.d.ts +1 -0
- package/dist/backend/native-tools.test.js +76 -0
- package/dist/backend/native-tools.test.js.map +1 -0
- package/dist/backend/object-localize.js +69 -9
- package/dist/backend/object-localize.js.map +1 -1
- package/dist/backend/object-localize.test.js +99 -10
- package/dist/backend/object-localize.test.js.map +1 -1
- package/dist/backend/publication.d.ts +2 -0
- package/dist/backend/publication.js +4 -0
- 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-core.d.ts +19 -0
- package/dist/backend/runtime-pack-core.js +23 -3
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +1 -1
- package/dist/backend/runtime-pack.test.js +48 -2
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-cpu.d.ts +2 -0
- package/dist/backend/target-cpu.js +4 -0
- package/dist/backend/target-cpu.js.map +1 -1
- package/dist/backend/target-diagnostics.js +1 -19
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +1 -1
- package/dist/backend/target-diagnostics.test.js.map +1 -1
- package/dist/backend/targets.d.ts +28 -0
- package/dist/backend/targets.js +70 -0
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +75 -1
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/backend/vendor-archives.d.ts +1 -1
- package/dist/backend/vendor-archives.js +25 -12
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +15 -2
- package/dist/backend/vendor-inputs.js +59 -3
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/vendor-inputs.test.d.ts +1 -0
- package/dist/backend/vendor-inputs.test.js +74 -0
- package/dist/backend/vendor-inputs.test.js.map +1 -0
- package/dist/cli/command.js +95 -5
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/host.d.ts +3 -0
- package/dist/cli/output-options.d.ts +3 -0
- package/dist/cli/output-options.js +8 -2
- package/dist/cli/output-options.js.map +1 -1
- package/dist/cli/usage.d.ts +28 -1
- package/dist/cli/usage.js +56 -6
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +3 -0
- package/dist/compat/fetch-profile.js +23 -3
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +45 -0
- package/dist/contracts/check.js +70 -2
- package/dist/contracts/check.js.map +1 -1
- package/dist/contracts/int32-elements.d.ts +2 -1
- package/dist/contracts/int32-elements.js.map +1 -1
- package/dist/coverage/report.d.ts +5 -1
- package/dist/coverage/report.js +83 -2
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +2 -0
- package/dist/coverage/verdict-cache.js +5 -10
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/diagnostics/codes.d.ts +145 -0
- package/dist/diagnostics/codes.js +159 -0
- package/dist/diagnostics/codes.js.map +1 -0
- package/dist/diagnostics/codes.test.d.ts +1 -0
- package/dist/diagnostics/codes.test.js +78 -0
- package/dist/diagnostics/codes.test.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +101 -2
- package/dist/diagnostics/diagnostic.js +155 -0
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/dynamic-slots.d.ts +23 -0
- package/dist/diagnostics/dynamic-slots.js +29 -0
- package/dist/diagnostics/dynamic-slots.js.map +1 -0
- package/dist/diagnostics/dynamic-tier.d.ts +6 -0
- package/dist/diagnostics/dynamic-tier.js +8 -1
- package/dist/diagnostics/dynamic-tier.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +43 -1
- package/dist/diagnostics/envelope.js +19 -1
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/diagnostics/envelope.test.js.map +1 -1
- package/dist/diagnostics/render.d.ts +3 -1
- package/dist/diagnostics/render.js +27 -6
- package/dist/diagnostics/render.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +41 -0
- package/dist/executable/executable-cache.js +39 -1
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +4 -1
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.d.ts +2 -1
- package/dist/executable/prepare.js +421 -10
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +1 -0
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/canon-map.d.ts +17 -0
- package/dist/frontend/canon-map.js +177 -0
- package/dist/frontend/canon-map.js.map +1 -0
- package/dist/frontend/canon.d.ts +122 -0
- package/dist/frontend/canon.js +462 -0
- package/dist/frontend/canon.js.map +1 -0
- package/dist/frontend/contract-types.d.ts +9 -1
- package/dist/frontend/contract-types.js +46 -4
- package/dist/frontend/contract-types.js.map +1 -1
- package/dist/frontend/decl-projection.d.ts +3 -0
- package/dist/frontend/decl-projection.js +121 -3
- package/dist/frontend/decl-projection.js.map +1 -1
- package/dist/frontend/dts-paths.d.ts +17 -4
- package/dist/frontend/dts-paths.js +149 -5
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/fork-target.js +4 -4
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/fork-target.test.js +3 -3
- package/dist/frontend/fork-target.test.js.map +1 -1
- package/dist/frontend/heritage-elements.d.ts +15 -0
- package/dist/frontend/heritage-elements.js +18 -0
- package/dist/frontend/heritage-elements.js.map +1 -0
- package/dist/frontend/heritage-elements.test.d.ts +1 -0
- package/dist/frontend/heritage-elements.test.js +68 -0
- package/dist/frontend/heritage-elements.test.js.map +1 -0
- package/dist/frontend/input-tracker.d.ts +20 -0
- package/dist/frontend/input-tracker.js +74 -4
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +66 -0
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lowering/any-collection-residue.d.ts +9 -0
- package/dist/frontend/lowering/any-collection-residue.js +42 -0
- package/dist/frontend/lowering/any-collection-residue.js.map +1 -0
- package/dist/frontend/lowering/array-values.d.ts +44 -2
- package/dist/frontend/lowering/array-values.js +193 -3
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/builtin-namespaces.d.ts +6 -2
- package/dist/frontend/lowering/builtin-namespaces.js +28 -6
- package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
- package/dist/frontend/lowering/builtins/array-classes.d.ts +69 -0
- package/dist/frontend/lowering/builtins/array-classes.js +729 -0
- package/dist/frontend/lowering/builtins/array-classes.js.map +1 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js +4 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.js +34 -0
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/disposable-stack.js +1 -3
- package/dist/frontend/lowering/builtins/disposable-stack.js.map +1 -1
- package/dist/frontend/lowering/builtins/errors.d.ts +13 -9
- package/dist/frontend/lowering/builtins/errors.js +136 -56
- package/dist/frontend/lowering/builtins/errors.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +1 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js +85 -4
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem.d.ts +11 -6
- package/dist/frontend/lowering/builtins/filesystem.js +270 -24
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +7 -1
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/mime.d.ts +25 -0
- package/dist/frontend/lowering/builtins/mime.js +167 -0
- package/dist/frontend/lowering/builtins/mime.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-bindings.d.ts +3 -0
- package/dist/frontend/lowering/builtins/module-bindings.js +6 -0
- package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-calls.js +79 -12
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +7 -4
- package/dist/frontend/lowering/builtins/module-resolution.js +115 -13
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/navigator.d.ts +3 -1
- package/dist/frontend/lowering/builtins/navigator.js +22 -8
- package/dist/frontend/lowering/builtins/navigator.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.js +49 -9
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +18 -3
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/promisify-callback.d.ts +6 -2
- package/dist/frontend/lowering/builtins/promisify-callback.js +19 -6
- package/dist/frontend/lowering/builtins/promisify-callback.js.map +1 -1
- package/dist/frontend/lowering/builtins/properties.js +23 -5
- package/dist/frontend/lowering/builtins/properties.js.map +1 -1
- package/dist/frontend/lowering/builtins/web-streams-dyn.d.ts +42 -0
- package/dist/frontend/lowering/builtins/web-streams-dyn.js +321 -0
- package/dist/frontend/lowering/builtins/web-streams-dyn.js.map +1 -0
- package/dist/frontend/lowering/builtins/x509.js +35 -5
- package/dist/frontend/lowering/builtins/x509.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.d.ts +14 -1
- package/dist/frontend/lowering/call-arguments.js +84 -70
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.js +108 -24
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-attributes.js +6 -5
- package/dist/frontend/lowering/class-attributes.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.js +40 -19
- 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.js +4 -0
- package/dist/frontend/lowering/class-protocol-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +61 -1
- package/dist/frontend/lowering/class-protocols.js +297 -21
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/class-to-primitive.d.ts +3 -2
- package/dist/frontend/lowering/class-to-primitive.js +15 -5
- package/dist/frontend/lowering/class-to-primitive.js.map +1 -1
- package/dist/frontend/lowering/coercions/asserted.d.ts +16 -0
- package/dist/frontend/lowering/coercions/asserted.js +79 -0
- package/dist/frontend/lowering/coercions/asserted.js.map +1 -0
- package/dist/frontend/lowering/coercions/function-adapters.d.ts +13 -0
- package/dist/frontend/lowering/coercions/function-adapters.js +70 -3
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +23 -0
- package/dist/frontend/lowering/coercions/state.js +9 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +67 -1
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.d.ts +10 -0
- package/dist/frontend/lowering/coercions/structural.js +134 -4
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.d.ts +11 -0
- package/dist/frontend/lowering/coercions/unions.js +83 -4
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/completion-callbacks.js +3 -2
- package/dist/frontend/lowering/completion-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +10 -0
- package/dist/frontend/lowering/containers/array-callbacks.js +224 -81
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-concat.d.ts +5 -2
- package/dist/frontend/lowering/containers/array-concat.js +76 -7
- package/dist/frontend/lowering/containers/array-concat.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.d.ts +9 -4
- package/dist/frontend/lowering/containers/array-construction.js +112 -100
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +193 -45
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.d.ts +3 -0
- package/dist/frontend/lowering/containers/array-pipelines.js +81 -13
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.d.ts +1 -0
- package/dist/frontend/lowering/containers/callback-arguments.js +28 -2
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +13 -3
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/filter-predicates.js +34 -3
- package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.d.ts +34 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +131 -72
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/cycle-initialization.js +43 -6
- package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
- package/dist/frontend/lowering/decl-origin.d.ts +49 -0
- package/dist/frontend/lowering/decl-origin.js +402 -0
- package/dist/frontend/lowering/decl-origin.js.map +1 -0
- package/dist/frontend/lowering/deferred-module-initializers.d.ts +2 -0
- package/dist/frontend/lowering/deferred-module-initializers.js +7 -0
- package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
- package/dist/frontend/lowering/divergences.js +5 -0
- package/dist/frontend/lowering/divergences.js.map +1 -1
- package/dist/frontend/lowering/dynamic-tier.d.ts +8 -2
- package/dist/frontend/lowering/dynamic-tier.js +111 -3
- package/dist/frontend/lowering/dynamic-tier.js.map +1 -1
- package/dist/frontend/lowering/expressions/array-literals.d.ts +14 -1
- package/dist/frontend/lowering/expressions/array-literals.js +43 -5
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/asserted-receiver.d.ts +48 -0
- package/dist/frontend/lowering/expressions/asserted-receiver.js +233 -0
- package/dist/frontend/lowering/expressions/asserted-receiver.js.map +1 -0
- package/dist/frontend/lowering/expressions/binary.js +136 -1
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.d.ts +7 -0
- package/dist/frontend/lowering/expressions/element-access.js +363 -12
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.d.ts +3 -0
- package/dist/frontend/lowering/expressions/identifiers.js +78 -62
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/message-listeners.d.ts +3 -0
- package/dist/frontend/lowering/expressions/message-listeners.js +19 -0
- package/dist/frontend/lowering/expressions/message-listeners.js.map +1 -0
- package/dist/frontend/lowering/expressions/narrowing.js +224 -6
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +5 -2
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +282 -24
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +15 -3
- package/dist/frontend/lowering/expressions/property-access.js +397 -74
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +202 -70
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/typeof.js +9 -1
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-fields.d.ts +28 -8
- package/dist/frontend/lowering/expressions/union-fields.js +168 -14
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
- package/dist/frontend/lowering/frozen-records.d.ts +8 -0
- package/dist/frontend/lowering/frozen-records.js +56 -9
- package/dist/frontend/lowering/frozen-records.js.map +1 -1
- package/dist/frontend/lowering/function-context.d.ts +3 -0
- package/dist/frontend/lowering/function-context.js +4 -1
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/function-returns.d.ts +4 -0
- package/dist/frontend/lowering/function-returns.js +231 -2
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/generator-delegation.js +3 -2
- package/dist/frontend/lowering/generator-delegation.js.map +1 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.d.ts +26 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +294 -2
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +10 -0
- package/dist/frontend/lowering/generic-functions.js +67 -7
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/global-values.d.ts +37 -0
- package/dist/frontend/lowering/global-values.js +395 -0
- package/dist/frontend/lowering/global-values.js.map +1 -0
- package/dist/frontend/lowering/handle-properties.js +3 -2
- package/dist/frontend/lowering/handle-properties.js.map +1 -1
- package/dist/frontend/lowering/handle-properties.test.d.ts +1 -0
- package/dist/frontend/lowering/handle-properties.test.js +25 -0
- package/dist/frontend/lowering/handle-properties.test.js.map +1 -0
- package/dist/frontend/lowering/import-meta.d.ts +3 -0
- package/dist/frontend/lowering/import-meta.js +8 -3
- package/dist/frontend/lowering/import-meta.js.map +1 -1
- package/dist/frontend/lowering/iterator-adapters.js +3 -3
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.d.ts +2 -0
- package/dist/frontend/lowering/key-order-witness.js +10 -0
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.d.ts +5 -1
- package/dist/frontend/lowering/lower-array-sort.js +16 -2
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.d.ts +7 -0
- package/dist/frontend/lowering/lower-builtin-values.js +65 -16
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +222 -24
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +6 -0
- package/dist/frontend/lowering/lower-classes.js +154 -20
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-console.js +25 -2
- package/dist/frontend/lowering/lower-console.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +29 -0
- package/dist/frontend/lowering/lower-exprs.js +544 -24
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +93 -18
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.d.ts +4 -1
- package/dist/frontend/lowering/lower-global-value.js +10 -3
- package/dist/frontend/lowering/lower-global-value.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +44 -4
- package/dist/frontend/lowering/lower-inspect.js +723 -26
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +3 -1
- package/dist/frontend/lowering/lower-modules.js +189 -24
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +7 -0
- package/dist/frontend/lowering/lower-namespaces.js +23 -0
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-island.d.ts +74 -0
- package/dist/frontend/lowering/lower-node-island.js +1931 -0
- package/dist/frontend/lowering/lower-node-island.js.map +1 -0
- package/dist/frontend/lowering/lower-server.js +44 -0
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-shared-modules.d.ts +27 -0
- package/dist/frontend/lowering/lower-shared-modules.js +611 -0
- package/dist/frontend/lowering/lower-shared-modules.js.map +1 -0
- package/dist/frontend/lowering/lower-stdlib.js +85 -9
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +2 -6
- package/dist/frontend/lowering/lower-stmts.js +781 -143
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +548 -36
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +9 -0
- package/dist/frontend/lowering/lower-timers.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +514 -10
- package/dist/frontend/lowering/lowerer.js +2667 -163
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +44 -1
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/maybe-promise.d.ts +6 -0
- package/dist/frontend/lowering/maybe-promise.js +13 -0
- package/dist/frontend/lowering/maybe-promise.js.map +1 -1
- package/dist/frontend/lowering/module-namespace-elements.d.ts +12 -0
- package/dist/frontend/lowering/module-namespace-elements.js +114 -18
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/nan-coded-reads.d.ts +11 -0
- package/dist/frontend/lowering/nan-coded-reads.js +45 -2
- package/dist/frontend/lowering/nan-coded-reads.js.map +1 -1
- package/dist/frontend/lowering/narrowing-stability.d.ts +4 -0
- package/dist/frontend/lowering/narrowing-stability.js +14 -6
- package/dist/frontend/lowering/narrowing-stability.js.map +1 -1
- package/dist/frontend/lowering/receiver-returns.d.ts +3 -0
- package/dist/frontend/lowering/receiver-returns.js +134 -0
- package/dist/frontend/lowering/receiver-returns.js.map +1 -0
- package/dist/frontend/lowering/record-inherited.d.ts +26 -0
- package/dist/frontend/lowering/record-inherited.js +807 -0
- package/dist/frontend/lowering/record-inherited.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-elements.d.ts +31 -1
- package/dist/frontend/lowering/runtime-optional-elements.js +105 -13
- package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-guards.d.ts +3 -0
- package/dist/frontend/lowering/runtime-optional-guards.js +35 -7
- package/dist/frontend/lowering/runtime-optional-guards.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-guards.test.js +59 -1
- package/dist/frontend/lowering/runtime-optional-guards.test.js.map +1 -1
- package/dist/frontend/lowering/stable-names.d.ts +8 -0
- package/dist/frontend/lowering/stable-names.js +22 -0
- package/dist/frontend/lowering/stable-names.js.map +1 -1
- package/dist/frontend/lowering/stable-names.test.d.ts +1 -0
- package/dist/frontend/lowering/stable-names.test.js +16 -0
- package/dist/frontend/lowering/stable-names.test.js.map +1 -0
- package/dist/frontend/lowering/static-typeof.d.ts +5 -4
- package/dist/frontend/lowering/static-typeof.js +10 -4
- package/dist/frontend/lowering/static-typeof.js.map +1 -1
- package/dist/frontend/lowering/structural-instances.d.ts +22 -0
- package/dist/frontend/lowering/structural-instances.js +282 -0
- package/dist/frontend/lowering/structural-instances.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +3 -0
- package/dist/frontend/lowering/surfaces.js +108 -12
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/symbol-fields.d.ts +7 -0
- package/dist/frontend/lowering/symbol-fields.js +32 -0
- package/dist/frontend/lowering/symbol-fields.js.map +1 -1
- package/dist/frontend/lowering/type-failure.d.ts +17 -0
- package/dist/frontend/lowering/type-failure.js +163 -0
- package/dist/frontend/lowering/type-failure.js.map +1 -0
- package/dist/frontend/lowering/typed-arguments.d.ts +5 -6
- package/dist/frontend/lowering/typed-arguments.js +10 -2
- package/dist/frontend/lowering/typed-arguments.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.d.ts +9 -1
- package/dist/frontend/lowering/union-narrow.js +31 -2
- package/dist/frontend/lowering/union-narrow.js.map +1 -1
- package/dist/frontend/lowering/union-retag.test.js +42 -2
- package/dist/frontend/lowering/union-retag.test.js.map +1 -1
- package/dist/frontend/lowering/unit-journal.d.ts +194 -0
- package/dist/frontend/lowering/unit-journal.js +556 -0
- package/dist/frontend/lowering/unit-journal.js.map +1 -0
- package/dist/frontend/lowering/unit-journal.test.d.ts +1 -0
- package/dist/frontend/lowering/unit-journal.test.js +335 -0
- package/dist/frontend/lowering/unit-journal.test.js.map +1 -0
- package/dist/frontend/lowering/width-lift.d.ts +19 -0
- package/dist/frontend/node-api-import.d.ts +21 -0
- package/dist/frontend/node-api-import.js +88 -0
- package/dist/frontend/node-api-import.js.map +1 -0
- package/dist/frontend/npm-static-type-exports-host.js +4 -3
- package/dist/frontend/npm-static-type-exports-host.js.map +1 -1
- package/dist/frontend/npm-static.js +9 -2
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/package-shims.d.ts +6 -2
- package/dist/frontend/package-shims.js +13 -2
- package/dist/frontend/package-shims.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +11 -4
- package/dist/frontend/pipeline.js +249 -26
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/process-fork.d.ts +3 -0
- package/dist/frontend/process-fork.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +6 -0
- package/dist/frontend/program-analysis.js +4 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program.d.ts +12 -1
- package/dist/frontend/program.js +256 -36
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.js +8 -2
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/shape-inference/analyze.d.ts +23 -1
- package/dist/frontend/shape-inference/analyze.js +982 -97
- package/dist/frontend/shape-inference/analyze.js.map +1 -1
- package/dist/frontend/shape-inference/constant-graphs.d.ts +2 -0
- package/dist/frontend/shape-inference/constant-graphs.js +39 -4
- package/dist/frontend/shape-inference/constant-graphs.js.map +1 -1
- package/dist/frontend/shape-inference/domain.d.ts +2 -0
- package/dist/frontend/shape-inference/domain.js.map +1 -1
- package/dist/frontend/shape-inference/fallback.d.ts +17 -0
- package/dist/frontend/shape-inference/fallback.js +303 -0
- package/dist/frontend/shape-inference/fallback.js.map +1 -0
- package/dist/frontend/shape-inference/index.d.ts +75 -1
- package/dist/frontend/shape-inference/index.js +531 -2
- package/dist/frontend/shape-inference/index.js.map +1 -1
- package/dist/frontend/shape-inference/inferred-checks.d.ts +2 -0
- package/dist/frontend/shape-inference/inferred-checks.js +90 -0
- package/dist/frontend/shape-inference/inferred-checks.js.map +1 -0
- package/dist/frontend/shape-inference/memo.d.ts +30 -0
- package/dist/frontend/shape-inference/memo.js +99 -0
- package/dist/frontend/shape-inference/memo.js.map +1 -0
- package/dist/frontend/shape-inference/overlay.d.ts +81 -0
- package/dist/frontend/shape-inference/overlay.js +1160 -0
- package/dist/frontend/shape-inference/overlay.js.map +1 -0
- package/dist/frontend/shape-inference/registry.test.d.ts +1 -0
- package/dist/frontend/shape-inference/registry.test.js +34 -0
- package/dist/frontend/shape-inference/registry.test.js.map +1 -0
- package/dist/frontend/shape-inference/report.js +42 -8
- package/dist/frontend/shape-inference/report.js.map +1 -1
- package/dist/frontend/shape-inference/static-objects.d.ts +29 -0
- package/dist/frontend/shape-inference/static-objects.js +1951 -0
- package/dist/frontend/shape-inference/static-objects.js.map +1 -0
- package/dist/frontend/tier-analysis.d.ts +53 -1
- package/dist/frontend/tier-analysis.js +133 -0
- package/dist/frontend/tier-analysis.js.map +1 -1
- package/dist/frontend/ts7/api.js +4 -2
- package/dist/frontend/ts7/api.js.map +1 -1
- package/dist/frontend/ts7/ast-node.d.ts +9 -0
- package/dist/frontend/ts7/ast-node.js +42 -10
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +23 -0
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-wire-protocols.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-wire-protocols.test.js +93 -0
- package/dist/frontend/ts7/ast-wire-protocols.test.js.map +1 -0
- package/dist/frontend/ts7/ast-wire.d.ts +18 -0
- package/dist/frontend/ts7/ast-wire.js +66 -4
- package/dist/frontend/ts7/ast-wire.js.map +1 -1
- package/dist/frontend/ts7/checker-server.d.ts +12 -11
- package/dist/frontend/ts7/checker-server.js +28 -12
- package/dist/frontend/ts7/checker-server.js.map +1 -1
- package/dist/frontend/ts7/checker-server.test.js +8 -3
- package/dist/frontend/ts7/checker-server.test.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +4 -0
- package/dist/frontend/ts7/checker.js +9 -0
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.js +216 -205
- package/dist/frontend/ts7/checker.test.js.map +1 -1
- package/dist/frontend/ts7/lib-diagnostics.d.ts +71 -4
- package/dist/frontend/ts7/lib-diagnostics.js +337 -20
- package/dist/frontend/ts7/lib-diagnostics.js.map +1 -1
- package/dist/frontend/ts7/lib-diagnostics.test.js +268 -5
- package/dist/frontend/ts7/lib-diagnostics.test.js.map +1 -1
- package/dist/frontend/ts7/native-api.d.ts +4 -0
- package/dist/frontend/ts7/native-api.js +36 -1
- package/dist/frontend/ts7/native-api.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +19 -2
- package/dist/frontend/ts7/program-host.js +69 -9
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/program-host.test.js +42 -1
- package/dist/frontend/ts7/program-host.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-filesystem.d.ts +4 -2
- package/dist/frontend/ts7/rpc-filesystem.js +23 -2
- package/dist/frontend/ts7/rpc-filesystem.js.map +1 -1
- package/dist/frontend/ts7/rpc-filesystem.test.js +28 -2
- package/dist/frontend/ts7/rpc-filesystem.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.js +73 -5
- package/dist/frontend/ts7/semantic-checker.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.test.js +106 -74
- package/dist/frontend/ts7/semantic-checker.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.d.ts +2 -6
- package/dist/frontend/ts7/semantic-model-71.test.d.ts +1 -0
- package/dist/frontend/ts7/semantic-model-71.test.js +131 -0
- package/dist/frontend/ts7/semantic-model-71.test.js.map +1 -0
- package/dist/frontend/ts7/semantic-model.d.ts +121 -3
- package/dist/frontend/ts7/semantic-model.js +245 -8
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/session.d.ts +19 -1
- package/dist/frontend/ts7/session.js +111 -11
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/ts7/session.test.js +259 -239
- package/dist/frontend/ts7/session.test.js.map +1 -1
- package/dist/frontend/ts7/test-servers.d.ts +12 -0
- package/dist/frontend/ts7/test-servers.js +16 -0
- package/dist/frontend/ts7/test-servers.js.map +1 -0
- package/dist/frontend/tsc-codes.js +6 -3
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +61 -1
- package/dist/frontend/type-mapper.js +577 -28
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-patches/command.d.ts +19 -0
- package/dist/frontend/type-patches/command.js +352 -0
- package/dist/frontend/type-patches/command.js.map +1 -0
- package/dist/frontend/type-patches/layer.d.ts +45 -0
- package/dist/frontend/type-patches/layer.js +409 -0
- package/dist/frontend/type-patches/layer.js.map +1 -0
- package/dist/frontend/type-patches/locate.d.ts +41 -0
- package/dist/frontend/type-patches/locate.js +914 -0
- package/dist/frontend/type-patches/locate.js.map +1 -0
- package/dist/frontend/type-patches/locate.test.d.ts +1 -0
- package/dist/frontend/type-patches/locate.test.js +179 -0
- package/dist/frontend/type-patches/locate.test.js.map +1 -0
- package/dist/frontend/type-patches/selector.d.ts +43 -0
- package/dist/frontend/type-patches/selector.js +126 -0
- package/dist/frontend/type-patches/selector.js.map +1 -0
- package/dist/frontend/type-patches/selector.test.d.ts +1 -0
- package/dist/frontend/type-patches/selector.test.js +56 -0
- package/dist/frontend/type-patches/selector.test.js.map +1 -0
- package/dist/frontend/type-patches/semver.d.ts +19 -0
- package/dist/frontend/type-patches/semver.js +221 -0
- package/dist/frontend/type-patches/semver.js.map +1 -0
- package/dist/frontend/type-patches/semver.test.d.ts +1 -0
- package/dist/frontend/type-patches/semver.test.js +47 -0
- package/dist/frontend/type-patches/semver.test.js.map +1 -0
- package/dist/frontend/worker-target.test.js +2 -2
- package/dist/frontend/worker-target.test.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +292 -27
- package/dist/index.js.map +1 -1
- package/dist/ir/builtin-effects.js +51 -5
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +4 -3
- package/dist/ir/builtin-signatures.js +277 -12
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/callback-specialization.js +108 -67
- package/dist/ir/callback-specialization.js.map +1 -1
- package/dist/ir/capture-values.d.ts +7 -1
- package/dist/ir/capture-values.js +28 -5
- package/dist/ir/capture-values.js.map +1 -1
- package/dist/ir/char-unit-locals.js +38 -42
- package/dist/ir/char-unit-locals.js.map +1 -1
- package/dist/ir/expression-inlining.js +12 -6
- package/dist/ir/expression-inlining.js.map +1 -1
- package/dist/ir/fields.generated.d.ts +751 -0
- package/dist/ir/fields.generated.js +2071 -0
- package/dist/ir/fields.generated.js.map +1 -0
- package/dist/ir/fields.test.d.ts +1 -0
- package/dist/ir/fields.test.js +113 -0
- package/dist/ir/fields.test.js.map +1 -0
- package/dist/ir/function-references.js +4 -0
- package/dist/ir/function-references.js.map +1 -1
- package/dist/ir/function-references.test.js +25 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/inline-array-sources.d.ts +15 -0
- package/dist/ir/inline-array-sources.js +1825 -0
- package/dist/ir/inline-array-sources.js.map +1 -0
- package/dist/ir/inline-arrays.d.ts +41 -0
- package/dist/ir/inline-arrays.js +533 -0
- package/dist/ir/inline-arrays.js.map +1 -0
- package/dist/ir/inline-arrays.test.d.ts +1 -0
- package/dist/ir/inline-arrays.test.js +225 -0
- package/dist/ir/inline-arrays.test.js.map +1 -0
- package/dist/ir/int32-slots.d.ts +6 -0
- package/dist/ir/int32-slots.js +154 -16
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +48 -0
- package/dist/ir/int32-slots.test.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +12 -0
- package/dist/ir/integer-loops.js +23 -0
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +7 -1
- package/dist/ir/integer-ranges.js +29 -2
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/intrinsic-signatures.js +2 -1
- package/dist/ir/intrinsic-signatures.js.map +1 -1
- package/dist/ir/ir.d.ts +103 -5
- package/dist/ir/ir.js +38 -4
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +134 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/jsval.js +211 -29
- package/dist/ir/jsval.js.map +1 -1
- package/dist/ir/jsval.test.js +120 -0
- package/dist/ir/jsval.test.js.map +1 -1
- package/dist/ir/loop-entry-ranges.d.ts +38 -0
- package/dist/ir/loop-entry-ranges.js +259 -0
- package/dist/ir/loop-entry-ranges.js.map +1 -0
- package/dist/ir/loop-entry-ranges.test.d.ts +1 -0
- package/dist/ir/loop-entry-ranges.test.js +191 -0
- package/dist/ir/loop-entry-ranges.test.js.map +1 -0
- package/dist/ir/node-index.d.ts +3 -0
- package/dist/ir/node-index.js +6 -0
- package/dist/ir/node-index.js.map +1 -1
- package/dist/ir/numeric-call-specialization.d.ts +9 -6
- package/dist/ir/numeric-call-specialization.js +164 -34
- package/dist/ir/numeric-call-specialization.js.map +1 -1
- package/dist/ir/paired-while-loops.js +23 -19
- package/dist/ir/paired-while-loops.js.map +1 -1
- package/dist/ir/parameter-versions.js +6 -3
- package/dist/ir/parameter-versions.js.map +1 -1
- package/dist/ir/receiver-readers.d.ts +10 -0
- package/dist/ir/receiver-readers.js +65 -28
- package/dist/ir/receiver-readers.js.map +1 -1
- package/dist/ir/row-pairs.d.ts +9 -1
- package/dist/ir/row-pairs.js +136 -43
- package/dist/ir/row-pairs.js.map +1 -1
- package/dist/ir/row-pairs.test.js +25 -5
- package/dist/ir/row-pairs.test.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +33 -1
- package/dist/ir/runtime-features.js +104 -6
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/runtime-features.test.js +13 -0
- package/dist/ir/runtime-features.test.js.map +1 -1
- package/dist/ir/saturating-loop-jams.d.ts +24 -0
- package/dist/ir/saturating-loop-jams.js +420 -0
- package/dist/ir/saturating-loop-jams.js.map +1 -0
- package/dist/ir/saturating-loop-jams.test.d.ts +1 -0
- package/dist/ir/saturating-loop-jams.test.js +196 -0
- package/dist/ir/saturating-loop-jams.test.js.map +1 -0
- package/dist/ir/scalar-records.js +9 -3
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/self-captures.js +2 -1
- package/dist/ir/self-captures.js.map +1 -1
- package/dist/ir/serialize.d.ts +5 -1
- package/dist/ir/serialize.js +7 -1
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/traverse.js +3 -0
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +91 -9
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/ir-policy.js +1 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/native/cache.js +2 -0
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cli.js +54 -7
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.d.ts +3 -0
- package/dist/native/compiler.js +173 -36
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/compiler.test.js +86 -3
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/executable-cache.d.ts +20 -2
- package/dist/native/executable-cache.js +17 -10
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/executable-cache.test.js +38 -1
- package/dist/native/executable-cache.test.js.map +1 -1
- package/dist/native/linker-job.d.ts +71 -0
- package/dist/native/linker-job.js +242 -0
- package/dist/native/linker-job.js.map +1 -0
- package/dist/native/linker-job.test.d.ts +1 -0
- package/dist/native/linker-job.test.js +349 -0
- package/dist/native/linker-job.test.js.map +1 -0
- package/dist/native/prepare.js +15 -2
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.js +10 -15
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +152 -66
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/toolchain.d.ts +11 -2
- package/dist/native/toolchain.js +43 -17
- package/dist/native/toolchain.js.map +1 -1
- package/dist/native/toolchain.test.js +75 -0
- package/dist/native/toolchain.test.js.map +1 -1
- package/dist/node-islands/boundary.d.ts +37 -0
- package/dist/node-islands/boundary.js +135 -0
- package/dist/node-islands/boundary.js.map +1 -0
- package/dist/node-islands/classify.js +1 -1
- package/dist/node-islands/classify.js.map +1 -1
- package/dist/node-islands/effect-gate.d.ts +11 -0
- package/dist/node-islands/effect-gate.js +746 -0
- package/dist/node-islands/effect-gate.js.map +1 -0
- package/dist/node-islands/effect-gate.test.d.ts +1 -0
- package/dist/node-islands/effect-gate.test.js +152 -0
- package/dist/node-islands/effect-gate.test.js.map +1 -0
- package/dist/node-islands/libnode-pack.d.ts +68 -0
- package/dist/node-islands/libnode-pack.js +199 -0
- package/dist/node-islands/libnode-pack.js.map +1 -0
- package/dist/node-islands/libnode-pack.test.d.ts +1 -0
- package/dist/node-islands/libnode-pack.test.js +258 -0
- package/dist/node-islands/libnode-pack.test.js.map +1 -0
- package/dist/node-islands/libnode.d.ts +32 -0
- package/dist/node-islands/libnode.js +212 -0
- package/dist/node-islands/libnode.js.map +1 -0
- package/dist/node-islands/libnode.test.d.ts +1 -0
- package/dist/node-islands/libnode.test.js +170 -0
- package/dist/node-islands/libnode.test.js.map +1 -0
- package/dist/node-islands/modules.d.ts +96 -0
- package/dist/node-islands/modules.js +803 -0
- package/dist/node-islands/modules.js.map +1 -0
- package/dist/node-islands/modules.test.d.ts +1 -0
- package/dist/node-islands/modules.test.js +276 -0
- package/dist/node-islands/modules.test.js.map +1 -0
- package/dist/node-islands/resolve.d.ts +8 -0
- package/dist/node-islands/resolve.js +10 -0
- package/dist/node-islands/resolve.js.map +1 -0
- package/dist/node-islands/snapshot.d.ts +16 -0
- package/dist/node-islands/snapshot.js +486 -0
- package/dist/node-islands/snapshot.js.map +1 -0
- package/dist/node-islands/snapshot.test.d.ts +1 -0
- package/dist/node-islands/snapshot.test.js +56 -0
- package/dist/node-islands/snapshot.test.js.map +1 -0
- package/dist/project-config.d.ts +37 -1
- package/dist/project-config.js +159 -7
- package/dist/project-config.js.map +1 -1
- package/dist/project-config.test.js +153 -0
- package/dist/project-config.test.js.map +1 -1
- package/dist/startup-cache.d.ts +1 -0
- package/dist/startup-cache.js +1 -0
- package/dist/startup-cache.js.map +1 -1
- package/package.json +24 -21
- package/surface-manifest.json +47 -7
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { keepsInitializerLayout, notePreservedLayout } from "./structural-instances.js";
|
|
2
|
+
import { jsGlobalValueByName } from "./global-values.js";
|
|
1
3
|
import { lowerTupleAliasDecl, stripTypeWrappers } from "./typed-arguments.js";
|
|
4
|
+
import { islandHandleBinding, lowerIslandExpr, lowerIslandSubclass } from "./lower-node-island.js";
|
|
5
|
+
import { isIslandSubclassDecl } from "../../node-islands/boundary.js";
|
|
2
6
|
import { allBytesArms, indexedUnionArms, lowerIndexedUnionMember, lowerIndexedUnionNumberRead, lowerIndexedUnionRead, } from "./indexed-unions.js";
|
|
3
|
-
import { declaredMemberOf, isPromisePrototypeRead } from "./expressions/property-access.js";
|
|
4
|
-
import { hostsAll } from "./expressions/hosted-narrowing.js";
|
|
7
|
+
import { declaredMemberOf, isPromisePrototypeRead, lowerUnionKeyedRead, } from "./expressions/property-access.js";
|
|
8
|
+
import { hostedStorageView, hostsAll } from "./expressions/hosted-narrowing.js";
|
|
5
9
|
import { requestGeneralStreamSurface } from "./general-streams.js";
|
|
6
10
|
import { lowerForAwaitDynStream, nodeStreamInterfaceSide } from "./dyn-streams.js";
|
|
7
11
|
import { lowerForAwaitValueStream } from "./builtins/hash-stream.js";
|
|
@@ -14,6 +18,7 @@ import { lowerCollectionSpread } from "./containers/collection-methods.js";
|
|
|
14
18
|
import { lowerEventObjectPropertyWrite } from "./lower-event-target.js";
|
|
15
19
|
import { lowerDynObjectLiteral } from "./expressions/object-literals.js";
|
|
16
20
|
import { importMetaBindingSource } from "./import-meta.js";
|
|
21
|
+
import { anyResidueReplacedBy } from "./any-collection-residue.js";
|
|
17
22
|
import { iteratorCanStep, iteratorValue } from "./iterator-consumption.js";
|
|
18
23
|
import { notIterableSpelling } from "./iterable-spelling.js";
|
|
19
24
|
import { isPrivateSplitConsumer } from "./split-consumers.js";
|
|
@@ -22,15 +27,16 @@ import { InternalCompilerError } from "../../errors.js";
|
|
|
22
27
|
* declarations including destructuring patterns, scoped blocks, control
|
|
23
28
|
* flow (if/while/for/for-of/do, switch, try/catch, abrupt completions),
|
|
24
29
|
* explicit resource management, and blocked-binding poisoning. */
|
|
30
|
+
import { isWebStreamValueInJavaScript, typeInvolvesWebStream } from "./builtins/web-streams-dyn.js";
|
|
25
31
|
import * as ts from "../ts7/adapter.js";
|
|
26
32
|
import { lowerOptionalIndex } from "./undefined-index.js";
|
|
27
|
-
import { builtinNamespaceValue } from "./builtin-namespaces.js";
|
|
28
33
|
import { processDataMemberValue, programReadsExitCode } from "./builtins/process.js";
|
|
29
34
|
import { requireInitFlagStmt } from "./require-initialization.js";
|
|
30
35
|
import { isJsonRequireDecl } from "./json-require.js";
|
|
31
36
|
import { isTimeValueDateDeclaration } from "./date-values.js";
|
|
32
37
|
import { bindingSource } from "../binding-source.js";
|
|
33
38
|
import { lowerConstructorReturn } from "./constructor-returns.js";
|
|
39
|
+
import { statementGroupKey } from "./type-failure.js";
|
|
34
40
|
import { cjsExportValueByName, cjsNamespaceDestructureOf, cjsTableMethodEntry, inlineProgramRequireOf, requireNestedPatternsOf, splitRequireAssignmentOf, splitRequireBindingOf, splitRequireBindingOfIdent, splitRequireEarlyReadOf, wholeExportSymbolOfModule, } from "./cjs-inline-require.js";
|
|
35
41
|
import { cjsExportMemberWriteGlobalOf, isCjsExportsIdentifier, isCjsModuleExports, isFreshExportsReset, } from "./cjs-exports-object.js";
|
|
36
42
|
import { isDeadTscHelperDecl, tscInteropBindingOfDecl } from "./cjs-tsc-interop.js";
|
|
@@ -79,11 +85,11 @@ import { abstractPropertyDeclOf, aliasTypeofNarrows, isMatchSliceType, lowerAbse
|
|
|
79
85
|
import { globalSymbolKey } from "./expressions/global-symbols.js";
|
|
80
86
|
import { identifiersNamed } from "./identifier-uses.js";
|
|
81
87
|
import { lowerShortCircuitAssignment } from "./expressions/nullish-assignment.js";
|
|
82
|
-
import {
|
|
88
|
+
import { dereferencedElementWrite, jsHoldsDynObject, lowerEnvironmentKey, lowerNativeFunctionAssignment, lowerStrictEquality, nodeTypeError, } from "./lower-exprs.js";
|
|
83
89
|
import { keptIdentityAssertion } from "./assertion-identity.js";
|
|
84
90
|
import { isNativeProxyInitializer } from "./expressions/native-proxy.js";
|
|
85
91
|
import { tryLowerExpression } from "./expressions/try-lower-expression.js";
|
|
86
|
-
import { lowerUnionFieldWrite } from "./expressions/union-fields.js";
|
|
92
|
+
import { lowerUnionFieldDelete, lowerUnionFieldWrite } from "./expressions/union-fields.js";
|
|
87
93
|
import { UNSUPPORTED, checkerPanicDiag, isCheckerPanic, unsupportedNativeExecutionDiag, } from "../../diagnostics/diagnostic.js";
|
|
88
94
|
import { isParseArgsDynTypeName, isUnitOnlyTsType, jsOpenObjectType, unitOnlyUnion, } from "../type-mapper.js";
|
|
89
95
|
import { canonicalBuiltinModule } from "../builtin-modules.js";
|
|
@@ -214,9 +220,7 @@ function stdlibTypeNamed(lowerer, node, name) {
|
|
|
214
220
|
function cleanupCall(lowerer, node, value, awaited) {
|
|
215
221
|
const loc = locOf(node);
|
|
216
222
|
if (value.type.kind === "object") {
|
|
217
|
-
const info = lowerer.classes.get(value.type.className);
|
|
218
|
-
if (!info)
|
|
219
|
-
lowerer.flushDeferredClass(value.type.className);
|
|
223
|
+
const info = lowerer.classes.get(value.type.className) ?? lowerer.flushDeferredClass(value.type.className);
|
|
220
224
|
const asyncFound = awaited && info ? lowerer.findMethodOn(info, "sym:asyncDispose") : null;
|
|
221
225
|
const syncFound = info ? lowerer.findMethodOn(info, "sym:dispose") : null;
|
|
222
226
|
const member = asyncFound ? "sym:asyncDispose" : syncFound ? "sym:dispose" : null;
|
|
@@ -529,59 +533,59 @@ export function lowerStmts(lowerer, stmts) {
|
|
|
529
533
|
lowerer.countStatement(stmt, sf?.fileName);
|
|
530
534
|
const diagsBefore = lowerer.diags.length;
|
|
531
535
|
const sinkMark = lowerer.diagSinkMark();
|
|
536
|
+
const touched = new Set();
|
|
537
|
+
lowerer.failureTouches.push(touched);
|
|
538
|
+
const pendingSlots = [];
|
|
539
|
+
// A declarator that initializes a forward-captured TDZ box takes it
|
|
540
|
+
// out of tdzPredeclared; a retry after a later declarator degrades
|
|
541
|
+
// must initialize the same box again.
|
|
542
|
+
const tdzBefore = new Map(lowerer.ctx.tdzPredeclared);
|
|
543
|
+
// The first attempt's diagnostics: a statement that still fails
|
|
544
|
+
// after degrading reports them, since a retry does not repeat what
|
|
545
|
+
// lowered once (a poisoned generic instance) and its own diagnostics
|
|
546
|
+
// can miss the failure's cause.
|
|
547
|
+
let firstAttempt = null;
|
|
532
548
|
try {
|
|
533
|
-
let
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
+
for (let attempt = 0;; attempt++) {
|
|
550
|
+
const hits = new Set();
|
|
551
|
+
try {
|
|
552
|
+
lowerer.withPartialHits(hits, () => lowerOneStatement(lowerer, stmt, out, usingMarkers, diagsBefore, deferFences));
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
catch (e) {
|
|
556
|
+
// Localized failure's statement commit point (design §3.3): a
|
|
557
|
+
// degradable type failure at a local, loop variable or module
|
|
558
|
+
// global degrades that type and the statement lowers again.
|
|
559
|
+
// A declaration this statement flushed inside a probe (where
|
|
560
|
+
// no retry runs) can retry here too.
|
|
561
|
+
firstAttempt ??= lowerer.diags.slice(diagsBefore);
|
|
562
|
+
const giveUp = () => {
|
|
563
|
+
if (attempt > 0)
|
|
564
|
+
lowerer.restoreFirstAttemptDiags(diagsBefore, firstAttempt);
|
|
565
|
+
return e;
|
|
566
|
+
};
|
|
567
|
+
if (attempt >= MAX_DEGRADE_RETRIES || deferFences)
|
|
568
|
+
throw giveUp();
|
|
569
|
+
const slot = lowerer.degradeAtCommit(e, STATEMENT_SLOTS);
|
|
570
|
+
// Pushed-down types the failed attempt mapped widen to the
|
|
571
|
+
// whole slot before anything else is given up.
|
|
572
|
+
if (slot === null &&
|
|
573
|
+
!lowerer.reopenFlushedAtCommit(diagsBefore) &&
|
|
574
|
+
!lowerer.widenPartials(hits))
|
|
575
|
+
throw giveUp();
|
|
576
|
+
// A failed attempt adds nothing to `out` but the TDZ boxes
|
|
577
|
+
// forward captures declared (they stay declared), so the
|
|
578
|
+
// retry appends after them.
|
|
579
|
+
lowerer.dropAttemptDiags(diagsBefore);
|
|
580
|
+
if (slot !== null)
|
|
581
|
+
pendingSlots.push(slot);
|
|
582
|
+
for (const [symbol, local] of tdzBefore)
|
|
583
|
+
if (!lowerer.ctx.tdzPredeclared.has(symbol))
|
|
584
|
+
lowerer.ctx.tdzPredeclared.set(symbol, local);
|
|
549
585
|
}
|
|
550
|
-
lowered = accounting;
|
|
551
|
-
appended = true;
|
|
552
|
-
}
|
|
553
|
-
else {
|
|
554
|
-
lowered = lowerer.lowerStmt(stmt);
|
|
555
|
-
}
|
|
556
|
-
// The lib-boundary chokepoint (lib-boundary.ts): checked-dynamic
|
|
557
|
-
// arguments that reached builtin-call slots without the checked
|
|
558
|
-
// coercion get their dynCheck here, and the uncoercible ones
|
|
559
|
-
// fence — inside this statement's poison window, so a JS fence
|
|
560
|
-
// becomes the statement's runtimeFence exactly like every other
|
|
561
|
-
// deferred rejection.
|
|
562
|
-
if (lowered) {
|
|
563
|
-
const body = [];
|
|
564
|
-
if (Array.isArray(lowered))
|
|
565
|
-
body.push(...lowered);
|
|
566
|
-
else
|
|
567
|
-
body.push(lowered);
|
|
568
|
-
const rewritten = lowerSurplusCalls(lowerer, body);
|
|
569
|
-
enforceLibBoundary(lowerer, rewritten);
|
|
570
|
-
if (!appended)
|
|
571
|
-
out.push(...rewritten);
|
|
572
|
-
}
|
|
573
|
-
// A JS statement that lowered CLEAN can still have flushed
|
|
574
|
-
// DEFERRED collection diagnostics (a symbol lookup on an alias
|
|
575
|
-
// resolves through flushDeferred — informational here, not a
|
|
576
|
-
// blocker of THIS statement): those belong to the runtime-fence
|
|
577
|
-
// ledger, not the build — real uses of the broken declaration
|
|
578
|
-
// meet their own per-site fences.
|
|
579
|
-
if (deferFences && lowerer.diagSink === null && lowerer.diags.length > diagsBefore) {
|
|
580
|
-
const flushed = lowerer.diags.splice(diagsBefore);
|
|
581
|
-
const ice = flushed.filter((d) => d.code === "SC9001");
|
|
582
|
-
lowerer.diags.push(...ice);
|
|
583
|
-
lowerer.runtimeFences.push(...flushed.filter((d) => d.code !== "SC9001"));
|
|
584
586
|
}
|
|
587
|
+
for (const slot of pendingSlots)
|
|
588
|
+
lowerer.noteDynamicSlot(slot);
|
|
585
589
|
}
|
|
586
590
|
catch (e) {
|
|
587
591
|
// A Go panic inside tsgo, surfaced by the sync channel as a
|
|
@@ -597,7 +601,17 @@ export function lowerStmts(lowerer, stmts) {
|
|
|
597
601
|
}
|
|
598
602
|
if (!lowerer.suppressStats)
|
|
599
603
|
lowerer.countStatementFailed(stmt, sf?.fileName);
|
|
600
|
-
|
|
604
|
+
// Localized failure (report-only): the statement's committed
|
|
605
|
+
// diagnostics that are not themselves type failures or rejected
|
|
606
|
+
// declarations are cascades of the rejected declarations it used.
|
|
607
|
+
const committed = lowerer.diagSink === null && !deferFences ? lowerer.diags.slice(diagsBefore) : [];
|
|
608
|
+
if (touched.size > 0) {
|
|
609
|
+
const cause = [...touched];
|
|
610
|
+
for (const d of committed)
|
|
611
|
+
if (d.typeFailure === undefined && d.rejects === undefined)
|
|
612
|
+
d.cause ??= cause;
|
|
613
|
+
}
|
|
614
|
+
lowerer.noteBlockedBindings(stmt, committed);
|
|
601
615
|
// The runtime-fence conversion (JS sources, direct diagnostics
|
|
602
616
|
// only — a capture wrapper in force means collection owns the
|
|
603
617
|
// report). The statement's diagnostics move OFF the build and
|
|
@@ -625,6 +639,9 @@ export function lowerStmts(lowerer, stmts) {
|
|
|
625
639
|
out.push(fence);
|
|
626
640
|
}
|
|
627
641
|
}
|
|
642
|
+
finally {
|
|
643
|
+
lowerer.failureTouches.pop();
|
|
644
|
+
}
|
|
628
645
|
}
|
|
629
646
|
// Each acquisition protects the remainder of its lexical statement
|
|
630
647
|
// list. Folding from the last registration outward produces the
|
|
@@ -649,6 +666,78 @@ export function lowerStmts(lowerer, stmts) {
|
|
|
649
666
|
}
|
|
650
667
|
return out;
|
|
651
668
|
}
|
|
669
|
+
/** Localized failure: retries a degradable statement-level type failure
|
|
670
|
+
* at most this many times (each retry degrades one more type). */
|
|
671
|
+
const MAX_DEGRADE_RETRIES = 16;
|
|
672
|
+
/** The slot kinds lowerStmts' commit point degrades: locals, loop
|
|
673
|
+
* variables and module globals (stage L1), and the parameters and returns
|
|
674
|
+
* of the function expressions, arrows and methods a statement holds
|
|
675
|
+
* (stage L2), and the types of the statement's own expressions: casts,
|
|
676
|
+
* literals with a contextual type, spread clones, temporaries (stage L4). */
|
|
677
|
+
const STATEMENT_SLOTS = new Set([
|
|
678
|
+
"local",
|
|
679
|
+
"global",
|
|
680
|
+
"loop",
|
|
681
|
+
"param",
|
|
682
|
+
"return",
|
|
683
|
+
"field",
|
|
684
|
+
"member",
|
|
685
|
+
"expression",
|
|
686
|
+
]);
|
|
687
|
+
/** One attempt at lowering a statement of lowerStmts into `out`. */
|
|
688
|
+
function lowerOneStatement(lowerer, stmt, out, usingMarkers, diagsBefore, deferFences) {
|
|
689
|
+
let lowered;
|
|
690
|
+
let appended = false;
|
|
691
|
+
if (ts.isVariableStatement(stmt) && (stmt.declarationList.flags & ts.NodeFlags.Using) !== 0) {
|
|
692
|
+
const registrations = lowerUsingStatement(lowerer, stmt);
|
|
693
|
+
const accounting = [];
|
|
694
|
+
for (const registration of registrations) {
|
|
695
|
+
out.push(...registration.acquire);
|
|
696
|
+
accounting.push(...registration.acquire, ...registration.cleanup);
|
|
697
|
+
if (registration.cleanup.length > 0) {
|
|
698
|
+
usingMarkers.push({
|
|
699
|
+
start: out.length,
|
|
700
|
+
cleanup: registration.cleanup,
|
|
701
|
+
loc: registration.loc,
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
lowered = accounting;
|
|
706
|
+
appended = true;
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
lowered = lowerer.lowerStmt(stmt);
|
|
710
|
+
}
|
|
711
|
+
// The lib-boundary chokepoint (lib-boundary.ts): checked-dynamic
|
|
712
|
+
// arguments that reached builtin-call slots without the checked
|
|
713
|
+
// coercion get their dynCheck here, and the uncoercible ones
|
|
714
|
+
// fence — inside this statement's poison window, so a JS fence
|
|
715
|
+
// becomes the statement's runtimeFence exactly like every other
|
|
716
|
+
// deferred rejection.
|
|
717
|
+
if (lowered) {
|
|
718
|
+
const body = [];
|
|
719
|
+
if (Array.isArray(lowered))
|
|
720
|
+
body.push(...lowered);
|
|
721
|
+
else
|
|
722
|
+
body.push(lowered);
|
|
723
|
+
const rewritten = lowerSurplusCalls(lowerer, body);
|
|
724
|
+
enforceLibBoundary(lowerer, rewritten);
|
|
725
|
+
if (!appended)
|
|
726
|
+
out.push(...rewritten);
|
|
727
|
+
}
|
|
728
|
+
// A JS statement that lowered CLEAN can still have flushed
|
|
729
|
+
// DEFERRED collection diagnostics (a symbol lookup on an alias
|
|
730
|
+
// resolves through flushDeferred — informational here, not a
|
|
731
|
+
// blocker of THIS statement): those belong to the runtime-fence
|
|
732
|
+
// ledger, not the build — real uses of the broken declaration
|
|
733
|
+
// meet their own per-site fences.
|
|
734
|
+
if (deferFences && lowerer.diagSink === null && lowerer.diags.length > diagsBefore) {
|
|
735
|
+
const flushed = lowerer.diags.splice(diagsBefore);
|
|
736
|
+
const ice = flushed.filter((d) => d.code === "SC9001");
|
|
737
|
+
lowerer.diags.push(...ice);
|
|
738
|
+
lowerer.runtimeFences.push(...flushed.filter((d) => d.code !== "SC9001"));
|
|
739
|
+
}
|
|
740
|
+
}
|
|
652
741
|
/** Whether a statement list belongs to a function body (at any block
|
|
653
742
|
* depth) rather than to a module's top level. */
|
|
654
743
|
function enclosedByFunction(stmt) {
|
|
@@ -1061,6 +1150,7 @@ function jsDeclarationExpandsObject(lowerer, decl, inferred) {
|
|
|
1061
1150
|
inferred !== null &&
|
|
1062
1151
|
jsOpenObjectType(decl, inferred, lowerer.shapes, lowerer.unions).kind === "dyn") ||
|
|
1063
1152
|
arms.some((arm) => arm.kind === "record" && jsObjectBindingExpands(lowerer, decl, arm)) ||
|
|
1153
|
+
arms.some((arm) => arm.kind === "record" && jsObjectLiteralFilledLater(lowerer, decl, arm)) ||
|
|
1064
1154
|
(isJsSourceFile(ts.getSourceFileOfNode(decl)) &&
|
|
1065
1155
|
!decl.type &&
|
|
1066
1156
|
!hasJsTypeAnnotation(decl) &&
|
|
@@ -1271,7 +1361,7 @@ function noteEarlyReadVar(lowerer, symbol, local) {
|
|
|
1271
1361
|
* lowerVarDecl's salvage path declares the local when it can, and
|
|
1272
1362
|
* resolution checks locals/globals before the fallthroughs consult
|
|
1273
1363
|
* blockedBindings. */
|
|
1274
|
-
export function noteBlockedBindings(lowerer, stmt) {
|
|
1364
|
+
export function noteBlockedBindings(lowerer, stmt, diags = []) {
|
|
1275
1365
|
let list = null;
|
|
1276
1366
|
if (ts.isVariableStatement(stmt))
|
|
1277
1367
|
list = stmt.declarationList;
|
|
@@ -1282,13 +1372,24 @@ export function noteBlockedBindings(lowerer, stmt) {
|
|
|
1282
1372
|
}
|
|
1283
1373
|
if (!list)
|
|
1284
1374
|
return;
|
|
1375
|
+
// Localized failure (report-only): the bindings form one failure group,
|
|
1376
|
+
// the statement, whose diagnostics are the group's.
|
|
1377
|
+
const group = statementGroupKey(stmt);
|
|
1378
|
+
let bound = false;
|
|
1285
1379
|
for (const decl of list.declarations.nodes) {
|
|
1286
1380
|
for (const nameNode of boundIdentifiersOf(decl.name)) {
|
|
1287
1381
|
const symbol = lowerer.checker.getSymbolAtLocation(nameNode);
|
|
1288
|
-
if (symbol)
|
|
1289
|
-
|
|
1382
|
+
if (!symbol)
|
|
1383
|
+
continue;
|
|
1384
|
+
lowerer.blockedBindings.add(symbol);
|
|
1385
|
+
if (!lowerer.rejectedGroups.has(symbol))
|
|
1386
|
+
lowerer.rejectedGroups.set(symbol, group);
|
|
1387
|
+
bound = true;
|
|
1290
1388
|
}
|
|
1291
1389
|
}
|
|
1390
|
+
if (bound)
|
|
1391
|
+
for (const d of diags)
|
|
1392
|
+
d.rejects ??= group;
|
|
1292
1393
|
}
|
|
1293
1394
|
/** True when a reference/assignment fell through resolution because the
|
|
1294
1395
|
* binding's DECLARATION never compiled: a poisoned declaration statement
|
|
@@ -1298,10 +1399,13 @@ export function noteBlockedBindings(lowerer, stmt) {
|
|
|
1298
1399
|
export function isBlockedBinding(lowerer, symbol) {
|
|
1299
1400
|
if (!symbol)
|
|
1300
1401
|
return false;
|
|
1301
|
-
|
|
1402
|
+
const blocked = lowerer.blockedBindings.has(symbol) ||
|
|
1302
1403
|
lowerer.deferredDiags.has(symbol) ||
|
|
1303
1404
|
lowerer.flushedSymbols.has(symbol) ||
|
|
1304
|
-
lowerer.alreadyFlushed.has(symbol)
|
|
1405
|
+
lowerer.alreadyFlushed.has(symbol);
|
|
1406
|
+
if (blocked)
|
|
1407
|
+
lowerer.touchRejected(symbol);
|
|
1408
|
+
return blocked;
|
|
1305
1409
|
}
|
|
1306
1410
|
/** Lowers a statement in a fresh lexical scope (if/while/for bodies). */
|
|
1307
1411
|
export function lowerScopedBlock(lowerer, stmt) {
|
|
@@ -1411,6 +1515,8 @@ function lowerModuleLevelReturn(lowerer, stmt) {
|
|
|
1411
1515
|
export function lowerStmt(lowerer, stmt) {
|
|
1412
1516
|
if (ownPrototypeResetStatement(lowerer, stmt))
|
|
1413
1517
|
return { kind: "block", body: [], loc: locOf(stmt) };
|
|
1518
|
+
if (ts.isClassDeclaration(stmt) && isIslandSubclassDecl(stmt))
|
|
1519
|
+
return lowerIslandSubclass(lowerer, stmt);
|
|
1414
1520
|
if (ts.isClassDeclaration(stmt)) {
|
|
1415
1521
|
if (!stmt.name)
|
|
1416
1522
|
lowerer.unsupported("SC1090", stmt, "anonymous local class declarations");
|
|
@@ -1419,8 +1525,8 @@ export function lowerStmt(lowerer, stmt) {
|
|
|
1419
1525
|
const symbol = lowerer.checker.getSymbolAtLocation(stmt.name);
|
|
1420
1526
|
const pre = symbol ? lowerer.ctx.tdzPredeclared.get(symbol) : undefined;
|
|
1421
1527
|
if (pre) {
|
|
1422
|
-
lowerer.ctx.tdzPredeclared.delete(symbol);
|
|
1423
1528
|
const value = lowerer.coerceToExpected(lowerer.lowerClassExpression(stmt), DYN);
|
|
1529
|
+
lowerer.ctx.tdzPredeclared.delete(symbol);
|
|
1424
1530
|
return { kind: "assign", localId: pre.id, value, initializes: true, loc: locOf(stmt) };
|
|
1425
1531
|
}
|
|
1426
1532
|
const type = { kind: "classval", className: info.def.name };
|
|
@@ -1598,7 +1704,16 @@ export function lowerStmt(lowerer, stmt) {
|
|
|
1598
1704
|
}
|
|
1599
1705
|
// Exception-representable values move into the runtime's exception
|
|
1600
1706
|
// cell. `throw f()` of a void call has no value.
|
|
1601
|
-
|
|
1707
|
+
// A thrown object or array literal has no declared type: it is built as
|
|
1708
|
+
// a dynamic object, so the catch binding's checked casts adopt it
|
|
1709
|
+
// (lowerer.untypedLiteralContext).
|
|
1710
|
+
let literal = stmt.expression;
|
|
1711
|
+
while (ts.isParenthesizedExpression(literal))
|
|
1712
|
+
literal = literal.expression;
|
|
1713
|
+
let value = (ts.isObjectLiteralExpression(literal) || ts.isArrayLiteralExpression(literal)) &&
|
|
1714
|
+
lowerer.untypedLiteralContext(literal)
|
|
1715
|
+
? lowerer.lowerExprExpecting(stmt.expression, DYN)
|
|
1716
|
+
: lowerer.lowerExpr(stmt.expression);
|
|
1602
1717
|
if (value.type.kind === "void")
|
|
1603
1718
|
lowerer.badType(stmt.expression, lowerer.typeOf(stmt.expression));
|
|
1604
1719
|
// Preserve primitive reasons and readable record identity across the
|
|
@@ -2133,7 +2248,7 @@ export function lowerDestructuringDecl(lowerer, decl, isLet) {
|
|
|
2133
2248
|
const jsRuntimeKeyCheck = init.type.kind === "dyn" &&
|
|
2134
2249
|
ts.isObjectBindingPattern(decl.name) &&
|
|
2135
2250
|
isJsSourceFile(ts.getSourceFileOfNode(decl)) &&
|
|
2136
|
-
startsWithRuntimeKey(lowerer, decl.name) &&
|
|
2251
|
+
(decl.name.elements.nodes.length === 0 || startsWithRuntimeKey(lowerer, decl.name)) &&
|
|
2137
2252
|
destrSpellingOf(decl.initializer) !== null;
|
|
2138
2253
|
if (jsRuntimeKeyCheck ||
|
|
2139
2254
|
(init.type.kind === "dyn" &&
|
|
@@ -2255,7 +2370,7 @@ export function lowerBindingPattern(lowerer, pattern, srcRef, srcType, isLet, ou
|
|
|
2255
2370
|
if (el.dotDotDotToken)
|
|
2256
2371
|
lowerer.unsupported("SC1031", el, "rest elements over a union of array or tuple layouts");
|
|
2257
2372
|
const loc = locOf(el);
|
|
2258
|
-
let value = unionArrayValueRead(lowerer, srcRef(), numLit(i, loc), loc, (text) => strCharsCall(
|
|
2373
|
+
let value = unionArrayValueRead(lowerer, srcRef(), numLit(i, loc), loc, (text) => strCharsCall(text, loc));
|
|
2259
2374
|
if (!value)
|
|
2260
2375
|
lowerer.unsupported("SC1031", el, "array or tuple union elements without a common native representation");
|
|
2261
2376
|
if (el.initializer)
|
|
@@ -2368,7 +2483,7 @@ export function lowerBindingPattern(lowerer, pattern, srcRef, srcType, isLet, ou
|
|
|
2368
2483
|
}
|
|
2369
2484
|
// STRING sources (`const [a, b] = str`): array destructuring walks
|
|
2370
2485
|
// the STRING ITERATOR — code points, astral characters whole —
|
|
2371
|
-
// which is Array.from(string)'s own machinery (
|
|
2486
|
+
// which is Array.from(string)'s own machinery (str.codePoints), so the
|
|
2372
2487
|
// source splits once into a hidden chars array and the pattern
|
|
2373
2488
|
// lowers as an array pattern over string[]. Positions, holes,
|
|
2374
2489
|
// defaults (with the bounds test), rest (the remaining code points
|
|
@@ -2387,7 +2502,7 @@ export function lowerBindingPattern(lowerer, pattern, srcRef, srcType, isLet, ou
|
|
|
2387
2502
|
out.push({
|
|
2388
2503
|
kind: "varDecl",
|
|
2389
2504
|
localId: chars.id,
|
|
2390
|
-
init: strCharsCall(
|
|
2505
|
+
init: strCharsCall(srcRef(), loc),
|
|
2391
2506
|
loc,
|
|
2392
2507
|
});
|
|
2393
2508
|
lowerer.lowerBindingPattern(pattern, () => ({ kind: "varRef", localId: chars.id, type: charsT, loc }), charsT, isLet, out);
|
|
@@ -2587,6 +2702,39 @@ export function lowerBindingPattern(lowerer, pattern, srcRef, srcType, isLet, ou
|
|
|
2587
2702
|
// every statically non-nullish kind, record or not (the assignment
|
|
2588
2703
|
// path's rule); possibly-nullish sources would throw in JS and keep
|
|
2589
2704
|
// a fence.
|
|
2705
|
+
//
|
|
2706
|
+
// A CHECKED-DYNAMIC source still owes that step at runtime: an empty
|
|
2707
|
+
// object pattern over null/undefined throws RequireObjectCoercible,
|
|
2708
|
+
// and an empty array pattern throws GetIterator's "is not iterable".
|
|
2709
|
+
// Nothing else about the pattern is observable, so the fence is the
|
|
2710
|
+
// whole lowering.
|
|
2711
|
+
if (srcType.kind === "dyn") {
|
|
2712
|
+
const unitLoc = locOf(pattern);
|
|
2713
|
+
const isObject = ts.isObjectBindingPattern(pattern);
|
|
2714
|
+
for (const unit of ["null", "undefined"]) {
|
|
2715
|
+
// V8 describes an argument-derived source by its type ("object
|
|
2716
|
+
// null"); a bare non-empty pattern names its source instead, but
|
|
2717
|
+
// those reads throw on their own before this check could fire.
|
|
2718
|
+
const described = unit === "null" ? "object null" : "undefined";
|
|
2719
|
+
const message = isObject
|
|
2720
|
+
? `Cannot destructure '${described}' as it is ${unit}.`
|
|
2721
|
+
: `${described} is not iterable (cannot read property Symbol(Symbol.iterator))`;
|
|
2722
|
+
out.push({
|
|
2723
|
+
kind: "if",
|
|
2724
|
+
cond: { kind: "dynTest", test: unit, value: srcRef(), type: BOOL, loc: unitLoc },
|
|
2725
|
+
then: [
|
|
2726
|
+
{
|
|
2727
|
+
kind: "exprStmt",
|
|
2728
|
+
expr: nodeThrowExpr(1, "", message, VOID, unitLoc),
|
|
2729
|
+
loc: unitLoc,
|
|
2730
|
+
},
|
|
2731
|
+
],
|
|
2732
|
+
else_: null,
|
|
2733
|
+
loc: unitLoc,
|
|
2734
|
+
});
|
|
2735
|
+
}
|
|
2736
|
+
return;
|
|
2737
|
+
}
|
|
2590
2738
|
if (isUnitType(srcType) ||
|
|
2591
2739
|
(srcType.kind === "union" &&
|
|
2592
2740
|
(lowerer.unions.get(srcType.unionId)?.arms.some(isUnitType) ?? true))) {
|
|
@@ -2727,9 +2875,7 @@ export function lowerBindingPattern(lowerer, pattern, srcRef, srcType, isLet, ou
|
|
|
2727
2875
|
// chain declares keep named fences (a detached method would lose its
|
|
2728
2876
|
// receiver without an error; JS binds the prototype function).
|
|
2729
2877
|
if (srcType.kind === "object") {
|
|
2730
|
-
const info = lowerer.classes.get(srcType.className);
|
|
2731
|
-
if (!info)
|
|
2732
|
-
lowerer.flushDeferredClass(srcType.className);
|
|
2878
|
+
const info = lowerer.classes.get(srcType.className) ?? lowerer.flushDeferredClass(srcType.className);
|
|
2733
2879
|
if (info) {
|
|
2734
2880
|
for (const el of pattern.elements.nodes) {
|
|
2735
2881
|
if (el.name === undefined)
|
|
@@ -2880,6 +3026,20 @@ export function lowerBindingPattern(lowerer, pattern, srcRef, srcType, isLet, ou
|
|
|
2880
3026
|
lowerer.unions
|
|
2881
3027
|
.get(srcType.unionId)
|
|
2882
3028
|
?.arms.every((arm) => arm.kind === "record" || arm.kind === "object")) {
|
|
3029
|
+
const arms = lowerer.unions.get(srcType.unionId).arms;
|
|
3030
|
+
if (!unionObjectPatternFits(lowerer, pattern, arms)) {
|
|
3031
|
+
// NARROW FIRST: the checker may have refined the union at this
|
|
3032
|
+
// very site (`if (u.kind === "a") { const { x } = u }`, an `in`
|
|
3033
|
+
// guard) while the IR value keeps the stored, wider union. Bind
|
|
3034
|
+
// the narrowed view once and destructure that.
|
|
3035
|
+
const view = narrowedUnionPatternSource(lowerer, pattern, present, srcType.unionId, locOf(pattern));
|
|
3036
|
+
if (view !== null) {
|
|
3037
|
+
const tmp = lowerer.declareHiddenLocal("%destrN", view.type);
|
|
3038
|
+
out.push({ kind: "varDecl", localId: tmp.id, init: view, loc: locOf(pattern) });
|
|
3039
|
+
lowerer.lowerBindingPattern(pattern, () => ({ kind: "varRef", localId: tmp.id, type: view.type, loc: locOf(pattern) }), view.type, isLet, out, dynSpell, allowDynObject);
|
|
3040
|
+
return;
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
2883
3043
|
lowerUnionObjectPattern(lowerer, pattern, srcRef, srcType, isLet, out);
|
|
2884
3044
|
return;
|
|
2885
3045
|
}
|
|
@@ -3224,18 +3384,220 @@ function lowerUrlObjectPattern(lowerer, pattern, srcRef, isLet, out) {
|
|
|
3224
3384
|
lowerer.bindPatternTarget(el.name, value, isLet, out);
|
|
3225
3385
|
}
|
|
3226
3386
|
}
|
|
3387
|
+
/** The fresh record for `{ a, ...rest }` over a UNION source: per arm,
|
|
3388
|
+
* the unconsumed fields copied out at destructure time into a fresh
|
|
3389
|
+
* record of the checker's arm-wise rest type, selected by the runtime
|
|
3390
|
+
* tag. Null-safe answer: an arm whose remaining fields do not spell an
|
|
3391
|
+
* arm of the checker's rest type keeps the named fence. */
|
|
3392
|
+
function unionObjectRestValue(lowerer, el, srcRef, srcType, arms) {
|
|
3393
|
+
const loc = locOf(el);
|
|
3394
|
+
const restT = patternBindingType(lowerer, el.name);
|
|
3395
|
+
const fence = (why) => lowerer.unsupported("SC1031", el, why);
|
|
3396
|
+
if (restT === null) {
|
|
3397
|
+
fence(`rest bindings over union sources (${NARROW_FIRST})`);
|
|
3398
|
+
}
|
|
3399
|
+
// The consumed set is the pattern's literal keys: a computed sibling
|
|
3400
|
+
// would make it a runtime fact.
|
|
3401
|
+
const consumed = new Set();
|
|
3402
|
+
const pattern = el.parent;
|
|
3403
|
+
if (ts.isObjectBindingPattern(pattern)) {
|
|
3404
|
+
for (const sib of pattern.elements.nodes) {
|
|
3405
|
+
if (sib === el || sib.dotDotDotToken)
|
|
3406
|
+
continue;
|
|
3407
|
+
const key = sib.propertyName ?? sib.name;
|
|
3408
|
+
if (key && ts.isComputedPropertyName(key)) {
|
|
3409
|
+
fence("rest bindings beside computed keys (the consumed set is a runtime fact)");
|
|
3410
|
+
}
|
|
3411
|
+
if (key && (ts.isIdentifier(key) || ts.isStringLiteral(key) || ts.isNumericLiteral(key))) {
|
|
3412
|
+
consumed.add(key.text);
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3416
|
+
const pieces = [];
|
|
3417
|
+
for (let tag = 0; tag < arms.length; tag++) {
|
|
3418
|
+
const arm = arms[tag];
|
|
3419
|
+
if (arm.kind !== "record") {
|
|
3420
|
+
fence(`rest bindings over union sources (${NARROW_FIRST})`);
|
|
3421
|
+
}
|
|
3422
|
+
const shape = lowerer.shapes.get(arm.shapeId);
|
|
3423
|
+
if (!shape || shape.indexValue) {
|
|
3424
|
+
fence("rest bindings over index-signature shapes (the undeclared entries would need overflow packing)");
|
|
3425
|
+
}
|
|
3426
|
+
const rem = shape.fields.filter((f) => !consumed.has(f.name));
|
|
3427
|
+
if (rem.some((f) => f.name.startsWith("%"))) {
|
|
3428
|
+
fence("rest bindings over accessor shapes (the entries are closures, not data)");
|
|
3429
|
+
}
|
|
3430
|
+
const armRef = {
|
|
3431
|
+
kind: "unionNarrow",
|
|
3432
|
+
unionId: srcType.unionId,
|
|
3433
|
+
tag,
|
|
3434
|
+
value: srcRef(),
|
|
3435
|
+
type: arm,
|
|
3436
|
+
loc,
|
|
3437
|
+
};
|
|
3438
|
+
const packed = lowerer.keyOrder.copy({
|
|
3439
|
+
kind: "recordLit",
|
|
3440
|
+
fields: rem.map((f) => ({
|
|
3441
|
+
name: f.name,
|
|
3442
|
+
value: lowerer.presenceKeepingCopy(armRef, arm.shapeId, f.name, {
|
|
3443
|
+
kind: "recordGet",
|
|
3444
|
+
obj: armRef,
|
|
3445
|
+
shapeId: arm.shapeId,
|
|
3446
|
+
field: f.name,
|
|
3447
|
+
type: f.type,
|
|
3448
|
+
loc,
|
|
3449
|
+
}, loc),
|
|
3450
|
+
})),
|
|
3451
|
+
type: {
|
|
3452
|
+
kind: "record",
|
|
3453
|
+
shapeId: lowerer.shapes.intern(rem.map((f) => ({ name: f.name, type: f.type }))),
|
|
3454
|
+
},
|
|
3455
|
+
loc,
|
|
3456
|
+
}, arm.shapeId);
|
|
3457
|
+
const coerced = lowerer.coerceInto(el, packed, restT);
|
|
3458
|
+
if (!typeEquals(coerced.type, restT)) {
|
|
3459
|
+
fence(`rest bindings over union sources (the remaining fields of an arm do not spell an arm of '${lowerer.fmt(restT)}')`);
|
|
3460
|
+
}
|
|
3461
|
+
pieces.push({ tag, value: coerced });
|
|
3462
|
+
}
|
|
3463
|
+
let result = null;
|
|
3464
|
+
for (let i = pieces.length - 1; i >= 0; i--) {
|
|
3465
|
+
const piece = pieces[i];
|
|
3466
|
+
result =
|
|
3467
|
+
result === null
|
|
3468
|
+
? piece.value
|
|
3469
|
+
: {
|
|
3470
|
+
kind: "ternary",
|
|
3471
|
+
cond: {
|
|
3472
|
+
kind: "unionIsTag",
|
|
3473
|
+
unionId: srcType.unionId,
|
|
3474
|
+
tag: piece.tag,
|
|
3475
|
+
negated: false,
|
|
3476
|
+
value: srcRef(),
|
|
3477
|
+
type: BOOL,
|
|
3478
|
+
loc,
|
|
3479
|
+
},
|
|
3480
|
+
then: piece.value,
|
|
3481
|
+
else_: result,
|
|
3482
|
+
type: restT,
|
|
3483
|
+
loc,
|
|
3484
|
+
};
|
|
3485
|
+
}
|
|
3486
|
+
if (result === null) {
|
|
3487
|
+
fence(`rest bindings over union sources (${NARROW_FIRST})`);
|
|
3488
|
+
}
|
|
3489
|
+
return result;
|
|
3490
|
+
}
|
|
3491
|
+
/** The one type every arm declares for `propName`, or null when an arm
|
|
3492
|
+
* does not declare it (or types it differently, or not at all). */
|
|
3493
|
+
function unionPatternCommonType(lowerer, arms, propName) {
|
|
3494
|
+
let common = null;
|
|
3495
|
+
for (const arm of arms) {
|
|
3496
|
+
let ft;
|
|
3497
|
+
if (arm.kind === "record") {
|
|
3498
|
+
ft = lowerer.shapes.get(arm.shapeId)?.fields.find((f) => f.name === propName)?.type;
|
|
3499
|
+
}
|
|
3500
|
+
else if (arm.kind === "object") {
|
|
3501
|
+
ft = lowerer.classes.get(arm.className)?.fields.get(propName);
|
|
3502
|
+
}
|
|
3503
|
+
if (!ft || ft.kind === "void" || isUnitType(ft) || (common && !typeEquals(common, ft))) {
|
|
3504
|
+
return null;
|
|
3505
|
+
}
|
|
3506
|
+
common = ft;
|
|
3507
|
+
}
|
|
3508
|
+
return common;
|
|
3509
|
+
}
|
|
3510
|
+
/** Whether the unionDisc fast path lowers this pattern over these arms
|
|
3511
|
+
* unchanged: no rest element, and every element's key folds to one name
|
|
3512
|
+
* every arm declares with one type. */
|
|
3513
|
+
function unionObjectPatternFits(lowerer, pattern, arms) {
|
|
3514
|
+
for (const el of pattern.elements.nodes) {
|
|
3515
|
+
if (el.name === undefined)
|
|
3516
|
+
continue;
|
|
3517
|
+
if (el.dotDotDotToken)
|
|
3518
|
+
return false;
|
|
3519
|
+
const prop = el.propertyName ?? el.name;
|
|
3520
|
+
const propName = ts.isIdentifier(prop) ||
|
|
3521
|
+
ts.isComputedPropertyName(prop) ||
|
|
3522
|
+
ts.isStringLiteralLike(prop) ||
|
|
3523
|
+
ts.isNumericLiteral(prop)
|
|
3524
|
+
? patternKeyNameOf(lowerer, prop)
|
|
3525
|
+
: null;
|
|
3526
|
+
if (propName === null)
|
|
3527
|
+
return false;
|
|
3528
|
+
if (unionPatternCommonType(lowerer, arms, propName) === null)
|
|
3529
|
+
return false;
|
|
3530
|
+
}
|
|
3531
|
+
return true;
|
|
3532
|
+
}
|
|
3533
|
+
/** The CHECKER-NARROWED view of a destructuring source: `if (u.kind ===
|
|
3534
|
+
* "a") { const { x } = u }` or an `in` guard refines the type at the
|
|
3535
|
+
* pattern's own site, while the IR value keeps the stored (wider) union
|
|
3536
|
+
* and the un-narrowed lowering. Bind the value to the narrowed sub-union
|
|
3537
|
+
* — a trusted arm extraction for one arm, a re-tag with the excluded
|
|
3538
|
+
* arms as traps for a sub-union — so the pattern reads the arms the
|
|
3539
|
+
* checker proved. Null when the checker did not narrow, when the
|
|
3540
|
+
* refinement is an intersection of stored records (hostedStorageView
|
|
3541
|
+
* keeps that layout), or when nothing was excluded. */
|
|
3542
|
+
function narrowedUnionPatternSource(lowerer, pattern, value, fromId, loc) {
|
|
3543
|
+
const from = lowerer.unions.get(fromId);
|
|
3544
|
+
if (!from)
|
|
3545
|
+
return null;
|
|
3546
|
+
const narrowed = lowerer.irTypeOf(pattern);
|
|
3547
|
+
if (narrowed.kind === "void" || isUnitType(narrowed))
|
|
3548
|
+
return null;
|
|
3549
|
+
const siteArms = narrowed.kind === "union" ? lowerer.unions.get(narrowed.unionId)?.arms : [narrowed];
|
|
3550
|
+
if (!siteArms || siteArms.length === 0)
|
|
3551
|
+
return null;
|
|
3552
|
+
const allowed = new Set();
|
|
3553
|
+
for (const arm of siteArms) {
|
|
3554
|
+
const tag = lowerer.armTag(fromId, arm);
|
|
3555
|
+
// Not a stored arm: a checker intersection that refines the stored
|
|
3556
|
+
// records, which keeps the value's layout.
|
|
3557
|
+
if (tag < 0)
|
|
3558
|
+
return hostedStorageView(lowerer, value, narrowed, loc);
|
|
3559
|
+
allowed.add(tag);
|
|
3560
|
+
}
|
|
3561
|
+
if (allowed.size === 0 || allowed.size === from.arms.length)
|
|
3562
|
+
return null;
|
|
3563
|
+
if (allowed.size === 1) {
|
|
3564
|
+
const tag = [...allowed][0];
|
|
3565
|
+
// The checker proved the tag; the extraction traps on a mismatch
|
|
3566
|
+
// instead of reading another arm.
|
|
3567
|
+
return { kind: "unionNarrow", unionId: fromId, tag, value, type: from.arms[tag], loc };
|
|
3568
|
+
}
|
|
3569
|
+
const arms = from.arms.filter((_, tag) => allowed.has(tag));
|
|
3570
|
+
const subId = lowerer.unions.transform(from, arms);
|
|
3571
|
+
const helper = lowerer.narrowedRetagHelper(pattern, fromId, subId, loc);
|
|
3572
|
+
if (!helper)
|
|
3573
|
+
return null;
|
|
3574
|
+
return {
|
|
3575
|
+
kind: "call",
|
|
3576
|
+
callee: helper,
|
|
3577
|
+
args: [value],
|
|
3578
|
+
type: { kind: "union", unionId: subId },
|
|
3579
|
+
loc,
|
|
3580
|
+
};
|
|
3581
|
+
}
|
|
3227
3582
|
/** An object pattern over a union of records and class instances
|
|
3228
3583
|
* (`function f({ kind, path }: Add | Remove)`): each element reads a data
|
|
3229
|
-
* field
|
|
3230
|
-
* `
|
|
3231
|
-
*
|
|
3584
|
+
* field through the runtime tag, as `value.field` does — the shared
|
|
3585
|
+
* `unionDisc` when every arm declares it with one type, else the
|
|
3586
|
+
* `unionKeyGet` join (an arm that does not declare the key answers
|
|
3587
|
+
* undefined, as JS reads it). A rest element packs each arm's unconsumed
|
|
3588
|
+
* fields into a fresh record. Class arms still need same-typed fields. */
|
|
3232
3589
|
function lowerUnionObjectPattern(lowerer, pattern, srcRef, srcType, isLet, out) {
|
|
3233
3590
|
const arms = lowerer.unions.get(srcType.unionId)?.arms ?? [];
|
|
3234
3591
|
for (const el of pattern.elements.nodes) {
|
|
3235
3592
|
if (el.name === undefined)
|
|
3236
3593
|
continue;
|
|
3237
3594
|
if (el.dotDotDotToken) {
|
|
3238
|
-
|
|
3595
|
+
// `{ a, ...rest }` over a union: each arm packs its own unconsumed
|
|
3596
|
+
// fields into a FRESH record (JS's CopyDataProperties makes a fresh
|
|
3597
|
+
// object too), and the checker's rest type is the union of those
|
|
3598
|
+
// per-arm packs. The tag decides which pack runs.
|
|
3599
|
+
lowerer.bindPatternTarget(el.name, unionObjectRestValue(lowerer, el, srcRef, srcType, arms), isLet, out);
|
|
3600
|
+
continue;
|
|
3239
3601
|
}
|
|
3240
3602
|
const prop = el.propertyName ?? el.name;
|
|
3241
3603
|
const propName = ts.isIdentifier(prop) ||
|
|
@@ -3247,32 +3609,30 @@ function lowerUnionObjectPattern(lowerer, pattern, srcRef, srcType, isLet, out)
|
|
|
3247
3609
|
if (propName === null) {
|
|
3248
3610
|
lowerer.unsupported("SC1031", el, "destructuring with computed keys that do not fold to one property name");
|
|
3249
3611
|
}
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
break;
|
|
3262
|
-
}
|
|
3263
|
-
common = ft;
|
|
3612
|
+
const common = unionPatternCommonType(lowerer, arms, propName);
|
|
3613
|
+
let value;
|
|
3614
|
+
if (common !== null) {
|
|
3615
|
+
value = {
|
|
3616
|
+
kind: "unionDisc",
|
|
3617
|
+
unionId: srcType.unionId,
|
|
3618
|
+
field: propName,
|
|
3619
|
+
value: srcRef(),
|
|
3620
|
+
type: common,
|
|
3621
|
+
loc: locOf(el),
|
|
3622
|
+
};
|
|
3264
3623
|
}
|
|
3265
|
-
|
|
3266
|
-
|
|
3624
|
+
else {
|
|
3625
|
+
// The unionDisc generalization (`unionKeyGet`): each arm answers
|
|
3626
|
+
// its own declared type and an arm that does not declare the
|
|
3627
|
+
// key answers undefined — exactly JS's desugar, which reads a
|
|
3628
|
+
// missing property as undefined.
|
|
3629
|
+
const loc = locOf(el);
|
|
3630
|
+
const joined = lowerUnionKeyedRead(lowerer, el, srcType.unionId, srcRef(), { kind: "strLit", value: propName, type: STRING, loc }, propName, true);
|
|
3631
|
+
if (joined === null) {
|
|
3632
|
+
lowerer.unsupported("SC1031", el, `destructuring '${propName}' from a union whose arms answer it with types that have no combined representation (every arm's '${propName}' must join into one union — ${NARROW_FIRST})`);
|
|
3633
|
+
}
|
|
3634
|
+
value = joined;
|
|
3267
3635
|
}
|
|
3268
|
-
let value = {
|
|
3269
|
-
kind: "unionDisc",
|
|
3270
|
-
unionId: srcType.unionId,
|
|
3271
|
-
field: propName,
|
|
3272
|
-
value: srcRef(),
|
|
3273
|
-
type: common,
|
|
3274
|
-
loc: locOf(el),
|
|
3275
|
-
};
|
|
3276
3636
|
if (el.initializer)
|
|
3277
3637
|
value = applyBindingDefault(lowerer, el, value);
|
|
3278
3638
|
lowerer.bindPatternTarget(el.name, value, isLet, out);
|
|
@@ -3610,14 +3970,9 @@ function stdlibGlobalTokenDestructure(lowerer, decl, isLet) {
|
|
|
3610
3970
|
const canonical = ts.symbolName(member) === "global" ? "globalThis" : ts.symbolName(member);
|
|
3611
3971
|
token = `[builtin ${canonical}]`;
|
|
3612
3972
|
alias = canonical;
|
|
3613
|
-
//
|
|
3614
|
-
//
|
|
3615
|
-
|
|
3616
|
-
value =
|
|
3617
|
-
canonical === "crypto"
|
|
3618
|
-
? { kind: "libCall", fn: "webcrypto.object", args: [], type: DYN, loc: locOf(el) }
|
|
3619
|
-
: (builtinNamespaceValue(lowerer, canonical, locOf(el)) ??
|
|
3620
|
-
builtinGlobalValue(canonical, locOf(el), true));
|
|
3973
|
+
// The values the bare and `globalThis.X` spellings read
|
|
3974
|
+
// (jsGlobalValueByName).
|
|
3975
|
+
value = jsGlobalValueByName(lowerer, canonical, locOf(el));
|
|
3621
3976
|
}
|
|
3622
3977
|
else if (globalName === "console" && !CONSOLE_CALL_MEMBERS.has(propName)) {
|
|
3623
3978
|
token = `[builtin console.${propName}]`;
|
|
@@ -3631,6 +3986,12 @@ function stdlibGlobalTokenDestructure(lowerer, decl, isLet) {
|
|
|
3631
3986
|
// A data member reads its value once, exactly like the spelled
|
|
3632
3987
|
// `process.<member>` read the destructuring performs.
|
|
3633
3988
|
}
|
|
3989
|
+
else if (globalName === "process" &&
|
|
3990
|
+
propName === "cwd" &&
|
|
3991
|
+
(value = lowerer.lowerBuiltinCallableValue({ module: "process", member: propName }, locOf(el))) !== null) {
|
|
3992
|
+
// process.cwd reads the directory when it is called, so the detached
|
|
3993
|
+
// function is the same one every other spelling reads.
|
|
3994
|
+
}
|
|
3634
3995
|
else {
|
|
3635
3996
|
lowerer.unsupported("SC1031", el, `destructuring the member '${propName}' of the builtin global '${globalName}' (a detached member loses its receiver-keyed lowering — call it through the global)`);
|
|
3636
3997
|
}
|
|
@@ -4514,6 +4875,11 @@ function inferredEvolvingLetType(lowerer, decl) {
|
|
|
4514
4875
|
const scope = decl.parent?.parent?.parent;
|
|
4515
4876
|
if (symbol === undefined || (!ts.isBlock(scope) && !ts.isSourceFile(scope)))
|
|
4516
4877
|
return null;
|
|
4878
|
+
// A shorthand property's name (`{ width }`) resolves to the property
|
|
4879
|
+
// symbol, but it reads the binding: the checker's shorthand-value symbol.
|
|
4880
|
+
const refersToBinding = (node) => (ts.isShorthandPropertyAssignment(node.parent) && node.parent.name === node
|
|
4881
|
+
? lowerer.checker.getShorthandAssignmentValueSymbol(node.parent)
|
|
4882
|
+
: lowerer.checker.getSymbolAtLocation(node)) === symbol;
|
|
4517
4883
|
const isPlainAssignmentTarget = (node) => {
|
|
4518
4884
|
let target = node;
|
|
4519
4885
|
while (ts.isParenthesizedExpression(target.parent) && target.parent.expression === target) {
|
|
@@ -4527,9 +4893,7 @@ function inferredEvolvingLetType(lowerer, decl) {
|
|
|
4527
4893
|
const captures = (fn) => {
|
|
4528
4894
|
let captured = false;
|
|
4529
4895
|
ts.walkPreorder(fn, (node) => {
|
|
4530
|
-
if (node !== fn &&
|
|
4531
|
-
ts.isIdentifier(node) &&
|
|
4532
|
-
lowerer.checker.getSymbolAtLocation(node) === symbol) {
|
|
4896
|
+
if (node !== fn && ts.isIdentifier(node) && refersToBinding(node)) {
|
|
4533
4897
|
captured = true;
|
|
4534
4898
|
return "stop";
|
|
4535
4899
|
}
|
|
@@ -4561,6 +4925,15 @@ function inferredEvolvingLetType(lowerer, decl) {
|
|
|
4561
4925
|
invalid = true;
|
|
4562
4926
|
return "stop";
|
|
4563
4927
|
}
|
|
4928
|
+
// An index read's checker type omits the undefined a read past the
|
|
4929
|
+
// end (or of an absent key) answers.
|
|
4930
|
+
let right = node.right;
|
|
4931
|
+
while (ts.isParenthesizedExpression(right))
|
|
4932
|
+
right = right.expression;
|
|
4933
|
+
if (ts.isElementAccessExpression(right)) {
|
|
4934
|
+
invalid = true;
|
|
4935
|
+
return "stop";
|
|
4936
|
+
}
|
|
4564
4937
|
const mapped = lowerer.mapTypeOf(lowerer.typeOf(node.right));
|
|
4565
4938
|
if (!mapped || mapped.kind === "dyn" || mapped.kind === "void" || isUnitType(mapped)) {
|
|
4566
4939
|
invalid = true;
|
|
@@ -4577,7 +4950,7 @@ function inferredEvolvingLetType(lowerer, decl) {
|
|
|
4577
4950
|
}
|
|
4578
4951
|
if (ts.isIdentifier(node) &&
|
|
4579
4952
|
node !== decl.name &&
|
|
4580
|
-
|
|
4953
|
+
refersToBinding(node) &&
|
|
4581
4954
|
!isPlainAssignmentTarget(node)) {
|
|
4582
4955
|
reads.push(node);
|
|
4583
4956
|
}
|
|
@@ -4754,8 +5127,8 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4754
5127
|
const symbol = lowerer.checker.getSymbolAtLocation(decl.name);
|
|
4755
5128
|
const pre = symbol ? lowerer.ctx.tdzPredeclared.get(symbol) : undefined;
|
|
4756
5129
|
if (pre) {
|
|
4757
|
-
lowerer.ctx.tdzPredeclared.delete(symbol);
|
|
4758
5130
|
const value = genericBindingStoredValue(lowerer, decl, info);
|
|
5131
|
+
lowerer.ctx.tdzPredeclared.delete(symbol);
|
|
4759
5132
|
return { kind: "assign", localId: pre.id, value, initializes: true, loc: locOf(decl) };
|
|
4760
5133
|
}
|
|
4761
5134
|
return genericBindingPresenceStore(info, decl);
|
|
@@ -4861,6 +5234,18 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4861
5234
|
return { kind: "assign", localId: g.id, value: wrapped, loc: locOf(decl) };
|
|
4862
5235
|
return null;
|
|
4863
5236
|
}
|
|
5237
|
+
// `const files = pkg.list()`: an undeclared island object stays a
|
|
5238
|
+
// handle (lower-node-island.ts), so the binding holds it as dyn.
|
|
5239
|
+
if (ts.isIdentifier(decl.name) && islandHandleBinding(lowerer, decl.name)) {
|
|
5240
|
+
g.type = DYN;
|
|
5241
|
+
return {
|
|
5242
|
+
kind: "assign",
|
|
5243
|
+
localId: g.id,
|
|
5244
|
+
value: lowerer.coerceToExpected(lowerer.lowerExpr(decl.initializer), DYN),
|
|
5245
|
+
...(g.tdz ? { initializes: true } : {}),
|
|
5246
|
+
loc: locOf(decl),
|
|
5247
|
+
};
|
|
5248
|
+
}
|
|
4864
5249
|
const guardedRead = isGuardedRecordRead(lowerer, decl)
|
|
4865
5250
|
? lowerAbsenceProbe(lowerer, decl.initializer)
|
|
4866
5251
|
: null;
|
|
@@ -4882,6 +5267,14 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4882
5267
|
(existingValueForm(decl.initializer) || jsHoldsDynObject(lowerer, decl.initializer)))))
|
|
4883
5268
|
g.type = DYN;
|
|
4884
5269
|
g.type = inferredOptionalRecordType(lowerer, decl, g.type, raw.type);
|
|
5270
|
+
// A module const keeps its initializer's record or array layout, as a
|
|
5271
|
+
// function's const does (keepsInitializerLayout).
|
|
5272
|
+
if (!isVarDeclared(decl) &&
|
|
5273
|
+
(ts.getCombinedNodeFlags(decl) & ts.NodeFlags.Const) !== 0 &&
|
|
5274
|
+
keepsInitializerLayout(lowerer, decl.initializer, raw.type, g.type)) {
|
|
5275
|
+
g.type = raw.type;
|
|
5276
|
+
notePreservedLayout(lowerer, decl);
|
|
5277
|
+
}
|
|
4885
5278
|
const arithmetic = raw.type.kind === "union" ? lowerer.unions.get(raw.type.unionId)?.arms : undefined;
|
|
4886
5279
|
if (arithmetic?.length === 2 &&
|
|
4887
5280
|
arithmetic.every((a) => a.kind === "f64" || a.kind === "string" || a.kind === "bool") &&
|
|
@@ -4905,11 +5298,13 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4905
5298
|
// A forward-captured binding pre-declared as a TDZ box (an earlier
|
|
4906
5299
|
// function in this scope captured it — predeclareForwardCapture): the
|
|
4907
5300
|
// binding and its scope-entry varDecl already exist; the source
|
|
4908
|
-
// declaration is the one initializing `assign` into the shared box.
|
|
5301
|
+
// declaration is the one initializing `assign` into the shared box. The
|
|
5302
|
+
// box stays pre-declared until the initializer lowers: a statement the
|
|
5303
|
+
// commit point lowers again (localized failure) initializes the same box.
|
|
4909
5304
|
const pre = declSymbol ? lowerer.ctx.tdzPredeclared.get(declSymbol) : undefined;
|
|
4910
5305
|
if (pre && decl.initializer) {
|
|
4911
|
-
lowerer.ctx.tdzPredeclared.delete(declSymbol);
|
|
4912
5306
|
const init = lowerer.lowerExprExpecting(decl.initializer, pre.type);
|
|
5307
|
+
lowerer.ctx.tdzPredeclared.delete(declSymbol);
|
|
4913
5308
|
return { kind: "assign", localId: pre.id, value: init, initializes: true, loc: locOf(decl) };
|
|
4914
5309
|
}
|
|
4915
5310
|
// `var x = e` — an ASSIGNMENT into the function-scoped hoisted slot
|
|
@@ -4958,6 +5353,11 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
4958
5353
|
: lowerer.unassignedSlotInit(type, locOf(decl));
|
|
4959
5354
|
return { kind: "varDecl", localId: local.id, init, loc: locOf(decl) };
|
|
4960
5355
|
}
|
|
5356
|
+
if (ts.isIdentifier(decl.name) && islandHandleBinding(lowerer, decl.name)) {
|
|
5357
|
+
const init = lowerer.coerceToExpected(lowerer.lowerExpr(decl.initializer), DYN);
|
|
5358
|
+
const local = lowerer.declareLocal(decl.name, decl.name.text, DYN, isLet);
|
|
5359
|
+
return { kind: "varDecl", localId: local.id, init, loc: locOf(decl) };
|
|
5360
|
+
}
|
|
4961
5361
|
// Initializer first: `const f = () => ...` should report the arrow
|
|
4962
5362
|
// function (with its hint), not the unmappable declared type. If it
|
|
4963
5363
|
// poisons, still declare the local when its type is representable, so
|
|
@@ -5015,6 +5415,35 @@ export function lowerVarDecl(lowerer, decl, isLet) {
|
|
|
5015
5415
|
// Promise.prototype is an ordinary object the checker types Promise<any>.
|
|
5016
5416
|
if (!decl.type && !hasJsTypeAnnotation(decl) && isPromisePrototypeRead(lowerer, decl.initializer))
|
|
5017
5417
|
type = DYN;
|
|
5418
|
+
// A web stream value in JavaScript keeps its checked-dynamic identity.
|
|
5419
|
+
if (init.type.kind === "dyn" &&
|
|
5420
|
+
!decl.type &&
|
|
5421
|
+
!hasJsTypeAnnotation(decl) &&
|
|
5422
|
+
decl.initializer !== undefined &&
|
|
5423
|
+
(isWebStreamValueInJavaScript(lowerer, decl.initializer) ||
|
|
5424
|
+
(isJsSourceFile(ts.getSourceFileOfNode(decl)) &&
|
|
5425
|
+
typeInvolvesWebStream(lowerer, lowerer.typeOf(decl.name)))))
|
|
5426
|
+
type = DYN;
|
|
5427
|
+
// An unannotated TypeScript binding whose checker type carries `any`
|
|
5428
|
+
// inference residue (`Map<any, any>` from an untyped `new Map()` joined
|
|
5429
|
+
// into the initializer's type) takes the initializer's own layout when
|
|
5430
|
+
// that layout replaces only the residue: `any` admits every use, and the
|
|
5431
|
+
// value has that layout.
|
|
5432
|
+
if (!decl.type &&
|
|
5433
|
+
type !== null &&
|
|
5434
|
+
!isJsSourceFile(ts.getSourceFileOfNode(decl)) &&
|
|
5435
|
+
!typeEquals(type, init.type) &&
|
|
5436
|
+
anyResidueReplacedBy(lowerer, type, init.type))
|
|
5437
|
+
type = init.type;
|
|
5438
|
+
// A const whose initializer has another record or array layout than the
|
|
5439
|
+
// binding's type keeps the initializer's layout: converting would copy the
|
|
5440
|
+
// value, so the binding would not be the value its initializer names.
|
|
5441
|
+
if (!isLet &&
|
|
5442
|
+
type !== null &&
|
|
5443
|
+
keepsInitializerLayout(lowerer, decl.initializer, init.type, type)) {
|
|
5444
|
+
type = init.type;
|
|
5445
|
+
notePreservedLayout(lowerer, decl);
|
|
5446
|
+
}
|
|
5018
5447
|
// A typed-arguments function expression (typed-arguments.ts): the
|
|
5019
5448
|
// checker types the binding variadic, but its value has the fixed
|
|
5020
5449
|
// signature every use asserts.
|
|
@@ -5494,6 +5923,40 @@ function lowerVariableInitializer(lowerer, node, expected) {
|
|
|
5494
5923
|
}
|
|
5495
5924
|
}
|
|
5496
5925
|
}
|
|
5926
|
+
/** A JS object literal that leaves out a required field of the binding's
|
|
5927
|
+
* inferred record: tsc types `var p = {}; p.id = id;` by the members later
|
|
5928
|
+
* assignments add, so the object only gains them after its initializer, and
|
|
5929
|
+
* until then it is not a value of that record. Keep it a checked-dynamic
|
|
5930
|
+
* object, as an object that gains keys outside the record is. */
|
|
5931
|
+
function jsObjectLiteralFilledLater(lowerer, decl, type) {
|
|
5932
|
+
if (decl.type || !decl.initializer || !isJsSourceFile(ts.getSourceFileOfNode(decl)))
|
|
5933
|
+
return false;
|
|
5934
|
+
let initializer = decl.initializer;
|
|
5935
|
+
while (ts.isParenthesizedExpression(initializer))
|
|
5936
|
+
initializer = initializer.expression;
|
|
5937
|
+
if (!ts.isObjectLiteralExpression(initializer) || hasJsTypeAnnotation(decl))
|
|
5938
|
+
return false;
|
|
5939
|
+
const shape = lowerer.shapes.get(type.shapeId);
|
|
5940
|
+
if (!shape || shape.tuple)
|
|
5941
|
+
return false;
|
|
5942
|
+
const given = new Set();
|
|
5943
|
+
for (const property of initializer.properties.nodes) {
|
|
5944
|
+
if (ts.isSpreadAssignment(property))
|
|
5945
|
+
return false;
|
|
5946
|
+
const name = property.name;
|
|
5947
|
+
if (name === undefined)
|
|
5948
|
+
return false;
|
|
5949
|
+
if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNumericLiteral(name))
|
|
5950
|
+
given.add(name.text);
|
|
5951
|
+
else
|
|
5952
|
+
return false;
|
|
5953
|
+
}
|
|
5954
|
+
// A field whose type holds undefined reads as it would before the write.
|
|
5955
|
+
const holdsUndefined = (t) => t.kind === "dyn" ||
|
|
5956
|
+
t.kind === "undefinedT" ||
|
|
5957
|
+
(t.kind === "union" && lowerer.armTag(t.unionId, UNDEFINED_T) >= 0);
|
|
5958
|
+
return shape.fields.some((field) => !given.has(field.name) && !field.name.startsWith("%") && !holdsUndefined(field.type));
|
|
5959
|
+
}
|
|
5497
5960
|
/** A JS object literal's inferred fields do not close its later storage.
|
|
5498
5961
|
* Keep the original native object when writes add keys or delete fields;
|
|
5499
5962
|
* converting it to a fixed record would discard that behavior. */
|
|
@@ -5872,8 +6335,13 @@ export function lowerSwitch(lowerer, stmt) {
|
|
|
5872
6335
|
if (dk === "union")
|
|
5873
6336
|
return lowerUnionSwitch(lowerer, stmt, disc, labels);
|
|
5874
6337
|
// Objects, arrays, functions and other references match their cases
|
|
5875
|
-
// with ===, which compares them by identity.
|
|
5876
|
-
|
|
6338
|
+
// with ===, which compares them by identity. In JavaScript, a case
|
|
6339
|
+
// test of another type (a namespace enum member read through an
|
|
6340
|
+
// untyped object) compares with === too.
|
|
6341
|
+
const mixedJsCases = isJsSourceFile(ts.getSourceFileOfNode(stmt)) &&
|
|
6342
|
+
stmt.caseBlock.clauses.nodes.some((clause) => ts.isCaseClause(clause) &&
|
|
6343
|
+
tryLowerExpression(lowerer, clause.expression)?.type.kind !== dk);
|
|
6344
|
+
if ((dk !== "f64" && dk !== "string" && dk !== "bool") || mixedJsCases)
|
|
5877
6345
|
return lowerBranchSwitch(lowerer, stmt, disc, labels, (stableDisc, test, expression) => lowerStrictEquality(lowerer, expression, stmt.expression, expression, stableDisc, test, false, locOf(expression)));
|
|
5878
6346
|
// The whole case-body sequence is ONE lexical scope in JS: a bare `let`
|
|
5879
6347
|
// in one case is visible in later cases.
|
|
@@ -6117,6 +6585,15 @@ function lowerDeleteStatement(lowerer, expr) {
|
|
|
6117
6585
|
loc,
|
|
6118
6586
|
};
|
|
6119
6587
|
}
|
|
6588
|
+
// `delete u.f` on a union of records that every arm declares `f` optional
|
|
6589
|
+
// on: dispatch over the arms and write each slot's ABSENT state (the
|
|
6590
|
+
// monomorphic optional-field delete). Required fields, class arms and
|
|
6591
|
+
// other receivers keep their own fences below.
|
|
6592
|
+
if (ts.isPropertyAccessExpression(target)) {
|
|
6593
|
+
const unionDelete = lowerUnionFieldDelete(lowerer, target);
|
|
6594
|
+
if (unionDelete)
|
|
6595
|
+
return unionDelete;
|
|
6596
|
+
}
|
|
6120
6597
|
let obj = lowerer.lowerExpr(target.expression);
|
|
6121
6598
|
// `delete this.stack` in an Error subclass that declares a `stack`
|
|
6122
6599
|
// accessor (quickjs-wasi's JSException): V8 gives each error an own
|
|
@@ -6648,10 +7125,39 @@ function lowerCjsSingleValueExport(lowerer, expr, loc) {
|
|
|
6648
7125
|
* assignment, and `({ a, b } = e);` (destructuring ASSIGNMENT, which JS
|
|
6649
7126
|
* requires parenthesized in statement position) lands in the
|
|
6650
7127
|
* object-literal-target branch below. */
|
|
7128
|
+
/** dereferencedElementWrite in statement position. */
|
|
7129
|
+
function lowerDereferencedElementWrite(lowerer, expr) {
|
|
7130
|
+
const write = dereferencedElementWrite(lowerer, expr);
|
|
7131
|
+
if (write === null)
|
|
7132
|
+
return null;
|
|
7133
|
+
const loc = locOf(expr);
|
|
7134
|
+
return {
|
|
7135
|
+
kind: "block",
|
|
7136
|
+
body: [
|
|
7137
|
+
...write.stmts,
|
|
7138
|
+
{
|
|
7139
|
+
kind: "if",
|
|
7140
|
+
cond: write.present,
|
|
7141
|
+
then: [
|
|
7142
|
+
lowerer.withExpressionOverrides(write.overrides, () => lowerExprStatement(lowerer, expr)),
|
|
7143
|
+
],
|
|
7144
|
+
else_: [{ kind: "exprStmt", expr: nodeTypeError(write.message, VOID, loc), loc }],
|
|
7145
|
+
loc,
|
|
7146
|
+
},
|
|
7147
|
+
],
|
|
7148
|
+
loc,
|
|
7149
|
+
};
|
|
7150
|
+
}
|
|
6651
7151
|
export function lowerExprStatement(lowerer, expr) {
|
|
6652
7152
|
const stmtNode = expr.parent;
|
|
6653
7153
|
while (ts.isParenthesizedExpression(expr))
|
|
6654
7154
|
expr = expr.expression;
|
|
7155
|
+
// Node islands (scope-B NI-4): writes and calls on island values.
|
|
7156
|
+
if (lowerer.nodeIslands !== null) {
|
|
7157
|
+
const island = lowerIslandExpr(lowerer, expr);
|
|
7158
|
+
if (island !== null)
|
|
7159
|
+
return { kind: "exprStmt", expr: island, loc: locOf(expr) };
|
|
7160
|
+
}
|
|
6655
7161
|
// A discarded conditional has no value to merge: represent its lazy
|
|
6656
7162
|
// branch selection directly as statement control flow. In particular,
|
|
6657
7163
|
// both arms may be void calls (`flag ? emitA() : emitB()`), for which a
|
|
@@ -6890,6 +7396,11 @@ export function lowerExprStatement(lowerer, expr) {
|
|
|
6890
7396
|
if (ex)
|
|
6891
7397
|
return ex;
|
|
6892
7398
|
}
|
|
7399
|
+
{
|
|
7400
|
+
const dereferenced = lowerDereferencedElementWrite(lowerer, expr);
|
|
7401
|
+
if (dereferenced)
|
|
7402
|
+
return dereferenced;
|
|
7403
|
+
}
|
|
6893
7404
|
if (ts.isElementAccessExpression(expr.left))
|
|
6894
7405
|
return lowerer.lowerElementWrite(expr);
|
|
6895
7406
|
if (ts.isPropertyAccessExpression(expr.left)) {
|
|
@@ -7493,12 +8004,17 @@ export function lowerExprStatement(lowerer, expr) {
|
|
|
7493
8004
|
if (droppedPureStdlibStatement(lowerer, expr)) {
|
|
7494
8005
|
return { kind: "block", body: [], loc: locOf(expr) };
|
|
7495
8006
|
}
|
|
7496
|
-
if (
|
|
7497
|
-
ts.isExpressionStatement(stmtNode) &&
|
|
7498
|
-
ts.isBinaryExpression(expr) &&
|
|
8007
|
+
if (ts.isBinaryExpression(expr) &&
|
|
7499
8008
|
(expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken ||
|
|
7500
8009
|
expr.operatorToken.kind === ts.SyntaxKind.BarBarToken)) {
|
|
7501
|
-
|
|
8010
|
+
// A right operand without a value (`skip || (flag ? warnA() : warnB())`,
|
|
8011
|
+
// where both arms are void calls) leaves the logical nothing to join:
|
|
8012
|
+
// it is the branch `if (!skip) ...` wherever its result is discarded,
|
|
8013
|
+
// a for loop's initializer and update included.
|
|
8014
|
+
if (needsNoValue(lowerer, expr.right))
|
|
8015
|
+
return lowerLogicalBranch(lowerer, expr);
|
|
8016
|
+
if (stmtNode !== undefined && ts.isExpressionStatement(stmtNode))
|
|
8017
|
+
return lowerDiscardedLogical(lowerer, expr);
|
|
7502
8018
|
}
|
|
7503
8019
|
const value = lowerer.lowerExpr(expr);
|
|
7504
8020
|
// A bare unit-literal statement (`undefined;`): a pure no-op in JS,
|
|
@@ -7541,6 +8057,27 @@ function lowerDiscardedLogical(lowerer, expr) {
|
|
|
7541
8057
|
throw e;
|
|
7542
8058
|
lowerer.diags.length = diagsBefore;
|
|
7543
8059
|
}
|
|
8060
|
+
return lowerLogicalBranch(lowerer, expr);
|
|
8061
|
+
}
|
|
8062
|
+
/** True when the discarded `expr` needs no value: its type maps to void,
|
|
8063
|
+
* or it is a logical or comma expression whose last operand needs none. A
|
|
8064
|
+
* discarded logical whose right operand needs no value lowers as a branch
|
|
8065
|
+
* that runs the operand as a statement. */
|
|
8066
|
+
function needsNoValue(lowerer, expr) {
|
|
8067
|
+
while (ts.isParenthesizedExpression(expr))
|
|
8068
|
+
expr = expr.expression;
|
|
8069
|
+
if (ts.isBinaryExpression(expr) &&
|
|
8070
|
+
(expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken ||
|
|
8071
|
+
expr.operatorToken.kind === ts.SyntaxKind.BarBarToken ||
|
|
8072
|
+
expr.operatorToken.kind === ts.SyntaxKind.CommaToken))
|
|
8073
|
+
return needsNoValue(lowerer, expr.right);
|
|
8074
|
+
const type = lowerer.typeOf(expr);
|
|
8075
|
+
return ((type.flags & (ts.TypeFlags.Void | ts.TypeFlags.TypeParameter)) !== 0 &&
|
|
8076
|
+
lowerer.mapTypeOf(type)?.kind === "void");
|
|
8077
|
+
}
|
|
8078
|
+
/** `a && b` as `if (a) b;` and `a || b` as `if (!a) b;`, with `b` lowered
|
|
8079
|
+
* as a statement under the narrowing `a` gives it. */
|
|
8080
|
+
function lowerLogicalBranch(lowerer, expr) {
|
|
7544
8081
|
const and = expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken;
|
|
7545
8082
|
const cond = lowerer.lowerCondition(expr.left);
|
|
7546
8083
|
if (cond.kind === "boolLit") {
|
|
@@ -8369,7 +8906,7 @@ function lowerArrayAssignInto(lowerer, out, target, tmpRef, blame, loc) {
|
|
|
8369
8906
|
let srcType = tmpRef().type;
|
|
8370
8907
|
// A STRING source (`[a, b] = s`): the declaration path's rule in
|
|
8371
8908
|
// assignment position — the string iterator's code-point split
|
|
8372
|
-
// (
|
|
8909
|
+
// (str.codePoints, astral characters whole) into a hidden chars array,
|
|
8373
8910
|
// then the pattern proceeds as an array pattern over string[]
|
|
8374
8911
|
// (defaults with the bounds test, rest packing the remaining code
|
|
8375
8912
|
// points, elisions; positions past the last code point inherit the
|
|
@@ -8382,7 +8919,7 @@ function lowerArrayAssignInto(lowerer, out, target, tmpRef, blame, loc) {
|
|
|
8382
8919
|
out.push({
|
|
8383
8920
|
kind: "varDecl",
|
|
8384
8921
|
localId: chars.id,
|
|
8385
|
-
init: strCharsCall(
|
|
8922
|
+
init: strCharsCall(tmpRef(), loc),
|
|
8386
8923
|
loc,
|
|
8387
8924
|
});
|
|
8388
8925
|
tmpRef = () => ({ kind: "varRef", localId: chars.id, type: charsT, loc });
|
|
@@ -8599,6 +9136,84 @@ function isUntypedIterable(lowerer, node) {
|
|
|
8599
9136
|
return true;
|
|
8600
9137
|
return lowerer.mapTypeOf(type)?.kind === "dyn";
|
|
8601
9138
|
}
|
|
9139
|
+
/** `for (const x of map.get(k) ?? [])`: the receiver's checker type is one
|
|
9140
|
+
* non-array iterable beside `never[]` — the array literal's type, whose only
|
|
9141
|
+
* value is the empty array (`never` is uninhabited), so that arm yields
|
|
9142
|
+
* nothing at all. The loop walks the iterable arm under its tag test and the
|
|
9143
|
+
* empty-array arm runs zero iterations. An ARRAY iterable never needs this:
|
|
9144
|
+
* `T[] | never[]` reduces in the checker to `T[]`, never being assignable to
|
|
9145
|
+
* T. A union of two inhabited iterables has no single element type and keeps
|
|
9146
|
+
* its existing fence. */
|
|
9147
|
+
function lowerForOfEmptyArrayArm(lowerer, stmt, iterable, iterSrc, labels) {
|
|
9148
|
+
if (iterable.type.kind !== "union" || stmt.awaitModifier !== undefined)
|
|
9149
|
+
return null;
|
|
9150
|
+
const { checker } = lowerer;
|
|
9151
|
+
const widened = lowerer.typeOf(iterSrc);
|
|
9152
|
+
if (!widened.isUnionType())
|
|
9153
|
+
return null;
|
|
9154
|
+
const parts = ts.constituentTypes(widened);
|
|
9155
|
+
if (parts.length !== 2)
|
|
9156
|
+
return null;
|
|
9157
|
+
const neverArrays = parts.filter((part) => {
|
|
9158
|
+
if (!checker.isArrayType(part))
|
|
9159
|
+
return false;
|
|
9160
|
+
const elem = checker.getTypeArguments(part)[0];
|
|
9161
|
+
return elem !== undefined && (elem.flags & ts.TypeFlags.Never) !== 0;
|
|
9162
|
+
});
|
|
9163
|
+
if (neverArrays.length !== 1)
|
|
9164
|
+
return null;
|
|
9165
|
+
const other = parts.find((part) => part !== neverArrays[0]);
|
|
9166
|
+
if (other === undefined)
|
|
9167
|
+
return null;
|
|
9168
|
+
const armT = lowerer.mapTypeOf(other);
|
|
9169
|
+
if (armT === null)
|
|
9170
|
+
return null;
|
|
9171
|
+
if (armT.kind !== "set" && armT.kind !== "map" && armT.kind !== "string")
|
|
9172
|
+
return null;
|
|
9173
|
+
const tag = lowerer.armTag(iterable.type.unionId, armT);
|
|
9174
|
+
if (tag < 0)
|
|
9175
|
+
return null;
|
|
9176
|
+
const loc = locOf(stmt);
|
|
9177
|
+
// The tag test and the walk read the source once: a call or getter in the
|
|
9178
|
+
// head runs one time, and the loop walks the value the test saw.
|
|
9179
|
+
const source = lowerer.declareHiddenLocal("%forOfEmptyArm", iterable.type);
|
|
9180
|
+
const sourceRef = { kind: "varRef", localId: source.id, type: iterable.type, loc };
|
|
9181
|
+
const narrowed = {
|
|
9182
|
+
kind: "unionNarrow",
|
|
9183
|
+
unionId: iterable.type.unionId,
|
|
9184
|
+
tag,
|
|
9185
|
+
value: sourceRef,
|
|
9186
|
+
type: armT,
|
|
9187
|
+
loc,
|
|
9188
|
+
};
|
|
9189
|
+
const loop = armT.kind === "set"
|
|
9190
|
+
? lowerForOfSet(lowerer, stmt, narrowed, armT)
|
|
9191
|
+
: armT.kind === "map"
|
|
9192
|
+
? lowerForOfMap(lowerer, stmt, narrowed, armT)
|
|
9193
|
+
: lowerForOfString(lowerer, stmt, narrowed, labels);
|
|
9194
|
+
return {
|
|
9195
|
+
kind: "block",
|
|
9196
|
+
body: [
|
|
9197
|
+
{ kind: "varDecl", localId: source.id, init: iterable, loc },
|
|
9198
|
+
{
|
|
9199
|
+
kind: "if",
|
|
9200
|
+
cond: {
|
|
9201
|
+
kind: "unionIsTag",
|
|
9202
|
+
unionId: iterable.type.unionId,
|
|
9203
|
+
tag,
|
|
9204
|
+
negated: false,
|
|
9205
|
+
value: sourceRef,
|
|
9206
|
+
type: BOOL,
|
|
9207
|
+
loc,
|
|
9208
|
+
},
|
|
9209
|
+
then: [loop],
|
|
9210
|
+
else_: null,
|
|
9211
|
+
loc,
|
|
9212
|
+
},
|
|
9213
|
+
],
|
|
9214
|
+
loc,
|
|
9215
|
+
};
|
|
9216
|
+
}
|
|
8602
9217
|
export function lowerForOf(lowerer, stmt) {
|
|
8603
9218
|
// Labels consume HERE (nested statements must never see them). The
|
|
8604
9219
|
// plain array/string paths carry them; the container/matchAll/stdin
|
|
@@ -8844,6 +9459,11 @@ export function lowerForOf(lowerer, stmt) {
|
|
|
8844
9459
|
if (iterableUnion)
|
|
8845
9460
|
return lowerForOfIterable(lowerer, stmt, iterable, iterableUnion, labels);
|
|
8846
9461
|
}
|
|
9462
|
+
{
|
|
9463
|
+
const emptyArrayArm = lowerForOfEmptyArrayArm(lowerer, stmt, iterable, iterSrc, labels);
|
|
9464
|
+
if (emptyArrayArm)
|
|
9465
|
+
return emptyArrayArm;
|
|
9466
|
+
}
|
|
8847
9467
|
let tupleSource = null;
|
|
8848
9468
|
// A nested loop receiver can be an OOB-safe array read from the outer
|
|
8849
9469
|
// loop (`for (const row of grid) for (const cell of row)`). The checker
|
|
@@ -9740,16 +10360,18 @@ function lowerForOfMatchAll(lowerer, stmt, call, stored) {
|
|
|
9740
10360
|
/** `for (const ch of s)` over a STRING: JS's string iterator, which walks
|
|
9741
10361
|
* code POINTS — each pass binds the whole character (a two-unit string
|
|
9742
10362
|
* for astral chars, where charAt/slice would return one surrogate half).
|
|
9743
|
-
* Desugars over the
|
|
9744
|
-
*
|
|
9745
|
-
*
|
|
10363
|
+
* Desugars over a byte cursor into the WTF-8 data: a hidden byte offset
|
|
10364
|
+
* reads the character that starts there with the cpAtByte intrinsic and
|
|
10365
|
+
* advances by ITS byte count before the body runs (so `continue` never
|
|
10366
|
+
* skips the advance):
|
|
9746
10367
|
*
|
|
9747
10368
|
* { const %s = <expr>; let %i = 0;
|
|
9748
|
-
* while (%i < %s
|
|
10369
|
+
* while (%i < byteLength(%s)) { const ch = cpAtByte(%s, %i); %i += byteLength(ch); <body> } }
|
|
9749
10370
|
*
|
|
9750
|
-
* Strings are immutable, so the
|
|
10371
|
+
* Strings are immutable, so the byte count is stable and there is no
|
|
9751
10372
|
* iterator state to unwind on throw; a lone surrogate is a one-unit
|
|
9752
|
-
* character, so every step lands on a
|
|
10373
|
+
* character with its own three-byte encoding, so every step lands on a
|
|
10374
|
+
* character start. */
|
|
9753
10375
|
/** for-of over a CLASS ITERABLE (classIteratorOf's shape) — the
|
|
9754
10376
|
* iterator protocol as ordinary method calls:
|
|
9755
10377
|
*
|
|
@@ -9952,6 +10574,7 @@ function lowerForOfDyn(lowerer, stmt, iterable, labels, asyncLoop = false, syncO
|
|
|
9952
10574
|
const iterator = lowerer.declareHiddenLocal("%dofIterator", DYN);
|
|
9953
10575
|
const next = lowerer.declareHiddenLocal("%dofNext", DYN);
|
|
9954
10576
|
const fast = lowerer.declareHiddenLocal("%dofNative", BOOL);
|
|
10577
|
+
const generator = lowerer.declareHiddenLocal("%dofGenerator", F64);
|
|
9955
10578
|
const done = lowerer.declareHiddenLocal("%dofDone", BOOL);
|
|
9956
10579
|
done.mutable = true;
|
|
9957
10580
|
const value = lowerer.declareHiddenLocal("%dofValue", DYN);
|
|
@@ -9961,6 +10584,15 @@ function lowerForOfDyn(lowerer, stmt, iterable, labels, asyncLoop = false, syncO
|
|
|
9961
10584
|
needsClose.mutable = true;
|
|
9962
10585
|
const error = lowerer.declareHiddenLocal("%dofError", CAUGHT);
|
|
9963
10586
|
const syncIterator = asyncLoop ? lowerer.declareHiddenLocal("%dofSync", BOOL) : null;
|
|
10587
|
+
lowerer.untypedLoops.set(generator, {
|
|
10588
|
+
kind: generator.id,
|
|
10589
|
+
value: value.id,
|
|
10590
|
+
iterator: iterator.id,
|
|
10591
|
+
next: next.id,
|
|
10592
|
+
done: done.id,
|
|
10593
|
+
async: asyncLoop,
|
|
10594
|
+
sync: syncIterator?.id ?? null,
|
|
10595
|
+
});
|
|
9964
10596
|
const awaitDyn = (value) => ({
|
|
9965
10597
|
kind: "libCall",
|
|
9966
10598
|
fn: "async.awaitDyn",
|
|
@@ -10205,6 +10837,14 @@ function lowerForOfDyn(lowerer, stmt, iterable, labels, asyncLoop = false, syncO
|
|
|
10205
10837
|
: iteratorCanStep(varRef(iterator.id, DYN, loc), varRef(next.id, DYN, loc), loc),
|
|
10206
10838
|
loc,
|
|
10207
10839
|
},
|
|
10840
|
+
// Which of the program's generator types the iterator is, once
|
|
10841
|
+
// generator-dynamic-dispatch.ts knows them; 0 keeps the protocol.
|
|
10842
|
+
{
|
|
10843
|
+
kind: "varDecl",
|
|
10844
|
+
localId: generator.id,
|
|
10845
|
+
init: { kind: "numLit", value: 0, type: F64, loc },
|
|
10846
|
+
loc,
|
|
10847
|
+
},
|
|
10208
10848
|
{
|
|
10209
10849
|
kind: "varDecl",
|
|
10210
10850
|
localId: done.id,
|
|
@@ -10374,7 +11014,7 @@ function lowerForOfString(lowerer, stmt, iterable, labels) {
|
|
|
10374
11014
|
try {
|
|
10375
11015
|
const s = lowerer.declareHiddenLocal("%strof", STRING);
|
|
10376
11016
|
const i = lowerer.declareHiddenLocal("%iterof", F64);
|
|
10377
|
-
i.mutable = true; // the
|
|
11017
|
+
i.mutable = true; // the byte cursor reassigns (hidden locals default const)
|
|
10378
11018
|
const sRef = () => ({ kind: "varRef", localId: s.id, type: STRING, loc });
|
|
10379
11019
|
const iRef = () => ({ kind: "varRef", localId: i.id, type: F64, loc });
|
|
10380
11020
|
// `for (var c of str)`: the character mechanics stay on a hidden
|
|
@@ -10398,7 +11038,7 @@ function lowerForOfString(lowerer, stmt, iterable, labels) {
|
|
|
10398
11038
|
localId: ch.id,
|
|
10399
11039
|
init: {
|
|
10400
11040
|
kind: "strIntrinsic",
|
|
10401
|
-
method: "
|
|
11041
|
+
method: "cpAtByte",
|
|
10402
11042
|
receiver: sRef(),
|
|
10403
11043
|
args: [iRef()],
|
|
10404
11044
|
type: STRING,
|
|
@@ -10425,7 +11065,7 @@ function lowerForOfString(lowerer, stmt, iterable, labels) {
|
|
|
10425
11065
|
left: iRef(),
|
|
10426
11066
|
right: {
|
|
10427
11067
|
kind: "strIntrinsic",
|
|
10428
|
-
method: "
|
|
11068
|
+
method: "byteLength",
|
|
10429
11069
|
receiver: chRef,
|
|
10430
11070
|
args: [],
|
|
10431
11071
|
type: F64,
|
|
@@ -10457,7 +11097,7 @@ function lowerForOfString(lowerer, stmt, iterable, labels) {
|
|
|
10457
11097
|
left: iRef(),
|
|
10458
11098
|
right: {
|
|
10459
11099
|
kind: "strIntrinsic",
|
|
10460
|
-
method: "
|
|
11100
|
+
method: "byteLength",
|
|
10461
11101
|
receiver: sRef(),
|
|
10462
11102
|
args: [],
|
|
10463
11103
|
type: F64,
|
|
@@ -10503,11 +11143,8 @@ function lowerForOfString(lowerer, stmt, iterable, labels) {
|
|
|
10503
11143
|
* own-keys snapshot, verified against Node) while each visit re-checks
|
|
10504
11144
|
* presence (i < live length), so pops during the body skip exactly
|
|
10505
11145
|
* like Node. Sparse arrays cannot exist here (hole creation traps).
|
|
10506
|
-
* - globalThis:
|
|
10507
|
-
* global
|
|
10508
|
-
* properties, so the enumeration is honestly EMPTY (zero iterations;
|
|
10509
|
-
* the body typechecked but never evaluates — SEMANTICS.md documents
|
|
10510
|
-
* the divergence).
|
|
11146
|
+
* - globalThis: Node 24's enumerable globals in Node's order, then the
|
|
11147
|
+
* program's own global properties, as keys of a fresh object.
|
|
10511
11148
|
* - JavaScript program classes use their live property-creation table.
|
|
10512
11149
|
* TypeScript and runtime-owned layouts keep the class-instance fence.
|
|
10513
11150
|
* Bindings mirror for-of's: const/let declare the per-iteration string
|
|
@@ -10517,10 +11154,11 @@ function lowerForOfString(lowerer, stmt, iterable, labels) {
|
|
|
10517
11154
|
function lowerForIn(lowerer, stmt) {
|
|
10518
11155
|
const labels = lowerer.takeLabels();
|
|
10519
11156
|
const loc = locOf(stmt);
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
11157
|
+
// The global object visits Node's enumerable globals, then the
|
|
11158
|
+
// program's own global properties (scr_global_for_in_object).
|
|
11159
|
+
let receiver = stdlibGlobalNameOf(lowerer, stmt.expression) === "globalThis"
|
|
11160
|
+
? { kind: "libCall", fn: "global.forInObject", args: [], type: DYN, loc }
|
|
11161
|
+
: lowerer.lowerExpr(stmt.expression);
|
|
10524
11162
|
if (receiver.type.kind === "object") {
|
|
10525
11163
|
const info = lowerer.classes.get(receiver.type.className);
|
|
10526
11164
|
let root = info;
|