@scriptc/compiler 0.2.10 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ambient/scriptc-node-fallback.d.ts +2 -36
- package/ambient/scriptc-overrides.d.ts +1 -25
- package/ambient/scriptc.d.ts +1 -9
- package/dist/backend/cycle-analysis.test.js +1 -1
- package/dist/backend/cycle-mutability.d.ts +1 -1
- package/dist/backend/cycle-mutability.js +1 -18
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.d.ts +1 -1
- package/dist/backend/executable-features.js +3 -8
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.d.ts +1 -1
- package/dist/backend/immutability.js +1 -1
- package/dist/backend/immutability.test.js +1 -1
- package/dist/backend/library-pack.js +0 -2
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/linker.js +1 -1
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/llvm/checked-narrows.test.js +1 -1
- package/dist/backend/llvm/classes.js +3 -9
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +7 -7
- package/dist/backend/llvm/constant-callbacks.d.ts +1 -1
- package/dist/backend/llvm/constant-callbacks.js +3 -3
- package/dist/backend/llvm/constant-callbacks.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.test.js +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +1 -1
- package/dist/backend/llvm/dyn.d.ts +0 -1
- package/dist/backend/llvm/dyn.js +0 -73
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +3 -17
- package/dist/backend/llvm/emitter.js +53 -181
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +3 -3
- package/dist/backend/llvm/expr-async.test.js +1 -1
- package/dist/backend/llvm/expr-containers.js +12 -8
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-control.js +4 -107
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.d.ts +1 -2
- package/dist/backend/llvm/expr-dispatch.js +0 -41
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.d.ts +1 -1
- package/dist/backend/llvm/expr-dynamic.js +13 -27
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +2 -2
- package/dist/backend/llvm/expr-stream-bridges.test.js +1 -1
- package/dist/backend/llvm/lib-dispatch.js +0 -1
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +0 -13
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +0 -8
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +7 -0
- package/dist/backend/llvm/map-number-lookup.js +16 -2
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.js +7 -1
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +24 -7
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/shapes.js +1 -2
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +3 -3
- package/dist/backend/llvm/stack-unions.test.js +1 -1
- package/dist/backend/llvm/string-construction.test.js +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +1 -1
- package/dist/backend/llvm/switch-dispatch.test.js +1 -1
- package/dist/backend/may-throw.js +0 -9
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +1 -1
- package/dist/backend/native/artifact-stamps.js +0 -2
- package/dist/backend/native/artifact-stamps.js.map +1 -1
- package/dist/backend/native/cache-warm.d.ts +1 -1
- package/dist/backend/native/cache-warm.js +2 -3
- package/dist/backend/native/cache-warm.js.map +1 -1
- package/dist/backend/native/compiler-fingerprint.d.ts +1 -1
- package/dist/backend/native/compiler-fingerprint.js +4 -7
- package/dist/backend/native/compiler-fingerprint.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +3 -28
- package/dist/backend/native/driver.js +1 -3
- package/dist/backend/native/driver.js.map +1 -1
- package/dist/backend/native/executable.d.ts +0 -15
- package/dist/backend/native/executable.js +17 -172
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/tool-identity.js +0 -1
- package/dist/backend/native/tool-identity.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native/vendor.js +1 -1
- package/dist/backend/native/vendor.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +0 -2
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +23 -33
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/publication.test.js +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-core.d.ts +1 -2
- package/dist/backend/runtime-pack-core.js +5 -14
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +3 -8
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +22 -19
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.d.ts +0 -5
- package/dist/backend/target-diagnostics.js +1 -11
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +1 -1
- package/dist/backend/vendor-archives.d.ts +1 -7
- package/dist/backend/vendor-archives.js +9 -189
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +0 -1
- package/dist/backend/vendor-inputs.js +0 -1
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/warm-cache.js +3 -5
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +4 -8
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/host.d.ts +1 -1
- package/dist/cli/usage.d.ts +1 -5
- package/dist/cli/usage.js +4 -9
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +2 -2
- package/dist/compat/fetch-profile.js +16 -25
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +2 -17
- package/dist/contracts/check.js +2 -6
- package/dist/contracts/check.js.map +1 -1
- package/dist/coverage/report.d.ts +5 -22
- package/dist/coverage/report.js +12 -76
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.d.ts +3 -3
- package/dist/coverage/surface-manifest.js +22 -27
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +1 -3
- package/dist/coverage/verdict-cache.js +2 -7
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +11 -60
- package/dist/diagnostics/diagnostic.js +39 -118
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +3 -4
- package/dist/diagnostics/envelope.js +0 -9
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/diagnostics/envelope.test.js +1 -1
- package/dist/diagnostics/envelope.test.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +0 -3
- package/dist/executable/executable-cache.js +2 -4
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +0 -4
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +5 -2
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +10 -10
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/cjs-syntax.js +0 -88
- package/dist/frontend/cjs-syntax.js.map +1 -1
- package/dist/frontend/dts-paths.d.ts +1 -1
- package/dist/frontend/dts-paths.js +1 -1
- package/dist/frontend/lowering/abstract-equality.js +1 -4
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +4 -11
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/builtins/arguments.js +0 -13
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +0 -4
- package/dist/frontend/lowering/builtins/crypto.js +0 -4
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +1 -39
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +0 -15
- package/dist/frontend/lowering/builtins/module-resolution.js +5 -44
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.d.ts +0 -6
- package/dist/frontend/lowering/builtins/numbers.js +6 -57
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +4 -67
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/workers.js +1 -1
- package/dist/frontend/lowering/builtins/workers.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.d.ts +1 -37
- package/dist/frontend/lowering/call-arguments.js +11 -94
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.d.ts +1 -6
- package/dist/frontend/lowering/call-signatures.js +16 -68
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +19 -4
- package/dist/frontend/lowering/class-dynamic-dispatch.js +168 -98
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +44 -4
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +0 -2
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.js +1 -1
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/coercions/function-adapters.js +5 -35
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +0 -1
- package/dist/frontend/lowering/coercions/state.js +0 -1
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +2 -4
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +2 -12
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.js +0 -1
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +9 -28
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +2 -3
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +10 -54
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +0 -1
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +2 -10
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +1 -6
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +0 -2
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +0 -6
- package/dist/frontend/lowering/containers/string-and-regexp.js +2 -10
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/expressions/evaluation-safety.js +0 -3
- package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +0 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +0 -8
- package/dist/frontend/lowering/expressions/object-literals.js +8 -35
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +0 -4
- package/dist/frontend/lowering/expressions/optional-chains.js +3 -66
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/function-context.js +0 -1
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.js +0 -1
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.js +10 -77
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.js +1 -10
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.test.js +2 -2
- package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +2 -3
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +2 -27
- package/dist/frontend/lowering/lower-calls.js +47 -463
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +11 -49
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.js +2 -3
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.js +5 -8
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +3 -4
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.js +3 -5
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +0 -8
- package/dist/frontend/lowering/lower-exprs.js +50 -907
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +2 -5
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +1 -50
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +0 -43
- package/dist/frontend/lowering/lower-modules.js +25 -329
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.js +5 -5
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +0 -30
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +98 -0
- package/dist/frontend/lowering/{lower-island.js → lower-stdlib.js} +97 -1160
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -0
- package/dist/frontend/lowering/lower-stmts.d.ts +0 -16
- package/dist/frontend/lowering/lower-stmts.js +58 -1016
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +1 -3
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +17 -151
- package/dist/frontend/lowering/lowerer.js +73 -770
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +4 -51
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/narrowing-stability.js +1 -1
- package/dist/frontend/lowering/narrowing-stability.js.map +1 -1
- package/dist/frontend/lowering/optional-arguments.js +0 -2
- package/dist/frontend/lowering/optional-arguments.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.test.js +2 -2
- package/dist/frontend/lowering/strict-equality.js +1 -1
- package/dist/frontend/lowering/strict-equality.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +6 -45
- package/dist/frontend/lowering/surfaces.js +5 -65
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/module-syntax.d.ts +0 -3
- package/dist/frontend/module-syntax.js.map +1 -1
- package/dist/frontend/npm-node.d.ts +0 -7
- package/dist/frontend/npm-node.js +0 -7
- package/dist/frontend/npm-node.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.d.ts +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +6 -82
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/npm-static.d.ts +1 -1
- package/dist/frontend/npm-static.js +6 -71
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +3 -319
- package/dist/frontend/npm.js +6 -1007
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.js +2 -197
- package/dist/frontend/npm.test.js.map +1 -1
- package/dist/frontend/pipeline-native.js +1 -2
- package/dist/frontend/pipeline-native.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +3 -11
- package/dist/frontend/pipeline.js +37 -56
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/pipeline.test.js +12 -6
- package/dist/frontend/pipeline.test.js.map +1 -1
- package/dist/frontend/program.d.ts +0 -34
- package/dist/frontend/program.js +12 -97
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/provenance-core.d.ts +0 -4
- package/dist/frontend/provenance-core.js +4 -37
- package/dist/frontend/provenance-core.js.map +1 -1
- package/dist/frontend/provenance-registry.d.ts +0 -4
- package/dist/frontend/provenance-registry.js +0 -20
- package/dist/frontend/provenance-registry.js.map +1 -1
- package/dist/frontend/resolve.d.ts +0 -12
- package/dist/frontend/resolve.js +0 -34
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.js +2 -2
- package/dist/frontend/runtime-resolve.js.map +1 -1
- package/dist/frontend/services-node.js +2 -3
- package/dist/frontend/services-node.js.map +1 -1
- package/dist/frontend/services.d.ts +1 -8
- package/dist/frontend/services.js +2 -22
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/services.test.js +0 -38
- package/dist/frontend/services.test.js.map +1 -1
- package/dist/frontend/tsc-codes.js +0 -11
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +2 -27
- package/dist/frontend/type-mapper.js +42 -153
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -10
- package/dist/index.js.map +1 -1
- package/dist/ir/api.d.ts +1 -1
- package/dist/ir/api.js +1 -1
- package/dist/ir/api.js.map +1 -1
- package/dist/ir/builtin-effects.js +0 -5
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +1 -55
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/constant-globals.test.js +1 -1
- package/dist/ir/constant-tables.test.js +1 -1
- package/dist/ir/final-fields.test.js +1 -1
- package/dist/ir/initializer-bindings.test.js +1 -1
- package/dist/ir/int32-slots.d.ts +3 -3
- package/dist/ir/int32-slots.js +5 -19
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +1 -1
- package/dist/ir/ir.d.ts +12 -284
- package/dist/ir/ir.js +10 -259
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +2 -7
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +3 -30
- package/dist/ir/runtime-features.js +5 -41
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/scalar-records.test.js +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +3 -3
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/traverse.js +0 -21
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/unshare.test.js +1 -1
- package/dist/ir/validate.js +9 -207
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +6 -6
- package/dist/library/fence-eval.test.js +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/library-cache.test.js +5 -5
- package/dist/library/prepare.js +5 -20
- package/dist/library/prepare.js.map +1 -1
- package/dist/native/cli.js +0 -2
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.test.js +2 -4
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/prepare.js +2 -4
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.js +2 -16
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +0 -3
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/startup-cache.js +0 -2
- package/dist/startup-cache.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +80 -88
- package/dist/backend/llvm/expr-island.d.ts +0 -15
- package/dist/backend/llvm/expr-island.js +0 -709
- package/dist/backend/llvm/expr-island.js.map +0 -1
- package/dist/frontend/lowering/coercions/island.d.ts +0 -37
- package/dist/frontend/lowering/coercions/island.js +0 -350
- package/dist/frontend/lowering/coercions/island.js.map +0 -1
- package/dist/frontend/lowering/lower-island.d.ts +0 -229
- package/dist/frontend/lowering/lower-island.js.map +0 -1
- package/dist/frontend/lowering/lower-island.test.d.ts +0 -1
- package/dist/frontend/lowering/lower-island.test.js +0 -56
- package/dist/frontend/lowering/lower-island.test.js.map +0 -1
- package/dist/frontend/npm-fetch-analysis.d.ts +0 -17
- package/dist/frontend/npm-fetch-analysis.js +0 -109
- package/dist/frontend/npm-fetch-analysis.js.map +0 -1
- package/dist/frontend/npm-fetch-analysis.test.d.ts +0 -1
- package/dist/frontend/npm-fetch-analysis.test.js +0 -130
- package/dist/frontend/npm-fetch-analysis.test.js.map +0 -1
- package/dist/frontend/npm-fetch-node.d.ts +0 -2
- package/dist/frontend/npm-fetch-node.js +0 -12
- package/dist/frontend/npm-fetch-node.js.map +0 -1
- package/dist/frontend/npm-fetch-syntax.d.ts +0 -6
- package/dist/frontend/npm-fetch-syntax.js +0 -202
- package/dist/frontend/npm-fetch-syntax.js.map +0 -1
- package/dist/native/runtime-typescript.d.ts +0 -4
- package/dist/native/runtime-typescript.js +0 -74
- package/dist/native/runtime-typescript.js.map +0 -1
- package/dist/native/runtime-typescript.test.d.ts +0 -1
- package/dist/native/runtime-typescript.test.js +0 -41
- package/dist/native/runtime-typescript.test.js.map +0 -1
|
@@ -14,12 +14,11 @@ import { lowerGenMethodCall } from "./lower-generators.js";
|
|
|
14
14
|
import { lowerClassSymbolMethodCall } from "./symbol-methods.js";
|
|
15
15
|
import { errorToStringCall } from "./error-methods.js";
|
|
16
16
|
import { lowerClassPrototypeAssign, lowerClassPrototypeDescriptors } from "./class-prototypes.js";
|
|
17
|
-
import { BYTES_ELEMENT_NAME, BIGINT_T, BOOL, CAUGHT, DYN, F64,
|
|
17
|
+
import { BYTES_ELEMENT_NAME, BIGINT_T, BOOL, CAUGHT, DYN, F64, NULL_T, STRING, SYMBOL_T, UNDEFINED_T, VOID, arrayOf, canBoxFuncIntoDyn, canConvertToDyn, canDynCheckTo, funcOf, isDynTypedRefType, isUnitType, shapeHasAccessorSlots, typeEquals, } from "../../ir/ir.js";
|
|
18
18
|
import { isJsSourceFile, locOf, requireSpecOf } from "../program.js";
|
|
19
19
|
import { isGenericCallableMemberType, typeKey } from "../type-mapper.js";
|
|
20
|
-
import {
|
|
20
|
+
import { dynFallbackType, jsFuncNameOf, newFnCtx, staticImportNamespaceType } from "./lowerer.js";
|
|
21
21
|
import { NARROW_FIRST, STRING_INDEX_METHODS, STR_METHODS, stdlibGlobalNameOf } from "./surfaces.js";
|
|
22
|
-
import { requiresDynamicDiag } from "../../diagnostics/diagnostic.js";
|
|
23
22
|
import { dynStringReceiver } from "./containers/dynamic-receivers.js";
|
|
24
23
|
import { lowerArrayConstructor, lowerArrayFromCall, lowerArrayOfCall, } from "./containers/array-construction.js";
|
|
25
24
|
import { lowerDynArrayFilterCall, lowerDynArrayFlatMapCall } from "./containers/array-callbacks.js";
|
|
@@ -57,28 +56,10 @@ import { lowerClassDataDescriptor, lowerClassDescriptorRead } from "./class-desc
|
|
|
57
56
|
import { classStaticDataFor } from "./class-static-data.js";
|
|
58
57
|
import { lowerUrlFactory } from "./lower-url.js";
|
|
59
58
|
import { nullishValueUnitOf } from "./binding-analysis.js";
|
|
60
|
-
import { spreadNeedsRuntimeArity, completeFuncValueArgs, lowerSpreadArgsCall,
|
|
59
|
+
import { spreadNeedsRuntimeArity, completeFuncValueArgs, lowerSpreadArgsCall, completeArgs, } from "./call-arguments.js";
|
|
61
60
|
import { isThisParameter } from "./call-signatures.js";
|
|
62
61
|
import { checkedArmExtraction } from "./coercions/unions.js";
|
|
63
62
|
import { requireObjLitGenericReceiver, objLitGenericFnNodeOf, objLitGenericFnInfoOf, genericCallInstance, } from "./generic-functions.js";
|
|
64
|
-
/** An island call result the .d.ts DECLARES as a primitive exits eagerly
|
|
65
|
-
* to that static type — the member-read rule's call sibling (see the
|
|
66
|
-
* getProp lowering in lower-exprs.ts): primitives copy by value, every
|
|
67
|
-
* static consumer works on the result, and a lying declaration throws the
|
|
68
|
-
* catchable TypeError. Chain-handled forms stay jsval (the optChain's
|
|
69
|
-
* unit path is the engine's undefined). */
|
|
70
|
-
export function islandPrimitiveExit(lowerer, call, result) {
|
|
71
|
-
if (call.questionDotToken)
|
|
72
|
-
return result;
|
|
73
|
-
if (ts.isPropertyAccessExpression(call.expression) && call.expression.questionDotToken)
|
|
74
|
-
return result;
|
|
75
|
-
const declared = lowerer.mapTypeOf(lowerer.typeOf(call));
|
|
76
|
-
if (declared &&
|
|
77
|
-
(declared.kind === "f64" || declared.kind === "bool" || declared.kind === "string")) {
|
|
78
|
-
return { kind: "jsExit", value: result, type: declared, loc: result.loc };
|
|
79
|
-
}
|
|
80
|
-
return result;
|
|
81
|
-
}
|
|
82
63
|
export function lowerCall(lowerer, expr) {
|
|
83
64
|
const loc = locOf(expr);
|
|
84
65
|
// Object's checker return type is `any`. Claim known object inputs
|
|
@@ -280,12 +261,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
280
261
|
}
|
|
281
262
|
const args = expr.arguments.map((a) => {
|
|
282
263
|
const lowered = lowerer.lowerExpr(a);
|
|
283
|
-
if (lowered.type.kind === "jsval") {
|
|
284
|
-
// Node prints objects with util.inspect formatting, which
|
|
285
|
-
// String() cannot match — silent divergence is banned. Templates
|
|
286
|
-
// are ToString (Node-exact), casts are validated: both honest.
|
|
287
|
-
lowerer.unsupported("SC1090", a, `${surface} of 'any' values (wrap it: ${surface}(\`\${v}\`), or validate with 'as <type>' first)`);
|
|
288
|
-
}
|
|
289
264
|
// Checked-dynamic values carry their own shape, so the runtime
|
|
290
265
|
// renders them exactly like Node's console formatter renders a
|
|
291
266
|
// non-format argument: strings VERBATIM, everything else through
|
|
@@ -580,20 +555,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
580
555
|
if (name === "String")
|
|
581
556
|
return lowerer.ensureString(arg, argNode);
|
|
582
557
|
}
|
|
583
|
-
// __island_eval: the internal island testing hook (eval in the embedded
|
|
584
|
-
// engine, String(result) back). Provenance-checked like setTimeout.
|
|
585
|
-
// Only meaningful when the engine is linked: without --dynamic it is a
|
|
586
|
-
// clean requires-dynamic diagnostic, never an ICE or a link error.
|
|
587
|
-
if (ts.isIdentifier(expr.expression) &&
|
|
588
|
-
expr.expression.text === "__island_eval" &&
|
|
589
|
-
lowerer.isStdlibSymbol(lowerer.resolveValueSymbol(expr.expression) ?? undefined)) {
|
|
590
|
-
if (!lowerer.dynamic) {
|
|
591
|
-
lowerer.pushDiag(requiresDynamicDiag("'__island_eval'", loc));
|
|
592
|
-
throw new PoisonError();
|
|
593
|
-
}
|
|
594
|
-
const code = lowerer.lowerExprExpecting(expr.arguments[0], STRING);
|
|
595
|
-
return { kind: "libCall", fn: "island.eval", args: [code], type: STRING, loc };
|
|
596
|
-
}
|
|
597
558
|
// Computed calls preserve their evaluated receiver just like dotted
|
|
598
559
|
// calls, including when the property is keyed by a native symbol.
|
|
599
560
|
if (ts.isElementAccessExpression(expr.expression) &&
|
|
@@ -640,129 +601,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
640
601
|
};
|
|
641
602
|
}
|
|
642
603
|
}
|
|
643
|
-
// Island calls. A property-access callee whose receiver is an 'any'
|
|
644
|
-
// value is an engine method call (this = receiver, JS-exact); any other
|
|
645
|
-
// 'any'-typed callee is an engine function call. Arguments marshal in;
|
|
646
|
-
// results stay island values.
|
|
647
|
-
// A questionDotToken here is always chain-handled (the gate at the top
|
|
648
|
-
// of lowerCall routed unhandled ones to the chain lowering), so
|
|
649
|
-
// `x?.y(...)` re-dispatches into this same method-call form with the
|
|
650
|
-
// receiver reading back as the chain's bound handle.
|
|
651
|
-
if (ts.isPropertyAccessExpression(expr.expression) &&
|
|
652
|
-
lowerer.isIslandExpr(expr.expression.expression)) {
|
|
653
|
-
// Typed fetch/Web Streams handles map to island values under
|
|
654
|
-
// --dynamic, but their inventory still owns which methods exist.
|
|
655
|
-
// Reject unsupported rows before the universal jsval method path.
|
|
656
|
-
lowerer.fenceStaticResponseMember(expr.expression, "call");
|
|
657
|
-
lowerer.fenceStaticHeadersMember(expr.expression, "call");
|
|
658
|
-
lowerer.fenceStaticReadableStreamMember(expr.expression, "call");
|
|
659
|
-
const receiver = lowerer.lowerExpr(expr.expression.expression);
|
|
660
|
-
// A checker-`any` receiver whose VALUE lives in the checked-dynamic tree (a
|
|
661
|
-
// checked-dynamic local behind the any-typed spelling — the JS
|
|
662
|
-
// WeakSet placeholder, rest-args arrays): the checked-dynamic
|
|
663
|
-
// method machinery owns it — receiver-kind dispatch, stored-member
|
|
664
|
-
// calls, honest fences — never an engine op over a dyn value.
|
|
665
|
-
if (receiver.type.kind === "dyn") {
|
|
666
|
-
const served = lowerDynReceiverMethodCall(lowerer, expr, expr.expression);
|
|
667
|
-
if (served)
|
|
668
|
-
return served;
|
|
669
|
-
lowerer.unsupported("SC1100", expr, `'.${expr.expression.name.text}()' calls through 'unknown'-valued receivers in dynamically-executed positions`);
|
|
670
|
-
}
|
|
671
|
-
const args = expr.arguments.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a));
|
|
672
|
-
const result = {
|
|
673
|
-
kind: "jsOp",
|
|
674
|
-
op: "callMethod",
|
|
675
|
-
name: expr.expression.name.text,
|
|
676
|
-
args: [receiver, ...args],
|
|
677
|
-
type: JSVAL,
|
|
678
|
-
loc,
|
|
679
|
-
};
|
|
680
|
-
return islandPrimitiveExit(lowerer, expr, result);
|
|
681
|
-
}
|
|
682
|
-
if (lowerer.isIslandExpr(expr.expression)) {
|
|
683
|
-
// `o.m(...)` where o LOWERS checked-dynamic and the checker types
|
|
684
|
-
// `o.m` 'any' (a member read behind an 'object'/'unknown'-typed
|
|
685
|
-
// bag): METHOD-CALL semantics — receiver-kind dispatch (dynInvoke),
|
|
686
|
-
// so `this` binds and a WRAPPED island receiver runs the ENGINE's
|
|
687
|
-
// own method (the routed-ops lane). A stored-member dynCall would
|
|
688
|
-
// call engine prototype methods receiverless — the this-less
|
|
689
|
-
// `list.slice()` ToObject TypeError. Spread arguments keep the
|
|
690
|
-
// stored-member path below (the runtime-arity lane owns them).
|
|
691
|
-
if (ts.isPropertyAccessExpression(expr.expression) &&
|
|
692
|
-
!expr.expression.questionDotToken &&
|
|
693
|
-
!expr.questionDotToken &&
|
|
694
|
-
!expr.arguments.some((a) => ts.isSpreadElement(a))) {
|
|
695
|
-
const recvProbe = tryLowerExpression(lowerer, expr.expression.expression);
|
|
696
|
-
if (recvProbe?.type.kind === "dyn") {
|
|
697
|
-
const args = expr.arguments.map((a) => lowerer.lowerExprExpecting(a, DYN));
|
|
698
|
-
return {
|
|
699
|
-
kind: "dynInvoke",
|
|
700
|
-
recv: recvProbe,
|
|
701
|
-
method: expr.expression.name.text,
|
|
702
|
-
calleeName: expr.expression.getText(),
|
|
703
|
-
args,
|
|
704
|
-
type: DYN,
|
|
705
|
-
loc,
|
|
706
|
-
};
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
const callee = lowerer.lowerExpr(expr.expression);
|
|
710
|
-
// A checker-`any` callee that LOWERED checked-dynamic (a dyn member
|
|
711
|
-
// chain's stored function): the checked-dynamic tree's own call — dynCall reads and
|
|
712
|
-
// calls the stored member with Node's is-not-a-function TypeError
|
|
713
|
-
// on refusal.
|
|
714
|
-
if (callee.type.kind === "dyn") {
|
|
715
|
-
const args = expr.arguments.map((a) => lowerer.lowerExprExpecting(a, DYN));
|
|
716
|
-
const calleeName = ts.isPropertyAccessExpression(expr.expression)
|
|
717
|
-
? expr.expression.getText()
|
|
718
|
-
: ts.isIdentifier(expr.expression)
|
|
719
|
-
? expr.expression.text
|
|
720
|
-
: "value";
|
|
721
|
-
return { kind: "dynCall", callee, calleeName, args, type: DYN, loc };
|
|
722
|
-
}
|
|
723
|
-
// `fn(...args)` — a TRAILING spread into an island call: the
|
|
724
|
-
// engine's own apply (`fn.apply(undefined, argsArray)`); leading
|
|
725
|
-
// plain arguments prepend through `[l1, l2].concat(argsArray)`
|
|
726
|
-
// (concat flattens the array argument one level — exactly the
|
|
727
|
-
// spread). Other spread shapes keep the syntax fence.
|
|
728
|
-
if (expr.arguments.length > 0 &&
|
|
729
|
-
ts.isSpreadElement(expr.arguments[expr.arguments.length - 1]) &&
|
|
730
|
-
expr.arguments.slice(0, -1).every((a) => !ts.isSpreadElement(a))) {
|
|
731
|
-
const spread = expr.arguments[expr.arguments.length - 1];
|
|
732
|
-
const spreadV = lowerer.jsvalIn(lowerer.lowerExpr(spread.expression), spread.expression);
|
|
733
|
-
const leading = expr.arguments
|
|
734
|
-
.slice(0, -1)
|
|
735
|
-
.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a));
|
|
736
|
-
const argsArr = leading.length === 0
|
|
737
|
-
? spreadV
|
|
738
|
-
: {
|
|
739
|
-
kind: "jsOp",
|
|
740
|
-
op: "callMethod",
|
|
741
|
-
name: "concat",
|
|
742
|
-
args: [{ kind: "jsOp", op: "arrLit", args: leading, type: JSVAL, loc }, spreadV],
|
|
743
|
-
type: JSVAL,
|
|
744
|
-
loc,
|
|
745
|
-
};
|
|
746
|
-
const result = {
|
|
747
|
-
kind: "jsOp",
|
|
748
|
-
op: "callMethod",
|
|
749
|
-
name: "apply",
|
|
750
|
-
args: [callee, { kind: "jsOp", op: "undefLit", args: [], type: JSVAL, loc }, argsArr],
|
|
751
|
-
type: JSVAL,
|
|
752
|
-
loc,
|
|
753
|
-
};
|
|
754
|
-
return islandPrimitiveExit(lowerer, expr, result);
|
|
755
|
-
}
|
|
756
|
-
const args = expr.arguments.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a));
|
|
757
|
-
const result = {
|
|
758
|
-
kind: "jsOp",
|
|
759
|
-
op: "callFn",
|
|
760
|
-
args: [callee, ...args],
|
|
761
|
-
type: JSVAL,
|
|
762
|
-
loc,
|
|
763
|
-
};
|
|
764
|
-
return islandPrimitiveExit(lowerer, expr, result);
|
|
765
|
-
}
|
|
766
604
|
// Builtin-module functions (fs, path, os, ...): named imports whose
|
|
767
605
|
// binding resolves to a supported builtin specifier lower to `libCall`.
|
|
768
606
|
// A user local shadowing an import has a different symbol and never
|
|
@@ -851,9 +689,8 @@ export function lowerCall(lowerer, expr) {
|
|
|
851
689
|
}
|
|
852
690
|
// STATIC parseInt/parseFloat/isNaN/isFinite (num.parseInt /
|
|
853
691
|
// num.parseFloat / num.isNaN / number.isFinite — scr_string.c,
|
|
854
|
-
// scr_lib.c; ECMA-exact, Node is the oracle).
|
|
855
|
-
//
|
|
856
|
-
// different, non-stdlib symbol. parseInt's omitted radix completes
|
|
692
|
+
// scr_lib.c; ECMA-exact, Node is the oracle). Declaration provenance
|
|
693
|
+
// excludes shadowed names. parseInt's omitted radix completes
|
|
857
694
|
// to 0 — the spec's "undefined" (base 10 with the 0x hex escape);
|
|
858
695
|
// parseFloat lowers the STRING form only (Node would ToString other
|
|
859
696
|
// values — no static story); isNaN/isFinite's arguments are
|
|
@@ -935,8 +772,7 @@ export function lowerCall(lowerer, expr) {
|
|
|
935
772
|
if (v.type.kind === "dyn") {
|
|
936
773
|
data = v;
|
|
937
774
|
}
|
|
938
|
-
else if (v.kind === "unitLit" ||
|
|
939
|
-
(v.type.kind !== "jsval" && lowerer.dynConvertible(v.type))) {
|
|
775
|
+
else if (v.kind === "unitLit" || lowerer.dynConvertible(v.type)) {
|
|
940
776
|
data = { kind: "dynFrom", value: v, type: DYN, loc };
|
|
941
777
|
}
|
|
942
778
|
else {
|
|
@@ -950,11 +786,10 @@ export function lowerCall(lowerer, expr) {
|
|
|
950
786
|
loc,
|
|
951
787
|
};
|
|
952
788
|
}
|
|
953
|
-
// Island-backed globals (parseFloat, isFinite): the engine's own
|
|
954
789
|
// global function executes — callFn(globalGet(name)) — and the
|
|
955
790
|
// result exits to the declared static type. A user function
|
|
956
791
|
// shadowing the name has a different, non-stdlib symbol.
|
|
957
|
-
const islFn = lowerer.
|
|
792
|
+
const islFn = lowerer.stdlibGlobalFnOf(expr.expression);
|
|
958
793
|
if (islFn && expr.arguments.length !== islFn.args.length) {
|
|
959
794
|
const name = expr.expression.text;
|
|
960
795
|
lowerer.noLowering(`${name} with ${expr.arguments.length} argument${expr.arguments.length === 1 ? "" : "s"}`, expr);
|
|
@@ -962,31 +797,14 @@ export function lowerCall(lowerer, expr) {
|
|
|
962
797
|
if (islFn && expr.arguments.length === islFn.args.length) {
|
|
963
798
|
// The static forms above already took the exactly-typed argument
|
|
964
799
|
// (a string for parseFloat, a number for isFinite): name the
|
|
965
|
-
// argument type that
|
|
966
|
-
//
|
|
967
|
-
//
|
|
968
|
-
const argText =
|
|
800
|
+
// argument type that refused the call, so the message states the
|
|
801
|
+
// condition rather than reading as if the global itself were
|
|
802
|
+
// unsupported.
|
|
803
|
+
const argText = loweredArgumentText(lowerer, expr.arguments[0]);
|
|
969
804
|
const exact = expr.expression.text === "isFinite" ? "number" : "string";
|
|
970
|
-
lowerer.
|
|
971
|
-
? "convert the argument explicitly first (for example String(x), or narrow the union)
|
|
972
|
-
: "
|
|
973
|
-
const callee = {
|
|
974
|
-
kind: "jsOp",
|
|
975
|
-
op: "globalGet",
|
|
976
|
-
name: expr.expression.text,
|
|
977
|
-
args: [],
|
|
978
|
-
type: JSVAL,
|
|
979
|
-
loc,
|
|
980
|
-
};
|
|
981
|
-
const args = expr.arguments.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a));
|
|
982
|
-
const result = {
|
|
983
|
-
kind: "jsOp",
|
|
984
|
-
op: "callFn",
|
|
985
|
-
args: [callee, ...args],
|
|
986
|
-
type: JSVAL,
|
|
987
|
-
loc,
|
|
988
|
-
};
|
|
989
|
-
return { kind: "jsExit", value: result, type: islFn.ret, loc };
|
|
805
|
+
lowerer.refuseUnsupportedApi(`'${expr.expression.text}' with a '${argText}' argument`, expr, exact === "string"
|
|
806
|
+
? "only a string argument compiles statically: convert the argument explicitly first (for example String(x), or narrow the union)"
|
|
807
|
+
: "only a number argument compiles statically: narrow the argument to a number first");
|
|
990
808
|
}
|
|
991
809
|
}
|
|
992
810
|
// A TYPE-GUARD call on a catch binding (`isErrnoException(err)` —
|
|
@@ -1254,8 +1072,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
1254
1072
|
lowerPromiseAllTupleCall(lowerer, expr, expr.expression) ??
|
|
1255
1073
|
lowerer.lowerPromiseStaticCall(expr, expr.expression) ??
|
|
1256
1074
|
lowerPromiseRejectCall(lowerer, expr, expr.expression) ??
|
|
1257
|
-
// Before the island path: regex-argument replace/replaceAll/split
|
|
1258
|
-
// lower STATICALLY; only the string-pattern overloads are island.
|
|
1259
1075
|
lowerRegexMethodCallWithOptionalArg(lowerer, expr, expr.expression) ??
|
|
1260
1076
|
lowerUrlStaticCall(lowerer, expr, expr.expression) ??
|
|
1261
1077
|
lowerer.lowerUrlMethodCall(expr, expr.expression) ??
|
|
@@ -1304,7 +1120,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
1304
1120
|
lowerStringPrototypeCall(lowerer, expr, expr.expression) ??
|
|
1305
1121
|
lowerStringMethodCallWithOptionalArgs(lowerer, expr, expr.expression) ??
|
|
1306
1122
|
// Typed-array/Buffer receivers and the Buffer statics — before the
|
|
1307
|
-
// island path (bytes never cross the boundary).
|
|
1308
1123
|
lowerer.lowerBytesMethodCall(expr, expr.expression) ??
|
|
1309
1124
|
lowerBytesStaticCall(lowerer, expr, expr.expression) ??
|
|
1310
1125
|
lowerBufferStaticCallWithNarrowedArg(lowerer, expr, expr.expression) ??
|
|
@@ -1312,7 +1127,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
1312
1127
|
// stdlib chokepoint claims the member).
|
|
1313
1128
|
lowerStreamStaticCall(lowerer, expr, expr.expression) ??
|
|
1314
1129
|
// Primitive toString calls, including numeric radices, use the
|
|
1315
|
-
// native formatters before the island method path.
|
|
1316
1130
|
lowerNumberToStringCall(lowerer, expr, expr.expression) ??
|
|
1317
1131
|
// Union receivers whose every arm has a text — the ngrok
|
|
1318
1132
|
// `(chunk: Buffer | string) => chunk.toString()` idiom.
|
|
@@ -1321,31 +1135,23 @@ export function lowerCall(lowerer, expr) {
|
|
|
1321
1135
|
// override-free program classes — "[object Object]", folded.
|
|
1322
1136
|
lowerDefaultToStringCall(lowerer, expr, expr.expression) ??
|
|
1323
1137
|
// The remaining primitive prototype statics — toExponential(),
|
|
1324
|
-
// both toFixed() forms, hasOwnProperty over literal keys.
|
|
1325
|
-
// the island path. Optional-chain spellings first enter the chain
|
|
1326
|
-
// machinery above, then re-enter here with a narrowed chainRecv.
|
|
1138
|
+
// both toFixed() forms, hasOwnProperty over literal keys.
|
|
1327
1139
|
lowerPrimitiveProtoCall(lowerer, expr, expr.expression.expression, expr.expression.name.text, lowerer.checker.getSymbolAtLocation(expr.expression.name)) ??
|
|
1328
1140
|
// hasOwnProperty on a program class CONSTRUCTOR — own statics are
|
|
1329
1141
|
// compile-time-known, so a literal key folds to a constant.
|
|
1330
1142
|
lowerClassHasOwnPropertyCall(lowerer, expr, expr.expression) ??
|
|
1331
1143
|
lowerObjectOwnMethodCall(lowerer, expr, expr.expression) ??
|
|
1332
|
-
// Response constructor
|
|
1333
|
-
//
|
|
1334
|
-
// and generic-call fallbacks (Response.json otherwise reports the
|
|
1335
|
-
// generic SC1090 fence).
|
|
1144
|
+
// Refuse Response constructor operations before generic-call
|
|
1145
|
+
// fallbacks can report an unrelated SC1090 diagnostic.
|
|
1336
1146
|
lowerer.fenceUnsupportedFetchConstructorMember(expr.expression) ??
|
|
1337
1147
|
// Static fetch responses are checked-dynamic handles, but the
|
|
1338
1148
|
// adopted undici declaration exposes a wider API than that handle.
|
|
1339
|
-
//
|
|
1340
|
-
// dyn receiver path can compile them into a runtime missing-method
|
|
1341
|
-
// failure. Dynamic-only rows pass through these checks unchanged.
|
|
1149
|
+
// Refuse unsupported members before generic checked-value dispatch.
|
|
1342
1150
|
lowerer.fenceStaticResponseMember(expr.expression, "call") ??
|
|
1343
1151
|
lowerer.fenceStaticHeadersMember(expr.expression, "call") ??
|
|
1344
1152
|
lowerer.fenceStaticReadableStreamMember(expr.expression, "call") ??
|
|
1345
|
-
lowerer.
|
|
1153
|
+
lowerer.lowerStdlibMethodCall(expr, expr.expression) ??
|
|
1346
1154
|
// Dyn receivers (JSON.parse-derived `unknown`/`any` values) —
|
|
1347
|
-
// validated-extract, then the static machinery. After the island
|
|
1348
|
-
// path (jsval receivers belong there), before the fences.
|
|
1349
1155
|
lowerDynReceiverMethodCall(lowerer, expr, expr.expression) ??
|
|
1350
1156
|
// Narrowing filters (inferred predicates, filter(Boolean)) claim
|
|
1351
1157
|
// their calls before the generic array HOF path types the result
|
|
@@ -1472,9 +1278,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
1472
1278
|
const symbolMethod = lowerClassSymbolMethodCall(lowerer, expr);
|
|
1473
1279
|
if (symbolMethod)
|
|
1474
1280
|
return symbolMethod;
|
|
1475
|
-
const headersIterator = lowerer.lowerDynamicHeadersIteratorCall(expr, expr.expression);
|
|
1476
|
-
if (headersIterator)
|
|
1477
|
-
return headersIterator;
|
|
1478
1281
|
lowerer.fenceUnsupportedFetchConstructorMember(expr.expression);
|
|
1479
1282
|
lowerer.fenceStaticResponseMember(expr.expression, "call");
|
|
1480
1283
|
lowerer.fenceStaticHeadersMember(expr.expression, "call");
|
|
@@ -1663,34 +1466,6 @@ export function lowerCall(lowerer, expr) {
|
|
|
1663
1466
|
if (spreadServed)
|
|
1664
1467
|
return spreadServed;
|
|
1665
1468
|
}
|
|
1666
|
-
// An ISLAND-REST func value called directly (`f(1, 2)` where f is the
|
|
1667
|
-
// --dynamic `(...args) =>` lambda): the type SPELLS its trailing
|
|
1668
|
-
// engine-array param — complete the call exactly like completeArgs'
|
|
1669
|
-
// island pack (fixed slots positionally, missing ones with the
|
|
1670
|
-
// engine's undefined, the surplus marshaled into one fresh engine
|
|
1671
|
-
// array). JS arity, no runtime machinery.
|
|
1672
|
-
if (callee.type.rest === true &&
|
|
1673
|
-
callee.type.restAbi === "jsval" &&
|
|
1674
|
-
callee.type.params.length >= 1 &&
|
|
1675
|
-
callee.type.params[callee.type.params.length - 1].kind === "jsval" &&
|
|
1676
|
-
!expr.arguments.some((a) => ts.isSpreadElement(a))) {
|
|
1677
|
-
const fixed = callee.type.params.slice(0, -1);
|
|
1678
|
-
const args = fixed.map((p, i) => {
|
|
1679
|
-
const a = expr.arguments[i];
|
|
1680
|
-
if (a)
|
|
1681
|
-
return lowerer.lowerExprExpecting(a, p);
|
|
1682
|
-
const absent = omittedArgFor(lowerer, p, loc);
|
|
1683
|
-
if (!absent) {
|
|
1684
|
-
lowerer.unsupported("SC1090", expr, "calls omitting a non-optional parameter of the callee's type");
|
|
1685
|
-
}
|
|
1686
|
-
return absent;
|
|
1687
|
-
});
|
|
1688
|
-
const restArgs = expr.arguments
|
|
1689
|
-
.slice(fixed.length)
|
|
1690
|
-
.map((a) => lowerer.lowerExprExpecting(a, JSVAL));
|
|
1691
|
-
args.push({ kind: "jsOp", op: "arrLit", args: restArgs, type: JSVAL, loc });
|
|
1692
|
-
return { kind: "callValue", callee, args, type: callee.type.ret, loc };
|
|
1693
|
-
}
|
|
1694
1469
|
// A JS call with MORE arguments than the callee's lowered signature
|
|
1695
1470
|
// (`cb(1, 'x')` where the mustCall wrapper's inferred type declared
|
|
1696
1471
|
// fewer params — tsc's JS world doesn't police arity): ride the
|
|
@@ -2204,8 +1979,7 @@ const ARRAY_BORROW_METHODS = new Set([
|
|
|
2204
1979
|
"some",
|
|
2205
1980
|
]);
|
|
2206
1981
|
function lowerArrayPrototypeBorrowCall(lowerer, call, access) {
|
|
2207
|
-
if (
|
|
2208
|
-
!isJsSourceFile(call.getSourceFile()) ||
|
|
1982
|
+
if (!isJsSourceFile(call.getSourceFile()) ||
|
|
2209
1983
|
call.questionDotToken ||
|
|
2210
1984
|
access.questionDotToken ||
|
|
2211
1985
|
access.name.text !== "call" ||
|
|
@@ -2239,9 +2013,7 @@ function lowerArrayPrototypeBorrowCall(lowerer, call, access) {
|
|
|
2239
2013
|
};
|
|
2240
2014
|
}
|
|
2241
2015
|
function lowerObjectOwnPrototypeCall(lowerer, call, access) {
|
|
2242
|
-
if (
|
|
2243
|
-
access.name.text !== "call" ||
|
|
2244
|
-
!ts.isPropertyAccessExpression(access.expression))
|
|
2016
|
+
if (access.name.text !== "call" || !ts.isPropertyAccessExpression(access.expression))
|
|
2245
2017
|
return null;
|
|
2246
2018
|
const method = access.expression;
|
|
2247
2019
|
const enumerable = method.name.text === "propertyIsEnumerable";
|
|
@@ -2258,8 +2030,7 @@ function lowerObjectOwnPrototypeCall(lowerer, call, access) {
|
|
|
2258
2030
|
}
|
|
2259
2031
|
function lowerObjectOwnMethodCall(lowerer, call, access) {
|
|
2260
2032
|
const method = access.name.text;
|
|
2261
|
-
if (
|
|
2262
|
-
call.questionDotToken ||
|
|
2033
|
+
if (call.questionDotToken ||
|
|
2263
2034
|
access.questionDotToken ||
|
|
2264
2035
|
(method !== "hasOwnProperty" && method !== "propertyIsEnumerable") ||
|
|
2265
2036
|
call.arguments.some(ts.isSpreadElement))
|
|
@@ -2477,9 +2248,7 @@ function lowerObjectOwnCall(lowerer, call, receiverNode, keyNode, extraNodes, me
|
|
|
2477
2248
|
return { kind: "seqExpr", stmts, result, type: BOOL, loc };
|
|
2478
2249
|
}
|
|
2479
2250
|
function lowerObjectPrototypeCall(lowerer, call, access) {
|
|
2480
|
-
if (
|
|
2481
|
-
access.name.text !== "call" ||
|
|
2482
|
-
!ts.isPropertyAccessExpression(access.expression))
|
|
2251
|
+
if (access.name.text !== "call" || !ts.isPropertyAccessExpression(access.expression))
|
|
2483
2252
|
return null;
|
|
2484
2253
|
const method = access.expression;
|
|
2485
2254
|
const prototype = method.expression;
|
|
@@ -3578,12 +3347,11 @@ function lowerArrayIsArrayCall(lowerer, call, access) {
|
|
|
3578
3347
|
// (`Array.isArray(tlds)` on `string | readonly string[]` — the
|
|
3579
3348
|
// narrowing test tsc's control flow then builds on); several array
|
|
3580
3349
|
// arms OR their tag tests, and zero arms fold to false — both only
|
|
3581
|
-
// over side-effect-free reads
|
|
3582
|
-
//
|
|
3583
|
-
// static tag answer and keep the narrow-first fence.
|
|
3350
|
+
// over side-effect-free reads. Opaque arms have no static tag answer
|
|
3351
|
+
// and keep the narrow-first fence.
|
|
3584
3352
|
const unionId = arg.type.unionId;
|
|
3585
3353
|
const def = lowerer.unions.get(unionId);
|
|
3586
|
-
const opaque = !def || def.arms.some((a) => a.kind === "dyn" || a.kind === "caught"
|
|
3354
|
+
const opaque = !def || def.arms.some((a) => a.kind === "dyn" || a.kind === "caught");
|
|
3587
3355
|
const arrayTags = lowerer.arrayValueTags(arg.type.unionId);
|
|
3588
3356
|
const freeRead = arg.kind === "varRef" || arg.kind === "recordGet" || arg.kind === "fieldGet";
|
|
3589
3357
|
if (!opaque && arrayTags.length === 1) {
|
|
@@ -3615,7 +3383,7 @@ function lowerArrayIsArrayCall(lowerer, call, access) {
|
|
|
3615
3383
|
}
|
|
3616
3384
|
lowerer.unsupported("SC1090", argNode, `Array.isArray on '${lowerer.fmt(arg.type)}' values (narrow first: check a discriminant field, or compare with '!== undefined'/'!== null' for unit arms)`);
|
|
3617
3385
|
}
|
|
3618
|
-
if (arg.type.kind === "
|
|
3386
|
+
if (arg.type.kind === "caught")
|
|
3619
3387
|
return null;
|
|
3620
3388
|
if (arg.kind === "varRef" || arg.kind === "recordGet" || arg.kind === "fieldGet") {
|
|
3621
3389
|
return { kind: "boolLit", value: lowerer.isArrayValueType(arg.type), type: BOOL, loc };
|
|
@@ -4152,24 +3920,13 @@ function reconcileOverloadReturn(lowerer, expr, call) {
|
|
|
4152
3920
|
// follows maybeNarrow's stance — a unit arm has no payload to extract.
|
|
4153
3921
|
if (!rt || rt.kind === "void" || isUnitType(rt) || typeEquals(rt, call.type))
|
|
4154
3922
|
return call;
|
|
4155
|
-
// An ISLAND-valued implementation return (`any` under --dynamic): the
|
|
4156
3923
|
// resolved overload's return type is a claim tsc never checked against
|
|
4157
3924
|
// the body — extracting it HERE would throw the boundary TypeError
|
|
4158
3925
|
// where Node just lets the value flow (functionOverloads35: the
|
|
4159
3926
|
// implementation returns its object argument under a number-returning
|
|
4160
3927
|
// overload signature; Node exits clean). The checker-trust trap keeps
|
|
4161
3928
|
// governing edges the checker actually vouches for; this edge it never
|
|
4162
|
-
// did. The
|
|
4163
|
-
// (uncheckedOverloadHandleCall's rule at the declaration sites), and
|
|
4164
|
-
// uses dispatch to engine ops like any island value.
|
|
4165
|
-
if (call.type.kind === "jsval")
|
|
4166
|
-
return call;
|
|
4167
|
-
// The CHECKED-DYNAMIC twin of the island rule: an `any`-returning
|
|
4168
|
-
// implementation under a typed overload signature is the same
|
|
4169
|
-
// never-vouched-for edge (functionOverloads35's shape without
|
|
4170
|
-
// --dynamic) — extracting the resolved type HERE would throw the
|
|
4171
|
-
// boundary TypeError where Node lets the value flow. Uses stay
|
|
4172
|
-
// checked per read like every any-origin value.
|
|
3929
|
+
// did. The checked value stays in bindings and is validated per use.
|
|
4173
3930
|
if (call.type.kind === "dyn")
|
|
4174
3931
|
return call;
|
|
4175
3932
|
if (call.type.kind === "union" && rt.kind !== "union") {
|
|
@@ -4224,24 +3981,6 @@ function templateEscapesValid(raw) {
|
|
|
4224
3981
|
}
|
|
4225
3982
|
return true;
|
|
4226
3983
|
}
|
|
4227
|
-
/** Tagged templates `tag\`a${x}b\`` — ES's call: tag(strings, ...values).
|
|
4228
|
-
* The strings object is a per-SITE lazily initialized hidden array global,
|
|
4229
|
-
* so the spec's identity contract holds — the same site evaluated twice
|
|
4230
|
-
* hands the tag the SAME array; two sites never share. TemplateStringsArray
|
|
4231
|
-
* maps to string[] (type-mapper.ts), so the array rides the ordinary
|
|
4232
|
-
* slot-directed coercion into whatever the tag's first parameter wants
|
|
4233
|
-
* — string[] exactly, an `any` slot through the dyn boundary, a rest
|
|
4234
|
-
* pack's first element. Checked tags receive frozen cooked and raw
|
|
4235
|
-
* arrays with the standard nonenumerable `.raw` descriptor. Typed direct
|
|
4236
|
-
* tags retain the string-array representation.
|
|
4237
|
-
*
|
|
4238
|
-
* Tag forms: a top-level declared function (the direct-call fast path —
|
|
4239
|
-
* overload sets reconcile through the resolved signature exactly like
|
|
4240
|
-
* plain calls), an island value under --dynamic (engine method/function
|
|
4241
|
-
* call with the engine's cooked/raw template object), and
|
|
4242
|
-
* a checked-dynamic value (the dynCall boundary — a non-function tag
|
|
4243
|
-
* throws Node's catchable TypeError). Everything else — generic tags,
|
|
4244
|
-
* method tags, function-value bindings — fences by name. */
|
|
4245
3984
|
export function lowerTaggedTemplate(lowerer, expr) {
|
|
4246
3985
|
const loc = locOf(expr);
|
|
4247
3986
|
const pieces = ts.isNoSubstitutionTemplateLiteral(expr.template)
|
|
@@ -4256,51 +3995,6 @@ export function lowerTaggedTemplate(lowerer, expr) {
|
|
|
4256
3995
|
const values = ts.isNoSubstitutionTemplateLiteral(expr.template)
|
|
4257
3996
|
? []
|
|
4258
3997
|
: expr.template.templateSpans.map((s) => s.expression);
|
|
4259
|
-
// Island tags (--dynamic): the engine call forms, mirroring lowerCall's
|
|
4260
|
-
// island paths — a property-access tag is a method call (this = the
|
|
4261
|
-
// receiver, JS-exact), any other island tag a function call. The
|
|
4262
|
-
// strings argument builds ENGINE-NATIVE with its `.raw` property (the
|
|
4263
|
-
// tplStrings op): a JSON marshal would drop `.raw`, and tags dispatch
|
|
4264
|
-
// on it (the outdent idiom treats a raw-less argument as its OPTIONS
|
|
4265
|
-
// form and answers a function). A fresh array per evaluation — tags
|
|
4266
|
-
// caching by strings identity re-compute per call (SEMANTICS.md).
|
|
4267
|
-
const islandStrings = () => ({
|
|
4268
|
-
kind: "jsOp",
|
|
4269
|
-
op: "tplStrings",
|
|
4270
|
-
args: [
|
|
4271
|
-
...pieces.map((p) => ({
|
|
4272
|
-
kind: "jsMarshal",
|
|
4273
|
-
value: { kind: "strLit", value: p.text, type: STRING, loc },
|
|
4274
|
-
type: JSVAL,
|
|
4275
|
-
loc,
|
|
4276
|
-
})),
|
|
4277
|
-
...pieces.map((p) => ({
|
|
4278
|
-
kind: "jsMarshal",
|
|
4279
|
-
value: { kind: "strLit", value: templateRawTextOf(p), type: STRING, loc },
|
|
4280
|
-
type: JSVAL,
|
|
4281
|
-
loc,
|
|
4282
|
-
})),
|
|
4283
|
-
],
|
|
4284
|
-
type: JSVAL,
|
|
4285
|
-
loc,
|
|
4286
|
-
});
|
|
4287
|
-
if (ts.isPropertyAccessExpression(expr.tag) && lowerer.isIslandExpr(expr.tag.expression)) {
|
|
4288
|
-
const receiver = lowerer.lowerExpr(expr.tag.expression);
|
|
4289
|
-
const args = [islandStrings(), ...values.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a))];
|
|
4290
|
-
return {
|
|
4291
|
-
kind: "jsOp",
|
|
4292
|
-
op: "callMethod",
|
|
4293
|
-
name: expr.tag.name.text,
|
|
4294
|
-
args: [receiver, ...args],
|
|
4295
|
-
type: JSVAL,
|
|
4296
|
-
loc,
|
|
4297
|
-
};
|
|
4298
|
-
}
|
|
4299
|
-
if (lowerer.isIslandExpr(expr.tag)) {
|
|
4300
|
-
const callee = lowerer.lowerExpr(expr.tag);
|
|
4301
|
-
const args = [islandStrings(), ...values.map((a) => lowerer.jsvalIn(lowerer.lowerExpr(a), a))];
|
|
4302
|
-
return { kind: "jsOp", op: "callFn", args: [callee, ...args], type: JSVAL, loc };
|
|
4303
|
-
}
|
|
4304
3998
|
// Direct call of a top-level declared function — the plain-call fast
|
|
4305
3999
|
// path with the strings array as the leading completed argument.
|
|
4306
4000
|
if (ts.isIdentifier(expr.tag) && !lowerer.isSelfReference(expr.tag)) {
|
|
@@ -4494,20 +4188,14 @@ function loweredTemplateStrings(lowerer, expr, cooked, loc, raw) {
|
|
|
4494
4188
|
* wrapper's await re-throws it), and a handler throw rejects the
|
|
4495
4189
|
* result — the spec's onFulfilled rules by construction. Null for
|
|
4496
4190
|
* non-promise receivers and other members. */
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
* `import("...")` call is the island promise itself; an identifier bound
|
|
4500
|
-
* to a promise-of-jsval local or module global answers the binding's
|
|
4501
|
-
* type. Null everywhere else. */
|
|
4502
|
-
function islandPromiseStorageTypeOf(lowerer, e) {
|
|
4503
|
-
const direct = lowerer.dynamic ? importCallHandleType(e) : staticImportNamespaceType(lowerer, e);
|
|
4191
|
+
function modulePromiseStorageTypeOf(lowerer, e) {
|
|
4192
|
+
const direct = staticImportNamespaceType(lowerer, e);
|
|
4504
4193
|
if (direct?.kind === "promise")
|
|
4505
4194
|
return direct;
|
|
4506
4195
|
if (!ts.isIdentifier(e))
|
|
4507
4196
|
return null;
|
|
4508
4197
|
const local = lowerer.resolveLocal(e);
|
|
4509
|
-
if (local?.type.kind === "promise" &&
|
|
4510
|
-
(local.type.inner.kind === "jsval" || local.type.inner.kind === "moduleNs"))
|
|
4198
|
+
if (local?.type.kind === "promise" && local.type.inner.kind === "moduleNs")
|
|
4511
4199
|
return local.type;
|
|
4512
4200
|
if (local)
|
|
4513
4201
|
return null;
|
|
@@ -4515,27 +4203,10 @@ function islandPromiseStorageTypeOf(lowerer, e) {
|
|
|
4515
4203
|
if (sym && sym.flags & ts.SymbolFlags.Alias)
|
|
4516
4204
|
sym = lowerer.checker.getAliasedSymbol(sym);
|
|
4517
4205
|
const g = sym ? lowerer.globalsBySymbol.get(sym) : undefined;
|
|
4518
|
-
if (g?.type.kind === "promise" &&
|
|
4519
|
-
(g.type.inner.kind === "jsval" || g.type.inner.kind === "moduleNs"))
|
|
4206
|
+
if (g?.type.kind === "promise" && g.type.inner.kind === "moduleNs")
|
|
4520
4207
|
return g.type;
|
|
4521
4208
|
return null;
|
|
4522
4209
|
}
|
|
4523
|
-
/** Marks an INLINE then-handler's unannotated identifier parameters for
|
|
4524
|
-
* the island-handle (jsval) binding type — paramShape's early-out. Only
|
|
4525
|
-
* the inline arrow/function forms qualify: a handler VALUE keeps its own
|
|
4526
|
-
* declared signature (and the settled-type equality check below). */
|
|
4527
|
-
function markJsvalHandlerParams(lowerer, handler) {
|
|
4528
|
-
let e = handler;
|
|
4529
|
-
while (ts.isParenthesizedExpression(e))
|
|
4530
|
-
e = e.expression;
|
|
4531
|
-
if (!ts.isArrowFunction(e) && !ts.isFunctionExpression(e))
|
|
4532
|
-
return;
|
|
4533
|
-
for (const p of e.parameters) {
|
|
4534
|
-
if (ts.isIdentifier(p.name) && p.type === undefined && !p.dotDotDotToken && !p.initializer) {
|
|
4535
|
-
lowerer.jsvalParamOverrides.add(p);
|
|
4536
|
-
}
|
|
4537
|
-
}
|
|
4538
|
-
}
|
|
4539
4210
|
function markModuleNsHandlerParams(lowerer, handler, type) {
|
|
4540
4211
|
let e = handler;
|
|
4541
4212
|
while (ts.isParenthesizedExpression(e))
|
|
@@ -4557,13 +4228,10 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4557
4228
|
let recvT = lowerer.mapTypeOf(lowerer.typeOf(access.expression)) ??
|
|
4558
4229
|
dynFallbackType(lowerer, access.expression, lowerer.typeOf(access.expression));
|
|
4559
4230
|
// A dynamic-import promise under an unmappable checker type
|
|
4560
|
-
// (`Promise<typeof import("./m")>`
|
|
4561
|
-
//
|
|
4562
|
-
// (importCallHandleType / the island-HANDLE var rules), so the storage
|
|
4563
|
-
// type is the receiver's truth. Direct `import("./m").then(...)`
|
|
4564
|
-
// spells the same promise with no binding at all.
|
|
4231
|
+
// (`Promise<typeof import("./m")>`) uses the module promise's native
|
|
4232
|
+
// storage type. Direct `import("./m").then(...)` needs no binding.
|
|
4565
4233
|
if (!recvT)
|
|
4566
|
-
recvT =
|
|
4234
|
+
recvT = modulePromiseStorageTypeOf(lowerer, access.expression);
|
|
4567
4235
|
if (recvT?.kind !== "promise")
|
|
4568
4236
|
return null;
|
|
4569
4237
|
if (!lowerer.isStdlibMember(access))
|
|
@@ -4597,20 +4265,6 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4597
4265
|
}
|
|
4598
4266
|
// The receiver evaluates FIRST, in the enclosing function, like JS.
|
|
4599
4267
|
let receiver = lowerer.lowerExpr(access.expression);
|
|
4600
|
-
// A PACKAGE-returned promise lowers as an island value (jsval): the
|
|
4601
|
-
// promise lives in the engine, so bridge it — a static promise the
|
|
4602
|
-
// engine promise settles (fulfillment = the retained handle or void,
|
|
4603
|
-
// rejection = the bridged reason) — and desugar over the BRIDGE
|
|
4604
|
-
// exactly like a native receiver. This is the classic CLI entry line,
|
|
4605
|
-
// `program.parseAsync(process.argv).catch(handler)`.
|
|
4606
|
-
if (receiver.type.kind === "jsval") {
|
|
4607
|
-
receiver = {
|
|
4608
|
-
kind: "jsBridgePromise",
|
|
4609
|
-
value: receiver,
|
|
4610
|
-
type: { kind: "promise", inner: recvT.inner.kind === "void" ? VOID : JSVAL },
|
|
4611
|
-
loc,
|
|
4612
|
-
};
|
|
4613
|
-
}
|
|
4614
4268
|
if (receiver.type.kind === "dyn" && lowerer.dynConvertible(recvT))
|
|
4615
4269
|
receiver = lowerer.coerceInto(access.expression, receiver, recvT);
|
|
4616
4270
|
if (receiver.type.kind !== "promise") {
|
|
@@ -4618,9 +4272,8 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4618
4272
|
// a lowering gap, named rather than ICEd on.
|
|
4619
4273
|
lowerer.unsupported("SC1090", call, `'.${member}' on this receiver`);
|
|
4620
4274
|
}
|
|
4621
|
-
//
|
|
4622
|
-
//
|
|
4623
|
-
// typed uses of the settled value exit through coerceInto below.
|
|
4275
|
+
// Wrapper types follow the receiver's promise type; typed uses of the
|
|
4276
|
+
// settled value convert through coerceInto below.
|
|
4624
4277
|
const promT = receiver.type;
|
|
4625
4278
|
const inner = promT.inner;
|
|
4626
4279
|
if (passthrough) {
|
|
@@ -4685,8 +4338,6 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4685
4338
|
lowerer.noLowering("then with these handlers", call, "the result must be a representable promise");
|
|
4686
4339
|
}
|
|
4687
4340
|
const R = resultT.inner;
|
|
4688
|
-
if (!fulfilledAbsent && inner.kind === "jsval")
|
|
4689
|
-
markJsvalHandlerParams(lowerer, fulfilledNode);
|
|
4690
4341
|
if (!fulfilledAbsent && inner.kind === "moduleNs")
|
|
4691
4342
|
markModuleNsHandlerParams(lowerer, fulfilledNode, inner);
|
|
4692
4343
|
const boxHandler = (node, allowDirect) => {
|
|
@@ -4864,12 +4515,8 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
4864
4515
|
lowerer.fnStack.pop();
|
|
4865
4516
|
}
|
|
4866
4517
|
}
|
|
4867
|
-
// The settled value is an island HANDLE: an inline handler's
|
|
4868
|
-
// unannotated parameter binds it as jsval, whatever the checker's
|
|
4869
4518
|
// contextual type spelled (a module-namespace type has no mapping —
|
|
4870
4519
|
// the handle is the value's only story, isIslandExpr's local rule).
|
|
4871
|
-
if (inner.kind === "jsval")
|
|
4872
|
-
markJsvalHandlerParams(lowerer, call.arguments[0]);
|
|
4873
4520
|
if (inner.kind === "moduleNs")
|
|
4874
4521
|
markModuleNsHandlerParams(lowerer, call.arguments[0], inner);
|
|
4875
4522
|
let cb = lowerer.lowerExpr(call.arguments[0]);
|
|
@@ -5389,18 +5036,6 @@ export function lowerPromiseMethodCall(lowerer, call, access) {
|
|
|
5389
5036
|
// with the dyn undefined.
|
|
5390
5037
|
catchBody.push({ kind: "return", value: dynUndefinedExpr(loc), loc });
|
|
5391
5038
|
}
|
|
5392
|
-
else if (R.kind === "jsval") {
|
|
5393
|
-
// A package-typed result (Promise<Command> — the parseAsync().catch
|
|
5394
|
-
// entry line): falling off the handler's end resolves with
|
|
5395
|
-
// undefined, which on the island side is the engine's own
|
|
5396
|
-
// undefined. Also what makes a never-returning handler (ending in
|
|
5397
|
-
// process.exit) satisfy the always-returns analysis.
|
|
5398
|
-
catchBody.push({
|
|
5399
|
-
kind: "return",
|
|
5400
|
-
value: { kind: "jsOp", op: "globalGet", name: "undefined", args: [], type: JSVAL, loc },
|
|
5401
|
-
loc,
|
|
5402
|
-
});
|
|
5403
|
-
}
|
|
5404
5039
|
const ctx = lowerer.ctx;
|
|
5405
5040
|
const lifted = {
|
|
5406
5041
|
name: fnName,
|
|
@@ -5498,7 +5133,7 @@ export function lowerFilterNarrowCall(lowerer, call, access) {
|
|
|
5498
5133
|
// ToBoolean must be answerable per element (dyn/caught arms are not).
|
|
5499
5134
|
if (elem.kind === "union")
|
|
5500
5135
|
lowerer.requireTruthyUnion(elem.unionId, argNode);
|
|
5501
|
-
if (elem.kind === "dyn" || elem.kind === "
|
|
5136
|
+
if (elem.kind === "dyn" || elem.kind === "void" || isUnitType(elem)) {
|
|
5502
5137
|
lowerer.badType(argNode, lowerer.typeOf(argNode));
|
|
5503
5138
|
}
|
|
5504
5139
|
const receiver = lowerer.lowerExpr(access.expression);
|
|
@@ -6056,8 +5691,7 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6056
5691
|
member === "getOwnPropertySymbols" ||
|
|
6057
5692
|
member === "getOwnPropertyDescriptors") &&
|
|
6058
5693
|
call.arguments.length === 1 &&
|
|
6059
|
-
!call.arguments.some(ts.isSpreadElement)
|
|
6060
|
-
!lowerer.dynamic) {
|
|
5694
|
+
!call.arguments.some(ts.isSpreadElement)) {
|
|
6061
5695
|
let object = lowerer.lowerExpr(call.arguments[0]);
|
|
6062
5696
|
if (object.type.kind === "string" ||
|
|
6063
5697
|
object.type.kind === "f64" ||
|
|
@@ -6079,8 +5713,7 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6079
5713
|
}
|
|
6080
5714
|
if ((member === "getPrototypeOf" || member === "setPrototypeOf") &&
|
|
6081
5715
|
call.arguments.length === (member === "getPrototypeOf" ? 1 : 2) &&
|
|
6082
|
-
!call.arguments.some(ts.isSpreadElement)
|
|
6083
|
-
!lowerer.dynamic) {
|
|
5716
|
+
!call.arguments.some(ts.isSpreadElement)) {
|
|
6084
5717
|
let object = lowerer.lowerExpr(call.arguments[0]);
|
|
6085
5718
|
if (object.type.kind === "func") {
|
|
6086
5719
|
const fnName = jsFuncNameOf(call.arguments[0], lowerer);
|
|
@@ -6160,7 +5793,6 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6160
5793
|
// identity. Statically DISJOINT kind pairs answer the constant false
|
|
6161
5794
|
// with the operands still evaluated (tsc admits any pair — Object.is
|
|
6162
5795
|
// is (any, any) — and JS evaluates the arguments either way).
|
|
6163
|
-
// dyn/jsval operands keep strict equality's stance: validate first.
|
|
6164
5796
|
if (member === "is") {
|
|
6165
5797
|
if (call.arguments.length !== 2 || call.arguments.some((a) => ts.isSpreadElement(a))) {
|
|
6166
5798
|
lowerer.noLowering(`Object.is with ${call.arguments.length} arguments`, call, "exactly two arguments are the lowered form (JS treats a missing one as undefined — pass it explicitly)");
|
|
@@ -6184,7 +5816,7 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6184
5816
|
const unitTest = lowerer.lowerUnitComparison(left, right, false, loc);
|
|
6185
5817
|
if (unitTest)
|
|
6186
5818
|
return unitTest;
|
|
6187
|
-
if (lk === "dyn" || rk === "dyn"
|
|
5819
|
+
if (lk === "dyn" || rk === "dyn") {
|
|
6188
5820
|
return {
|
|
6189
5821
|
kind: "libCall",
|
|
6190
5822
|
fn: "dyn.sameValue",
|
|
@@ -6271,8 +5903,7 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6271
5903
|
lowerer.noLowering(`Object.is over '${lowerer.fmt(left.type)}' and '${lowerer.fmt(right.type)}' operands`, call, "the operands must share one comparable kind (numbers, strings, booleans, units, one union shape, or one reference type)");
|
|
6272
5904
|
}
|
|
6273
5905
|
// Native checked objects retain a live prototype and can install an
|
|
6274
|
-
// own-property descriptor table during creation.
|
|
6275
|
-
// use the engine's Object.create path below.
|
|
5906
|
+
// own-property descriptor table during creation.
|
|
6276
5907
|
if (member === "create") {
|
|
6277
5908
|
if (call.arguments.some((a) => ts.isSpreadElement(a))) {
|
|
6278
5909
|
lowerer.noLowering("Object.create with spread arguments", call);
|
|
@@ -6285,50 +5916,6 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6285
5916
|
while (ts.isParenthesizedExpression(protoNode))
|
|
6286
5917
|
protoNode = protoNode.expression;
|
|
6287
5918
|
const nullProto = protoNode.kind === ts.SyntaxKind.NullKeyword;
|
|
6288
|
-
if (lowerer.dynamic) {
|
|
6289
|
-
if (call.arguments.length === 2)
|
|
6290
|
-
lowerer.noLowering("Object.create with properties under --dynamic", call);
|
|
6291
|
-
// The checker types the result `any` — an ENGINE value under
|
|
6292
|
-
// --dynamic — and the engine's own Object.create answers with
|
|
6293
|
-
// REAL prototype semantics: reads delegate LIVE, writes shadow,
|
|
6294
|
-
// and inspect renders Node's exact shapes ("[Object: null
|
|
6295
|
-
// prototype]" included). null and engine-held (jsval) prototypes
|
|
6296
|
-
// route; checked-dynamic (dyn) prototypes keep the named fence —
|
|
6297
|
-
// their marshal into the engine is a DEEP COPY, so a later
|
|
6298
|
-
// prototype mutation would be invisible through the created
|
|
6299
|
-
// object where Node delegates live.
|
|
6300
|
-
const objectGlobal = () => ({
|
|
6301
|
-
kind: "jsOp",
|
|
6302
|
-
op: "globalGet",
|
|
6303
|
-
name: "Object",
|
|
6304
|
-
args: [],
|
|
6305
|
-
type: JSVAL,
|
|
6306
|
-
loc,
|
|
6307
|
-
});
|
|
6308
|
-
if (nullProto) {
|
|
6309
|
-
const nullIn = { kind: "jsOp", op: "nullLit", args: [], type: JSVAL, loc };
|
|
6310
|
-
return {
|
|
6311
|
-
kind: "jsOp",
|
|
6312
|
-
op: "callMethod",
|
|
6313
|
-
name: "create",
|
|
6314
|
-
args: [objectGlobal(), nullIn],
|
|
6315
|
-
type: JSVAL,
|
|
6316
|
-
loc,
|
|
6317
|
-
};
|
|
6318
|
-
}
|
|
6319
|
-
const proto = lowerer.lowerExpr(protoNode);
|
|
6320
|
-
if (proto.type.kind === "jsval") {
|
|
6321
|
-
return {
|
|
6322
|
-
kind: "jsOp",
|
|
6323
|
-
op: "callMethod",
|
|
6324
|
-
name: "create",
|
|
6325
|
-
args: [objectGlobal(), proto],
|
|
6326
|
-
type: JSVAL,
|
|
6327
|
-
loc,
|
|
6328
|
-
};
|
|
6329
|
-
}
|
|
6330
|
-
lowerer.noLowering(`Object.create over '${lowerer.fmt(proto.type)}' prototypes`, call, "prototype reads delegate LIVE in Node (mutating the prototype shows through the created object), which the boundary's deep copy cannot honor — only null and engine-held ('any') prototypes lower");
|
|
6331
|
-
}
|
|
6332
5919
|
if (nullProto && call.arguments.length === 1) {
|
|
6333
5920
|
return { kind: "libCall", fn: "dyn.objCreateNullProto", args: [], type: DYN, loc };
|
|
6334
5921
|
}
|
|
@@ -6979,7 +6566,6 @@ function lowerObjectStaticCall(lowerer, call, access) {
|
|
|
6979
6566
|
}
|
|
6980
6567
|
// unknown[] uses the checked-dynamic array representation. Enumerate
|
|
6981
6568
|
// a live view of the record so values retain their identities and the
|
|
6982
|
-
// result never pretends to be a native vector or an island array.
|
|
6983
6569
|
const enumerationType = lowerer.mapTypeOf(lowerer.typeOf(call));
|
|
6984
6570
|
if ((member === "values" || member === "entries") &&
|
|
6985
6571
|
(enumerationType?.kind === "dyn" ||
|
|
@@ -7683,7 +7269,6 @@ function lowerObjLitGenericMethodCall(lowerer, call, access) {
|
|
|
7683
7269
|
const provablyNot = thisT !== null &&
|
|
7684
7270
|
thisT.kind !== "searchParams" &&
|
|
7685
7271
|
thisT.kind !== "dyn" &&
|
|
7686
|
-
thisT.kind !== "jsval" &&
|
|
7687
7272
|
(!thisArg ||
|
|
7688
7273
|
ts.isIdentifier(thisArg) ||
|
|
7689
7274
|
ts.isLiteralExpression(thisArg) ||
|
|
@@ -8396,8 +7981,8 @@ function loweredArgumentText(lowerer, arg) {
|
|
|
8396
7981
|
}
|
|
8397
7982
|
/** The static global number parsers (parseInt/parseFloat/isNaN/isFinite),
|
|
8398
7983
|
* shared by the globals and their Number.* aliases. `call` blames arity
|
|
8399
|
-
* fences; null when the argument shape
|
|
8400
|
-
*
|
|
7984
|
+
* fences; null when the argument shape has no static form (the caller
|
|
7985
|
+
* reports the SC2012 refusal). */
|
|
8401
7986
|
export function lowerStaticNumberGlobal(lowerer, name, call, args, loc) {
|
|
8402
7987
|
if (name === "parseInt" || name === "isNaN") {
|
|
8403
7988
|
const maxArgs = name === "parseInt" ? 2 : 1;
|
|
@@ -8498,10 +8083,9 @@ export function lowerStaticNumberGlobal(lowerer, name, call, args, loc) {
|
|
|
8498
8083
|
// parseInt's siblings (num.parseFloat is ECMA 19.2.4's decimal-
|
|
8499
8084
|
// literal prefix parse in scr_string.c; a number-typed isFinite IS
|
|
8500
8085
|
// Number.isFinite — the global's ToNumber coercion is the identity
|
|
8501
|
-
// there, ms's `isFinite(val)` guard). Other argument types
|
|
8502
|
-
//
|
|
8503
|
-
//
|
|
8504
|
-
// territory. The probe never emits — lowering is IR construction.
|
|
8086
|
+
// there, ms's `isFinite(val)` guard). Other argument types retain
|
|
8087
|
+
// their native coercion checks or the SC2012 refusal. The probe never
|
|
8088
|
+
// emits — lowering is IR construction.
|
|
8505
8089
|
if ((name === "parseFloat" || name === "isFinite") && args.length === 1) {
|
|
8506
8090
|
if (name === "parseFloat") {
|
|
8507
8091
|
const optional = optionalCallValue(lowerer, args[0]);
|