@scriptc/compiler 0.4.7 → 0.4.8
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/child_process.d.ts +71 -22
- package/ambient/node-fallback/crypto.d.ts +15 -7
- package/ambient/node-fallback/events.d.ts +23 -5
- package/ambient/node-fallback/fs.d.ts +3 -2
- package/ambient/node-fallback/http.d.ts +23 -17
- package/ambient/node-fallback/https.d.ts +5 -2
- package/ambient/node-fallback/net.d.ts +6 -0
- package/ambient/node-fallback/os.d.ts +11 -1
- package/ambient/node-fallback/path-posix.d.ts +6 -0
- package/ambient/node-fallback/path-win32.d.ts +5 -0
- package/ambient/node-fallback/path.d.ts +2 -0
- package/ambient/node-fallback/zlib.d.ts +31 -2
- package/ambient/scriptc-node-fallback.d.ts +37 -7
- package/ambient/scriptc.d.ts +7 -2
- package/dist/backend/executable-features.js +11 -3
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/library-pack.d.ts +6 -0
- package/dist/backend/library-pack.js +17 -6
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/library-pack.test.d.ts +1 -0
- package/dist/backend/library-pack.test.js +28 -0
- package/dist/backend/library-pack.test.js.map +1 -0
- package/dist/backend/linker.d.ts +9 -2
- package/dist/backend/linker.js +190 -32
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/lld.d.ts +8 -4
- package/dist/backend/lld.js +19 -13
- package/dist/backend/lld.js.map +1 -1
- package/dist/backend/lld.test.js +3 -1
- package/dist/backend/lld.test.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +15 -2
- package/dist/backend/llvm/alloc.js +172 -36
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/alloc.test.js +69 -1
- package/dist/backend/llvm/alloc.test.js.map +1 -1
- package/dist/backend/llvm/arenas.d.ts +17 -4
- package/dist/backend/llvm/arenas.js +105 -10
- package/dist/backend/llvm/arenas.js.map +1 -1
- package/dist/backend/llvm/arenas.test.js +229 -0
- package/dist/backend/llvm/arenas.test.js.map +1 -1
- package/dist/backend/llvm/bytes-alias.js +10 -1
- package/dist/backend/llvm/bytes-alias.js.map +1 -1
- package/dist/backend/llvm/bytes-headers.js +6 -0
- package/dist/backend/llvm/bytes-headers.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +25 -0
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.js +10 -0
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +16 -9
- package/dist/backend/llvm/classes.js +142 -37
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +42 -0
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/cpu-dispatch.d.ts +15 -5
- package/dist/backend/llvm/cpu-dispatch.js +31 -7
- package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +12 -3
- package/dist/backend/llvm/dyn.js +31 -7
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +67 -4
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-module.js +90 -39
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-module.test.d.ts +1 -0
- package/dist/backend/llvm/emit-module.test.js +52 -0
- package/dist/backend/llvm/emit-module.test.js.map +1 -0
- package/dist/backend/llvm/emit-statements.js +99 -15
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +113 -8
- package/dist/backend/llvm/emitter.js +438 -67
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +31 -3
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +19 -1
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +16 -1
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +18 -2
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +31 -10
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +31 -3
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.d.ts +1 -1
- package/dist/backend/llvm/expr-records.js +124 -56
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +17 -0
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/js-groups.d.ts +21 -0
- package/dist/backend/llvm/js-groups.js +277 -0
- package/dist/backend/llvm/js-groups.js.map +1 -0
- package/dist/backend/llvm/js-ic.d.ts +19 -1
- package/dist/backend/llvm/js-ic.js +96 -23
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +132 -1
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +33 -6
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +44 -3
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +69 -2
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +32 -0
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/loop-state.js +7 -2
- package/dist/backend/llvm/loop-state.js.map +1 -1
- package/dist/backend/llvm/map-entry-fusion.d.ts +8 -0
- package/dist/backend/llvm/map-entry-fusion.js +3 -3
- package/dist/backend/llvm/map-entry-fusion.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.js +6 -6
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.js +7 -6
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.test.js +4 -1
- package/dist/backend/llvm/nullable-unions.test.js.map +1 -1
- package/dist/backend/llvm/receivers.js +3 -0
- package/dist/backend/llvm/receivers.js.map +1 -1
- package/dist/backend/llvm/record-entry-fusion.d.ts +32 -0
- package/dist/backend/llvm/record-entry-fusion.js +217 -0
- package/dist/backend/llvm/record-entry-fusion.js.map +1 -0
- package/dist/backend/llvm/record-results.d.ts +5 -2
- package/dist/backend/llvm/record-results.js +13 -12
- package/dist/backend/llvm/record-results.js.map +1 -1
- package/dist/backend/llvm/record-views.js +12 -6
- package/dist/backend/llvm/record-views.js.map +1 -1
- package/dist/backend/llvm/reference-effects.js +1 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +3 -0
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/region-ir.js +1 -0
- package/dist/backend/llvm/region-ir.js.map +1 -1
- package/dist/backend/llvm/region-sites.d.ts +18 -0
- package/dist/backend/llvm/region-sites.js +79 -1
- package/dist/backend/llvm/region-sites.js.map +1 -1
- package/dist/backend/llvm/runtime-registries.test.js +53 -6
- package/dist/backend/llvm/runtime-registries.test.js.map +1 -1
- package/dist/backend/llvm/serialized-ir-emission.test.js +3 -1
- package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +33 -3
- package/dist/backend/llvm/shapes.js +183 -13
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/stack-objects.d.ts +1 -2
- package/dist/backend/llvm/stack-objects.js +8 -5
- package/dist/backend/llvm/stack-objects.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +12 -0
- package/dist/backend/llvm/walkers.js +46 -2
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/may-throw.js +12 -2
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +13 -0
- package/dist/backend/may-throw.test.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +48 -8
- package/dist/backend/native/executable.js +55 -13
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/helper-identity-record.d.ts +11 -0
- package/dist/backend/native/helper-identity-record.js +76 -0
- package/dist/backend/native/helper-identity-record.js.map +1 -0
- package/dist/backend/native/helper-identity-record.test.d.ts +1 -0
- package/dist/backend/native/helper-identity-record.test.js +101 -0
- package/dist/backend/native/helper-identity-record.test.js.map +1 -0
- package/dist/backend/native/library.js +9 -1
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native/runtime-inputs.js +4 -1
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native/vendor.js +1 -1
- package/dist/backend/native/vendor.js.map +1 -1
- package/dist/backend/native-codegen-core.d.ts +13 -10
- package/dist/backend/native-codegen-core.js +26 -13
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.js +27 -8
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +110 -14
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +37 -8
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/runtime-pack-core.d.ts +17 -2
- package/dist/backend/runtime-pack-core.js +18 -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-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +211 -2
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/tree-classes.d.ts +42 -0
- package/dist/backend/tree-classes.js +723 -0
- package/dist/backend/tree-classes.js.map +1 -0
- package/dist/backend/tree-classes.test.d.ts +1 -0
- package/dist/backend/tree-classes.test.js +338 -0
- package/dist/backend/tree-classes.test.js.map +1 -0
- package/dist/backend/vendor-archives.d.ts +5 -1
- package/dist/backend/vendor-archives.js +51 -7
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +25 -4
- package/dist/backend/vendor-inputs.js +68 -4
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/vendor-inputs.test.js +35 -1
- package/dist/backend/vendor-inputs.test.js.map +1 -1
- package/dist/backend/warm-cache.js +1 -1
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/compat/fetch-profile.js +2 -2
- package/dist/coverage/report.js +47 -0
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +1 -1
- package/dist/diagnostics/codes.d.ts +8 -0
- package/dist/diagnostics/codes.js +8 -0
- package/dist/diagnostics/codes.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +27 -9
- package/dist/diagnostics/diagnostic.js +60 -19
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +18 -0
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +21 -2
- package/dist/executable/executable-cache.js +21 -1
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +123 -1
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +199 -248
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +200 -18
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/builtin-modules.d.ts +4 -0
- package/dist/frontend/builtin-modules.js +10 -0
- package/dist/frontend/builtin-modules.js.map +1 -1
- package/dist/frontend/early-errors.d.ts +12 -2
- package/dist/frontend/early-errors.js +535 -4
- package/dist/frontend/early-errors.js.map +1 -1
- package/dist/frontend/early-errors.test.js +165 -0
- package/dist/frontend/early-errors.test.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.test.js +65 -0
- package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
- package/dist/frontend/jsx-opinion-sites.test.d.ts +1 -0
- package/dist/frontend/jsx-opinion-sites.test.js +86 -0
- package/dist/frontend/jsx-opinion-sites.test.js.map +1 -0
- package/dist/frontend/lib-exports.d.ts +23 -4
- package/dist/frontend/lib-exports.js +98 -26
- package/dist/frontend/lib-exports.js.map +1 -1
- package/dist/frontend/lowering/binding-analysis.js +21 -3
- package/dist/frontend/lowering/binding-analysis.js.map +1 -1
- package/dist/frontend/lowering/buffers.d.ts +8 -0
- package/dist/frontend/lowering/buffers.js +43 -0
- package/dist/frontend/lowering/buffers.js.map +1 -0
- package/dist/frontend/lowering/builtin-calls.js +4 -0
- package/dist/frontend/lowering/builtin-calls.js.map +1 -1
- package/dist/frontend/lowering/builtin-namespaces.d.ts +3 -2
- package/dist/frontend/lowering/builtin-namespaces.js +24 -3
- package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
- package/dist/frontend/lowering/builtin-statics.d.ts +24 -0
- package/dist/frontend/lowering/builtin-statics.js +407 -0
- package/dist/frontend/lowering/builtin-statics.js.map +1 -0
- package/dist/frontend/lowering/builtins/arguments.d.ts +4 -0
- package/dist/frontend/lowering/builtins/arguments.js +12 -0
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/atomics.d.ts +6 -1
- package/dist/frontend/lowering/builtins/atomics.js +87 -1
- package/dist/frontend/lowering/builtins/atomics.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.js +2 -2
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-sync.d.ts +13 -0
- package/dist/frontend/lowering/builtins/child-process-sync.js +1 -13
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process.d.ts +10 -4
- package/dist/frontend/lowering/builtins/child-process.js +560 -27
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
- package/dist/frontend/lowering/builtins/compression.d.ts +2 -2
- package/dist/frontend/lowering/builtins/compression.js +41 -21
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/constants.js +7 -2
- package/dist/frontend/lowering/builtins/constants.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +1 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js +28 -2
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +4 -0
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-calls.js +3 -1
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.d.ts +4 -1
- package/dist/frontend/lowering/builtins/numbers.js +10 -2
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/operating-system.d.ts +6 -3
- package/dist/frontend/lowering/builtins/operating-system.js +96 -16
- package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.d.ts +2 -2
- package/dist/frontend/lowering/builtins/process.js +103 -8
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +169 -8
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/properties.js +6 -2
- package/dist/frontend/lowering/builtins/properties.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +6 -4
- package/dist/frontend/lowering/builtins/readline.js +180 -36
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.js +35 -12
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/builtins/webassembly.js +2 -0
- package/dist/frontend/lowering/builtins/webassembly.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.d.ts +10 -0
- package/dist/frontend/lowering/call-arguments.js +37 -2
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.d.ts +10 -0
- package/dist/frontend/lowering/call-signatures.js +103 -0
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-construction.d.ts +14 -2
- package/dist/frontend/lowering/class-construction.js +99 -5
- package/dist/frontend/lowering/class-construction.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +9 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +1283 -1030
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +158 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.js +20 -15
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-runtime-statics.d.ts +8 -0
- package/dist/frontend/lowering/class-runtime-statics.js +20 -1
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
- package/dist/frontend/lowering/class-unions.js +21 -4
- package/dist/frontend/lowering/class-unions.js.map +1 -1
- package/dist/frontend/lowering/coercions/function-adapters.js +9 -0
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +8 -0
- package/dist/frontend/lowering/coercions/state.js +17 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +20 -5
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +10 -1
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.d.ts +2 -1
- package/dist/frontend/lowering/coercions/unions.js +54 -10
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/constructor-returns.d.ts +23 -2
- package/dist/frontend/lowering/constructor-returns.js +284 -58
- package/dist/frontend/lowering/constructor-returns.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +156 -62
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +21 -3
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-from-async.js +139 -3
- package/dist/frontend/lowering/containers/array-from-async.js.map +1 -1
- package/dist/frontend/lowering/containers/array-iteration.d.ts +14 -4
- package/dist/frontend/lowering/containers/array-iteration.js +24 -7
- package/dist/frontend/lowering/containers/array-iteration.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +14 -11
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.d.ts +6 -0
- package/dist/frontend/lowering/containers/bytes.js +446 -86
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.d.ts +5 -0
- package/dist/frontend/lowering/containers/callback-arguments.js +21 -12
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-grouping.js +421 -2
- package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +52 -17
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/iterator-helpers.d.ts +23 -0
- package/dist/frontend/lowering/containers/iterator-helpers.js +176 -10
- package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +5 -2
- package/dist/frontend/lowering/containers/string-and-regexp.js +45 -11
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/crypto-tables.d.ts +3 -3
- package/dist/frontend/lowering/crypto-tables.js +5 -5
- package/dist/frontend/lowering/dispatch-sites.js +3 -0
- package/dist/frontend/lowering/dispatch-sites.js.map +1 -1
- package/dist/frontend/lowering/divergences.d.ts +40 -0
- package/dist/frontend/lowering/divergences.js +239 -20
- package/dist/frontend/lowering/divergences.js.map +1 -1
- package/dist/frontend/lowering/effect-free.d.ts +12 -0
- package/dist/frontend/lowering/effect-free.js +44 -0
- package/dist/frontend/lowering/effect-free.js.map +1 -0
- package/dist/frontend/lowering/expressions/array-literals.d.ts +10 -0
- package/dist/frontend/lowering/expressions/array-literals.js +62 -0
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +115 -5
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +151 -7
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +15 -0
- package/dist/frontend/lowering/expressions/hosted-narrowing.js +54 -1
- package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +31 -2
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.d.ts +3 -0
- package/dist/frontend/lowering/expressions/narrowing.js +175 -22
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +173 -11
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +5 -1
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +8 -0
- package/dist/frontend/lowering/expressions/property-access.js +379 -109
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +237 -7
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/typeof.js +8 -0
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-fields.d.ts +20 -1
- package/dist/frontend/lowering/expressions/union-fields.js +103 -13
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +74 -55
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/function-returns.js +37 -10
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/general-streams.js +5 -0
- package/dist/frontend/lowering/general-streams.js.map +1 -1
- package/dist/frontend/lowering/generator-delegation.d.ts +15 -7
- package/dist/frontend/lowering/generator-delegation.js +301 -118
- package/dist/frontend/lowering/generator-delegation.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +27 -1
- package/dist/frontend/lowering/generic-functions.js +432 -18
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/global-function-values.d.ts +25 -0
- package/dist/frontend/lowering/global-function-values.js +193 -0
- package/dist/frontend/lowering/global-function-values.js.map +1 -0
- package/dist/frontend/lowering/global-values.d.ts +6 -4
- package/dist/frontend/lowering/global-values.js +24 -10
- package/dist/frontend/lowering/global-values.js.map +1 -1
- package/dist/frontend/lowering/host-global-values.d.ts +31 -0
- package/dist/frontend/lowering/host-global-values.js +121 -0
- package/dist/frontend/lowering/host-global-values.js.map +1 -0
- package/dist/frontend/lowering/host-globals.d.ts +74 -0
- package/dist/frontend/lowering/host-globals.js +344 -0
- package/dist/frontend/lowering/host-globals.js.map +1 -0
- package/dist/frontend/lowering/http2-constants.js +1 -1
- package/dist/frontend/lowering/iterator-adapters.js +46 -17
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/iterator-prototype.d.ts +30 -0
- package/dist/frontend/lowering/iterator-prototype.js +160 -0
- package/dist/frontend/lowering/iterator-prototype.js.map +1 -0
- package/dist/frontend/lowering/key-order-witness.js +43 -22
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.test.js +1 -0
- package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.js +11 -3
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +30 -15
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.d.ts +11 -0
- package/dist/frontend/lowering/lower-async-iteration.js +15 -0
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.js +11 -1
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +25 -0
- package/dist/frontend/lowering/lower-calls.js +929 -227
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.test.js +59 -16
- package/dist/frontend/lowering/lower-calls.test.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +20 -0
- package/dist/frontend/lowering/lower-classes.js +468 -44
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.d.ts +6 -2
- package/dist/frontend/lowering/lower-event-emitter.js +253 -83
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +1 -1
- package/dist/frontend/lowering/lower-exprs.js +71 -20
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +25 -6
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +57 -10
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.d.ts +6 -0
- package/dist/frontend/lowering/lower-global-value.js +14 -5
- package/dist/frontend/lowering/lower-global-value.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +4 -0
- package/dist/frontend/lowering/lower-inspect.js +638 -64
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +48 -2
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.js +18 -0
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-island.js +16 -6
- package/dist/frontend/lowering/lower-node-island.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +303 -87
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.js +45 -0
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +14 -11
- package/dist/frontend/lowering/lower-stmts.js +270 -52
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +110 -27
- package/dist/frontend/lowering/lower-timers.js.map +1 -1
- package/dist/frontend/lowering/lower-url.js +6 -3
- package/dist/frontend/lowering/lower-url.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +227 -21
- package/dist/frontend/lowering/lowerer.js +651 -92
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +18 -0
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/lowering-facts.d.ts +110 -0
- package/dist/frontend/lowering/lowering-facts.js +323 -0
- package/dist/frontend/lowering/lowering-facts.js.map +1 -0
- package/dist/frontend/lowering/lowering-facts.test.d.ts +1 -0
- package/dist/frontend/lowering/lowering-facts.test.js +100 -0
- package/dist/frontend/lowering/lowering-facts.test.js.map +1 -0
- package/dist/frontend/lowering/nan-coded-reads.d.ts +27 -4
- package/dist/frontend/lowering/nan-coded-reads.js +112 -9
- package/dist/frontend/lowering/nan-coded-reads.js.map +1 -1
- package/dist/frontend/lowering/optional-arguments.d.ts +4 -0
- package/dist/frontend/lowering/optional-arguments.js +26 -2
- package/dist/frontend/lowering/optional-arguments.js.map +1 -1
- package/dist/frontend/lowering/partial-assertions.d.ts +0 -3
- package/dist/frontend/lowering/partial-assertions.js +9 -15
- package/dist/frontend/lowering/partial-assertions.js.map +1 -1
- package/dist/frontend/lowering/primitive-throws.d.ts +100 -0
- package/dist/frontend/lowering/primitive-throws.js +241 -0
- package/dist/frontend/lowering/primitive-throws.js.map +1 -0
- package/dist/frontend/lowering/primitive-wrappers.js +1 -0
- package/dist/frontend/lowering/primitive-wrappers.js.map +1 -1
- package/dist/frontend/lowering/record-inherited.d.ts +17 -1
- package/dist/frontend/lowering/record-inherited.js +16 -2
- package/dist/frontend/lowering/record-inherited.js.map +1 -1
- package/dist/frontend/lowering/record-links.d.ts +73 -0
- package/dist/frontend/lowering/record-links.js +797 -0
- package/dist/frontend/lowering/record-links.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-provenance.d.ts +27 -7
- package/dist/frontend/lowering/runtime-optional-provenance.js +25 -11
- package/dist/frontend/lowering/runtime-optional-provenance.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-report.d.ts +40 -0
- package/dist/frontend/lowering/runtime-optional-report.js +300 -0
- package/dist/frontend/lowering/runtime-optional-report.js.map +1 -0
- package/dist/frontend/lowering/scoped-type-memo.test.d.ts +1 -0
- package/dist/frontend/lowering/scoped-type-memo.test.js +86 -0
- package/dist/frontend/lowering/scoped-type-memo.test.js.map +1 -0
- package/dist/frontend/lowering/static-typeof.d.ts +3 -1
- package/dist/frontend/lowering/static-typeof.js +6 -1
- package/dist/frontend/lowering/static-typeof.js.map +1 -1
- package/dist/frontend/lowering/strict-mode.d.ts +1 -5
- package/dist/frontend/lowering/strict-mode.js +4 -30
- package/dist/frontend/lowering/strict-mode.js.map +1 -1
- package/dist/frontend/lowering/structural-instances.d.ts +7 -0
- package/dist/frontend/lowering/structural-instances.js +23 -0
- package/dist/frontend/lowering/structural-instances.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +15 -1
- package/dist/frontend/lowering/surfaces.js +78 -10
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/union-retag.d.ts +13 -1
- package/dist/frontend/lowering/union-retag.js +55 -1
- package/dist/frontend/lowering/union-retag.js.map +1 -1
- package/dist/frontend/lowering/union-retag.test.js +51 -0
- package/dist/frontend/lowering/union-retag.test.js.map +1 -1
- package/dist/frontend/lowering/unit-journal.d.ts +8 -0
- package/dist/frontend/lowering/unit-journal.js +14 -0
- package/dist/frontend/lowering/unit-journal.js.map +1 -1
- package/dist/frontend/lowering/unit-journal.test.js +36 -1
- package/dist/frontend/lowering/unit-journal.test.js.map +1 -1
- package/dist/frontend/lowering/zlib-constants.js +3 -2
- package/dist/frontend/lowering/zlib-constants.js.map +1 -1
- package/dist/frontend/npm-static.js +78 -9
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm-static.test.js +95 -2
- package/dist/frontend/npm-static.test.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +5 -4
- package/dist/frontend/pipeline.js +94 -31
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/pipeline.test.js +68 -11
- package/dist/frontend/pipeline.test.js.map +1 -1
- package/dist/frontend/program.d.ts +62 -2
- package/dist/frontend/program.js +695 -422
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +37 -1
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/services-node.d.ts +7 -0
- package/dist/frontend/services-node.js +32 -1
- package/dist/frontend/services-node.js.map +1 -1
- package/dist/frontend/services-node.test.js +51 -0
- package/dist/frontend/services-node.test.js.map +1 -1
- package/dist/frontend/shape-inference/overlay.js +68 -2
- package/dist/frontend/shape-inference/overlay.js.map +1 -1
- package/dist/frontend/tier-analysis.d.ts +9 -0
- package/dist/frontend/tier-analysis.js +1 -0
- package/dist/frontend/tier-analysis.js.map +1 -1
- package/dist/frontend/tsc-codes.d.ts +57 -3
- package/dist/frontend/tsc-codes.js +935 -150
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/tsc-codes.test.js +221 -12
- package/dist/frontend/tsc-codes.test.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +91 -9
- package/dist/frontend/type-mapper.js +622 -181
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +80 -15
- package/dist/index.js.map +1 -1
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +60 -0
- package/dist/index.test.js.map +1 -0
- package/dist/ir/builtin-effects.js +43 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +242 -16
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/callback-specialization.d.ts +3 -2
- package/dist/ir/callback-specialization.js +35 -25
- package/dist/ir/callback-specialization.js.map +1 -1
- package/dist/ir/capture-values.d.ts +8 -4
- package/dist/ir/capture-values.js +9 -6
- package/dist/ir/capture-values.js.map +1 -1
- package/dist/ir/char-unit-locals.d.ts +6 -2
- package/dist/ir/char-unit-locals.js +11 -2
- package/dist/ir/char-unit-locals.js.map +1 -1
- package/dist/ir/class-key-index.d.ts +18 -0
- package/dist/ir/class-key-index.js +29 -0
- package/dist/ir/class-key-index.js.map +1 -0
- package/dist/ir/class-key-index.test.d.ts +1 -0
- package/dist/ir/class-key-index.test.js +25 -0
- package/dist/ir/class-key-index.test.js.map +1 -0
- package/dist/ir/codec.generated.d.ts +1 -1
- package/dist/ir/codec.generated.js +724 -648
- package/dist/ir/codec.generated.js.map +1 -1
- package/dist/ir/constant-globals.d.ts +5 -2
- package/dist/ir/constant-globals.js +25 -27
- package/dist/ir/constant-globals.js.map +1 -1
- package/dist/ir/expression-inlining.d.ts +4 -2
- package/dist/ir/expression-inlining.js +8 -2
- package/dist/ir/expression-inlining.js.map +1 -1
- package/dist/ir/field-values.d.ts +5 -2
- package/dist/ir/field-values.js +32 -21
- package/dist/ir/field-values.js.map +1 -1
- package/dist/ir/fields.generated.d.ts +11 -2
- package/dist/ir/fields.generated.js +8 -0
- package/dist/ir/fields.generated.js.map +1 -1
- package/dist/ir/final-fields.js +1 -1
- package/dist/ir/final-fields.js.map +1 -1
- package/dist/ir/function-references.d.ts +5 -4
- package/dist/ir/function-references.js +7 -4
- package/dist/ir/function-references.js.map +1 -1
- package/dist/ir/function-references.test.js +7 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/init-only-globals.d.ts +4 -2
- package/dist/ir/init-only-globals.js +17 -18
- package/dist/ir/init-only-globals.js.map +1 -1
- package/dist/ir/inline-array-views.js +1 -0
- package/dist/ir/inline-array-views.js.map +1 -1
- package/dist/ir/int32-slots.js +7 -0
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/ir.d.ts +59 -4
- package/dist/ir/ir.js +7 -0
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/js-groups.d.ts +51 -0
- package/dist/ir/js-groups.js +394 -0
- package/dist/ir/js-groups.js.map +1 -0
- package/dist/ir/js-groups.test.d.ts +1 -0
- package/dist/ir/js-groups.test.js +555 -0
- package/dist/ir/js-groups.test.js.map +1 -0
- package/dist/ir/js-ic.js +30 -5
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +27 -1
- package/dist/ir/js-ic.test.js.map +1 -1
- package/dist/ir/node-index.d.ts +23 -6
- package/dist/ir/node-index.js +126 -49
- package/dist/ir/node-index.js.map +1 -1
- package/dist/ir/numeric-call-specialization.d.ts +4 -2
- package/dist/ir/numeric-call-specialization.js +40 -26
- package/dist/ir/numeric-call-specialization.js.map +1 -1
- package/dist/ir/paired-while-loops.d.ts +4 -2
- package/dist/ir/paired-while-loops.js +8 -2
- package/dist/ir/paired-while-loops.js.map +1 -1
- package/dist/ir/parameter-versions.d.ts +13 -4
- package/dist/ir/parameter-versions.js +63 -42
- package/dist/ir/parameter-versions.js.map +1 -1
- package/dist/ir/property-bags.d.ts +4 -2
- package/dist/ir/property-bags.js +22 -17
- package/dist/ir/property-bags.js.map +1 -1
- package/dist/ir/row-pairs.d.ts +4 -2
- package/dist/ir/row-pairs.js +12 -11
- package/dist/ir/row-pairs.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +87 -12
- package/dist/ir/runtime-features.js +263 -160
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/runtime-features.test.js +109 -139
- package/dist/ir/runtime-features.test.js.map +1 -1
- package/dist/ir/runtime-jam-loops.d.ts +35 -0
- package/dist/ir/runtime-jam-loops.js +604 -0
- package/dist/ir/runtime-jam-loops.js.map +1 -0
- package/dist/ir/runtime-jam-loops.test.d.ts +1 -0
- package/dist/ir/runtime-jam-loops.test.js +565 -0
- package/dist/ir/runtime-jam-loops.test.js.map +1 -0
- package/dist/ir/saturating-loop-jams.d.ts +4 -2
- package/dist/ir/saturating-loop-jams.js +11 -10
- package/dist/ir/saturating-loop-jams.js.map +1 -1
- package/dist/ir/scalar-records.d.ts +5 -2
- package/dist/ir/scalar-records.js +12 -2
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/self-captures.d.ts +4 -2
- package/dist/ir/self-captures.js +32 -27
- package/dist/ir/self-captures.js.map +1 -1
- package/dist/ir/serialize.d.ts +6 -1
- package/dist/ir/serialize.js +87 -23
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.js +26 -0
- package/dist/ir/serialize.test.js.map +1 -1
- package/dist/ir/tiers.js +1 -0
- package/dist/ir/tiers.js.map +1 -1
- package/dist/ir/traverse.js +4 -0
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/typed-argument-clones.d.ts +30 -0
- package/dist/ir/typed-argument-clones.js +789 -0
- package/dist/ir/typed-argument-clones.js.map +1 -0
- package/dist/ir/union-arm-loops.d.ts +3 -0
- package/dist/ir/union-arm-loops.js +373 -0
- package/dist/ir/union-arm-loops.js.map +1 -0
- package/dist/ir/union-arm-loops.test.d.ts +1 -0
- package/dist/ir/union-arm-loops.test.js +230 -0
- package/dist/ir/union-arm-loops.test.js.map +1 -0
- package/dist/ir/validate.js +88 -18
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/compiler-self-identity.d.ts +8 -2
- package/dist/library/compiler-self-identity.js +92 -18
- package/dist/library/compiler-self-identity.js.map +1 -1
- package/dist/library/compiler-self-identity.test.js +150 -3
- package/dist/library/compiler-self-identity.test.js.map +1 -1
- package/dist/library/int-infer.d.ts +5 -0
- package/dist/library/int-infer.js +15 -3
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/ir-policy.js +1 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/library/library-cache.d.ts +4 -0
- package/dist/library/library-cache.js +2 -0
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +26 -0
- package/dist/library/library-cache.test.js.map +1 -1
- package/dist/library/prepare.js +99 -31
- package/dist/library/prepare.js.map +1 -1
- package/dist/native/cache.d.ts +7 -0
- package/dist/native/cache.js +47 -0
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cache.test.js +13 -1
- package/dist/native/cache.test.js.map +1 -1
- package/dist/native/cli.js +1 -1
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +18 -3
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/executable-cache-open.test.js +31 -5
- package/dist/native/executable-cache-open.test.js.map +1 -1
- package/dist/native/executable-cache.d.ts +6 -1
- package/dist/native/executable-cache.js +7 -1
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/prepare.d.ts +3 -0
- package/dist/native/prepare.js +43 -26
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +25 -3
- package/dist/native/prepare.test.js.map +1 -1
- package/dist/native/sanitizer.js +10 -1
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +7 -2
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/node-islands/boundary.d.ts +12 -0
- package/dist/node-islands/boundary.js +38 -6
- package/dist/node-islands/boundary.js.map +1 -1
- package/dist/node-islands/boundary.test.d.ts +1 -0
- package/dist/node-islands/boundary.test.js +76 -0
- package/dist/node-islands/boundary.test.js.map +1 -0
- package/dist/node-islands/detect.d.ts +9 -0
- package/dist/node-islands/detect.js +110 -0
- package/dist/node-islands/detect.js.map +1 -1
- package/dist/node-islands/detect.test.js +24 -0
- package/dist/node-islands/detect.test.js.map +1 -1
- package/dist/node-islands/graph-islands.d.ts +40 -0
- package/dist/node-islands/graph-islands.js +128 -0
- package/dist/node-islands/graph-islands.js.map +1 -0
- package/dist/node-islands/growth.d.ts +57 -0
- package/dist/node-islands/growth.js +205 -0
- package/dist/node-islands/growth.js.map +1 -0
- package/dist/node-islands/report.d.ts +12 -0
- package/dist/node-islands/report.js +28 -0
- package/dist/node-islands/report.js.map +1 -1
- package/dist/node-islands/report.test.js +2 -0
- package/dist/node-islands/report.test.js.map +1 -1
- package/dist/node-islands/rules.js +5 -0
- package/dist/node-islands/rules.js.map +1 -1
- package/dist/node-islands/scan.d.ts +11 -2
- package/dist/node-islands/scan.js +61 -9
- package/dist/node-islands/scan.js.map +1 -1
- package/dist/wasm/translate.js +11 -5
- package/dist/wasm/translate.js.map +1 -1
- package/dist/wasm/translate.test.js +35 -0
- package/dist/wasm/translate.test.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +184 -117
|
@@ -106,6 +106,22 @@ export interface GenericFnInfo {
|
|
|
106
106
|
* JavaScript has one. */
|
|
107
107
|
valueInstances?: Set<string>;
|
|
108
108
|
}
|
|
109
|
+
/** The temporal-dead-zone flag of a module-scope generic ALIAS binding
|
|
110
|
+
* (`const h = id`): an alias names a generic declaration, so it has no
|
|
111
|
+
* runtime value of its own — a read that can run before the declaration
|
|
112
|
+
* checks this flag instead of a binding. */
|
|
113
|
+
export interface GenericAliasPresence {
|
|
114
|
+
flagId: string;
|
|
115
|
+
name: string;
|
|
116
|
+
decl: ts.VariableDeclaration;
|
|
117
|
+
/** A `let`/`const` declaration (a temporal dead zone, where an early
|
|
118
|
+
* read throws before a call's arguments run) or a `var` (undefined,
|
|
119
|
+
* where an early call runs the arguments and throws "is not a
|
|
120
|
+
* function"). */
|
|
121
|
+
lexical: boolean;
|
|
122
|
+
/** useRunsAfter's answers for the declarations it placed. */
|
|
123
|
+
ordering: Map<ts.Node, boolean>;
|
|
124
|
+
}
|
|
109
125
|
/** One enclosing-frame value a generic arrow/function-expression binding
|
|
110
126
|
* reads (GenericFnInfo.captures). `nameNode` is the binding's own
|
|
111
127
|
* declaration identifier: declaring a local for it binds the SYMBOL, so
|
|
@@ -247,12 +263,19 @@ export declare function checkGenericIdentityPins(lowerer: Lowerer): void;
|
|
|
247
263
|
* aliasing bindings and property initializers) from that declaration. Used
|
|
248
264
|
* where a comparison reads the value through `unknown`/`any`, so the
|
|
249
265
|
* declaration is not syntactically at the compared site. */
|
|
250
|
-
export declare function genericDeclarationBehindValue(lowerer: Lowerer, node: ts.Node): GenericFnInfo | null;
|
|
266
|
+
export declare function genericDeclarationBehindValue(lowerer: Lowerer, node: ts.Node, requireConst?: boolean): GenericFnInfo | null;
|
|
251
267
|
/** An identity comparison at the dynamic boundary (`unknown`/`any`
|
|
252
268
|
* operands): when either operand reads a generic declaration's value
|
|
253
269
|
* instance, the comparison is exact only while the program holds that
|
|
254
270
|
* declaration at one signature (checkGenericIdentityPins). */
|
|
255
271
|
export declare function noteDynamicIdentityComparison(lowerer: Lowerer, node: ts.Node, left: ts.Node, right: ts.Node): void;
|
|
272
|
+
/** An identity comparison of two function-typed values (`g === h`), where
|
|
273
|
+
* either side may name a value instance of a generic declaration: two pins
|
|
274
|
+
* of one declaration at different signatures are separate compiled
|
|
275
|
+
* closures, so the pointer compare would answer false where JavaScript
|
|
276
|
+
* answers true (one function object). Resolved by
|
|
277
|
+
* checkGenericIdentityPins, where every instance is known. */
|
|
278
|
+
export declare function notePinnedIdentityComparison(lowerer: Lowerer, node: ts.Node, left: ts.Node, right: ts.Node, leftInstance: string | undefined, rightInstance: string | undefined): void;
|
|
256
279
|
/** The npm-static gate: implicit-any monomorphization applies to functions
|
|
257
280
|
* DECLARED in an opted-in package's JS files (user JS keeps today's
|
|
258
281
|
* checked-dynamic story until the corpus is re-baselined). */
|
|
@@ -402,6 +425,9 @@ export declare function genericBindingPresenceStore(info: GenericFnInfo, decl: t
|
|
|
402
425
|
* shape doesn't match or the target isn't a registered generic; fences
|
|
403
426
|
* (reassignment, var redeclaration) report by name inside. */
|
|
404
427
|
export declare function bindingGenericFnAliasInfoOf(lowerer: Lowerer, decl: ts.VariableDeclaration): GenericFnInfo | null;
|
|
428
|
+
/** The statement that records a generic alias's declaration as run, for
|
|
429
|
+
* an alias with a presence flag. */
|
|
430
|
+
export declare function genericAliasPresenceStore(lowerer: Lowerer, decl: ts.VariableDeclaration): IrStmt | null;
|
|
405
431
|
/** Static resolution stands in for the receiver's runtime value, so an
|
|
406
432
|
* object-literal generic-method receiver must provably HOLD the defining
|
|
407
433
|
* literal: a direct read of a binding whose initializer IS that literal
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shapeOverlayAnnotated } from "../shape-inference/index.js";
|
|
2
|
-
import { documentedParameter } from "./call-signatures.js";
|
|
2
|
+
import { documentedParameter, generatorParamsBindAtCall } from "./call-signatures.js";
|
|
3
3
|
import { staticNameBindings } from "./static-function-names.js";
|
|
4
4
|
import { positionTag } from "./structural-positions.js";
|
|
5
5
|
import { keyedHelperName } from "./stable-names.js";
|
|
@@ -125,7 +125,7 @@ export function lowerGenericCall(lowerer, expr, info) {
|
|
|
125
125
|
type: instance.returnType,
|
|
126
126
|
loc,
|
|
127
127
|
};
|
|
128
|
-
return
|
|
128
|
+
return guardEarlyCall(lowerer, info, expr, call);
|
|
129
129
|
}
|
|
130
130
|
// The enclosing-frame values follow the declared arguments, the order
|
|
131
131
|
// the instance takes them in (lowerGenericInstance).
|
|
@@ -139,7 +139,7 @@ export function lowerGenericCall(lowerer, expr, info) {
|
|
|
139
139
|
type: instance.returnType,
|
|
140
140
|
loc,
|
|
141
141
|
};
|
|
142
|
-
return
|
|
142
|
+
return guardEarlyCall(lowerer, info, expr, call);
|
|
143
143
|
}
|
|
144
144
|
/** The instance a CALL of a generic function-like names: resolved
|
|
145
145
|
* signature → mapped param shapes/return → interned instance. Shared by
|
|
@@ -1015,7 +1015,15 @@ export function lowerGenericInstance(lowerer, info, inst) {
|
|
|
1015
1015
|
// threaded — a default mentioning T resolves like any body expression.
|
|
1016
1016
|
const declared = lowerer.declareParams(decl.parameters.nodes, inst.params);
|
|
1017
1017
|
params.push(...declared.params, ...captureParams);
|
|
1018
|
-
|
|
1018
|
+
// See lowerFunction: a generator binds its parameters at the CALL
|
|
1019
|
+
// exactly when that is observable. The receiver materialization
|
|
1020
|
+
// (`staticReceiver`) is call machinery, not parameter binding.
|
|
1021
|
+
const bindsAtCall = isGenerator && declared.prologue.length > 0 && generatorParamsBindAtCall(decl);
|
|
1022
|
+
const body = [
|
|
1023
|
+
...receiverInit,
|
|
1024
|
+
...declared.prologue,
|
|
1025
|
+
...(bindsAtCall ? [{ kind: "genBindBarrier", loc: locOf(decl) }] : []),
|
|
1026
|
+
];
|
|
1019
1027
|
const bodyBlock = blockBodyOf(decl);
|
|
1020
1028
|
if (bodyBlock) {
|
|
1021
1029
|
body.push(...lowerer.lowerStmts(bodyBlock.statements.nodes));
|
|
@@ -1077,7 +1085,7 @@ export function lowerGenericInstance(lowerer, info, inst) {
|
|
|
1077
1085
|
if (isAsync)
|
|
1078
1086
|
fn.async = true;
|
|
1079
1087
|
if (fnCtx.generator)
|
|
1080
|
-
fn.generator = fnCtx.generator;
|
|
1088
|
+
fn.generator = bindsAtCall ? { ...fnCtx.generator, bindAtCall: true } : fnCtx.generator;
|
|
1081
1089
|
return fn;
|
|
1082
1090
|
}
|
|
1083
1091
|
finally {
|
|
@@ -1107,6 +1115,25 @@ function noteValueInstance(info, instance) {
|
|
|
1107
1115
|
}
|
|
1108
1116
|
instances.add(instance);
|
|
1109
1117
|
}
|
|
1118
|
+
/** Records the instance a pinned binding holds (`const f: Fn = ident`,
|
|
1119
|
+
* `const i = identity<number>`) under its declaration, so an identity
|
|
1120
|
+
* comparison between two bindings compares the closures they name
|
|
1121
|
+
* (checkGenericIdentityPins). */
|
|
1122
|
+
function notePinnedBinding(lowerer, ref, info, instance) {
|
|
1123
|
+
let node = ref;
|
|
1124
|
+
if (node.parent !== undefined &&
|
|
1125
|
+
ts.isPropertyAccessExpression(node.parent) &&
|
|
1126
|
+
node.parent.name === node)
|
|
1127
|
+
node = node.parent;
|
|
1128
|
+
while (node.parent !== undefined && ts.isParenthesizedExpression(node.parent))
|
|
1129
|
+
node = node.parent;
|
|
1130
|
+
const parent = node.parent;
|
|
1131
|
+
if (parent === undefined || !ts.isVariableDeclaration(parent) || parent.initializer !== node)
|
|
1132
|
+
return;
|
|
1133
|
+
if (!ts.isIdentifier(parent.name))
|
|
1134
|
+
return;
|
|
1135
|
+
lowerer.pinnedValueInstances.set(parent, { info, instance });
|
|
1136
|
+
}
|
|
1110
1137
|
/** A generic function taken as a VALUE, monomorphized by flow. A function
|
|
1111
1138
|
* value needs ONE concrete signature; tsc pins one at exactly two
|
|
1112
1139
|
* reference shapes — an instantiation EXPRESSION (`identity<number>`,
|
|
@@ -1128,10 +1155,17 @@ export function lowerGenericFnValue(lowerer, ref, info) {
|
|
|
1128
1155
|
if (info.implicitParams) {
|
|
1129
1156
|
const inst = implicitDefaultInstance(lowerer, ref, info);
|
|
1130
1157
|
noteValueInstance(info, inst.name);
|
|
1158
|
+
notePinnedBinding(lowerer, ref, info, inst.name);
|
|
1131
1159
|
const funcType = funcTypeFromParamShapes(inst.params, inst.returnType);
|
|
1132
1160
|
lowerer.requireExactArityValue(ref, ref, inst.params, funcType);
|
|
1133
1161
|
lowerer.noteEdge(inst.name);
|
|
1134
|
-
return
|
|
1162
|
+
return aliasTdzGuard(lowerer, ref, {
|
|
1163
|
+
kind: "closure",
|
|
1164
|
+
fnName: inst.name,
|
|
1165
|
+
captures: [],
|
|
1166
|
+
type: funcType,
|
|
1167
|
+
loc,
|
|
1168
|
+
});
|
|
1135
1169
|
}
|
|
1136
1170
|
// Each call of the enclosing function makes a new function object for a
|
|
1137
1171
|
// binding declared inside it (`make() !== make()` when make returns
|
|
@@ -1174,9 +1208,73 @@ export function lowerGenericFnValue(lowerer, ref, info) {
|
|
|
1174
1208
|
if (target)
|
|
1175
1209
|
lowerer.genericIdentityPins.push({ info, node: ref });
|
|
1176
1210
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1211
|
+
// No concrete pin, or a pin that keeps its own type parameters (the slot
|
|
1212
|
+
// type is the generic signature itself, as a record field of a generic
|
|
1213
|
+
// method or a generic result flows): the value is the ERASED instance —
|
|
1214
|
+
// the one function JavaScript runs for every type argument — and each
|
|
1215
|
+
// instantiating call converts its arguments in and its result out
|
|
1216
|
+
// (lower-calls.ts, genericValueCall). `f === f` still holds: the erased
|
|
1217
|
+
// instance is one interned closure per declaration.
|
|
1218
|
+
if (!target || target.getTypeParameters().length > 0) {
|
|
1219
|
+
return aliasTdzGuard(lowerer, ref, guardEarlyBindingValue(lowerer, info, ref, erasedGenericFnValue(lowerer, ref, info)));
|
|
1220
|
+
}
|
|
1221
|
+
return aliasTdzGuard(lowerer, ref, guardEarlyBindingValue(lowerer, info, ref, pinnedGenericClosure(lowerer, ref, info, target, fenceUnpinned)));
|
|
1222
|
+
}
|
|
1223
|
+
/** A read of a generic ALIAS binding (`const h = id`) that can run before
|
|
1224
|
+
* the alias's declaration: the alias has no binding storage, so JavaScript
|
|
1225
|
+
* reaches its temporal dead zone through the flag the declaration sets —
|
|
1226
|
+
* the read throws before it hands out the function. Reads that can only
|
|
1227
|
+
* run after the declaration stay direct. A `var` alias reads `undefined`
|
|
1228
|
+
* there, which is no function value to hand out, so that read is
|
|
1229
|
+
* refused. */
|
|
1230
|
+
function aliasTdzGuard(lowerer, ref, value) {
|
|
1231
|
+
const presence = earlyAliasPresence(lowerer, ref);
|
|
1232
|
+
if (presence === undefined)
|
|
1233
|
+
return value;
|
|
1234
|
+
if (!presence.lexical)
|
|
1235
|
+
lowerer.unsupported("SC1090", ref, `generic 'var' aliases read as values before their declaration runs (Node reads undefined there; declare '${presence.name}' with const)`);
|
|
1236
|
+
const loc = value.loc;
|
|
1237
|
+
const flag = { kind: "varRef", localId: presence.flagId, type: BOOL, loc };
|
|
1238
|
+
return {
|
|
1239
|
+
kind: "seqExpr",
|
|
1240
|
+
stmts: [tdzCheck(flag, presence.name, loc)],
|
|
1241
|
+
result: value,
|
|
1242
|
+
type: value.type,
|
|
1243
|
+
loc,
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
/** The flag of a generic ALIAS binding that `node`, a reference to it,
|
|
1247
|
+
* can reach before its declaration runs — undefined when the node names no
|
|
1248
|
+
* alias, or names one whose declaration has already run. */
|
|
1249
|
+
function earlyAliasPresence(lowerer, node) {
|
|
1250
|
+
const ident = ts.isIdentifier(node)
|
|
1251
|
+
? node
|
|
1252
|
+
: ts.isExpressionWithTypeArguments(node) && ts.isIdentifier(node.expression)
|
|
1253
|
+
? node.expression
|
|
1254
|
+
: undefined;
|
|
1255
|
+
if (ident === undefined)
|
|
1256
|
+
return undefined;
|
|
1257
|
+
const symbol = lowerer.resolveValueSymbol(ident);
|
|
1258
|
+
const presence = symbol === null ? undefined : lowerer.genericAliasPresence.get(symbol);
|
|
1259
|
+
if (presence === undefined)
|
|
1260
|
+
return undefined;
|
|
1261
|
+
if (useRunsAfter(lowerer, presence.decl, ident, presence.ordering, new Set()))
|
|
1262
|
+
return undefined;
|
|
1263
|
+
return presence;
|
|
1264
|
+
}
|
|
1265
|
+
/** The value of a generic declaration read where no concrete instantiation
|
|
1266
|
+
* pins it: the declaration's erased instance's closure — the ONE function
|
|
1267
|
+
* JavaScript has, whose parameters and result are `unknown`, so arguments
|
|
1268
|
+
* entering it box (records, arrays, maps and sets as live capsules;
|
|
1269
|
+
* identity preserved) and results leaving it are checked against the
|
|
1270
|
+
* instantiated signature at the call. */
|
|
1271
|
+
function erasedGenericFnValue(lowerer, ref, info) {
|
|
1272
|
+
const loc = locOf(ref);
|
|
1273
|
+
const inst = erasedGenericInstance(lowerer, ref, info);
|
|
1274
|
+
const funcType = funcTypeFromParamShapes(inst.params, inst.returnType);
|
|
1275
|
+
lowerer.requireExactArityValue(ref, ref, inst.params, funcType);
|
|
1276
|
+
lowerer.noteEdge(inst.name);
|
|
1277
|
+
return { kind: "closure", fnName: inst.name, captures: [], type: funcType, loc };
|
|
1180
1278
|
}
|
|
1181
1279
|
/** The pinning signature of a generic declaration compared by identity
|
|
1182
1280
|
* (`held === ident`, `held !== ident`, and the loose forms): the other
|
|
@@ -1293,6 +1391,7 @@ function pinnedGenericClosure(lowerer, ref, info, target, fenceUnpinned) {
|
|
|
1293
1391
|
fenceUnpinned();
|
|
1294
1392
|
const inst = genericValueInstance(lowerer, ref, info, bindings);
|
|
1295
1393
|
noteValueInstance(info, inst.name);
|
|
1394
|
+
notePinnedBinding(lowerer, ref, info, inst.name);
|
|
1296
1395
|
// The value's type is the completed ABI signature. Typed rest keeps its
|
|
1297
1396
|
// packed-array slot; dynRest stays hidden behind the rest marker.
|
|
1298
1397
|
const funcType = funcTypeFromParamShapes(inst.params, inst.returnType);
|
|
@@ -1386,13 +1485,137 @@ export function checkGenericIdentityPins(lowerer) {
|
|
|
1386
1485
|
report(info, node, true);
|
|
1387
1486
|
}
|
|
1388
1487
|
}
|
|
1488
|
+
// A typed function-vs-function comparison (`g === h`) whose two operands
|
|
1489
|
+
// are pins of ONE declaration at different signatures: the closures the
|
|
1490
|
+
// operands name are different function objects, so the pointer compare
|
|
1491
|
+
// answers false while JavaScript has one function — a silent divergence.
|
|
1492
|
+
for (const { node, left, right, leftInstance, rightInstance, } of lowerer.pinnedIdentityComparisons) {
|
|
1493
|
+
const leftPin = pinnedInstanceBehind(lowerer, left, leftInstance);
|
|
1494
|
+
if (leftPin === null)
|
|
1495
|
+
continue;
|
|
1496
|
+
const rightPin = pinnedInstanceBehind(lowerer, right, rightInstance);
|
|
1497
|
+
if (rightPin === null || rightPin.info !== leftPin.info)
|
|
1498
|
+
continue;
|
|
1499
|
+
if (rightPin.instance === leftPin.instance)
|
|
1500
|
+
continue;
|
|
1501
|
+
let infos = seen.get(node);
|
|
1502
|
+
if (infos === undefined)
|
|
1503
|
+
seen.set(node, (infos = new Set()));
|
|
1504
|
+
if (infos.has(leftPin.info))
|
|
1505
|
+
continue;
|
|
1506
|
+
infos.add(leftPin.info);
|
|
1507
|
+
lowerer.pushDiag(unsupportedDiag("SC1090", locOf(node), `comparing two values of the generic function '${leftPin.info.baseName}' pinned at different signatures by identity (each pinned signature is a separate compiled function object; JavaScript has one) — hold '${leftPin.info.baseName}' at a single signature, or compare values pinned to the same signature`));
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
/** The value instance an identity operand names: the closure name it
|
|
1511
|
+
* lowered to when it is an inline pin (`identity<number>`), else the
|
|
1512
|
+
* binding it reads, resolved through casts and aliasing bindings. Null for
|
|
1513
|
+
* a value with no recorded pin (a call result, a parameter, a binding the
|
|
1514
|
+
* program rewrites). */
|
|
1515
|
+
function pinnedInstanceBehind(lowerer, node, directInstance) {
|
|
1516
|
+
let current = node;
|
|
1517
|
+
const seen = new Set();
|
|
1518
|
+
while (current !== undefined && !seen.has(current)) {
|
|
1519
|
+
seen.add(current);
|
|
1520
|
+
if (ts.isParenthesizedExpression(current) ||
|
|
1521
|
+
ts.isAsExpression(current) ||
|
|
1522
|
+
ts.isSatisfiesExpression(current) ||
|
|
1523
|
+
ts.isNonNullExpression(current) ||
|
|
1524
|
+
ts.isExpressionWithTypeArguments(current)) {
|
|
1525
|
+
current = current.expression;
|
|
1526
|
+
continue;
|
|
1527
|
+
}
|
|
1528
|
+
if (!ts.isIdentifier(current) && !ts.isPropertyAccessExpression(current))
|
|
1529
|
+
return null;
|
|
1530
|
+
const symbol = lowerer.checker.getSymbolAtLocation(ts.isPropertyAccessExpression(current) ? current.name : current);
|
|
1531
|
+
if (symbol === undefined)
|
|
1532
|
+
return null;
|
|
1533
|
+
const info = lowerer.genericFnsBySymbol.get(symbol);
|
|
1534
|
+
if (info !== undefined) {
|
|
1535
|
+
// The bare declaration itself: a pin only where the comparison
|
|
1536
|
+
// names it directly (the direct rule covers that shape).
|
|
1537
|
+
return directInstance === undefined ? null : { info, instance: directInstance };
|
|
1538
|
+
}
|
|
1539
|
+
const decl = symbol.valueDeclaration ?? symbol.declarations?.[0];
|
|
1540
|
+
if (decl === undefined)
|
|
1541
|
+
return null;
|
|
1542
|
+
// A binding the program later rewrites may hold another function at
|
|
1543
|
+
// the comparison: resolve it, and alias it through its initializer,
|
|
1544
|
+
// only where it is never written.
|
|
1545
|
+
if (!holdsItsInitializer(lowerer, decl))
|
|
1546
|
+
return null;
|
|
1547
|
+
const recorded = lowerer.pinnedValueInstances.get(decl);
|
|
1548
|
+
if (recorded !== undefined)
|
|
1549
|
+
return recorded;
|
|
1550
|
+
current = decl
|
|
1551
|
+
.initializer;
|
|
1552
|
+
}
|
|
1553
|
+
return null;
|
|
1554
|
+
}
|
|
1555
|
+
/** Whether `decl` is a variable or property that keeps the value it starts
|
|
1556
|
+
* with: a variable with an identifier name that nothing writes, or a
|
|
1557
|
+
* readonly property its class never assigns (a constructor can). A
|
|
1558
|
+
* parameter's default is not its value: a call can pass any function for
|
|
1559
|
+
* it. */
|
|
1560
|
+
function holdsItsInitializer(lowerer, decl) {
|
|
1561
|
+
if (ts.isPropertyDeclaration(decl))
|
|
1562
|
+
return ((ts.getCombinedModifierFlags(decl) & ts.ModifierFlags.Readonly) !== 0 &&
|
|
1563
|
+
!classWritesField(decl));
|
|
1564
|
+
if (!ts.isVariableDeclaration(decl) || !ts.isIdentifier(decl.name))
|
|
1565
|
+
return false;
|
|
1566
|
+
const binding = lowerer.checker.getSymbolAtLocation(decl.name);
|
|
1567
|
+
return binding !== undefined && bindingNeverReassigned(lowerer, binding, decl);
|
|
1568
|
+
}
|
|
1569
|
+
/** Whether the class that declares `field` assigns a property of its name
|
|
1570
|
+
* anywhere in its body: a readonly field can still be assigned in a
|
|
1571
|
+
* constructor or a static block. Any receiver counts, which only
|
|
1572
|
+
* over-approximates. */
|
|
1573
|
+
function classWritesField(field) {
|
|
1574
|
+
const name = field.name;
|
|
1575
|
+
if (!ts.isIdentifier(name) && !ts.isStringLiteral(name))
|
|
1576
|
+
return true;
|
|
1577
|
+
const text = name.text;
|
|
1578
|
+
const targets = (target) => {
|
|
1579
|
+
let e = target;
|
|
1580
|
+
while (ts.isParenthesizedExpression(e))
|
|
1581
|
+
e = e.expression;
|
|
1582
|
+
if (ts.isPropertyAccessExpression(e))
|
|
1583
|
+
return e.name.text === text;
|
|
1584
|
+
if (ts.isElementAccessExpression(e))
|
|
1585
|
+
return !ts.isStringLiteralLike(e.argumentExpression) || e.argumentExpression.text === text;
|
|
1586
|
+
return false;
|
|
1587
|
+
};
|
|
1588
|
+
let written = false;
|
|
1589
|
+
const visit = (node) => {
|
|
1590
|
+
if (written)
|
|
1591
|
+
return;
|
|
1592
|
+
if (ts.isBinaryExpression(node) &&
|
|
1593
|
+
node.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
|
|
1594
|
+
node.operatorToken.kind <= ts.SyntaxKind.LastAssignment &&
|
|
1595
|
+
targets(node.left))
|
|
1596
|
+
written = true;
|
|
1597
|
+
else if ((ts.isPrefixUnaryExpression(node) || ts.isPostfixUnaryExpression(node)) &&
|
|
1598
|
+
(node.operator === ts.SyntaxKind.PlusPlusToken ||
|
|
1599
|
+
node.operator === ts.SyntaxKind.MinusMinusToken) &&
|
|
1600
|
+
targets(node.operand))
|
|
1601
|
+
written = true;
|
|
1602
|
+
else
|
|
1603
|
+
ts.forEachChild(node, visit);
|
|
1604
|
+
};
|
|
1605
|
+
if (field.parent !== undefined)
|
|
1606
|
+
visit(field.parent);
|
|
1607
|
+
return written;
|
|
1389
1608
|
}
|
|
1390
1609
|
/** The generic declaration whose value instance an expression names, when
|
|
1391
1610
|
* the expression is a binding initialized (directly, or through casts,
|
|
1392
1611
|
* aliasing bindings and property initializers) from that declaration. Used
|
|
1393
1612
|
* where a comparison reads the value through `unknown`/`any`, so the
|
|
1394
1613
|
* declaration is not syntactically at the compared site. */
|
|
1395
|
-
export function genericDeclarationBehindValue(lowerer, node
|
|
1614
|
+
export function genericDeclarationBehindValue(lowerer, node,
|
|
1615
|
+
// A comparison answers for the VALUE the binding holds at that point, so
|
|
1616
|
+
// only a binding the program cannot reassign may stand for the
|
|
1617
|
+
// declaration its initializer reads.
|
|
1618
|
+
requireConst = false) {
|
|
1396
1619
|
let current = node;
|
|
1397
1620
|
const seen = new Set();
|
|
1398
1621
|
while (current !== undefined && !seen.has(current)) {
|
|
@@ -1404,6 +1627,12 @@ export function genericDeclarationBehindValue(lowerer, node) {
|
|
|
1404
1627
|
current = current.expression;
|
|
1405
1628
|
continue;
|
|
1406
1629
|
}
|
|
1630
|
+
// An instantiation expression (`identity<number>`) names the
|
|
1631
|
+
// declaration its type arguments apply to.
|
|
1632
|
+
if (ts.isExpressionWithTypeArguments(current)) {
|
|
1633
|
+
current = current.expression;
|
|
1634
|
+
continue;
|
|
1635
|
+
}
|
|
1407
1636
|
if (!ts.isIdentifier(current) && !ts.isPropertyAccessExpression(current))
|
|
1408
1637
|
return null;
|
|
1409
1638
|
const symbol = lowerer.checker.getSymbolAtLocation(ts.isPropertyAccessExpression(current) ? current.name : current);
|
|
@@ -1417,6 +1646,11 @@ export function genericDeclarationBehindValue(lowerer, node) {
|
|
|
1417
1646
|
return null;
|
|
1418
1647
|
if (!ts.isVariableDeclaration(decl) && !ts.isPropertyDeclaration(decl) && !ts.isParameter(decl))
|
|
1419
1648
|
return null;
|
|
1649
|
+
if (requireConst &&
|
|
1650
|
+
(!ts.isVariableDeclaration(decl) ||
|
|
1651
|
+
!ts.isVariableDeclarationList(decl.parent) ||
|
|
1652
|
+
(decl.parent.flags & ts.NodeFlags.Const) === 0))
|
|
1653
|
+
return null;
|
|
1420
1654
|
current = decl.initializer;
|
|
1421
1655
|
}
|
|
1422
1656
|
return null;
|
|
@@ -1437,6 +1671,16 @@ export function noteDynamicIdentityComparison(lowerer, node, left, right) {
|
|
|
1437
1671
|
if (mightNameBinding(left) || mightNameBinding(right))
|
|
1438
1672
|
lowerer.dynIdentityComparisons.push({ node, left, right });
|
|
1439
1673
|
}
|
|
1674
|
+
/** An identity comparison of two function-typed values (`g === h`), where
|
|
1675
|
+
* either side may name a value instance of a generic declaration: two pins
|
|
1676
|
+
* of one declaration at different signatures are separate compiled
|
|
1677
|
+
* closures, so the pointer compare would answer false where JavaScript
|
|
1678
|
+
* answers true (one function object). Resolved by
|
|
1679
|
+
* checkGenericIdentityPins, where every instance is known. */
|
|
1680
|
+
export function notePinnedIdentityComparison(lowerer, node, left, right, leftInstance, rightInstance) {
|
|
1681
|
+
if (mightNameBinding(left) || mightNameBinding(right))
|
|
1682
|
+
lowerer.pinnedIdentityComparisons.push({ node, left, right, leftInstance, rightInstance });
|
|
1683
|
+
}
|
|
1440
1684
|
const PRIMITIVE_TYPE_FLAGS = ts.TypeFlags.StringLike |
|
|
1441
1685
|
ts.TypeFlags.NumberLike |
|
|
1442
1686
|
ts.TypeFlags.BooleanLike |
|
|
@@ -1455,6 +1699,10 @@ function mightNameBinding(node) {
|
|
|
1455
1699
|
for (let hops = 0; hops < 16 && current !== undefined; hops++) {
|
|
1456
1700
|
if (ts.isIdentifier(current) || ts.isPropertyAccessExpression(current))
|
|
1457
1701
|
return true;
|
|
1702
|
+
if (ts.isExpressionWithTypeArguments(current)) {
|
|
1703
|
+
current = current.expression;
|
|
1704
|
+
continue;
|
|
1705
|
+
}
|
|
1458
1706
|
if (ts.isParenthesizedExpression(current) ||
|
|
1459
1707
|
ts.isAsExpression(current) ||
|
|
1460
1708
|
ts.isNonNullExpression(current) ||
|
|
@@ -2420,6 +2668,84 @@ function capturesEnclosingFrame(lowerer, fn, decl, scope) {
|
|
|
2420
2668
|
scan(scope);
|
|
2421
2669
|
return captures;
|
|
2422
2670
|
}
|
|
2671
|
+
/** Whether a captured value's type can change between two instantiations of
|
|
2672
|
+
* the enclosing generic scopes: true when a type parameter reaches the type
|
|
2673
|
+
* (directly, through a union, or as a type argument), and true for the shapes
|
|
2674
|
+
* whose contents the walk cannot name — a mapped type, an inferred object
|
|
2675
|
+
* literal, a signature — so those keep the fence they had. */
|
|
2676
|
+
function typeVariesWithEnclosingTypeParameters(lowerer, type) {
|
|
2677
|
+
const seen = new Set();
|
|
2678
|
+
const walk = (part, depth) => {
|
|
2679
|
+
if ((part.flags & ts.TypeFlags.TypeParameter) !== 0)
|
|
2680
|
+
return true;
|
|
2681
|
+
if (depth > 8)
|
|
2682
|
+
return true;
|
|
2683
|
+
if (seen.has(part))
|
|
2684
|
+
return false;
|
|
2685
|
+
seen.add(part);
|
|
2686
|
+
if (part.isUnionType())
|
|
2687
|
+
return ts.constituentTypes(part).some((p) => walk(p, depth + 1));
|
|
2688
|
+
if ((part.flags & ts.TypeFlags.Intersection) !== 0)
|
|
2689
|
+
return ts.constituentTypes(part).some((p) => walk(p, depth + 1));
|
|
2690
|
+
if (part.getAliasTypeArguments().some((p) => walk(p, depth + 1)))
|
|
2691
|
+
return true;
|
|
2692
|
+
// An indexed access, a conditional, a substitution or an index type is
|
|
2693
|
+
// resolved from a source type this walk would have to reduce.
|
|
2694
|
+
if ((part.flags &
|
|
2695
|
+
(ts.TypeFlags.Index |
|
|
2696
|
+
ts.TypeFlags.IndexedAccess |
|
|
2697
|
+
ts.TypeFlags.Conditional |
|
|
2698
|
+
ts.TypeFlags.Substitution)) !==
|
|
2699
|
+
0)
|
|
2700
|
+
return true;
|
|
2701
|
+
if ((part.flags & ts.TypeFlags.Object) === 0)
|
|
2702
|
+
return false;
|
|
2703
|
+
const flags = part.objectFlags;
|
|
2704
|
+
// A reference names its type arguments — a class instance, an interface,
|
|
2705
|
+
// an array, a tuple.
|
|
2706
|
+
if ((flags & ts.ObjectFlags.Reference) !== 0)
|
|
2707
|
+
return lowerer.checker
|
|
2708
|
+
.getTypeArguments(part)
|
|
2709
|
+
.some((p) => walk(p, depth + 1));
|
|
2710
|
+
// A mapped type reduces to its source's keys and type arguments.
|
|
2711
|
+
if ((flags & ts.ObjectFlags.Mapped) !== 0)
|
|
2712
|
+
return true;
|
|
2713
|
+
// An index signature names its value type directly, and its key is never
|
|
2714
|
+
// a type parameter: `{ [key: string]: T }` varies exactly as `T` does,
|
|
2715
|
+
// whether the type is an object literal's or a named one's.
|
|
2716
|
+
for (const info of lowerer.checker.getIndexInfosOfType(part)) {
|
|
2717
|
+
if (walk(info.type, depth + 1))
|
|
2718
|
+
return true;
|
|
2719
|
+
}
|
|
2720
|
+
// A nominal instance whose type arguments the reference test above did
|
|
2721
|
+
// not see carries none to miss.
|
|
2722
|
+
if ((flags & ts.ObjectFlags.ClassOrInterface) !== 0)
|
|
2723
|
+
return false;
|
|
2724
|
+
// An inferred object literal or a type alias's object type names its
|
|
2725
|
+
// members instead of type arguments: read them, with a bounded width so
|
|
2726
|
+
// a wide type cannot make this walk expensive.
|
|
2727
|
+
let budget = 0;
|
|
2728
|
+
for (const prop of lowerer.checker.getPropertiesOfType(part)) {
|
|
2729
|
+
if (++budget > 64)
|
|
2730
|
+
return true;
|
|
2731
|
+
if (walk(lowerer.checker.getTypeOfSymbol(prop), depth + 1))
|
|
2732
|
+
return true;
|
|
2733
|
+
}
|
|
2734
|
+
for (const sig of [
|
|
2735
|
+
...lowerer.checker.getCallSignatures(part),
|
|
2736
|
+
...lowerer.checker.getConstructSignatures(part),
|
|
2737
|
+
]) {
|
|
2738
|
+
for (const param of sig.getParameters()) {
|
|
2739
|
+
if (walk(lowerer.checker.getTypeOfSymbol(param), depth + 1))
|
|
2740
|
+
return true;
|
|
2741
|
+
}
|
|
2742
|
+
if (walk(lowerer.checker.getReturnTypeOfSignature(sig), depth + 1))
|
|
2743
|
+
return true;
|
|
2744
|
+
}
|
|
2745
|
+
return false;
|
|
2746
|
+
};
|
|
2747
|
+
return walk(type, 0);
|
|
2748
|
+
}
|
|
2423
2749
|
/** The enclosing-frame VALUES `fn`, bound by `decl`, reads — in first-use
|
|
2424
2750
|
* order, the order the instances take them as trailing parameters. The
|
|
2425
2751
|
* shape is the one the instance body resolves: a binding declared by an
|
|
@@ -2509,17 +2835,29 @@ function enclosingFrameCaptures(lowerer, fn, decl, scope, name) {
|
|
|
2509
2835
|
// A capture's type is fixed when the info is registered, once per
|
|
2510
2836
|
// binding, while an enclosing generic function or class re-lowers its
|
|
2511
2837
|
// frame per instantiation: the second instantiation's value would have a
|
|
2512
|
-
// different type than the parameter the shared instance declares.
|
|
2513
|
-
//
|
|
2514
|
-
// type
|
|
2838
|
+
// different type than the parameter the shared instance declares. The
|
|
2839
|
+
// fence is about that TYPE, not about genericity: a capture whose type
|
|
2840
|
+
// reads none of the enclosing type parameters is the same type in every
|
|
2841
|
+
// instantiation, and the instance reads it exactly (the getSlot shape:
|
|
2842
|
+
// a generic arrow closing over a Map and a counter inside a generic
|
|
2843
|
+
// provider function).
|
|
2515
2844
|
if (captures.length > 0) {
|
|
2845
|
+
let genericEnclosing = false;
|
|
2516
2846
|
for (let p = fn.parent; p && !ts.isSourceFile(p); p = p.parent) {
|
|
2517
2847
|
if (!ts.isFunctionLike(p) && !ts.isClassLikeDeclaration(p))
|
|
2518
2848
|
continue;
|
|
2519
2849
|
const typeParameters = p
|
|
2520
2850
|
.typeParameters;
|
|
2521
|
-
if (typeParameters !== undefined && typeParameters.nodes.length > 0)
|
|
2522
|
-
|
|
2851
|
+
if (typeParameters !== undefined && typeParameters.nodes.length > 0) {
|
|
2852
|
+
genericEnclosing = true;
|
|
2853
|
+
break;
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
if (genericEnclosing) {
|
|
2857
|
+
for (const capture of captures) {
|
|
2858
|
+
if (typeVariesWithEnclosingTypeParameters(lowerer, lowerer.typeOf(capture.nameNode)))
|
|
2859
|
+
frameFence();
|
|
2860
|
+
}
|
|
2523
2861
|
}
|
|
2524
2862
|
}
|
|
2525
2863
|
return captures;
|
|
@@ -2930,8 +3268,13 @@ function guardEarlyBindingCall(lowerer, info, expr, call) {
|
|
|
2930
3268
|
type: call.type,
|
|
2931
3269
|
loc,
|
|
2932
3270
|
};
|
|
2933
|
-
|
|
2934
|
-
|
|
3271
|
+
return earlyUnassignedCall(lowerer, call, flag, info.baseName, loc);
|
|
3272
|
+
}
|
|
3273
|
+
/** A call whose callee is an unassigned `var` binding — or a `var` alias
|
|
3274
|
+
* — before its initializer runs: arguments first, in order, then the
|
|
3275
|
+
* check. Node evaluates them before it finds the callee is not
|
|
3276
|
+
* callable. */
|
|
3277
|
+
function earlyUnassignedCall(lowerer, call, flag, name, loc) {
|
|
2935
3278
|
const stmts = [];
|
|
2936
3279
|
const args = call.args.map((arg) => {
|
|
2937
3280
|
const id = `%earlyCallArg.${lowerer.ctx.locals.length}`;
|
|
@@ -2946,7 +3289,7 @@ function guardEarlyBindingCall(lowerer, info, expr, call) {
|
|
|
2946
3289
|
kind: "ternary",
|
|
2947
3290
|
cond: flag,
|
|
2948
3291
|
then: { ...call, args },
|
|
2949
|
-
else_: nodeThrowExpr(1, "", `${
|
|
3292
|
+
else_: nodeThrowExpr(1, "", `${name} is not a function`, call.type, loc),
|
|
2950
3293
|
type: call.type,
|
|
2951
3294
|
loc,
|
|
2952
3295
|
},
|
|
@@ -2972,6 +3315,29 @@ function guardEarlyBindingValue(lowerer, info, ref, value) {
|
|
|
2972
3315
|
loc,
|
|
2973
3316
|
};
|
|
2974
3317
|
}
|
|
3318
|
+
/** A call of a generic binding or ALIAS that can run before the
|
|
3319
|
+
* declaration. Through an ALIAS (`h(3)`), JavaScript reads the alias first:
|
|
3320
|
+
* a `let`/`const` alias is in its temporal dead zone, so the call throws
|
|
3321
|
+
* before the arguments evaluate, while a `var` alias is `undefined`, so the
|
|
3322
|
+
* arguments run and the call throws "is not a function" — the alias names
|
|
3323
|
+
* no binding the callee could have read, so no check of the aliased
|
|
3324
|
+
* binding's own flag applies. Other calls check the binding's flag. */
|
|
3325
|
+
function guardEarlyCall(lowerer, info, expr, call) {
|
|
3326
|
+
const presence = earlyAliasPresence(lowerer, expr.expression);
|
|
3327
|
+
if (presence === undefined)
|
|
3328
|
+
return guardEarlyBindingCall(lowerer, info, expr, call);
|
|
3329
|
+
const loc = call.loc;
|
|
3330
|
+
const flag = { kind: "varRef", localId: presence.flagId, type: BOOL, loc };
|
|
3331
|
+
if (!presence.lexical)
|
|
3332
|
+
return earlyUnassignedCall(lowerer, call, flag, presence.name, loc);
|
|
3333
|
+
return {
|
|
3334
|
+
kind: "seqExpr",
|
|
3335
|
+
stmts: [tdzCheck(flag, presence.name, loc)],
|
|
3336
|
+
result: guardEarlyBindingCall(lowerer, info, expr, call),
|
|
3337
|
+
type: call.type,
|
|
3338
|
+
loc,
|
|
3339
|
+
};
|
|
3340
|
+
}
|
|
2975
3341
|
/** The presence flag a use that can run before the declaration checks.
|
|
2976
3342
|
* Only module-scope bindings have one: a binding inside a function would
|
|
2977
3343
|
* need a per-call flag that its closures share. */
|
|
@@ -3029,8 +3395,56 @@ export function bindingGenericFnAliasInfoOf(lowerer, decl) {
|
|
|
3029
3395
|
const name = decl.name.text;
|
|
3030
3396
|
requireStableGenericBinding(lowerer, decl, sym, name);
|
|
3031
3397
|
lowerer.genericFnsBySymbol.set(sym, target);
|
|
3398
|
+
noteAliasPresence(lowerer, decl, sym, name);
|
|
3032
3399
|
return target;
|
|
3033
3400
|
}
|
|
3401
|
+
/** Records the temporal-dead-zone flag of a module-scope alias whose reads
|
|
3402
|
+
* can run before its declaration — a hoisted function called during module
|
|
3403
|
+
* evaluation reads the binding while JavaScript still has it in its dead
|
|
3404
|
+
* zone, and the alias has no storage of its own to throw from. The
|
|
3405
|
+
* declaration statement sets the flag (genericAliasPresenceStore) and the
|
|
3406
|
+
* early reads check it. Aliases declared inside functions keep the
|
|
3407
|
+
* existing fences: a per-call flag would need a closure shared with every
|
|
3408
|
+
* reader. */
|
|
3409
|
+
function noteAliasPresence(lowerer, decl, symbol, name) {
|
|
3410
|
+
const stmt = decl.parent?.parent;
|
|
3411
|
+
const list = stmt?.parent;
|
|
3412
|
+
if (stmt === undefined || list === undefined)
|
|
3413
|
+
return;
|
|
3414
|
+
if (!ts.isSourceFile(list) && !ts.isModuleBlock(list))
|
|
3415
|
+
return;
|
|
3416
|
+
const nameNode = decl.name;
|
|
3417
|
+
const ordering = new Map();
|
|
3418
|
+
const early = bindingReferences(lowerer, ts.getSourceFileOfNode(decl), symbol, nameNode).some((ref) => !useRunsAfter(lowerer, decl, ref, ordering, new Set()));
|
|
3419
|
+
if (!early)
|
|
3420
|
+
return;
|
|
3421
|
+
const flagId = `%g.${lowerer.qualify(ts.getSourceFileOfNode(decl), nsPathPrefix(lowerer, stmt, decl) + name)}%initialized`;
|
|
3422
|
+
lowerer.globalsList.push({ id: flagId, name: "%initialized", type: BOOL, mutable: true });
|
|
3423
|
+
lowerer.genericAliasPresence.set(symbol, {
|
|
3424
|
+
flagId,
|
|
3425
|
+
name,
|
|
3426
|
+
decl,
|
|
3427
|
+
lexical: !isVarDeclared(decl),
|
|
3428
|
+
ordering,
|
|
3429
|
+
});
|
|
3430
|
+
}
|
|
3431
|
+
/** The statement that records a generic alias's declaration as run, for
|
|
3432
|
+
* an alias with a presence flag. */
|
|
3433
|
+
export function genericAliasPresenceStore(lowerer, decl) {
|
|
3434
|
+
if (!ts.isIdentifier(decl.name))
|
|
3435
|
+
return null;
|
|
3436
|
+
const symbol = lowerer.checker.getSymbolAtLocation(decl.name);
|
|
3437
|
+
const presence = symbol === undefined ? undefined : lowerer.genericAliasPresence.get(symbol);
|
|
3438
|
+
if (presence === undefined)
|
|
3439
|
+
return null;
|
|
3440
|
+
const loc = locOf(decl);
|
|
3441
|
+
return {
|
|
3442
|
+
kind: "assign",
|
|
3443
|
+
localId: presence.flagId,
|
|
3444
|
+
value: { kind: "boolLit", value: true, type: BOOL, loc },
|
|
3445
|
+
loc,
|
|
3446
|
+
};
|
|
3447
|
+
}
|
|
3034
3448
|
/** Static resolution stands in for the receiver's runtime value, so an
|
|
3035
3449
|
* object-literal generic-method receiver must provably HOLD the defining
|
|
3036
3450
|
* literal: a direct read of a binding whose initializer IS that literal
|