@scriptc/compiler 0.0.35 → 0.1.1
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 +14 -11
- package/ambient/scriptc-overrides.d.ts +0 -7
- package/ambient/scriptc.d.ts +1 -1
- 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 +7937 -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 +4 -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} +395 -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} +242 -304
- package/dist/backend/c/walkers.js.map +1 -0
- package/dist/backend/external-c.d.ts +33 -0
- package/dist/backend/external-c.js +51 -0
- package/dist/backend/external-c.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/link-plan.d.ts +37 -0
- package/dist/backend/link-plan.js +26 -0
- package/dist/backend/link-plan.js.map +1 -0
- package/dist/backend/linker.d.ts +22 -0
- package/dist/backend/linker.js +236 -0
- package/dist/backend/linker.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 +159 -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 +548 -9988
- 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 +637 -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 +153 -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 +642 -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 +420 -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 +195 -222
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +45 -0
- package/dist/backend/native-codegen.js +275 -0
- package/dist/backend/native-codegen.js.map +1 -0
- package/dist/backend/native-codegen.test.js +226 -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 +243 -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} +219 -7
- 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-targets.test.d.ts +1 -0
- package/dist/backend/runtime-pack-targets.test.js +54 -0
- package/dist/backend/runtime-pack-targets.test.js.map +1 -0
- package/dist/backend/runtime-pack.d.ts +112 -0
- package/dist/backend/runtime-pack.js +305 -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 +473 -0
- package/dist/backend/runtime-pack.test.js.map +1 -0
- package/dist/backend/targets.d.ts +76 -0
- package/dist/backend/targets.js +262 -0
- package/dist/backend/targets.js.map +1 -0
- package/dist/backend/targets.test.d.ts +1 -0
- package/dist/backend/targets.test.js +41 -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 +35 -33
- 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/array-values.d.ts +8 -0
- package/dist/frontend/lowering/array-values.js +60 -0
- package/dist/frontend/lowering/array-values.js.map +1 -0
- 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-array-sort.d.ts +22 -0
- package/dist/frontend/lowering/lower-array-sort.js +619 -0
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -0
- 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 +1285 -1233
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +59 -192
- package/dist/frontend/lowering/lower-calls.js +1644 -1506
- 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 +1984 -2227
- 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 +60 -264
- package/dist/frontend/lowering/lower-exprs.js +2361 -1765
- 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 +273 -261
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +39 -49
- package/dist/frontend/lowering/lower-island.js +447 -513
- 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 +909 -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 +1463 -1285
- 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 +134 -22
- package/dist/frontend/lowering/lowerer.js +1277 -126
- 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 +24 -35
- package/dist/frontend/lowering/surfaces.js +78 -66
- 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 +113 -31
- package/dist/index.js +536 -128
- 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} +119 -37
- package/dist/ir/{nodes.js → ir.js} +170 -166
- 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 +2 -2
- package/dist/ir/serialize.js +3 -2
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/validate.d.ts +1 -1
- package/dist/ir/validate.js +93 -41
- 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 +8 -2
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/int-infer.d.ts +1 -36
- package/dist/library/int-infer.js +29 -18
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +4 -4
- 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} +7 -7
- 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 +11 -3
- package/dist/startup-cache.js +17 -2
- package/dist/startup-cache.js.map +1 -1
- package/package.json +19 -2
- package/surface-manifest.json +5 -5
- 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
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
import * as ts from "../ts7/adapter.js";
|
|
40
40
|
import { boundIdentifiersOf } from "./lowerer.js";
|
|
41
41
|
import { locOf, resolveImport } from "../program.js";
|
|
42
|
-
import { F64, STRING } from "../../ir/
|
|
42
|
+
import { F64, STRING } from "../../ir/ir.js";
|
|
43
43
|
/** True when this module declaration produces NO runtime construct at all:
|
|
44
44
|
* ambient (`declare namespace/module`, `declare global`, string-named
|
|
45
45
|
* modules — .d.ts surface or user-file declares) or a non-instantiated
|
|
46
46
|
* body (only type-world statements inside). */
|
|
47
|
-
|
|
47
|
+
function nsZeroRuntime(decl) {
|
|
48
48
|
if (isAmbientModuleDecl(decl))
|
|
49
49
|
return true;
|
|
50
50
|
if (!ts.isIdentifier(decl.name))
|
|
@@ -53,7 +53,7 @@ export function nsZeroRuntime(decl) {
|
|
|
53
53
|
}
|
|
54
54
|
/** Ambient module declaration: carries `declare` itself, sits in an
|
|
55
55
|
* ambient ancestor, or is the `declare global` augmentation. */
|
|
56
|
-
|
|
56
|
+
function isAmbientModuleDecl(decl) {
|
|
57
57
|
if (decl.flags & ts.NodeFlags.Ambient)
|
|
58
58
|
return true;
|
|
59
59
|
for (let p = decl; p !== undefined && !ts.isSourceFile(p); p = p.parent) {
|
|
@@ -89,19 +89,19 @@ function nsTypeOnlyBody(decl) {
|
|
|
89
89
|
* declaration's block flattened (the object exists once a block ran;
|
|
90
90
|
* merged ambient declarations don't subtract), "typeOnly"/"ambient" when
|
|
91
91
|
* none did. Null for non-namespace symbols. */
|
|
92
|
-
|
|
92
|
+
function nsSymbolRuntimeKind(lowerer, sym) {
|
|
93
93
|
if (!(sym.flags & (ts.SymbolFlags.ValueModule | ts.SymbolFlags.NamespaceModule)))
|
|
94
94
|
return null;
|
|
95
95
|
let sawTypeOnly = false;
|
|
96
96
|
let sawNamespace = false;
|
|
97
|
-
for (const d of
|
|
97
|
+
for (const d of lowerer.checker.declarationsOf(sym)) {
|
|
98
98
|
if (!ts.isModuleDeclaration(d))
|
|
99
99
|
continue;
|
|
100
100
|
sawNamespace = true;
|
|
101
101
|
let body = d.body;
|
|
102
102
|
while (body !== undefined && ts.isModuleDeclaration(body))
|
|
103
103
|
body = body.body;
|
|
104
|
-
const kind = body !== undefined ?
|
|
104
|
+
const kind = body !== undefined ? lowerer.nsBlocks.get(body) : undefined;
|
|
105
105
|
if (kind === "flattened")
|
|
106
106
|
return "instantiated";
|
|
107
107
|
if (kind === "typeOnly")
|
|
@@ -118,10 +118,10 @@ export function nsSymbolRuntimeKind(L, sym) {
|
|
|
118
118
|
* collection lists, everything else joins the init body in source order.
|
|
119
119
|
* Nested namespaces recurse; dotted declarations (`namespace A.B.C`)
|
|
120
120
|
* descend to the innermost block. */
|
|
121
|
-
export function collectNamespaceStmt(
|
|
121
|
+
export function collectNamespaceStmt(lowerer, decl, fp) {
|
|
122
122
|
if (nsZeroRuntime(decl)) {
|
|
123
123
|
if (!isAmbientModuleDecl(decl))
|
|
124
|
-
registerTypeOnlyBlocks(
|
|
124
|
+
registerTypeOnlyBlocks(lowerer, decl);
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
let body = decl.body;
|
|
@@ -129,7 +129,7 @@ export function collectNamespaceStmt(L, decl, fp) {
|
|
|
129
129
|
body = body.body;
|
|
130
130
|
if (body === undefined || !ts.isModuleBlock(body))
|
|
131
131
|
return; // bodyless non-ambient: tsc-rejected
|
|
132
|
-
|
|
132
|
+
lowerer.nsBlocks.set(body, "flattened");
|
|
133
133
|
for (const s of body.statements) {
|
|
134
134
|
if (ts.isFunctionDeclaration(s))
|
|
135
135
|
fp.fnDecls.push(s);
|
|
@@ -138,7 +138,7 @@ export function collectNamespaceStmt(L, decl, fp) {
|
|
|
138
138
|
else if (ts.isInterfaceDeclaration(s) || ts.isTypeAliasDeclaration(s))
|
|
139
139
|
continue;
|
|
140
140
|
else if (ts.isModuleDeclaration(s))
|
|
141
|
-
collectNamespaceStmt(
|
|
141
|
+
collectNamespaceStmt(lowerer, s, fp);
|
|
142
142
|
// Everything else — member variables, side-effecting statements,
|
|
143
143
|
// import= aliases (lowerStmt handles them), enums (their own fence) —
|
|
144
144
|
// runs in the init body at its source position.
|
|
@@ -146,16 +146,16 @@ export function collectNamespaceStmt(L, decl, fp) {
|
|
|
146
146
|
fp.topStmts.push(s);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
function registerTypeOnlyBlocks(
|
|
149
|
+
function registerTypeOnlyBlocks(lowerer, decl) {
|
|
150
150
|
let body = decl.body;
|
|
151
151
|
while (body !== undefined && ts.isModuleDeclaration(body))
|
|
152
152
|
body = body.body;
|
|
153
153
|
if (body === undefined || !ts.isModuleBlock(body))
|
|
154
154
|
return;
|
|
155
|
-
|
|
155
|
+
lowerer.nsBlocks.set(body, "typeOnly");
|
|
156
156
|
for (const s of body.statements) {
|
|
157
157
|
if (ts.isModuleDeclaration(s))
|
|
158
|
-
registerTypeOnlyBlocks(
|
|
158
|
+
registerTypeOnlyBlocks(lowerer, s);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
/** The namespace-path prefix of a declaration's emitted name ("A%B." for
|
|
@@ -193,8 +193,8 @@ export function nsPathPrefix(node, modifierDecl) {
|
|
|
193
193
|
* non-instantiated one, whose only value members are import= aliases), or
|
|
194
194
|
* null. The walk stops at class/function boundaries: a static member of a
|
|
195
195
|
* class INSIDE a namespace is the class's business, not the namespace's. */
|
|
196
|
-
|
|
197
|
-
for (const d of
|
|
196
|
+
function nsBlockKindOfSymbol(lowerer, sym) {
|
|
197
|
+
for (const d of lowerer.checker.declarationsOf(sym)) {
|
|
198
198
|
// TYPE declarations don't make a member a namespace VALUE: a class
|
|
199
199
|
// static `C.B` whose name also carries `namespace C { export
|
|
200
200
|
// interface B }` is the static's business — value references consult
|
|
@@ -208,7 +208,7 @@ export function nsBlockKindOfSymbol(L, sym) {
|
|
|
208
208
|
continue;
|
|
209
209
|
let blocked = false;
|
|
210
210
|
for (let p = d.parent; p !== undefined && !ts.isSourceFile(p); p = p.parent) {
|
|
211
|
-
const kind =
|
|
211
|
+
const kind = lowerer.nsBlocks.get(p);
|
|
212
212
|
if (kind !== undefined) {
|
|
213
213
|
if (!blocked)
|
|
214
214
|
return kind;
|
|
@@ -231,23 +231,23 @@ export function nsBlockKindOfSymbol(L, sym) {
|
|
|
231
231
|
* Builtin/stdlib module namespaces (string-named ambient modules in
|
|
232
232
|
* .d.ts files) and npm packages answer null — their own chokepoints and
|
|
233
233
|
* fences keep ownership. */
|
|
234
|
-
|
|
234
|
+
function moduleNsSourceFileOf(lowerer, e) {
|
|
235
235
|
let sym;
|
|
236
236
|
if (ts.isIdentifier(e)) {
|
|
237
|
-
sym =
|
|
237
|
+
sym = lowerer.checker.getSymbolAtLocation(e);
|
|
238
238
|
}
|
|
239
239
|
else if (ts.isPropertyAccessExpression(e) &&
|
|
240
240
|
e.questionDotToken === undefined &&
|
|
241
241
|
ts.isIdentifier(e.name)) {
|
|
242
|
-
sym =
|
|
242
|
+
sym = lowerer.checker.getSymbolAtLocation(e.name);
|
|
243
243
|
}
|
|
244
244
|
if (!sym)
|
|
245
245
|
return null;
|
|
246
246
|
if (sym.flags & ts.SymbolFlags.Alias)
|
|
247
|
-
sym =
|
|
248
|
-
for (const d of
|
|
247
|
+
sym = lowerer.checker.getAliasedSymbol(sym);
|
|
248
|
+
for (const d of lowerer.checker.declarationsOf(sym)) {
|
|
249
249
|
if (sym.flags & ts.SymbolFlags.ValueModule &&
|
|
250
|
-
ts.isSourceFile(d) && !d.isDeclarationFile &&
|
|
250
|
+
ts.isSourceFile(d) && !d.isDeclarationFile && lowerer.fileTag.has(d)) {
|
|
251
251
|
return d;
|
|
252
252
|
}
|
|
253
253
|
// A symbol MERGED with type-world declarations (`export type Drink =
|
|
@@ -260,8 +260,8 @@ export function moduleNsSourceFileOf(L, e) {
|
|
|
260
260
|
if ((ts.isImportDeclaration(stmt) || ts.isExportDeclaration(stmt)) &&
|
|
261
261
|
stmt.moduleSpecifier !== undefined &&
|
|
262
262
|
ts.isStringLiteral(stmt.moduleSpecifier)) {
|
|
263
|
-
const dep = resolveImport(
|
|
264
|
-
if (dep && !dep.isDeclarationFile &&
|
|
263
|
+
const dep = resolveImport(lowerer.program, d.getSourceFile(), stmt.moduleSpecifier.text);
|
|
264
|
+
if (dep && !dep.isDeclarationFile && lowerer.fileTag.has(dep))
|
|
265
265
|
return dep;
|
|
266
266
|
}
|
|
267
267
|
}
|
|
@@ -279,17 +279,17 @@ export function moduleNsSourceFileOf(L, e) {
|
|
|
279
279
|
* reads are LIVE bindings in Node (the namespace object's properties
|
|
280
280
|
* alias the exporter's storage), which is exactly what resolving to the
|
|
281
281
|
* exporter's module global gives. */
|
|
282
|
-
export function nsMemberIdentOf(
|
|
282
|
+
export function nsMemberIdentOf(lowerer, access) {
|
|
283
283
|
if (access.questionDotToken !== undefined)
|
|
284
284
|
return null;
|
|
285
285
|
if (!ts.isIdentifier(access.name))
|
|
286
286
|
return null;
|
|
287
|
-
const memberSym =
|
|
287
|
+
const memberSym = lowerer.checker.getSymbolAtLocation(access.name);
|
|
288
288
|
if (!memberSym)
|
|
289
289
|
return null;
|
|
290
|
-
if (nsBlockKindOfSymbol(
|
|
290
|
+
if (nsBlockKindOfSymbol(lowerer, memberSym) !== null)
|
|
291
291
|
return access.name;
|
|
292
|
-
if (moduleNsSourceFileOf(
|
|
292
|
+
if (moduleNsSourceFileOf(lowerer, access.expression) !== null)
|
|
293
293
|
return access.name;
|
|
294
294
|
return null;
|
|
295
295
|
}
|
|
@@ -298,21 +298,21 @@ export function nsMemberIdentOf(L, access) {
|
|
|
298
298
|
* ModuleDeclaration outside the stdlib/@types surface), or null. Reads
|
|
299
299
|
* through it compile to Node's ReferenceError naming the root — the
|
|
300
300
|
* ambient namespace object never exists at runtime. */
|
|
301
|
-
export function ambientNsRootOf(
|
|
301
|
+
export function ambientNsRootOf(lowerer, e) {
|
|
302
302
|
let root = e;
|
|
303
303
|
while (ts.isPropertyAccessExpression(root) && root.questionDotToken === undefined) {
|
|
304
304
|
root = root.expression;
|
|
305
305
|
}
|
|
306
306
|
if (!ts.isIdentifier(root))
|
|
307
307
|
return null;
|
|
308
|
-
let sym =
|
|
308
|
+
let sym = lowerer.checker.getSymbolAtLocation(root);
|
|
309
309
|
if (sym && sym.flags & ts.SymbolFlags.Alias)
|
|
310
|
-
sym =
|
|
310
|
+
sym = lowerer.checker.getAliasedSymbol(sym);
|
|
311
311
|
if (!sym || !(sym.flags & (ts.SymbolFlags.ValueModule | ts.SymbolFlags.NamespaceModule)))
|
|
312
312
|
return null;
|
|
313
|
-
if (
|
|
313
|
+
if (lowerer.isStdlibSymbol(sym))
|
|
314
314
|
return null;
|
|
315
|
-
const decls =
|
|
315
|
+
const decls = lowerer.checker.declarationsOf(sym);
|
|
316
316
|
if (decls.length === 0)
|
|
317
317
|
return null;
|
|
318
318
|
for (const d of decls) {
|
|
@@ -344,7 +344,7 @@ export function ambientNsRootOf(L, e) {
|
|
|
344
344
|
* defined";
|
|
345
345
|
* - an ambient `declare function` nothing defines (the same erasure,
|
|
346
346
|
* ambientUndefinedFnSymbolOf);
|
|
347
|
-
* - a TRAP BINDING (
|
|
347
|
+
* - a TRAP BINDING (lowerer.trapBindings) — a binding whose own initializer
|
|
348
348
|
* provably threw before producing a value, so module init unwound and
|
|
349
349
|
* no reference to it can ever execute (any lowering is sound there;
|
|
350
350
|
* the trap keeps the shape honest if reachability analysis is wrong).
|
|
@@ -354,11 +354,14 @@ export function ambientNsRootOf(L, e) {
|
|
|
354
354
|
* null/undefined AFTER a successful read; it cannot guard the root's own
|
|
355
355
|
* ReferenceError), calls and `new` (the callee evaluates before any
|
|
356
356
|
* argument), instantiation expressions, and tagged templates (the tag
|
|
357
|
-
* evaluates first).
|
|
358
|
-
*
|
|
359
|
-
* the
|
|
357
|
+
* evaluates first). A manifest-validated direct FFI call is the narrow
|
|
358
|
+
* exception: its ambient declaration supplies a native implementation, so
|
|
359
|
+
* the call itself is not an undefined-root read and outer transparent chains
|
|
360
|
+
* retain that native result. Callers lower every other whole expression to
|
|
361
|
+
* the root's throw, typed by the use site — and never lower the arguments,
|
|
362
|
+
* exactly the order Node dies in. Null for stdlib/@types roots (their own
|
|
360
363
|
* chokepoints stand) and anything declared with a value. */
|
|
361
|
-
export function ambientUndefVarRootOf(
|
|
364
|
+
export function ambientUndefVarRootOf(lowerer, e) {
|
|
362
365
|
let root = e;
|
|
363
366
|
for (;;) {
|
|
364
367
|
if (ts.isParenthesizedExpression(root) ||
|
|
@@ -374,6 +377,11 @@ export function ambientUndefVarRootOf(L, e) {
|
|
|
374
377
|
continue;
|
|
375
378
|
}
|
|
376
379
|
if (ts.isCallExpression(root) || ts.isNewExpression(root)) {
|
|
380
|
+
// A configured native binding owns this exact call node. Do not walk
|
|
381
|
+
// into its signature-only declaration: the call produces a native
|
|
382
|
+
// result, and normal call lowering must retain its ffiCall IR.
|
|
383
|
+
if (ts.isCallExpression(root) && lowerer.ownsFfiCall(root))
|
|
384
|
+
return null;
|
|
377
385
|
root = root.expression;
|
|
378
386
|
continue;
|
|
379
387
|
}
|
|
@@ -399,19 +407,19 @@ export function ambientUndefVarRootOf(L, e) {
|
|
|
399
407
|
// PoisonError out of collection entirely. The collect-phase guard
|
|
400
408
|
// suppresses both; the ordinary lowering that follows a null answer
|
|
401
409
|
// re-resolves with full effects at its own site.
|
|
402
|
-
const wasCollecting =
|
|
403
|
-
|
|
410
|
+
const wasCollecting = lowerer.collecting;
|
|
411
|
+
lowerer.collecting = true;
|
|
404
412
|
try {
|
|
405
|
-
const sym =
|
|
413
|
+
const sym = lowerer.resolveValueSymbol(root);
|
|
406
414
|
if (!sym)
|
|
407
415
|
return null;
|
|
408
|
-
if (
|
|
416
|
+
if (lowerer.trapBindings.has(sym))
|
|
409
417
|
return root;
|
|
410
|
-
if (
|
|
418
|
+
if (lowerer.isStdlibSymbol(sym))
|
|
411
419
|
return null;
|
|
412
|
-
if (ambientUndefinedFnSymbolOf(
|
|
420
|
+
if (ambientUndefinedFnSymbolOf(lowerer, root) !== null)
|
|
413
421
|
return root;
|
|
414
|
-
const decls =
|
|
422
|
+
const decls = lowerer.checker.declarationsOf(sym);
|
|
415
423
|
if (decls.length === 0)
|
|
416
424
|
return null;
|
|
417
425
|
for (const d of decls) {
|
|
@@ -425,7 +433,7 @@ export function ambientUndefVarRootOf(L, e) {
|
|
|
425
433
|
return root;
|
|
426
434
|
}
|
|
427
435
|
finally {
|
|
428
|
-
|
|
436
|
+
lowerer.collecting = wasCollecting;
|
|
429
437
|
}
|
|
430
438
|
}
|
|
431
439
|
/** The declaration-classification form of ambientUndefVarRootOf: the root
|
|
@@ -451,16 +459,16 @@ export function ambientUndefVarRootOf(L, e) {
|
|
|
451
459
|
* skips the write forms the no-storage lowering already compiles (a
|
|
452
460
|
* statement-position `x = <ambient-rooted chain>` IS the RHS root's
|
|
453
461
|
* throw — lowerExprStatement never touches the target's storage). */
|
|
454
|
-
export function trapDeclRootOf(
|
|
462
|
+
export function trapDeclRootOf(lowerer, decl) {
|
|
455
463
|
if (decl.initializer === undefined)
|
|
456
464
|
return null;
|
|
457
|
-
const root = ambientUndefVarRootOf(
|
|
465
|
+
const root = ambientUndefVarRootOf(lowerer, decl.initializer);
|
|
458
466
|
if (root === null)
|
|
459
467
|
return null;
|
|
460
468
|
for (const nameNode of boundIdentifiersOf(decl.name)) {
|
|
461
|
-
const sym =
|
|
462
|
-
if (sym && bindingEverWritten(
|
|
463
|
-
const mapped =
|
|
469
|
+
const sym = lowerer.checker.getSymbolAtLocation(nameNode);
|
|
470
|
+
if (sym && bindingEverWritten(lowerer, sym, decl.getSourceFile())) {
|
|
471
|
+
const mapped = lowerer.mapTypeOf(lowerer.checker.getTypeOfSymbol(sym));
|
|
464
472
|
if (mapped !== null && mapped.kind !== "void")
|
|
465
473
|
return null;
|
|
466
474
|
}
|
|
@@ -483,9 +491,9 @@ export function trapDeclRootOf(L, decl) {
|
|
|
483
491
|
* taggedTemplatesWithTypeArguments1 shape, where the decline pushed the
|
|
484
492
|
* initializer into an ordinary lowering that fences). ambientUndefVarRootOf
|
|
485
493
|
* carries its own collect-guard, so the extra question stays a probe. */
|
|
486
|
-
function bindingEverWritten(
|
|
494
|
+
function bindingEverWritten(lowerer, sym, sf) {
|
|
487
495
|
const symText = sym.name;
|
|
488
|
-
const namesSym = (e) => ts.isIdentifier(e) && e.text === symText &&
|
|
496
|
+
const namesSym = (e) => ts.isIdentifier(e) && e.text === symText && lowerer.checker.getSymbolAtLocation(e) === sym;
|
|
489
497
|
const patternWrites = (target) => {
|
|
490
498
|
if (namesSym(target))
|
|
491
499
|
return true;
|
|
@@ -519,7 +527,7 @@ function bindingEverWritten(L, sym, sf) {
|
|
|
519
527
|
p = p.parent;
|
|
520
528
|
if (!ts.isExpressionStatement(p))
|
|
521
529
|
return false;
|
|
522
|
-
return ambientUndefVarRootOf(
|
|
530
|
+
return ambientUndefVarRootOf(lowerer, n.right) !== null;
|
|
523
531
|
};
|
|
524
532
|
if (namesSym(lhs)) {
|
|
525
533
|
if (!throwsBeforeTheWrite())
|
|
@@ -556,10 +564,10 @@ function bindingEverWritten(L, sym, sf) {
|
|
|
556
564
|
* type has no mapping (an `any`-typed member off a narrowed ambient), the
|
|
557
565
|
* type the value flows INTO types the throw instead — sound because the
|
|
558
566
|
* read never returns, so the typed dummy is never observed. */
|
|
559
|
-
export function contextualUndefReadType(
|
|
560
|
-
const ctx =
|
|
561
|
-
const mapped = ctx ?
|
|
562
|
-
if (mapped && mapped.kind !== "void" && !
|
|
567
|
+
export function contextualUndefReadType(lowerer, node) {
|
|
568
|
+
const ctx = lowerer.checker.getContextualType(node);
|
|
569
|
+
const mapped = ctx ? lowerer.mapTypeOf(ctx) : null;
|
|
570
|
+
if (mapped && mapped.kind !== "void" && !lowerer.typeNamesUnregisteredClass(mapped))
|
|
563
571
|
return mapped;
|
|
564
572
|
return null;
|
|
565
573
|
}
|
|
@@ -569,12 +577,12 @@ export function contextualUndefReadType(L, node) {
|
|
|
569
577
|
* reads conformance tests are full of), null otherwise (the callers fall
|
|
570
578
|
* through to their ordinary fences). The read always throws, so the typed
|
|
571
579
|
* dummy is never observed. */
|
|
572
|
-
export function ambientUndefReadType(
|
|
573
|
-
const declared =
|
|
580
|
+
export function ambientUndefReadType(lowerer, node) {
|
|
581
|
+
const declared = lowerer.mapTypeOf(lowerer.typeOf(node));
|
|
574
582
|
// A type naming an UNREGISTERED class (an ambient class's instance —
|
|
575
583
|
// nothing collected a shape) would make the emitter name a struct that
|
|
576
584
|
// does not exist; the F64 dummy serves discarded positions instead.
|
|
577
|
-
if (declared && declared.kind !== "void" && !
|
|
585
|
+
if (declared && declared.kind !== "void" && !lowerer.typeNamesUnregisteredClass(declared)) {
|
|
578
586
|
return declared;
|
|
579
587
|
}
|
|
580
588
|
const p = node.parent;
|
|
@@ -592,14 +600,14 @@ export function ambientUndefReadType(L, node) {
|
|
|
592
600
|
* stance. Null for stdlib/@types surfaces (their own chokepoints stand),
|
|
593
601
|
* for overload signatures (an implementation exists), and for anything
|
|
594
602
|
* declared in a .d.ts. */
|
|
595
|
-
export function ambientUndefinedFnSymbolOf(
|
|
596
|
-
const sym =
|
|
603
|
+
export function ambientUndefinedFnSymbolOf(lowerer, ident) {
|
|
604
|
+
const sym = lowerer.resolveValueSymbol(ident);
|
|
597
605
|
if (!sym || !(sym.flags & ts.SymbolFlags.Function))
|
|
598
606
|
return null;
|
|
599
|
-
if (
|
|
607
|
+
if (lowerer.isStdlibSymbol(sym))
|
|
600
608
|
return null;
|
|
601
609
|
let sawFn = false;
|
|
602
|
-
for (const d of
|
|
610
|
+
for (const d of lowerer.checker.declarationsOf(sym)) {
|
|
603
611
|
if (ts.isInterfaceDeclaration(d) || ts.isTypeAliasDeclaration(d))
|
|
604
612
|
continue; // type-world merge partners
|
|
605
613
|
if (ts.isFunctionDeclaration(d)) {
|
|
@@ -620,7 +628,7 @@ export function ambientUndefinedFnSymbolOf(L, ident) {
|
|
|
620
628
|
/** Node's ReferenceError at an ambient namespace access — the undefRead
|
|
621
629
|
* libCall the ambient `declare const` path already uses, typed by the use
|
|
622
630
|
* site (it always throws; the typed dummy is abandoned by the unwind). */
|
|
623
|
-
export function nsUndefRead(
|
|
631
|
+
export function nsUndefRead(lowerer, rootName, node, type) {
|
|
624
632
|
const loc = locOf(node);
|
|
625
633
|
return {
|
|
626
634
|
kind: "libCall",
|
|
@@ -644,9 +652,9 @@ function initExecutingPosition(node) {
|
|
|
644
652
|
}
|
|
645
653
|
return true;
|
|
646
654
|
}
|
|
647
|
-
function earliestSameFileDeclStart(
|
|
655
|
+
function earliestSameFileDeclStart(lowerer, sym, sf) {
|
|
648
656
|
let earliest = Infinity;
|
|
649
|
-
for (const d of
|
|
657
|
+
for (const d of lowerer.checker.declarationsOf(sym)) {
|
|
650
658
|
if (d.getSourceFile() === sf)
|
|
651
659
|
earliest = Math.min(earliest, d.getStart());
|
|
652
660
|
}
|
|
@@ -656,11 +664,11 @@ function earliestSameFileDeclStart(L, sym, sf) {
|
|
|
656
664
|
* use): the alias statement captures its target's CURRENT value, so an
|
|
657
665
|
* init-position use above the alias — or an alias above its target — would
|
|
658
666
|
* observe what Node leaves uninitialized. Fences instead of diverging. */
|
|
659
|
-
export function fenceEarlyAliasUse(
|
|
660
|
-
const sym =
|
|
667
|
+
export function fenceEarlyAliasUse(lowerer, ident, refNode) {
|
|
668
|
+
const sym = lowerer.checker.getSymbolAtLocation(ident);
|
|
661
669
|
if (!sym || !(sym.flags & ts.SymbolFlags.Alias))
|
|
662
670
|
return;
|
|
663
|
-
const aliasDecl =
|
|
671
|
+
const aliasDecl = lowerer.checker.declarationsOf(sym).find(ts.isImportEqualsDeclaration);
|
|
664
672
|
if (!aliasDecl || ts.isExternalModuleReference(aliasDecl.moduleReference))
|
|
665
673
|
return;
|
|
666
674
|
if (!initExecutingPosition(refNode))
|
|
@@ -670,15 +678,15 @@ export function fenceEarlyAliasUse(L, ident, refNode) {
|
|
|
670
678
|
return; // cross-file: module init order applies
|
|
671
679
|
const aliasStart = aliasDecl.getStart();
|
|
672
680
|
if (refNode.getStart() < aliasStart) {
|
|
673
|
-
|
|
681
|
+
lowerer.unsupported("SC1090", refNode, `reading '${ident.text}' above its \`import ${ident.text} = ...\` alias (Node binds the alias at its statement — this read would observe an uninitialized binding; move it below the alias)`);
|
|
674
682
|
}
|
|
675
683
|
// The alias itself must run AFTER its target exists: a namespace target
|
|
676
684
|
// needs a contributing block above the alias, a value target its
|
|
677
685
|
// declaration.
|
|
678
|
-
const target =
|
|
679
|
-
const targetStart = earliestSameFileDeclStart(
|
|
686
|
+
const target = lowerer.checker.getAliasedSymbol(sym);
|
|
687
|
+
const targetStart = earliestSameFileDeclStart(lowerer, target, sf);
|
|
680
688
|
if (targetStart !== Infinity && aliasStart < targetStart) {
|
|
681
|
-
|
|
689
|
+
lowerer.unsupported("SC1090", refNode, `the \`import ${ident.text} = ...\` alias above its target's declaration (Node binds the alias at its statement, when the target is still uninitialized; move the alias below the target)`);
|
|
682
690
|
}
|
|
683
691
|
}
|
|
684
692
|
/** The source-order guard for a qualified namespace-member reference in
|
|
@@ -690,25 +698,25 @@ export function fenceEarlyAliasUse(L, ident, refNode) {
|
|
|
690
698
|
* Function-body references are exempt: they take the module-globals stance
|
|
691
699
|
* the compiler already takes for top-level consts read through early
|
|
692
700
|
* calls. */
|
|
693
|
-
export function fenceEarlyNsMemberRef(
|
|
701
|
+
export function fenceEarlyNsMemberRef(lowerer, access, memberSym) {
|
|
694
702
|
if (!initExecutingPosition(access))
|
|
695
703
|
return;
|
|
696
704
|
const sf = access.getSourceFile();
|
|
697
705
|
const refStart = access.getStart();
|
|
698
|
-
const memberStart = earliestSameFileDeclStart(
|
|
706
|
+
const memberStart = earliestSameFileDeclStart(lowerer, memberSym, sf);
|
|
699
707
|
if (memberStart !== Infinity && refStart < memberStart) {
|
|
700
|
-
|
|
708
|
+
lowerer.unsupported("SC1090", access, `reading namespace member '${access.name.text}' above its declaration (Node evaluates namespace bodies in source order — this read would observe an uninitialized binding; move it below the declaring block)`);
|
|
701
709
|
}
|
|
702
710
|
// Alias segments in the qualifier chain (`C.a.Origin` where `a` is
|
|
703
711
|
// `import a = A`): each captures its target at ITS statement.
|
|
704
712
|
for (let e = access.expression;;) {
|
|
705
713
|
if (ts.isPropertyAccessExpression(e) && ts.isIdentifier(e.name)) {
|
|
706
|
-
fenceEarlyAliasUse(
|
|
714
|
+
fenceEarlyAliasUse(lowerer, e.name, access);
|
|
707
715
|
e = e.expression;
|
|
708
716
|
continue;
|
|
709
717
|
}
|
|
710
718
|
if (ts.isIdentifier(e))
|
|
711
|
-
fenceEarlyAliasUse(
|
|
719
|
+
fenceEarlyAliasUse(lowerer, e, access);
|
|
712
720
|
break;
|
|
713
721
|
}
|
|
714
722
|
}
|
|
@@ -726,8 +734,8 @@ export function fenceEarlyNsMemberRef(L, access, memberSym) {
|
|
|
726
734
|
* machinery carries its own guards. Called from resolveValueSymbol with
|
|
727
735
|
* the PRE-alias symbol; property NAMES (qualified reads — runtime
|
|
728
736
|
* property lookups, always fine) never reach it. */
|
|
729
|
-
export function fenceCrossBlockNsRef(
|
|
730
|
-
if (
|
|
737
|
+
export function fenceCrossBlockNsRef(lowerer, ident, symbol) {
|
|
738
|
+
if (lowerer.nsBlocks.size === 0 || lowerer.collecting)
|
|
731
739
|
return;
|
|
732
740
|
if (symbol.flags & ts.SymbolFlags.Alias)
|
|
733
741
|
return;
|
|
@@ -737,12 +745,12 @@ export function fenceCrossBlockNsRef(L, ident, symbol) {
|
|
|
737
745
|
// The registered blocks enclosing the REFERENCE, innermost first.
|
|
738
746
|
const refBlocks = [];
|
|
739
747
|
for (let q = ident.parent; q !== undefined && !ts.isSourceFile(q); q = q.parent) {
|
|
740
|
-
if (
|
|
748
|
+
if (lowerer.nsBlocks.has(q))
|
|
741
749
|
refBlocks.push(q);
|
|
742
750
|
}
|
|
743
|
-
for (const d of
|
|
751
|
+
for (const d of lowerer.checker.declarationsOf(symbol)) {
|
|
744
752
|
for (let q = d.parent; q !== undefined && !ts.isSourceFile(q); q = q.parent) {
|
|
745
|
-
if (!
|
|
753
|
+
if (!lowerer.nsBlocks.has(q))
|
|
746
754
|
continue;
|
|
747
755
|
// Declared in a registered block: fine when that block encloses the
|
|
748
756
|
// reference too (same block, or an enclosing namespace's block).
|
|
@@ -752,7 +760,7 @@ export function fenceCrossBlockNsRef(L, ident, symbol) {
|
|
|
752
760
|
const m = q.parent;
|
|
753
761
|
return m !== undefined && ts.isModuleDeclaration(m) && ts.isIdentifier(m.name) ? m.name.text : "N";
|
|
754
762
|
})();
|
|
755
|
-
|
|
763
|
+
lowerer.unsupported("SC1090", ident, `the bare reference to '${ident.text}' from a different block of the merged namespace (Node's TypeScript transform does not bind exported members across namespace blocks — it throws ReferenceError where tsc's emit would qualify; write ${nsName}.${ident.text})`);
|
|
756
764
|
}
|
|
757
765
|
}
|
|
758
766
|
}
|
|
@@ -762,17 +770,17 @@ export function fenceCrossBlockNsRef(L, ident, symbol) {
|
|
|
762
770
|
* to consts/functions/classes through the qualifier). Null when `access`
|
|
763
771
|
* is not a lowered-namespace member at all; a member whose declaration
|
|
764
772
|
* never registered storage takes the blocked-binding cascade. */
|
|
765
|
-
export function nsWritableTarget(
|
|
766
|
-
const nsMember = nsMemberIdentOf(
|
|
773
|
+
export function nsWritableTarget(lowerer, access) {
|
|
774
|
+
const nsMember = nsMemberIdentOf(lowerer, access);
|
|
767
775
|
if (!nsMember)
|
|
768
776
|
return null;
|
|
769
|
-
const memberSym =
|
|
777
|
+
const memberSym = lowerer.checker.getSymbolAtLocation(nsMember);
|
|
770
778
|
if (memberSym)
|
|
771
|
-
fenceEarlyNsMemberRef(
|
|
772
|
-
const resolved =
|
|
773
|
-
const g = resolved ?
|
|
779
|
+
fenceEarlyNsMemberRef(lowerer, access, memberSym);
|
|
780
|
+
const resolved = lowerer.resolveValueSymbol(nsMember);
|
|
781
|
+
const g = resolved ? lowerer.globalsBySymbol.get(resolved) : undefined;
|
|
774
782
|
if (!g) {
|
|
775
|
-
|
|
783
|
+
lowerer.rejectUnresolved(nsMember, `assignment to namespace member '${nsMember.text}' (not a writable module global)`);
|
|
776
784
|
}
|
|
777
785
|
return { id: g.id, type: g.type };
|
|
778
786
|
}
|
|
@@ -786,19 +794,19 @@ export function nsWritableTarget(L, access) {
|
|
|
786
794
|
* collection registered the alias its own const global (keyed by the
|
|
787
795
|
* pre-alias symbol — resolveValueSymbol stops there) and this statement
|
|
788
796
|
* assigns it from the target's storage, exactly when Node does. */
|
|
789
|
-
export function lowerImportEquals(
|
|
797
|
+
export function lowerImportEquals(lowerer, stmt) {
|
|
790
798
|
if (stmt.isTypeOnly)
|
|
791
799
|
return null;
|
|
792
800
|
if (ts.isExternalModuleReference(stmt.moduleReference)) {
|
|
793
|
-
|
|
801
|
+
lowerer.unsupported("SC1013", stmt, "import = require(...) assignments");
|
|
794
802
|
}
|
|
795
803
|
// A BARE-identifier entity target (`import g = f` inside a block):
|
|
796
804
|
// Node emits `var g = f` — the same cross-block bare-reference hole as
|
|
797
805
|
// any other bare use; the shared fence applies at the alias statement.
|
|
798
806
|
if (ts.isIdentifier(stmt.moduleReference)) {
|
|
799
|
-
const refSym =
|
|
807
|
+
const refSym = lowerer.checker.getSymbolAtLocation(stmt.moduleReference);
|
|
800
808
|
if (refSym)
|
|
801
|
-
fenceCrossBlockNsRef(
|
|
809
|
+
fenceCrossBlockNsRef(lowerer, stmt.moduleReference, refSym);
|
|
802
810
|
}
|
|
803
811
|
// Node's transform ALWAYS emits `var x = <entity>` — it never elides
|
|
804
812
|
// type-only aliases the way tsc's emit does — so an alias whose entity
|
|
@@ -811,32 +819,32 @@ export function lowerImportEquals(L, stmt) {
|
|
|
811
819
|
while (ts.isQualifiedName(root))
|
|
812
820
|
root = root.left;
|
|
813
821
|
if (ts.isIdentifier(root)) {
|
|
814
|
-
let rootSym =
|
|
822
|
+
let rootSym = lowerer.checker.getSymbolAtLocation(root);
|
|
815
823
|
if (rootSym && rootSym.flags & ts.SymbolFlags.Alias) {
|
|
816
|
-
rootSym =
|
|
824
|
+
rootSym = lowerer.checker.getAliasedSymbol(rootSym);
|
|
817
825
|
}
|
|
818
|
-
const kind = rootSym ? nsSymbolRuntimeKind(
|
|
826
|
+
const kind = rootSym ? nsSymbolRuntimeKind(lowerer, rootSym) : null;
|
|
819
827
|
if (kind === "typeOnly" || kind === "ambient") {
|
|
820
828
|
const loc = locOf(stmt);
|
|
821
829
|
return {
|
|
822
830
|
kind: "exprStmt",
|
|
823
|
-
expr: nsUndefRead(
|
|
831
|
+
expr: nsUndefRead(lowerer, root.text, stmt, F64),
|
|
824
832
|
loc,
|
|
825
833
|
};
|
|
826
834
|
}
|
|
827
835
|
}
|
|
828
836
|
}
|
|
829
|
-
const nameSym =
|
|
830
|
-
const aliasG = nameSym ?
|
|
837
|
+
const nameSym = lowerer.checker.getSymbolAtLocation(stmt.name);
|
|
838
|
+
const aliasG = nameSym ? lowerer.globalsBySymbol.get(nameSym) : undefined;
|
|
831
839
|
if (nameSym && aliasG) {
|
|
832
840
|
// The snapshot assignment. The target is a mutable binding with its
|
|
833
841
|
// own module global (a namespace `export var` member, a top-level
|
|
834
842
|
// var reached through an alias chain); a target whose declaration
|
|
835
843
|
// never registered storage takes the blocked-binding cascade.
|
|
836
|
-
const target =
|
|
837
|
-
const targetG =
|
|
844
|
+
const target = lowerer.checker.getAliasedSymbol(nameSym);
|
|
845
|
+
const targetG = lowerer.globalsBySymbol.get(target);
|
|
838
846
|
if (!targetG) {
|
|
839
|
-
|
|
847
|
+
lowerer.rejectUnresolvedSymbol(target, stmt.name.text, stmt.name, `the alias target of '${stmt.name.text}' (no lowered storage)`);
|
|
840
848
|
}
|
|
841
849
|
const loc = locOf(stmt);
|
|
842
850
|
return {
|
|
@@ -854,30 +862,30 @@ export function lowerImportEquals(L, stmt) {
|
|
|
854
862
|
* ReferenceError instead when the use site's type maps (the object never
|
|
855
863
|
* exists at runtime). Returns null when `ident` is not a namespace
|
|
856
864
|
* reference at all. */
|
|
857
|
-
export function lowerNsIdentifierValue(
|
|
858
|
-
const sym =
|
|
865
|
+
export function lowerNsIdentifierValue(lowerer, ident) {
|
|
866
|
+
const sym = lowerer.resolveValueSymbol(ident);
|
|
859
867
|
if (!sym || !(sym.flags & (ts.SymbolFlags.ValueModule | ts.SymbolFlags.NamespaceModule))) {
|
|
860
868
|
return null;
|
|
861
869
|
}
|
|
862
870
|
if (sym.flags & (ts.SymbolFlags.Class | ts.SymbolFlags.Function | ts.SymbolFlags.RegularEnum | ts.SymbolFlags.ConstEnum | ts.SymbolFlags.Variable)) {
|
|
863
871
|
return null; // merged with a value declaration — its own paths and fences apply
|
|
864
872
|
}
|
|
865
|
-
const ambientRoot = ambientNsRootOf(
|
|
873
|
+
const ambientRoot = ambientNsRootOf(lowerer, ident);
|
|
866
874
|
if (ambientRoot !== null) {
|
|
867
|
-
const t = ambientUndefReadType(
|
|
875
|
+
const t = ambientUndefReadType(lowerer, ident);
|
|
868
876
|
if (t)
|
|
869
|
-
return nsUndefRead(
|
|
877
|
+
return nsUndefRead(lowerer, ambientRoot.text, ident, t);
|
|
870
878
|
}
|
|
871
|
-
if (
|
|
879
|
+
if (lowerer.isStdlibSymbol(sym))
|
|
872
880
|
return null; // stdlib namespaces keep their chokepoints
|
|
873
881
|
// A MODULE namespace object as a first-class value (`import * as ns`
|
|
874
882
|
// passed/stored/iterated): member accesses resolve statically, but the
|
|
875
883
|
// object itself has no runtime representation — Node's frozen,
|
|
876
884
|
// alphabetically-keyed namespace object is not materialized. Named
|
|
877
885
|
// residual of the SC1013 lowering.
|
|
878
|
-
if (moduleNsSourceFileOf(
|
|
879
|
-
|
|
886
|
+
if (moduleNsSourceFileOf(lowerer, ident) !== null) {
|
|
887
|
+
lowerer.unsupported("SC1013", ident, `module namespace objects as first-class values (access '${ident.text}' members directly: ${ident.text}.<member>)`);
|
|
880
888
|
}
|
|
881
|
-
|
|
889
|
+
lowerer.unsupported("SC1090", ident, `namespace objects as first-class values (access '${ident.text}' members directly: ${ident.text}.<member>)`);
|
|
882
890
|
}
|
|
883
891
|
//# sourceMappingURL=lower-namespaces.js.map
|