@scriptc/compiler 0.0.35 → 0.0.36
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 +7 -6
- package/dist/backend/build-cache.d.ts +44 -0
- package/dist/backend/build-cache.js +241 -0
- package/dist/backend/build-cache.js.map +1 -0
- package/dist/backend/{emission/emit-async.d.ts → c/async.d.ts} +21 -30
- package/dist/backend/{emission/emit-async.js → c/async.js} +270 -286
- package/dist/backend/c/async.js.map +1 -0
- package/dist/backend/{emission/emitter.d.ts → c/c-emitter.d.ts} +6 -23
- package/dist/backend/{emission/emitter.js → c/c-emitter.js} +53 -107
- package/dist/backend/c/c-emitter.js.map +1 -0
- package/dist/backend/c/exprs.d.ts +8 -0
- package/dist/backend/c/exprs.js +7913 -0
- package/dist/backend/c/exprs.js.map +1 -0
- package/dist/backend/{emission/emit-island.d.ts → c/island.d.ts} +5 -5
- package/dist/backend/{emission/emit-island.js → c/island.js} +24 -22
- package/dist/backend/c/island.js.map +1 -0
- package/dist/backend/{emission → c}/may-throw.d.ts +1 -1
- package/dist/backend/{emission → c}/may-throw.js +1 -1
- package/dist/backend/c/may-throw.js.map +1 -0
- package/dist/backend/{emission/emit-shapes.d.ts → c/shapes.d.ts} +19 -19
- package/dist/backend/{emission/emit-shapes.js → c/shapes.js} +78 -87
- package/dist/backend/c/shapes.js.map +1 -0
- package/dist/backend/{emission/emit-stmts.d.ts → c/stmts.d.ts} +12 -12
- package/dist/backend/{emission/emit-stmts.js → c/stmts.js} +377 -343
- package/dist/backend/c/stmts.js.map +1 -0
- package/dist/backend/{emission/emit-types.d.ts → c/types.d.ts} +1 -1
- package/dist/backend/{emission/emit-types.js → c/types.js} +42 -286
- package/dist/backend/c/types.js.map +1 -0
- package/dist/backend/c/types.test.js +25 -0
- package/dist/backend/c/types.test.js.map +1 -0
- package/dist/backend/{emission/emit-walkers.d.ts → c/walkers.d.ts} +19 -41
- package/dist/backend/{emission/emit-walkers.js → c/walkers.js} +238 -298
- package/dist/backend/c/walkers.js.map +1 -0
- package/dist/backend/ffi-callbacks.d.ts +1 -1
- package/dist/backend/ffi-callbacks.js +4 -3
- package/dist/backend/ffi-callbacks.js.map +1 -1
- package/dist/backend/{library-identity.d.ts → library-identity-markers.d.ts} +0 -4
- package/dist/backend/{library-identity.js → library-identity-markers.js} +10 -9
- package/dist/backend/library-identity-markers.js.map +1 -0
- package/dist/backend/llvm/blocks.d.ts +4 -0
- package/dist/backend/llvm/blocks.js +29 -0
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +2 -19
- package/dist/backend/llvm/classes.js +20 -52
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +4 -0
- package/dist/backend/llvm/common.js +27 -0
- package/dist/backend/llvm/common.js.map +1 -0
- package/dist/backend/llvm/dyn.d.ts +3 -8
- package/dist/backend/llvm/dyn.js +152 -224
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +4 -1
- package/dist/backend/llvm/emitter.js +514 -9981
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/expr-async.d.ts +4 -0
- package/dist/backend/llvm/expr-async.js +726 -0
- package/dist/backend/llvm/expr-async.js.map +1 -0
- package/dist/backend/llvm/expr-bytes.d.ts +13 -0
- package/dist/backend/llvm/expr-bytes.js +456 -0
- package/dist/backend/llvm/expr-bytes.js.map +1 -0
- package/dist/backend/llvm/expr-callbacks.d.ts +22 -0
- package/dist/backend/llvm/expr-callbacks.js +520 -0
- package/dist/backend/llvm/expr-callbacks.js.map +1 -0
- package/dist/backend/llvm/expr-calls.d.ts +2 -0
- package/dist/backend/llvm/expr-calls.js +618 -0
- package/dist/backend/llvm/expr-calls.js.map +1 -0
- package/dist/backend/llvm/expr-containers.d.ts +25 -0
- package/dist/backend/llvm/expr-containers.js +623 -0
- package/dist/backend/llvm/expr-containers.js.map +1 -0
- package/dist/backend/llvm/expr-context.d.ts +255 -0
- package/dist/backend/llvm/expr-context.js +2 -0
- package/dist/backend/llvm/expr-context.js.map +1 -0
- package/dist/backend/llvm/expr-control.d.ts +2 -0
- package/dist/backend/llvm/expr-control.js +473 -0
- package/dist/backend/llvm/expr-control.js.map +1 -0
- package/dist/backend/llvm/expr-dispatch.d.ts +4 -0
- package/dist/backend/llvm/expr-dispatch.js +151 -0
- package/dist/backend/llvm/expr-dispatch.js.map +1 -0
- package/dist/backend/llvm/expr-dynamic.d.ts +2 -0
- package/dist/backend/llvm/expr-dynamic.js +810 -0
- package/dist/backend/llvm/expr-dynamic.js.map +1 -0
- package/dist/backend/llvm/expr-island.d.ts +15 -0
- package/dist/backend/llvm/expr-island.js +690 -0
- package/dist/backend/llvm/expr-island.js.map +1 -0
- package/dist/backend/llvm/expr-primitives.d.ts +6 -0
- package/dist/backend/llvm/expr-primitives.js +622 -0
- package/dist/backend/llvm/expr-primitives.js.map +1 -0
- package/dist/backend/llvm/expr-records.d.ts +9 -0
- package/dist/backend/llvm/expr-records.js +299 -0
- package/dist/backend/llvm/expr-records.js.map +1 -0
- package/dist/backend/llvm/expr-stream-bridges.d.ts +13 -0
- package/dist/backend/llvm/expr-stream-bridges.js +396 -0
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -0
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +12 -0
- package/dist/backend/llvm/expr-stream-callbacks.js +360 -0
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -0
- package/dist/backend/llvm/lib-dispatch.d.ts +5 -0
- package/dist/backend/llvm/lib-dispatch.js +267 -0
- package/dist/backend/llvm/lib-dispatch.js.map +1 -0
- package/dist/backend/llvm/lib-filesystem.d.ts +6 -0
- package/dist/backend/llvm/lib-filesystem.js +594 -0
- package/dist/backend/llvm/lib-filesystem.js.map +1 -0
- package/dist/backend/llvm/lib-network.d.ts +2 -0
- package/dist/backend/llvm/lib-network.js +429 -0
- package/dist/backend/llvm/lib-network.js.map +1 -0
- package/dist/backend/llvm/lib-process.d.ts +5 -0
- package/dist/backend/llvm/lib-process.js +585 -0
- package/dist/backend/llvm/lib-process.js.map +1 -0
- package/dist/backend/llvm/lib-shared.d.ts +6 -0
- package/dist/backend/llvm/lib-shared.js +687 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -0
- package/dist/backend/llvm/lib-stream.d.ts +2 -0
- package/dist/backend/llvm/lib-stream.js +470 -0
- package/dist/backend/llvm/lib-stream.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +12 -2
- package/dist/backend/llvm/shapes.js +66 -307
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +52 -0
- package/dist/backend/llvm/shapes.test.js.map +1 -0
- package/dist/backend/llvm/unsupported.d.ts +1 -1
- package/dist/backend/llvm/walkers.d.ts +2 -3
- package/dist/backend/llvm/walkers.js +164 -218
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +38 -0
- package/dist/backend/native-codegen.js +261 -0
- package/dist/backend/native-codegen.js.map +1 -0
- package/dist/backend/native-codegen.test.js +188 -0
- package/dist/backend/native-codegen.test.js.map +1 -0
- package/dist/backend/native-link-info.d.ts +96 -0
- package/dist/backend/native-link-info.js +219 -0
- package/dist/backend/native-link-info.js.map +1 -0
- package/dist/backend/native-link-info.test.d.ts +1 -0
- package/dist/backend/native-link-info.test.js +134 -0
- package/dist/backend/native-link-info.test.js.map +1 -0
- package/dist/backend/{cc.d.ts → native-toolchain.d.ts} +54 -34
- package/dist/backend/{cc.js → native-toolchain.js} +231 -810
- package/dist/backend/native-toolchain.js.map +1 -0
- package/dist/backend/native-toolchain.test.d.ts +1 -0
- package/dist/backend/{cc-cache.test.js → native-toolchain.test.js} +214 -6
- package/dist/backend/native-toolchain.test.js.map +1 -0
- package/dist/backend/object-localize.js +1 -1
- package/dist/backend/runtime-abi.d.ts +10 -0
- package/dist/backend/runtime-abi.js +11 -0
- package/dist/backend/runtime-abi.js.map +1 -0
- package/dist/backend/runtime-pack.d.ts +137 -0
- package/dist/backend/runtime-pack.js +400 -0
- package/dist/backend/runtime-pack.js.map +1 -0
- package/dist/backend/runtime-pack.test.d.ts +1 -0
- package/dist/backend/runtime-pack.test.js +438 -0
- package/dist/backend/runtime-pack.test.js.map +1 -0
- package/dist/backend/targets.d.ts +30 -0
- package/dist/backend/targets.js +46 -0
- package/dist/backend/targets.js.map +1 -0
- package/dist/backend/targets.test.d.ts +1 -0
- package/dist/backend/targets.test.js +19 -0
- package/dist/backend/targets.test.js.map +1 -0
- package/dist/backend/vendor-archives.d.ts +41 -0
- package/dist/backend/vendor-archives.js +462 -0
- package/dist/backend/vendor-archives.js.map +1 -0
- package/dist/compat/fetch-profile.d.ts +0 -1
- package/dist/compat/fetch-profile.js +0 -1
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/coverage/report.js +3 -3
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +25 -32
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +11 -12
- package/dist/diagnostics/diagnostic.js +19 -17
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/render.d.ts +1 -1
- package/dist/diagnostics/render.js +1 -1
- package/dist/diagnostics/render.js.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +1 -0
- package/dist/executable/{early-cache.d.ts → executable-cache.d.ts} +2 -2
- package/dist/executable/{early-cache.js → executable-cache.js} +36 -98
- package/dist/executable/executable-cache.js.map +1 -0
- package/dist/executable/executable-cache.test.d.ts +1 -0
- package/dist/executable/{early-cache.test.js → executable-cache.test.js} +3 -3
- package/dist/executable/executable-cache.test.js.map +1 -0
- package/dist/ffi/{profile.js → ffi-manifest.js} +1 -1
- package/dist/ffi/ffi-manifest.js.map +1 -0
- package/dist/frontend/builtin-modules.d.ts +21 -0
- package/dist/frontend/builtin-modules.js +82 -0
- package/dist/frontend/builtin-modules.js.map +1 -0
- package/dist/frontend/cjs-lexer.d.ts +7 -0
- package/dist/frontend/cjs-lexer.js +15 -17
- package/dist/frontend/cjs-lexer.js.map +1 -1
- package/dist/frontend/dts-paths.d.ts +26 -0
- package/dist/frontend/dts-paths.js +41 -0
- package/dist/frontend/dts-paths.js.map +1 -0
- package/dist/frontend/input-tracker.d.ts +0 -2
- package/dist/frontend/input-tracker.js +1 -4
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/lib-contract.d.ts +1 -5
- package/dist/frontend/lib-contract.js +1 -1
- package/dist/frontend/lib-contract.js.map +1 -1
- package/dist/frontend/lib-exports.d.ts +1 -1
- package/dist/frontend/lowering/call-position.d.ts +4 -0
- package/dist/frontend/lowering/call-position.js +7 -0
- package/dist/frontend/lowering/call-position.js.map +1 -0
- package/dist/frontend/lowering/callback-arg.d.ts +20 -0
- package/dist/frontend/lowering/callback-arg.js +44 -0
- package/dist/frontend/lowering/callback-arg.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.d.ts +1 -1
- package/dist/frontend/lowering/lib-boundary.js +34 -34
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.d.ts +3 -3
- package/dist/frontend/lowering/lower-assert.js +214 -241
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +74 -146
- package/dist/frontend/lowering/lower-builtins.js +1124 -1232
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +56 -188
- package/dist/frontend/lowering/lower-calls.js +1397 -1492
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +62 -125
- package/dist/frontend/lowering/lower-classes.js +832 -866
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +5 -12
- package/dist/frontend/lowering/lower-comptime.js +32 -31
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +35 -135
- package/dist/frontend/lowering/lower-containers.js +1384 -1700
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.d.ts +3 -7
- package/dist/frontend/lowering/lower-dgram.js +97 -111
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.d.ts +4 -4
- package/dist/frontend/lowering/lower-enums.js +30 -30
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/{lower-emitter.d.ts → lower-event-emitter.d.ts} +7 -18
- package/dist/frontend/lowering/{lower-emitter.js → lower-event-emitter.js} +172 -174
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -0
- package/dist/frontend/lowering/lower-expando.d.ts +5 -5
- package/dist/frontend/lowering/lower-expando.js +40 -40
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +56 -264
- package/dist/frontend/lowering/lower-exprs.js +1624 -1696
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.d.ts +6 -6
- package/dist/frontend/lowering/lower-generators.js +73 -72
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +5 -17
- package/dist/frontend/lowering/lower-inspect.js +236 -238
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +34 -45
- package/dist/frontend/lowering/lower-island.js +437 -508
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.d.ts +7 -10
- package/dist/frontend/lowering/lower-mixins.js +85 -85
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +12 -18
- package/dist/frontend/lowering/lower-modules.js +284 -283
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +23 -49
- package/dist/frontend/lowering/lower-namespaces.js +123 -115
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +18 -25
- package/dist/frontend/lowering/lower-server.js +899 -899
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +30 -149
- package/dist/frontend/lowering/lower-stmts.js +1175 -1228
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +12 -12
- package/dist/frontend/lowering/lower-stream.js +300 -301
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-test.d.ts +5 -5
- package/dist/frontend/lowering/lower-test.js +82 -82
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +60 -20
- package/dist/frontend/lowering/lowerer.js +191 -117
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/pairs-snapshot.d.ts +11 -0
- package/dist/frontend/lowering/pairs-snapshot.js +85 -0
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -0
- package/dist/frontend/lowering/static-this.d.ts +6 -0
- package/dist/frontend/lowering/static-this.js +24 -0
- package/dist/frontend/lowering/static-this.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +14 -33
- package/dist/frontend/lowering/surfaces.js +63 -63
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/npm-static-rewrite.js +6 -28
- package/dist/frontend/npm-static-rewrite.js.map +1 -1
- package/dist/frontend/npm-static.d.ts +0 -10
- package/dist/frontend/npm-static.js +4 -7
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +0 -24
- package/dist/frontend/npm.js +11 -85
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/program.d.ts +3 -1
- package/dist/frontend/program.js +9 -4
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/provenance-registry.d.ts +0 -2
- package/dist/frontend/provenance-registry.js +0 -10
- package/dist/frontend/provenance-registry.js.map +1 -1
- package/dist/frontend/provenance.js +4 -7
- package/dist/frontend/provenance.js.map +1 -1
- package/dist/frontend/resolve.d.ts +7 -2
- package/dist/frontend/resolve.js +12 -17
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/resolve.test.d.ts +1 -0
- package/dist/frontend/resolve.test.js +29 -0
- package/dist/frontend/resolve.test.js.map +1 -0
- package/dist/frontend/ts7/adapter.d.ts +2 -2
- package/dist/frontend/ts7/adapter.js +1 -1
- package/dist/frontend/ts7/adapter.js.map +1 -1
- package/dist/frontend/ts7/checker.js +2 -36
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/enums.js +2 -1
- package/dist/frontend/ts7/enums.js.map +1 -1
- package/dist/frontend/ts7/{program.js → program-adapter.js} +7 -6
- package/dist/frontend/ts7/program-adapter.js.map +1 -0
- package/dist/frontend/ts7/world-check.d.ts +1 -3
- package/dist/frontend/ts7/world-check.js +3 -1
- package/dist/frontend/ts7/world-check.js.map +1 -1
- package/dist/frontend/tsc-codes.d.ts +8 -0
- package/dist/frontend/tsc-codes.js +109 -0
- package/dist/frontend/tsc-codes.js.map +1 -0
- package/dist/frontend/{types.d.ts → type-mapper.d.ts} +2 -25
- package/dist/frontend/{types.js → type-mapper.js} +12 -11
- package/dist/frontend/type-mapper.js.map +1 -0
- package/dist/frontend/workspace-registry.d.ts +26 -0
- package/dist/frontend/workspace-registry.js +71 -0
- package/dist/frontend/workspace-registry.js.map +1 -0
- package/dist/index.d.ts +112 -30
- package/dist/index.js +512 -126
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.d.ts +37 -0
- package/dist/ir/analysis.js +118 -0
- package/dist/ir/analysis.js.map +1 -0
- package/dist/ir/analysis.test.d.ts +1 -0
- package/dist/ir/analysis.test.js +21 -0
- package/dist/ir/analysis.test.js.map +1 -0
- package/dist/ir/build.d.ts +9 -0
- package/dist/ir/build.js +33 -0
- package/dist/ir/build.js.map +1 -0
- package/dist/ir/integer-loops.d.ts +1 -1
- package/dist/ir/{nodes.d.ts → ir.d.ts} +54 -26
- package/dist/ir/{nodes.js → ir.js} +145 -141
- package/dist/ir/ir.js.map +1 -0
- package/dist/ir/ir.test.d.ts +1 -0
- package/dist/ir/ir.test.js +17 -0
- package/dist/ir/ir.test.js.map +1 -0
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +2 -1
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/validate.d.ts +1 -1
- package/dist/ir/validate.js +10 -5
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/cache-primitives.d.ts +24 -0
- package/dist/library/cache-primitives.js +83 -0
- package/dist/library/cache-primitives.js.map +1 -0
- package/dist/library/cache-reset.test.d.ts +1 -0
- package/dist/library/cache-reset.test.js +47 -0
- package/dist/library/cache-reset.test.js.map +1 -0
- package/dist/library/{implementation-identity.js → compiler-self-identity.js} +1 -1
- package/dist/library/compiler-self-identity.js.map +1 -0
- package/dist/library/fence-eval.d.ts +3 -1
- package/dist/library/fence-eval.js +5 -1
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/int-infer.d.ts +1 -36
- package/dist/library/int-infer.js +17 -17
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/{early-cache.d.ts → library-cache.d.ts} +1 -1
- package/dist/library/{early-cache.js → library-cache.js} +34 -89
- package/dist/library/library-cache.js.map +1 -0
- package/dist/library/library-cache.test.d.ts +1 -0
- package/dist/library/{early-cache.test.js → library-cache.test.js} +2 -2
- package/dist/library/library-cache.test.js.map +1 -0
- package/dist/library/{profile.d.ts → library-profile.d.ts} +4 -7
- package/dist/library/{profile.js → library-profile.js} +18 -11
- package/dist/library/library-profile.js.map +1 -0
- package/dist/library/semantic-source.js +2 -1
- package/dist/library/semantic-source.js.map +1 -1
- package/dist/library/sidecar.d.ts +5 -2
- package/dist/library/sidecar.js +11 -5
- package/dist/library/sidecar.js.map +1 -1
- package/dist/startup-cache.d.ts +3 -3
- package/dist/startup-cache.js +2 -2
- package/dist/startup-cache.js.map +1 -1
- package/package.json +6 -2
- package/surface-manifest.json +1 -1
- package/dist/backend/cc-cache.test.js.map +0 -1
- package/dist/backend/cc.js.map +0 -1
- package/dist/backend/emission/emit-async.js.map +0 -1
- package/dist/backend/emission/emit-exprs.d.ts +0 -13
- package/dist/backend/emission/emit-exprs.js +0 -7407
- package/dist/backend/emission/emit-exprs.js.map +0 -1
- package/dist/backend/emission/emit-island.js.map +0 -1
- package/dist/backend/emission/emit-shapes.js.map +0 -1
- package/dist/backend/emission/emit-stmts.js.map +0 -1
- package/dist/backend/emission/emit-types.js.map +0 -1
- package/dist/backend/emission/emit-walkers.js.map +0 -1
- package/dist/backend/emission/emitter.js.map +0 -1
- package/dist/backend/emission/may-throw.js.map +0 -1
- package/dist/backend/library-identity.js.map +0 -1
- package/dist/executable/early-cache.js.map +0 -1
- package/dist/executable/early-cache.test.js.map +0 -1
- package/dist/ffi/profile.js.map +0 -1
- package/dist/frontend/lowering/lower-emitter.js.map +0 -1
- package/dist/frontend/shared.d.ts +0 -82
- package/dist/frontend/shared.js +0 -308
- package/dist/frontend/shared.js.map +0 -1
- package/dist/frontend/ts7/program.js.map +0 -1
- package/dist/frontend/types.js.map +0 -1
- package/dist/ir/nodes.js.map +0 -1
- package/dist/library/early-cache.js.map +0 -1
- package/dist/library/early-cache.test.js.map +0 -1
- package/dist/library/implementation-identity.js.map +0 -1
- package/dist/library/profile.js.map +0 -1
- /package/dist/backend/{cc-cache.test.d.ts → c/types.test.d.ts} +0 -0
- /package/dist/{executable/early-cache.test.d.ts → backend/llvm/shapes.test.d.ts} +0 -0
- /package/dist/{library/early-cache.test.d.ts → backend/native-codegen.test.d.ts} +0 -0
- /package/dist/ffi/{profile.d.ts → ffi-manifest.d.ts} +0 -0
- /package/dist/frontend/ts7/{program.d.ts → program-adapter.d.ts} +0 -0
- /package/dist/library/{implementation-identity.d.ts → compiler-self-identity.d.ts} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InternalCompilerError } from "../../errors.js";
|
|
1
2
|
/* AST + checker → IR.
|
|
2
3
|
*
|
|
3
4
|
* Invariants:
|
|
@@ -13,13 +14,14 @@
|
|
|
13
14
|
* ("x.0", "x.1" for shadowing); the IR is scope-flat.
|
|
14
15
|
*/
|
|
15
16
|
import { resolve } from "node:path";
|
|
16
|
-
import {
|
|
17
|
+
import { tsgoPath } from "../dts-paths.js";
|
|
18
|
+
import { isRelativeSpecifier } from "../workspace-registry.js";
|
|
17
19
|
import * as ts from "../ts7/adapter.js";
|
|
18
20
|
import { anyOpRequiresDynamicDiag, blockedBindingUseDiag, checkerPanicDiag, componentTypeDiag, isCheckerPanic, genericSignatureTypeDiag, indexSignatureTypeDiag, intersectionTypeDiag, noLoweringDiag, overloadedSignatureTypeDiag, recordShapeMismatchDiag, requiresDynamicApiDiag, requiresDynamicPackageDiag, requiresDynamicTypeDiag, unionMismatchDiag, unsupportedDiag, unsupportedTypeDiag, } from "../../diagnostics/diagnostic.js";
|
|
19
|
-
import { arrayOf, BOOL, canAdaptDynFuncTo, canConvertToDyn, canCrossIslandBoundary, canExitIslandToType, canMarshalTypedFuncIntoIsland, DYN, F64, isJsonSafeType, isUndefinedArmedUnion, isUnitType, JSVAL, RUNTIME_ERROR_CLASSES, STRING, typeEquals, UNDEFINED_T, VOID } from "../../ir/
|
|
21
|
+
import { arrayOf, BOOL, canAdaptDynFuncTo, canConvertToDyn, canCrossIslandBoundary, canExitIslandToType, canMarshalTypedFuncIntoIsland, DYN, F64, isJsonSafeType, isUndefinedArmedUnion, isUnitType, JSVAL, RUNTIME_ERROR_CLASSES, STRING, typeEquals, UNDEFINED_T, VOID } from "../../ir/ir.js";
|
|
20
22
|
import { provenanceActive } from "../provenance-registry.js";
|
|
21
23
|
import { ambientDtsPath, canonicalBuiltinModule, cjsExportAssignmentOf, cjsExportDiscardReason, fallbackDtsPath, isCjsExportTableLiteral, isJsSourceFile, isNodeEsmFile, isNodeTypesPath, locOf, orderedImportsOf, overridesDtsPath, npmStaticDepSf7, requireSpecOf, resolveImport, workspacePackageOfPath, } from "../program.js";
|
|
22
|
-
import { containsRecord, containsUnion, describeComponentBlocker, describeRecordMemberBlocker, formatIrType, ISLAND_AMBIENT_TYPES, isUnitOnlyTsType, mapType, ShapeRegistry, typeKey, UnionRegistry, withUndefinedArm as withUndefinedArmCanonical, } from "../
|
|
24
|
+
import { containsRecord, containsUnion, describeComponentBlocker, describeRecordMemberBlocker, formatIrType, ISLAND_AMBIENT_TYPES, isUnitOnlyTsType, mapType, ShapeRegistry, typeKey, UnionRegistry, withUndefinedArm as withUndefinedArmCanonical, } from "../type-mapper.js";
|
|
23
25
|
import { boundaryIntoIslandMsg, boundaryOutOfIslandMsg, builtinConstLit, builtinModuleConstOf, builtinModulesArrayLit, builtinFenceHintOf, builtinModuleFnOf, stdlibMemberFence, isStdlibMember, isStdlibSymbol, isStdlibGlobal, stdlibGlobalMember, nodeTypesOnlySymbol } from "./surfaces.js";
|
|
24
26
|
import { splitFiles, collectProgram, collectNpmImports, collectJsonImports, moduleArtifacts, collectGlobals, declSymbolOf, defaultExportSymbolOf, lowerFileInit, lowerDefaultExport, buildMain, appendDynamicImportModules } from "./lower-modules.js";
|
|
25
27
|
import { registerBuiltinErrorClasses, registerBuiltinEmitterClass, registerBuiltinStreamClasses, builtinErrorInfoOf, builtinEmitterInfoOf, builtinStreamInfoOf, analyzeClassDecoration, classIteratorDrainCall, classIteratorNextCall, classIteratorOf, classIteratorOpenCall, classIteratorRestDrainCall, classMemberNameOf, classValueRef, collectClassShape, exactClassOfReceiver, collectClassShapeInner, ctorAbiEquals, findMethodOn, findStaticOn, findGenericMethodOn, findGenericStaticOn, genericClassInstanceType, isSubclassOf, inHierarchy, overrideBelow, staticShadowBelow, upcastTo, lowerClassMembers, lowerClassCtor, lowerClassExpression, lowerClassExpressionInfo, lowerClassMethodMember, lowerClassValueProperty, lowerStaticMethod, throwingSetterFn, fieldInitStmts, lowerStaticFieldInits, lowerStaticFieldRead, lowerDerivedCtorBody, superCallStmt, lowerSuperMethodCall, superThisRef, lowerSuperAccessorRead, lowerSuperAccessorWrite, inheritsBuiltinErrorCtor, inheritsBuiltinEmitterCtor, errorMessageArg, lowerNew, accessorCall } from "./lower-classes.js";
|
|
@@ -27,7 +29,7 @@ import { mixinCallClassInfoOf, mixinIntersectionInstanceType } from "./lower-mix
|
|
|
27
29
|
import { bindingNeverReassigned, bodyReadsArguments, implicitMonoFile, isThisParameter, paramShape, paramShapes, checkDefaultParamBodyType, completeArgs, wrappedUndefined, undefinedArgFor, requireExactArityValue, bodyReturnType, declaredReturnType, collectSignature, collectSignatureInner, collectGenericSignature, genericFnOf, lowerGenericCall, lowerGenericFnValue, inferTypeParamBindings, lowerGenericInstance, lowerCall, lowerFfiCall, lowerTimersMemberCall, lowerPromiseMethodCall, lowerFilterNarrowCall, isTopLevelFnSymbol, lowerNestedFunctionDecl, lambdaSignature, lowerLambda, lowerFunction, validateFfiImports } from "./lower-calls.js";
|
|
28
30
|
import { lowerArrayMethodCall, lowerBufferStaticCall, lowerBytesMethodCall, lowerBytesNew, lowerMapMethodCall, lowerMapForEachCall, buildMapForEachFn, lowerRecordOvfCaptureHelper, lowerEnvToPairsHelper, lowerSetMethodCall, lowerSetForEachCall, buildSetForEachFn, lowerRegexMethodCall, lowerStringMethodCall } from "./lower-containers.js";
|
|
29
31
|
import { lowerStreamModuleCall } from "./lower-stream.js";
|
|
30
|
-
import { lowerEmitOverrideSpec } from "./lower-emitter.js";
|
|
32
|
+
import { lowerEmitOverrideSpec } from "./lower-event-emitter.js";
|
|
31
33
|
import { builtinImportOf, createRequireBindingDecl, createRequireNamespaceDecl, createRequireSpecOf, stripTypeCasts, lowerBuiltinModuleCall, lowerFsToUnixTimestampCall, lowerFsLadderCall, lowerChildArgsArg, lowerSpawnSyncCall, lowerSpawnCall, lowerExecSyncCall, recordToEnvPairs, lowerJsonMethodCall, fencedBuiltinImportOf, lowerCryptoComposedCall, lowerUrlMethodCall, lowerSearchParamsMethodCall, lowerStatsMethodCall, lowerChildMethodCall, lowerAtomicsCall, lowerBuiltinExtraProperty, promisifiedExecFileDecl, lowerExecFileAsyncCall, execFileAsyncHelper, lowerStringDecoderMethodCall, strdecHelper, lowerReadlineMethodCall, lowerDcChannelMethodCall, lowerDcChannelProperty, lowerAlsMethodCall, lowerDcTracingChannelMethodCall, lowerDcTracingChannelProperty, lowerJsonProperty, lowerErrorCodeProperty, lowerProcessProperty, isProcessEnv, envValueType, lowerProcessEnvGet, lowerProcessMethodCall, lowerProcessOptionalMethodCall, lowerTimeoutMethodCall, envSnapshotHelper, isConsoleLog, consoleCallMember, lowerNumberStaticCall, lowerNumberStaticProperty, lowerDateCall, lowerTextCodecCall, lowerCryptoModuleCall, lowerFsConstantsProperty, lowerBuiltinConstantsProperty, builtinConstantBindingOf, builtinConstantsDestructureDecl, lowerProcessStreamProperty, lowerStringStaticCall, lowerStringLastIndexOfCall, lowerPromiseStaticCall, textCodecBindingClassOf } from "./lower-builtins.js";
|
|
32
34
|
import { fenceFetchObjectAssignment, fenceFetchObjectBinding, fenceStaticAbortControllerMemberRead, fenceStaticHeadersIteration, fenceStaticHeadersMember, fenceStaticReadableStreamMember, fenceStaticResponseMember, fenceUnsupportedFetchConstructorMember, isIslandExpr, islandFuncValueFence, islandRegexpOf, jsvalIn, requireDynamicApi, islandGlobalFnOf, lowerAbortControllerNew, lowerDynamicHeadersIteratorCall, lowerDynamicHeadersSpread, lowerDynamicImportCall, lowerFetchCall, lowerFetchElementMethodCall, lowerResponseNew, lowerStaticFetchCompanionCall, lowerStaticAbortControllerCall, lowerStaticAbortSignalListenerCall, lowerStaticReadableStreamCancelCall, lowerStaticReadableStreamControllerCall, lowerStaticReadableStreamNew, lowerStaticReadableStreamReaderCall, lowerStaticResponseCall, lowerIslandMethodCall, lowerMathProperty, npmPackageOf, npmMemberFence, npmPackageOfSymbol } from "./lower-island.js";
|
|
33
35
|
import { lowerHttpHeadersElement, lowerNetModuleCall, lowerServerMethodCall, lowerServerProperty, lowerTlsRootCertificates } from "./lower-server.js";
|
|
@@ -40,6 +42,7 @@ import { lowerStmts, noteBlockedBindings, isBlockedBinding, lowerScopedBlock, pr
|
|
|
40
42
|
import { lowerDynObjectLiteral, lowerExpr, maybeNarrow, lowerUnitComparison, lowerNullishCoalesce, lowerOptionalChain, finishOptionalChain, lowerCondition, ensureBool, requireTruthyUnion, eqComparableUnion, lowerIntrinsicProperty, lowerArrayLiteral, lowerObjectLiteral, lowerShorthandValue, rejectThisInObjectMethod, lowerElementAccess, lowerElementWrite, lowerRecordKeyRead, ensureString, lowerTemplate, lowerAsExpression, lowerPrefixUnary, lowerBinary, lowerCaughtTypeofTest, caughtRead, caughtLocalOf, caughtToString, lowerInstanceOf, lowerRegexLiteral, lowerFieldRead, lowerUnionProperty, fieldTarget, fieldGetExpr, fieldSetStmt, lowerFieldCompound, uniqueSymbolKeyOf, foldedStringKeyOf } from "./lower-exprs.js";
|
|
41
43
|
import { lowerRecordFieldCall, lowerObjectMethodCall } from "./lower-calls.js";
|
|
42
44
|
import { fenceCrossBlockNsRef, nsPathPrefix } from "./lower-namespaces.js";
|
|
45
|
+
import { numLit, varRef } from "../../ir/build.js";
|
|
43
46
|
/** Entry function name. '%' cannot appear in a TS identifier, so a user
|
|
44
47
|
* function can never collide with it (mangling is injective per prefix). */
|
|
45
48
|
export const ENTRY_NAME = "%main";
|
|
@@ -56,7 +59,7 @@ export function own(table, key) {
|
|
|
56
59
|
/** Sentinel binding key for `this` (which has no ts.Symbol): a stable
|
|
57
60
|
* object identity used in the same scope/capture maps as real symbols, so
|
|
58
61
|
* arrows capturing `this` ride the ordinary capture machinery. */
|
|
59
|
-
|
|
62
|
+
const THIS_BINDING = { escapedName: "%this" };
|
|
60
63
|
export function newFnCtx(lifted, selfSymbol, selfType, returnType) {
|
|
61
64
|
return {
|
|
62
65
|
locals: [],
|
|
@@ -76,7 +79,7 @@ export function newFnCtx(lifted, selfSymbol, selfType, returnType) {
|
|
|
76
79
|
* visit; descending would attribute a nested island statement to every
|
|
77
80
|
* enclosing construct too). The top-level statement object itself is
|
|
78
81
|
* always visited. */
|
|
79
|
-
|
|
82
|
+
const IR_STMT_KINDS = new Set([
|
|
80
83
|
"varDecl", "assign", "exprStmt", "if", "while", "doWhile", "switch",
|
|
81
84
|
"arraySet", "forOf", "return", "fieldSet", "recordSet", "break",
|
|
82
85
|
"continue", "block", "tryCatch", "throw", "rethrow", "runtimeFence",
|
|
@@ -308,8 +311,8 @@ export function importCallHandleType(expr) {
|
|
|
308
311
|
* Ambient (.d.ts) declarations never reach this: they have no compiled
|
|
309
312
|
* implementation, so their calls lower through the island/builtin paths
|
|
310
313
|
* whose validated exits keep the checker-trust trap. */
|
|
311
|
-
export function uncheckedOverloadHandleCall(
|
|
312
|
-
if (!
|
|
314
|
+
export function uncheckedOverloadHandleCall(lowerer, expr) {
|
|
315
|
+
if (!lowerer.dynamic || !expr)
|
|
313
316
|
return false;
|
|
314
317
|
let e = expr;
|
|
315
318
|
while (ts.isParenthesizedExpression(e))
|
|
@@ -319,25 +322,25 @@ export function uncheckedOverloadHandleCall(L, expr) {
|
|
|
319
322
|
// overload of an any-returning implementation stores the handle.
|
|
320
323
|
if (!ts.isCallExpression(e) && !ts.isTaggedTemplateExpression(e))
|
|
321
324
|
return false;
|
|
322
|
-
const rsig =
|
|
323
|
-
const rdecl = rsig ?
|
|
325
|
+
const rsig = lowerer.checker.getResolvedSignature(e);
|
|
326
|
+
const rdecl = rsig ? lowerer.checker.signatureDeclaration(rsig) : undefined;
|
|
324
327
|
if (!rsig || !rdecl)
|
|
325
328
|
return false;
|
|
326
329
|
if (!(ts.isFunctionDeclaration(rdecl) || ts.isMethodDeclaration(rdecl)) || rdecl.body)
|
|
327
330
|
return false;
|
|
328
331
|
const name = rdecl.name;
|
|
329
|
-
const symbol = name ?
|
|
332
|
+
const symbol = name ? lowerer.checker.getSymbolAtLocation(name) : undefined;
|
|
330
333
|
if (!symbol)
|
|
331
334
|
return false;
|
|
332
|
-
const impl =
|
|
335
|
+
const impl = lowerer.checker
|
|
333
336
|
.declarationsOf(symbol)
|
|
334
337
|
.find((d) => (ts.isFunctionDeclaration(d) || ts.isMethodDeclaration(d)) && d.body !== undefined);
|
|
335
338
|
if (!impl)
|
|
336
339
|
return false;
|
|
337
|
-
const implSig =
|
|
340
|
+
const implSig = lowerer.checker.getSignatureFromDeclaration(impl);
|
|
338
341
|
if (!implSig)
|
|
339
342
|
return false;
|
|
340
|
-
return
|
|
343
|
+
return lowerer.mapTypeOf(lowerer.checker.getReturnTypeOfSignature(implSig))?.kind === "jsval";
|
|
341
344
|
}
|
|
342
345
|
/** The JavaScript declaration fallback for unmappable binding types (see
|
|
343
346
|
* irTypeOf): `any` and every other inference residue is the checked-
|
|
@@ -356,7 +359,7 @@ export function uncheckedOverloadHandleCall(L, expr) {
|
|
|
356
359
|
* checked-dynamic fallbacks apply, the pre-never-mapping behavior. Bare
|
|
357
360
|
* `never` at the ROOT stays out (`for (const v of [])`'s loop var — the
|
|
358
361
|
* dead read the f64 mapping is FOR). */
|
|
359
|
-
export function neverTaintedJsType(
|
|
362
|
+
export function neverTaintedJsType(lowerer, node, t) {
|
|
360
363
|
if (!isJsSourceFile(node.getSourceFile()))
|
|
361
364
|
return false;
|
|
362
365
|
const walk = (x, depth) => {
|
|
@@ -364,8 +367,8 @@ export function neverTaintedJsType(L, node, t) {
|
|
|
364
367
|
return false;
|
|
365
368
|
if (x.isUnionType())
|
|
366
369
|
return ts.constituentTypes(x).some((a) => walk(a, depth - 1));
|
|
367
|
-
if (
|
|
368
|
-
return
|
|
370
|
+
if (lowerer.checker.isArrayType(x) || lowerer.checker.isTupleType(x)) {
|
|
371
|
+
return lowerer.checker
|
|
369
372
|
.getTypeArguments(x)
|
|
370
373
|
.some((a) => (a.flags & ts.TypeFlags.Never) !== 0 || walk(a, depth - 1));
|
|
371
374
|
}
|
|
@@ -414,10 +417,10 @@ export function nodeThrowExpr(kind, code, message, type, loc) {
|
|
|
414
417
|
* (scr_throw_lowering_fence). The diagnostic joins the runtime-fence
|
|
415
418
|
* ledger exactly like a deferred statement fence — nothing silently
|
|
416
419
|
* drops off the coverage report. */
|
|
417
|
-
export function ladderFenceExpr(
|
|
420
|
+
export function ladderFenceExpr(lowerer, surface, node, hint) {
|
|
418
421
|
const loc = locOf(node);
|
|
419
422
|
const d = noLoweringDiag(surface, loc, hint);
|
|
420
|
-
|
|
423
|
+
lowerer.runtimeFences.push(d);
|
|
421
424
|
const sf = node.getSourceFile();
|
|
422
425
|
const pos = ts.getLineAndCharacterOfPosition(sf, loc.start);
|
|
423
426
|
return {
|
|
@@ -450,7 +453,7 @@ export function ladderFenceExpr(L, surface, node, hint) {
|
|
|
450
453
|
* this fallback for `any` (mapType answers jsval first).
|
|
451
454
|
*
|
|
452
455
|
* Null for void (no value exists to represent). */
|
|
453
|
-
export function dynFallbackType(
|
|
456
|
+
export function dynFallbackType(lowerer, node, t) {
|
|
454
457
|
if (t.flags & ts.TypeFlags.Void)
|
|
455
458
|
return null;
|
|
456
459
|
if (!isJsSourceFile(node.getSourceFile())) {
|
|
@@ -459,13 +462,13 @@ export function dynFallbackType(L, node, t) {
|
|
|
459
462
|
// TS single-call-signature function types: per-piece fallback, but
|
|
460
463
|
// ONLY `any` pieces fall to dyn — any other unmappable piece keeps
|
|
461
464
|
// the whole type's own fence.
|
|
462
|
-
return anyPiecedFuncType(
|
|
465
|
+
return anyPiecedFuncType(lowerer, node, t);
|
|
463
466
|
}
|
|
464
|
-
if (
|
|
465
|
-
const elem =
|
|
467
|
+
if (lowerer.checker.isArrayType(t)) {
|
|
468
|
+
const elem = lowerer.checker.getTypeArguments(t)[0];
|
|
466
469
|
const elemTainted = elem !== undefined &&
|
|
467
|
-
((elem.flags & ts.TypeFlags.Never) !== 0 || neverTaintedJsType(
|
|
468
|
-
const mappedElem = elem !== undefined && !elemTainted ?
|
|
470
|
+
((elem.flags & ts.TypeFlags.Never) !== 0 || neverTaintedJsType(lowerer, node, elem));
|
|
471
|
+
const mappedElem = elem !== undefined && !elemTainted ? lowerer.mapTypeOf(elem) : null;
|
|
469
472
|
// A mappable element keeps the static array; an unmappable one makes
|
|
470
473
|
// the WHOLE value dyn (the checked-dynamic tree has real arrays — length/index/push
|
|
471
474
|
// read through the keyed-dyn paths; dyn-element STATIC arrays have no
|
|
@@ -482,14 +485,14 @@ export function dynFallbackType(L, node, t) {
|
|
|
482
485
|
// construct signatures, overloads, and function-with-properties shapes
|
|
483
486
|
// stay out (the whole value falls to dyn below, where every reached
|
|
484
487
|
// use meets its own fence or boxes as-is).
|
|
485
|
-
const sig = pureSingleCallSignatureOf(
|
|
488
|
+
const sig = pureSingleCallSignatureOf(lowerer, t);
|
|
486
489
|
if (sig) {
|
|
487
490
|
const params = sig.getParameters().map((p) => {
|
|
488
|
-
const pt =
|
|
489
|
-
return
|
|
491
|
+
const pt = lowerer.checker.getTypeOfSymbolAtLocation(p, node);
|
|
492
|
+
return lowerer.mapTypeOf(pt) ?? DYN;
|
|
490
493
|
});
|
|
491
|
-
const retT =
|
|
492
|
-
const ret = retT.flags & ts.TypeFlags.Void ? VOID :
|
|
494
|
+
const retT = lowerer.checker.getReturnTypeOfSignature(sig);
|
|
495
|
+
const ret = retT.flags & ts.TypeFlags.Void ? VOID : lowerer.mapTypeOf(retT) ?? DYN;
|
|
493
496
|
return { kind: "func", params, ret };
|
|
494
497
|
}
|
|
495
498
|
return DYN;
|
|
@@ -498,23 +501,23 @@ export function dynFallbackType(L, node, t) {
|
|
|
498
501
|
* properties, no construct signatures, no type parameters, no rest params
|
|
499
502
|
* (declared or synthesized from an `arguments` read). Null for every
|
|
500
503
|
* other shape. The structural gate both dynFallbackType arms share. */
|
|
501
|
-
function pureSingleCallSignatureOf(
|
|
504
|
+
function pureSingleCallSignatureOf(lowerer, t) {
|
|
502
505
|
if (!(t.flags & ts.TypeFlags.Object))
|
|
503
506
|
return null;
|
|
504
|
-
const sigs =
|
|
507
|
+
const sigs = lowerer.checker.getCallSignatures(t);
|
|
505
508
|
if (sigs.length === 1 &&
|
|
506
|
-
|
|
507
|
-
|
|
509
|
+
lowerer.checker.getPropertiesOfType(t).length === 0 &&
|
|
510
|
+
lowerer.checker.getConstructSignatures(t).length === 0 &&
|
|
508
511
|
sigs[0].getTypeParameters().length === 0 &&
|
|
509
512
|
sigs[0].getParameters().every((p) => {
|
|
510
|
-
const pDecl =
|
|
513
|
+
const pDecl = lowerer.checker.valueDeclarationOf(p);
|
|
511
514
|
return !pDecl || !ts.isParameter(pDecl) || pDecl.dotDotDotToken === undefined;
|
|
512
515
|
}) &&
|
|
513
516
|
// A SYNTHESIZED rest param (tsc's `arguments` inference — no
|
|
514
517
|
// valueDeclaration to carry the dotDotDot): param-count mismatch
|
|
515
518
|
// against the signature's declaration; the whole value stays dyn.
|
|
516
519
|
(() => {
|
|
517
|
-
const sigDecl =
|
|
520
|
+
const sigDecl = lowerer.checker.signatureDeclaration(sigs[0]);
|
|
518
521
|
const declParams = sigDecl !== undefined && ts.isFunctionLike(sigDecl) ? sigDecl.parameters : undefined;
|
|
519
522
|
if (declParams !== undefined && declParams.length !== sigs[0].getParameters().length)
|
|
520
523
|
return false;
|
|
@@ -534,21 +537,21 @@ function pureSingleCallSignatureOf(L, t) {
|
|
|
534
537
|
* irTypeOf fallback, so the binding type and the closure type agree).
|
|
535
538
|
* A piece that fails to map for any other reason answers null — the
|
|
536
539
|
* whole type keeps its own diagnostic. */
|
|
537
|
-
function anyPiecedFuncType(
|
|
538
|
-
const sig = pureSingleCallSignatureOf(
|
|
540
|
+
function anyPiecedFuncType(lowerer, node, t) {
|
|
541
|
+
const sig = pureSingleCallSignatureOf(lowerer, t);
|
|
539
542
|
if (!sig)
|
|
540
543
|
return null;
|
|
541
544
|
const params = [];
|
|
542
545
|
for (const p of sig.getParameters()) {
|
|
543
|
-
const pt =
|
|
544
|
-
const mapped =
|
|
546
|
+
const pt = lowerer.checker.getTypeOfSymbolAtLocation(p, node);
|
|
547
|
+
const mapped = lowerer.mapTypeOf(pt) ?? (pt.flags & ts.TypeFlags.Any ? DYN : null);
|
|
545
548
|
if (!mapped || mapped.kind === "void")
|
|
546
549
|
return null;
|
|
547
550
|
params.push(mapped);
|
|
548
551
|
}
|
|
549
|
-
const retT =
|
|
552
|
+
const retT = lowerer.checker.getReturnTypeOfSignature(sig);
|
|
550
553
|
const ret = retT.flags & (ts.TypeFlags.Void | ts.TypeFlags.Never) ? VOID
|
|
551
|
-
:
|
|
554
|
+
: lowerer.mapTypeOf(retT) ?? (retT.flags & ts.TypeFlags.Any ? DYN : null);
|
|
552
555
|
if (!ret)
|
|
553
556
|
return null;
|
|
554
557
|
return { kind: "func", params, ret };
|
|
@@ -863,7 +866,7 @@ export class Lowerer {
|
|
|
863
866
|
* Reachability lowers inits before the declarations they discover, so
|
|
864
867
|
* these rebuild after the worklist restores historical shape metadata. */
|
|
865
868
|
shapeOrderHelperFinalizers = [];
|
|
866
|
-
/** Emit-override specializations (`%C.emit:<event>` — lower-emitter.ts's
|
|
869
|
+
/** Emit-override specializations (`%C.emit:<event>` — lower-event-emitter.ts's
|
|
867
870
|
* emit-overrides block): interned names, the drive-loop queue, and the
|
|
868
871
|
* currently-lowering specialization's context (the super-forward
|
|
869
872
|
* interception reads it). */
|
|
@@ -1130,7 +1133,7 @@ export class Lowerer {
|
|
|
1130
1133
|
get ctx() {
|
|
1131
1134
|
const top = this.fnStack[this.fnStack.length - 1];
|
|
1132
1135
|
if (!top)
|
|
1133
|
-
throw new
|
|
1136
|
+
throw new InternalCompilerError("lowerer bug: no active function context");
|
|
1134
1137
|
return top;
|
|
1135
1138
|
}
|
|
1136
1139
|
get scopes() {
|
|
@@ -1377,6 +1380,31 @@ export class Lowerer {
|
|
|
1377
1380
|
this.flushDeferred(symbol);
|
|
1378
1381
|
return symbol;
|
|
1379
1382
|
}
|
|
1383
|
+
/** Whether this exact direct call belongs to a manifest-validated native
|
|
1384
|
+
* binding. Declaration classification uses this as a probe before normal
|
|
1385
|
+
* expression lowering: resolving must not flush deferred diagnostics or
|
|
1386
|
+
* trigger the merged-namespace fence just because it is asking ownership.
|
|
1387
|
+
* Call lowering remains the authority for every ABI and call-shape
|
|
1388
|
+
* diagnostic once this answers true. */
|
|
1389
|
+
ownsFfiCall(expr) {
|
|
1390
|
+
if (!ts.isIdentifier(expr.expression))
|
|
1391
|
+
return false;
|
|
1392
|
+
const binding = this.ffiImportsByName.get(expr.expression.text);
|
|
1393
|
+
if (binding === undefined || this.ffiBindingSymbols === null)
|
|
1394
|
+
return false;
|
|
1395
|
+
const validSymbols = this.ffiBindingSymbols.get(binding.name);
|
|
1396
|
+
if (validSymbols === undefined)
|
|
1397
|
+
return false;
|
|
1398
|
+
const wasCollecting = this.collecting;
|
|
1399
|
+
this.collecting = true;
|
|
1400
|
+
try {
|
|
1401
|
+
const symbol = this.resolveValueSymbol(expr.expression);
|
|
1402
|
+
return symbol !== null && validSymbols.has(symbol);
|
|
1403
|
+
}
|
|
1404
|
+
finally {
|
|
1405
|
+
this.collecting = wasCollecting;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1380
1408
|
/** The configured external host module owning an expression's runtime
|
|
1381
1409
|
* value, or null. Alias chains are followed to their declaration file so
|
|
1382
1410
|
* direct imports and local re-export facades classify identically. Type
|
|
@@ -2710,7 +2738,61 @@ export class Lowerer {
|
|
|
2710
2738
|
moduleArtifacts(functions) {
|
|
2711
2739
|
return moduleArtifacts(this, functions);
|
|
2712
2740
|
}
|
|
2713
|
-
|
|
2741
|
+
deferToRuntimeFence(diagsBefore, node, target) {
|
|
2742
|
+
if ((this.diagSink !== null && target.allowDiagSink !== true) ||
|
|
2743
|
+
(this.diags.length <= diagsBefore && target.fallback === undefined)) {
|
|
2744
|
+
return null;
|
|
2745
|
+
}
|
|
2746
|
+
const captured = this.diags.splice(diagsBefore);
|
|
2747
|
+
if (captured.some((d) => d.code === "SC9001")) {
|
|
2748
|
+
this.diags.push(...captured);
|
|
2749
|
+
return null;
|
|
2750
|
+
}
|
|
2751
|
+
this.runtimeFences.push(...captured);
|
|
2752
|
+
const first = captured[0];
|
|
2753
|
+
const loc = locOf(node);
|
|
2754
|
+
const code = first?.code ?? target.fallback.code;
|
|
2755
|
+
const baseMessage = first?.message ?? target.fallback.message;
|
|
2756
|
+
const messageLoc = first?.loc ?? loc;
|
|
2757
|
+
const source = first
|
|
2758
|
+
? this.program.getSourceFile(messageLoc.file) ?? node.getSourceFile()
|
|
2759
|
+
: node.getSourceFile();
|
|
2760
|
+
const pos = ts.getLineAndCharacterOfPosition(source, messageLoc.start);
|
|
2761
|
+
const fence = {
|
|
2762
|
+
kind: "runtimeFence",
|
|
2763
|
+
code,
|
|
2764
|
+
message: target.bareMessage
|
|
2765
|
+
? baseMessage
|
|
2766
|
+
: `${baseMessage} [${code} at ${messageLoc.file}:${pos.line + 1}]`,
|
|
2767
|
+
loc,
|
|
2768
|
+
};
|
|
2769
|
+
if (target.kind === "statement")
|
|
2770
|
+
return fence;
|
|
2771
|
+
const params = target.params ?? [];
|
|
2772
|
+
const name = typeof target.name === "function" ? target.name() : target.name;
|
|
2773
|
+
const fn = {
|
|
2774
|
+
name,
|
|
2775
|
+
params,
|
|
2776
|
+
returnType: target.returnType,
|
|
2777
|
+
locals: params.map((p) => ({
|
|
2778
|
+
id: p.localId,
|
|
2779
|
+
name: p.name,
|
|
2780
|
+
type: p.type,
|
|
2781
|
+
mutable: target.paramsMutable ?? false,
|
|
2782
|
+
})),
|
|
2783
|
+
body: [fence],
|
|
2784
|
+
loc,
|
|
2785
|
+
};
|
|
2786
|
+
if (target.async)
|
|
2787
|
+
fn.async = true;
|
|
2788
|
+
if (target.generator)
|
|
2789
|
+
fn.generator = target.generator;
|
|
2790
|
+
if (target.kind === "function")
|
|
2791
|
+
return fn;
|
|
2792
|
+
fn.captures = [];
|
|
2793
|
+
this.liftedFns.push(fn);
|
|
2794
|
+
return { kind: "closure", fnName: fn.name, captures: [], type: target.type, loc };
|
|
2795
|
+
}
|
|
2714
2796
|
/** All diagnostics land here; while a generic instance body is lowering,
|
|
2715
2797
|
* the instantiation context is appended so the user knows which concrete
|
|
2716
2798
|
* types made the (source-anchored) construct fail. */
|
|
@@ -3316,7 +3398,7 @@ export class Lowerer {
|
|
|
3316
3398
|
/** Unwraps a HYBRID (function-with-properties) record to its callable:
|
|
3317
3399
|
* a record whose shape carries the reserved `%call` func field reads
|
|
3318
3400
|
* that field; anything else returns unchanged. The consumer half of
|
|
3319
|
-
*
|
|
3401
|
+
* type-mapper.ts's chalk-shape mapping — call paths and func-slot coercions
|
|
3320
3402
|
* share it. */
|
|
3321
3403
|
hybridCallUnwrap(expr) {
|
|
3322
3404
|
if (expr.type.kind !== "record")
|
|
@@ -3499,7 +3581,7 @@ export class Lowerer {
|
|
|
3499
3581
|
}
|
|
3500
3582
|
// A HYBRID (function-with-properties) record flowing into a plain
|
|
3501
3583
|
// func slot extracts its reserved %call field — the chalk shape's
|
|
3502
|
-
// "the value IS callable" half (
|
|
3584
|
+
// "the value IS callable" half (type-mapper.ts's hybrid mapping).
|
|
3503
3585
|
if (expected.kind === "func" && expr.type.kind === "record") {
|
|
3504
3586
|
const un = this.hybridCallUnwrap(expr);
|
|
3505
3587
|
if (un !== expr && typeEquals(un.type, expected))
|
|
@@ -3954,102 +4036,102 @@ export class Lowerer {
|
|
|
3954
4036
|
return value;
|
|
3955
4037
|
case "wrap": {
|
|
3956
4038
|
if (dst.kind !== "union")
|
|
3957
|
-
throw new
|
|
4039
|
+
throw new InternalCompilerError("lowerer bug: wrap lift against a non-union");
|
|
3958
4040
|
return { kind: "unionWrap", unionId: dst.unionId, tag: lift.tag, value, type: dst, loc };
|
|
3959
4041
|
}
|
|
3960
4042
|
case "retag": {
|
|
3961
4043
|
if (dst.kind !== "union" || value.type.kind !== "union")
|
|
3962
|
-
throw new
|
|
4044
|
+
throw new InternalCompilerError("lowerer bug: retag lift shape");
|
|
3963
4045
|
const retag = this.unionRetagHelper(value.type.unionId, dst.unionId, loc);
|
|
3964
4046
|
if (!retag)
|
|
3965
|
-
throw new
|
|
4047
|
+
throw new InternalCompilerError("lowerer bug: planned retag lift failed to intern");
|
|
3966
4048
|
return { kind: "call", callee: retag, args: [value], type: dst, loc };
|
|
3967
4049
|
}
|
|
3968
4050
|
case "liftWrap": {
|
|
3969
4051
|
if (dst.kind !== "union")
|
|
3970
|
-
throw new
|
|
4052
|
+
throw new InternalCompilerError("lowerer bug: liftWrap lift against a non-union");
|
|
3971
4053
|
const inner = this.widthLiftPlan(value.type, lift.arm);
|
|
3972
4054
|
if (!inner)
|
|
3973
|
-
throw new
|
|
4055
|
+
throw new InternalCompilerError("lowerer bug: planned liftWrap arm stopped lifting");
|
|
3974
4056
|
const lifted = this.applyWidthLift(inner, value, lift.arm, loc);
|
|
3975
4057
|
return { kind: "unionWrap", unionId: dst.unionId, tag: lift.tag, value: lifted, type: dst, loc };
|
|
3976
4058
|
}
|
|
3977
4059
|
case "width": {
|
|
3978
4060
|
if (dst.kind !== "record" || value.type.kind !== "record")
|
|
3979
|
-
throw new
|
|
4061
|
+
throw new InternalCompilerError("lowerer bug: width lift shape");
|
|
3980
4062
|
const helper = this.recordWidthHelper(value.type.shapeId, dst.shapeId, loc);
|
|
3981
4063
|
if (!helper)
|
|
3982
|
-
throw new
|
|
4064
|
+
throw new InternalCompilerError("lowerer bug: planned width lift failed to intern");
|
|
3983
4065
|
return { kind: "call", callee: helper, args: [value], type: dst, loc };
|
|
3984
4066
|
}
|
|
3985
4067
|
case "arr": {
|
|
3986
4068
|
if (dst.kind !== "array" || value.type.kind !== "array")
|
|
3987
|
-
throw new
|
|
4069
|
+
throw new InternalCompilerError("lowerer bug: arr lift shape");
|
|
3988
4070
|
const helper = this.arrayWidthHelper(value.type, dst, loc);
|
|
3989
4071
|
if (!helper)
|
|
3990
|
-
throw new
|
|
4072
|
+
throw new InternalCompilerError("lowerer bug: planned arr lift failed to intern");
|
|
3991
4073
|
return { kind: "call", callee: helper, args: [value], type: dst, loc };
|
|
3992
4074
|
}
|
|
3993
4075
|
case "tupleArr": {
|
|
3994
4076
|
if (dst.kind !== "array" || value.type.kind !== "record")
|
|
3995
|
-
throw new
|
|
4077
|
+
throw new InternalCompilerError("lowerer bug: tupleArr lift shape");
|
|
3996
4078
|
const helper = this.tupleArrayWidthHelper(value.type.shapeId, dst, loc);
|
|
3997
4079
|
if (!helper)
|
|
3998
|
-
throw new
|
|
4080
|
+
throw new InternalCompilerError("lowerer bug: planned tupleArr lift failed to intern");
|
|
3999
4081
|
return { kind: "call", callee: helper, args: [value], type: dst, loc };
|
|
4000
4082
|
}
|
|
4001
4083
|
case "emptyArr": {
|
|
4002
4084
|
if (dst.kind !== "array" || value.type.kind !== "array")
|
|
4003
|
-
throw new
|
|
4085
|
+
throw new InternalCompilerError("lowerer bug: emptyArr lift shape");
|
|
4004
4086
|
const helper = this.emptyArrayLiftHelper(value.type, dst, loc);
|
|
4005
4087
|
return { kind: "call", callee: helper, args: [value], type: dst, loc };
|
|
4006
4088
|
}
|
|
4007
4089
|
case "objWidth": {
|
|
4008
4090
|
if (dst.kind !== "record" || value.type.kind !== "object")
|
|
4009
|
-
throw new
|
|
4091
|
+
throw new InternalCompilerError("lowerer bug: objWidth lift shape");
|
|
4010
4092
|
const helper = this.objRecordWidthHelper(value.type.className, dst.shapeId, loc);
|
|
4011
4093
|
if (!helper)
|
|
4012
|
-
throw new
|
|
4094
|
+
throw new InternalCompilerError("lowerer bug: planned objWidth lift failed to intern");
|
|
4013
4095
|
return { kind: "call", callee: helper, args: [value], type: dst, loc };
|
|
4014
4096
|
}
|
|
4015
4097
|
case "clsWidth": {
|
|
4016
4098
|
if (dst.kind !== "object" || value.type.kind !== "record")
|
|
4017
|
-
throw new
|
|
4099
|
+
throw new InternalCompilerError("lowerer bug: clsWidth lift shape");
|
|
4018
4100
|
const helper = this.recordClassWidthHelper(value.type.shapeId, dst.className, loc);
|
|
4019
4101
|
if (!helper)
|
|
4020
|
-
throw new
|
|
4102
|
+
throw new InternalCompilerError("lowerer bug: planned clsWidth lift failed to intern");
|
|
4021
4103
|
return { kind: "call", callee: helper, args: [value], type: dst, loc };
|
|
4022
4104
|
}
|
|
4023
4105
|
case "narrow": {
|
|
4024
4106
|
if (value.type.kind !== "union")
|
|
4025
|
-
throw new
|
|
4107
|
+
throw new InternalCompilerError("lowerer bug: narrow lift on a non-union");
|
|
4026
4108
|
const helper = this.narrowedArmHelper(value.type.unionId, dst, loc);
|
|
4027
4109
|
if (!helper)
|
|
4028
|
-
throw new
|
|
4110
|
+
throw new InternalCompilerError("lowerer bug: planned narrow lift failed to intern");
|
|
4029
4111
|
return { kind: "call", callee: helper, args: [value], type: dst, loc };
|
|
4030
4112
|
}
|
|
4031
4113
|
case "dynIn": {
|
|
4032
4114
|
if (dst.kind !== "dyn")
|
|
4033
|
-
throw new
|
|
4115
|
+
throw new InternalCompilerError("lowerer bug: dynIn lift against a non-dyn slot");
|
|
4034
4116
|
return { kind: "dynFrom", value, type: DYN, loc };
|
|
4035
4117
|
}
|
|
4036
4118
|
case "upcast": {
|
|
4037
4119
|
if (dst.kind !== "object" || value.type.kind !== "object")
|
|
4038
|
-
throw new
|
|
4120
|
+
throw new InternalCompilerError("lowerer bug: upcast lift shape");
|
|
4039
4121
|
return this.upcastTo(value, dst.className);
|
|
4040
4122
|
}
|
|
4041
4123
|
case "funcAdapt": {
|
|
4042
4124
|
if (dst.kind !== "func" || value.type.kind !== "func")
|
|
4043
|
-
throw new
|
|
4125
|
+
throw new InternalCompilerError("lowerer bug: funcAdapt lift shape");
|
|
4044
4126
|
const adapter = this.funcCoerceAdapter(value.type, dst, loc);
|
|
4045
4127
|
if (!adapter)
|
|
4046
|
-
throw new
|
|
4128
|
+
throw new InternalCompilerError("lowerer bug: planned funcAdapt lift failed to intern");
|
|
4047
4129
|
return { kind: "call", callee: adapter, args: [value], type: dst, loc };
|
|
4048
4130
|
}
|
|
4049
4131
|
default: {
|
|
4050
4132
|
const _exhaustive = lift;
|
|
4051
4133
|
void _exhaustive;
|
|
4052
|
-
throw new
|
|
4134
|
+
throw new InternalCompilerError("unreachable");
|
|
4053
4135
|
}
|
|
4054
4136
|
}
|
|
4055
4137
|
}
|
|
@@ -4264,7 +4346,7 @@ export class Lowerer {
|
|
|
4264
4346
|
}
|
|
4265
4347
|
if ("absent" in lift) {
|
|
4266
4348
|
if (f.type.kind !== "union")
|
|
4267
|
-
throw new
|
|
4349
|
+
throw new InternalCompilerError("lowerer bug: absent lift against a non-union field");
|
|
4268
4350
|
// The unset optional field: build the undefined arm.
|
|
4269
4351
|
return {
|
|
4270
4352
|
name: f.name,
|
|
@@ -4406,8 +4488,6 @@ export class Lowerer {
|
|
|
4406
4488
|
this.widthHelpers.set(key, name);
|
|
4407
4489
|
const arrT = { kind: "array", elem: fromElem };
|
|
4408
4490
|
const outT = { kind: "array", elem: toElem };
|
|
4409
|
-
const ref = (localId, type) => ({ kind: "varRef", localId, type, loc });
|
|
4410
|
-
const num = (value) => ({ kind: "numLit", value, type: { kind: "f64" }, loc });
|
|
4411
4491
|
const f64 = { kind: "f64" };
|
|
4412
4492
|
this.liftedFns.push({
|
|
4413
4493
|
name,
|
|
@@ -4424,17 +4504,17 @@ export class Lowerer {
|
|
|
4424
4504
|
{
|
|
4425
4505
|
kind: "varDecl",
|
|
4426
4506
|
localId: "n.0",
|
|
4427
|
-
init: { kind: "arrIntrinsic", method: "length", receiver:
|
|
4507
|
+
init: { kind: "arrIntrinsic", method: "length", receiver: varRef("a.0", arrT, loc), args: [], type: f64, loc },
|
|
4428
4508
|
loc,
|
|
4429
4509
|
},
|
|
4430
4510
|
{
|
|
4431
4511
|
kind: "for",
|
|
4432
|
-
init: { kind: "varDecl", localId: "i.0", init:
|
|
4433
|
-
cond: { kind: "bin", op: "<", left:
|
|
4512
|
+
init: { kind: "varDecl", localId: "i.0", init: numLit(0, loc), loc },
|
|
4513
|
+
cond: { kind: "bin", op: "<", left: varRef("i.0", f64, loc), right: varRef("n.0", f64, loc), type: BOOL, loc },
|
|
4434
4514
|
update: {
|
|
4435
4515
|
kind: "assign",
|
|
4436
4516
|
localId: "i.0",
|
|
4437
|
-
value: { kind: "bin", op: "+", left:
|
|
4517
|
+
value: { kind: "bin", op: "+", left: varRef("i.0", f64, loc), right: numLit(1, loc), type: f64, loc },
|
|
4438
4518
|
loc,
|
|
4439
4519
|
},
|
|
4440
4520
|
body: [
|
|
@@ -4443,9 +4523,9 @@ export class Lowerer {
|
|
|
4443
4523
|
expr: {
|
|
4444
4524
|
kind: "arrIntrinsic",
|
|
4445
4525
|
method: "push",
|
|
4446
|
-
receiver:
|
|
4526
|
+
receiver: varRef("out.0", outT, loc),
|
|
4447
4527
|
args: [
|
|
4448
|
-
this.applyWidthLift(elemLift, { kind: "arrayGet", arr:
|
|
4528
|
+
this.applyWidthLift(elemLift, { kind: "arrayGet", arr: varRef("a.0", arrT, loc), index: varRef("i.0", f64, loc), type: fromElem, loc }, toElem, loc),
|
|
4449
4529
|
],
|
|
4450
4530
|
type: f64,
|
|
4451
4531
|
loc,
|
|
@@ -4455,7 +4535,7 @@ export class Lowerer {
|
|
|
4455
4535
|
],
|
|
4456
4536
|
loc,
|
|
4457
4537
|
},
|
|
4458
|
-
{ kind: "return", value:
|
|
4538
|
+
{ kind: "return", value: varRef("out.0", outT, loc), loc },
|
|
4459
4539
|
],
|
|
4460
4540
|
loc,
|
|
4461
4541
|
});
|
|
@@ -4554,7 +4634,7 @@ export class Lowerer {
|
|
|
4554
4634
|
const lift = plan.get(f.name);
|
|
4555
4635
|
if ("absent" in lift) {
|
|
4556
4636
|
if (f.type.kind !== "union")
|
|
4557
|
-
throw new
|
|
4637
|
+
throw new InternalCompilerError("lowerer bug: absent lift against a non-union field");
|
|
4558
4638
|
return {
|
|
4559
4639
|
name: f.name,
|
|
4560
4640
|
value: {
|
|
@@ -4683,7 +4763,7 @@ export class Lowerer {
|
|
|
4683
4763
|
if ("absent" in entry) {
|
|
4684
4764
|
const u = this.wrappedUndefined(shape.type, loc);
|
|
4685
4765
|
if (!u)
|
|
4686
|
-
throw new
|
|
4766
|
+
throw new InternalCompilerError("lowerer bug: planned absent ctor arg has no undefined arm");
|
|
4687
4767
|
return u;
|
|
4688
4768
|
}
|
|
4689
4769
|
const get = { kind: "recordGet", obj: r, shapeId: fromId, field: entry.field, type: entry.src, loc };
|
|
@@ -4986,7 +5066,7 @@ export class Lowerer {
|
|
|
4986
5066
|
const aRef = { kind: "varRef", localId: `a.${i}`, type: toT.params[i], loc };
|
|
4987
5067
|
const converted = this.coerceToExpected(aRef, pt);
|
|
4988
5068
|
if (!typeEquals(converted.type, pt))
|
|
4989
|
-
throw new
|
|
5069
|
+
throw new InternalCompilerError("lowerer bug: probed fn-adapter param stopped coercing");
|
|
4990
5070
|
return converted;
|
|
4991
5071
|
});
|
|
4992
5072
|
const call = {
|
|
@@ -5029,7 +5109,7 @@ export class Lowerer {
|
|
|
5029
5109
|
else {
|
|
5030
5110
|
const result = this.coerceToExpected(call, toT.ret);
|
|
5031
5111
|
if (!typeEquals(result.type, toT.ret))
|
|
5032
|
-
throw new
|
|
5112
|
+
throw new InternalCompilerError("lowerer bug: probed fn-adapter return stopped coercing");
|
|
5033
5113
|
body = [{ kind: "return", value: result, loc }];
|
|
5034
5114
|
}
|
|
5035
5115
|
}
|
|
@@ -5720,7 +5800,7 @@ export class Lowerer {
|
|
|
5720
5800
|
if (e.type.kind === "dyn" || e.type.kind === "func") {
|
|
5721
5801
|
return { kind: "jsMarshal", value: e, type: JSVAL, loc };
|
|
5722
5802
|
}
|
|
5723
|
-
throw new
|
|
5803
|
+
throw new InternalCompilerError(`lowerer bug: jsvalLiftExpr of unliftable ${e.type.kind}`);
|
|
5724
5804
|
}
|
|
5725
5805
|
/** Interned `%jsin.union.<n>(u)` — the runtime tag switch marshaling a
|
|
5726
5806
|
* union value INTO the island: unit arms become the engine's own
|
|
@@ -5737,7 +5817,7 @@ export class Lowerer {
|
|
|
5737
5817
|
return existing;
|
|
5738
5818
|
const def = this.unions.get(unionId);
|
|
5739
5819
|
if (!def)
|
|
5740
|
-
throw new
|
|
5820
|
+
throw new InternalCompilerError(`lowerer bug: jsval lift of unknown union ${unionId}`);
|
|
5741
5821
|
const name = `%jsin.union.${this.jsinHelpers.size}`;
|
|
5742
5822
|
this.jsinHelpers.set(key, name);
|
|
5743
5823
|
const fromT = { kind: "union", unionId };
|
|
@@ -5779,7 +5859,7 @@ export class Lowerer {
|
|
|
5779
5859
|
return existing;
|
|
5780
5860
|
const shape = this.shapes.get(shapeId);
|
|
5781
5861
|
if (!shape)
|
|
5782
|
-
throw new
|
|
5862
|
+
throw new InternalCompilerError(`lowerer bug: jsval lift of unknown shape ${shapeId}`);
|
|
5783
5863
|
const name = `%jsin.rec.${this.jsinHelpers.size}`;
|
|
5784
5864
|
this.jsinHelpers.set(key, name);
|
|
5785
5865
|
const recT = { kind: "record", shapeId };
|
|
@@ -5812,9 +5892,7 @@ export class Lowerer {
|
|
|
5812
5892
|
const iv = shape.indexValue;
|
|
5813
5893
|
const f64 = { kind: "f64" };
|
|
5814
5894
|
const ksT = arrayOf(STRING);
|
|
5815
|
-
const
|
|
5816
|
-
const num = (value) => ({ kind: "numLit", value, type: f64, loc });
|
|
5817
|
-
const kRef = ref("k.0", STRING);
|
|
5895
|
+
const kRef = varRef("k.0", STRING, loc);
|
|
5818
5896
|
this.liftedFns.push({
|
|
5819
5897
|
name,
|
|
5820
5898
|
params: [{ localId: "r.0", name: "r", type: recT }],
|
|
@@ -5831,25 +5909,25 @@ export class Lowerer {
|
|
|
5831
5909
|
{ kind: "varDecl", localId: "ks.0", init: { kind: "recordOvfKeys", obj: r, shapeId, type: ksT, loc }, loc },
|
|
5832
5910
|
{
|
|
5833
5911
|
kind: "for",
|
|
5834
|
-
init: { kind: "varDecl", localId: "i.0", init:
|
|
5912
|
+
init: { kind: "varDecl", localId: "i.0", init: numLit(0, loc), loc },
|
|
5835
5913
|
cond: {
|
|
5836
5914
|
kind: "bin",
|
|
5837
5915
|
op: "<",
|
|
5838
|
-
left:
|
|
5839
|
-
right: { kind: "arrIntrinsic", method: "length", receiver:
|
|
5916
|
+
left: varRef("i.0", f64, loc),
|
|
5917
|
+
right: { kind: "arrIntrinsic", method: "length", receiver: varRef("ks.0", ksT, loc), args: [], type: f64, loc },
|
|
5840
5918
|
type: BOOL,
|
|
5841
5919
|
loc,
|
|
5842
5920
|
},
|
|
5843
|
-
update: { kind: "assign", localId: "i.0", value: { kind: "bin", op: "+", left:
|
|
5921
|
+
update: { kind: "assign", localId: "i.0", value: { kind: "bin", op: "+", left: varRef("i.0", f64, loc), right: numLit(1, loc), type: f64, loc }, loc },
|
|
5844
5922
|
body: [
|
|
5845
|
-
{ kind: "varDecl", localId: "k.0", init: { kind: "arrayGet", arr:
|
|
5923
|
+
{ kind: "varDecl", localId: "k.0", init: { kind: "arrayGet", arr: varRef("ks.0", ksT, loc), index: varRef("i.0", f64, loc), type: STRING, loc }, loc },
|
|
5846
5924
|
{
|
|
5847
5925
|
kind: "exprStmt",
|
|
5848
5926
|
expr: {
|
|
5849
5927
|
kind: "jsOp",
|
|
5850
5928
|
op: "setIdx",
|
|
5851
5929
|
args: [
|
|
5852
|
-
|
|
5930
|
+
varRef("out.0", JSVAL, loc),
|
|
5853
5931
|
{ kind: "jsMarshal", value: kRef, type: JSVAL, loc },
|
|
5854
5932
|
this.jsvalLiftExpr({ kind: "recordKeyGet", obj: r, shapeId, key: kRef, overflowOnly: true, type: iv, loc }, loc),
|
|
5855
5933
|
],
|
|
@@ -5861,7 +5939,7 @@ export class Lowerer {
|
|
|
5861
5939
|
],
|
|
5862
5940
|
loc,
|
|
5863
5941
|
},
|
|
5864
|
-
{ kind: "return", value:
|
|
5942
|
+
{ kind: "return", value: varRef("out.0", JSVAL, loc), loc },
|
|
5865
5943
|
],
|
|
5866
5944
|
loc,
|
|
5867
5945
|
});
|
|
@@ -5880,8 +5958,6 @@ export class Lowerer {
|
|
|
5880
5958
|
this.jsinHelpers.set(key, name);
|
|
5881
5959
|
const arrT = { kind: "array", elem };
|
|
5882
5960
|
const f64 = { kind: "f64" };
|
|
5883
|
-
const ref = (localId, type) => ({ kind: "varRef", localId, type, loc });
|
|
5884
|
-
const num = (value) => ({ kind: "numLit", value, type: f64, loc });
|
|
5885
5961
|
this.liftedFns.push({
|
|
5886
5962
|
name,
|
|
5887
5963
|
params: [{ localId: "a.0", name: "a", type: arrT }],
|
|
@@ -5897,17 +5973,17 @@ export class Lowerer {
|
|
|
5897
5973
|
{
|
|
5898
5974
|
kind: "varDecl",
|
|
5899
5975
|
localId: "n.0",
|
|
5900
|
-
init: { kind: "arrIntrinsic", method: "length", receiver:
|
|
5976
|
+
init: { kind: "arrIntrinsic", method: "length", receiver: varRef("a.0", arrT, loc), args: [], type: f64, loc },
|
|
5901
5977
|
loc,
|
|
5902
5978
|
},
|
|
5903
5979
|
{
|
|
5904
5980
|
kind: "for",
|
|
5905
|
-
init: { kind: "varDecl", localId: "i.0", init:
|
|
5906
|
-
cond: { kind: "bin", op: "<", left:
|
|
5981
|
+
init: { kind: "varDecl", localId: "i.0", init: numLit(0, loc), loc },
|
|
5982
|
+
cond: { kind: "bin", op: "<", left: varRef("i.0", f64, loc), right: varRef("n.0", f64, loc), type: BOOL, loc },
|
|
5907
5983
|
update: {
|
|
5908
5984
|
kind: "assign",
|
|
5909
5985
|
localId: "i.0",
|
|
5910
|
-
value: { kind: "bin", op: "+", left:
|
|
5986
|
+
value: { kind: "bin", op: "+", left: varRef("i.0", f64, loc), right: numLit(1, loc), type: f64, loc },
|
|
5911
5987
|
loc,
|
|
5912
5988
|
},
|
|
5913
5989
|
body: [
|
|
@@ -5917,9 +5993,9 @@ export class Lowerer {
|
|
|
5917
5993
|
kind: "jsOp",
|
|
5918
5994
|
op: "setIdx",
|
|
5919
5995
|
args: [
|
|
5920
|
-
|
|
5921
|
-
{ kind: "jsMarshal", value:
|
|
5922
|
-
this.jsvalLiftExpr({ kind: "arrayGet", arr:
|
|
5996
|
+
varRef("out.0", JSVAL, loc),
|
|
5997
|
+
{ kind: "jsMarshal", value: varRef("i.0", f64, loc), type: JSVAL, loc },
|
|
5998
|
+
this.jsvalLiftExpr({ kind: "arrayGet", arr: varRef("a.0", arrT, loc), index: varRef("i.0", f64, loc), type: elem, loc }, loc),
|
|
5923
5999
|
],
|
|
5924
6000
|
type: { kind: "void" },
|
|
5925
6001
|
loc,
|
|
@@ -5929,7 +6005,7 @@ export class Lowerer {
|
|
|
5929
6005
|
],
|
|
5930
6006
|
loc,
|
|
5931
6007
|
},
|
|
5932
|
-
{ kind: "return", value:
|
|
6008
|
+
{ kind: "return", value: varRef("out.0", JSVAL, loc), loc },
|
|
5933
6009
|
],
|
|
5934
6010
|
loc,
|
|
5935
6011
|
});
|
|
@@ -5951,8 +6027,6 @@ export class Lowerer {
|
|
|
5951
6027
|
const arrT = { kind: "array", elem: fromElem };
|
|
5952
6028
|
const outT = { kind: "array", elem: JSVAL };
|
|
5953
6029
|
const f64 = { kind: "f64" };
|
|
5954
|
-
const ref = (localId, type) => ({ kind: "varRef", localId, type, loc });
|
|
5955
|
-
const num = (value) => ({ kind: "numLit", value, type: f64, loc });
|
|
5956
6030
|
this.liftedFns.push({
|
|
5957
6031
|
name,
|
|
5958
6032
|
params: [{ localId: "a.0", name: "a", type: arrT }],
|
|
@@ -5968,17 +6042,17 @@ export class Lowerer {
|
|
|
5968
6042
|
{
|
|
5969
6043
|
kind: "varDecl",
|
|
5970
6044
|
localId: "n.0",
|
|
5971
|
-
init: { kind: "arrIntrinsic", method: "length", receiver:
|
|
6045
|
+
init: { kind: "arrIntrinsic", method: "length", receiver: varRef("a.0", arrT, loc), args: [], type: f64, loc },
|
|
5972
6046
|
loc,
|
|
5973
6047
|
},
|
|
5974
6048
|
{
|
|
5975
6049
|
kind: "for",
|
|
5976
|
-
init: { kind: "varDecl", localId: "i.0", init:
|
|
5977
|
-
cond: { kind: "bin", op: "<", left:
|
|
6050
|
+
init: { kind: "varDecl", localId: "i.0", init: numLit(0, loc), loc },
|
|
6051
|
+
cond: { kind: "bin", op: "<", left: varRef("i.0", f64, loc), right: varRef("n.0", f64, loc), type: BOOL, loc },
|
|
5978
6052
|
update: {
|
|
5979
6053
|
kind: "assign",
|
|
5980
6054
|
localId: "i.0",
|
|
5981
|
-
value: { kind: "bin", op: "+", left:
|
|
6055
|
+
value: { kind: "bin", op: "+", left: varRef("i.0", f64, loc), right: numLit(1, loc), type: f64, loc },
|
|
5982
6056
|
loc,
|
|
5983
6057
|
},
|
|
5984
6058
|
body: [
|
|
@@ -5987,9 +6061,9 @@ export class Lowerer {
|
|
|
5987
6061
|
expr: {
|
|
5988
6062
|
kind: "arrIntrinsic",
|
|
5989
6063
|
method: "push",
|
|
5990
|
-
receiver:
|
|
6064
|
+
receiver: varRef("out.0", outT, loc),
|
|
5991
6065
|
args: [
|
|
5992
|
-
this.jsvalLiftExpr({ kind: "arrayGet", arr:
|
|
6066
|
+
this.jsvalLiftExpr({ kind: "arrayGet", arr: varRef("a.0", arrT, loc), index: varRef("i.0", f64, loc), type: fromElem, loc }, loc),
|
|
5993
6067
|
],
|
|
5994
6068
|
type: f64,
|
|
5995
6069
|
loc,
|
|
@@ -5999,7 +6073,7 @@ export class Lowerer {
|
|
|
5999
6073
|
],
|
|
6000
6074
|
loc,
|
|
6001
6075
|
},
|
|
6002
|
-
{ kind: "return", value:
|
|
6076
|
+
{ kind: "return", value: varRef("out.0", outT, loc), loc },
|
|
6003
6077
|
],
|
|
6004
6078
|
loc,
|
|
6005
6079
|
});
|
|
@@ -7513,7 +7587,7 @@ export class Lowerer {
|
|
|
7513
7587
|
* node_modules but NOT the standard library (typescript's own lib files
|
|
7514
7588
|
* live under node_modules too), or inside a registered workspace-linked
|
|
7515
7589
|
* package (a node_modules symlink whose realpath'd files carry no
|
|
7516
|
-
* node_modules segment —
|
|
7590
|
+
* node_modules segment — workspace-registry.ts). The provenance half of the npm
|
|
7517
7591
|
* typing rule (package types are island handles) and of the per-package
|
|
7518
7592
|
* requires-dynamic attribution. */
|
|
7519
7593
|
isNpmFile = (sf) => sf.isDeclarationFile &&
|