@scriptc/compiler 0.0.36 → 0.1.2
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 +52 -22
- package/ambient/scriptc-overrides.d.ts +0 -7
- package/ambient/scriptc.d.ts +3 -2
- package/dist/backend/build-cache.js.map +1 -1
- package/dist/backend/c/async.js +24 -2
- package/dist/backend/c/async.js.map +1 -1
- package/dist/backend/c/c-emitter.d.ts +22 -10
- package/dist/backend/c/c-emitter.js +60 -15
- package/dist/backend/c/c-emitter.js.map +1 -1
- package/dist/backend/c/exprs.js +289 -55
- package/dist/backend/c/exprs.js.map +1 -1
- package/dist/backend/c/island.js.map +1 -1
- package/dist/backend/c/may-throw.js +3 -0
- package/dist/backend/c/may-throw.js.map +1 -1
- package/dist/backend/c/stmts.d.ts +3 -5
- package/dist/backend/c/stmts.js +76 -17
- package/dist/backend/c/stmts.js.map +1 -1
- package/dist/backend/c/types.js.map +1 -1
- package/dist/backend/c/walkers.js +36 -12
- package/dist/backend/c/walkers.js.map +1 -1
- 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/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.js.map +1 -1
- package/dist/backend/llvm/dyn.js +63 -3
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.js +132 -26
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +85 -3
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +68 -54
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +2 -1
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.js +2 -0
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +6 -3
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-island.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.d.ts +1 -1
- package/dist/backend/llvm/expr-primitives.js +20 -0
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +245 -10
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +2 -0
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +18 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +6 -3
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/split.js.map +1 -1
- package/dist/backend/llvm/unsupported.js.map +1 -1
- package/dist/backend/llvm/walkers.js +31 -4
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +8 -1
- package/dist/backend/native-codegen.js +39 -25
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +44 -4
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info.d.ts +1 -1
- package/dist/backend/native-link-info.js +42 -18
- package/dist/backend/native-link-info.js.map +1 -1
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +5 -1
- package/dist/backend/native-toolchain.test.js.map +1 -1
- 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 +5 -30
- package/dist/backend/runtime-pack.js +46 -141
- package/dist/backend/runtime-pack.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +49 -14
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/targets.d.ts +63 -17
- package/dist/backend/targets.js +251 -35
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +27 -5
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/compat/fetch-profile.js +4 -2
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +22 -1
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +6 -5
- package/dist/diagnostics/diagnostic.js +7 -6
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/render.js.map +1 -1
- package/dist/ffi/ffi-manifest.js.map +1 -1
- package/dist/frontend/cjs-lexer.js.map +1 -1
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/input-tracker.d.ts +10 -0
- package/dist/frontend/input-tracker.js +26 -3
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +8 -1
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lib-contract.js.map +1 -1
- package/dist/frontend/lowering/array-values.d.ts +12 -0
- package/dist/frontend/lowering/array-values.js +76 -0
- package/dist/frontend/lowering/array-values.js.map +1 -0
- package/dist/frontend/lowering/callback-arg.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.d.ts +35 -0
- package/dist/frontend/lowering/containers/bytes.js +1021 -0
- package/dist/frontend/lowering/containers/bytes.js.map +1 -0
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +17 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js +345 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -0
- package/dist/frontend/lowering/expressions/evaluation-safety.d.ts +13 -0
- package/dist/frontend/lowering/expressions/evaluation-safety.js +76 -0
- package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -0
- package/dist/frontend/lowering/expressions/object-literals.d.ts +44 -0
- package/dist/frontend/lowering/expressions/object-literals.js +1815 -0
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -0
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +31 -0
- package/dist/frontend/lowering/expressions/optional-chains.js +382 -0
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -0
- package/dist/frontend/lowering/expressions/try-lower-expression.d.ts +7 -0
- package/dist/frontend/lowering/expressions/try-lower-expression.js +26 -0
- package/dist/frontend/lowering/expressions/try-lower-expression.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.js +7 -2
- 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.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.d.ts +7 -0
- package/dist/frontend/lowering/lower-async-iteration.js +657 -0
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.d.ts +18 -0
- package/dist/frontend/lowering/lower-builtins.js +379 -48
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +16 -8
- package/dist/frontend/lowering/lower-calls.js +667 -91
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +7 -13
- package/dist/frontend/lowering/lower-classes.js +128 -35
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +1 -47
- package/dist/frontend/lowering/lower-containers.js +779 -2038
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +51 -5
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +4 -78
- package/dist/frontend/lowering/lower-exprs.js +1128 -2409
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.d.ts +18 -3
- package/dist/frontend/lowering/lower-generators.js +145 -9
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +50 -36
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +11 -4
- package/dist/frontend/lowering/lower-island.js +47 -10
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +52 -15
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-node-module.d.ts +18 -0
- package/dist/frontend/lowering/lower-node-module.js +302 -0
- package/dist/frontend/lowering/lower-node-module.js.map +1 -0
- package/dist/frontend/lowering/lower-server.js +11 -1
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +5 -24
- package/dist/frontend/lowering/lower-stmts.js +811 -314
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +4 -4
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +109 -34
- package/dist/frontend/lowering/lowerer.js +1225 -62
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/optional-arguments.d.ts +9 -0
- package/dist/frontend/lowering/optional-arguments.js +57 -0
- package/dist/frontend/lowering/optional-arguments.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +10 -2
- package/dist/frontend/lowering/surfaces.js +15 -3
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/npm-static-declarations.d.ts +35 -0
- package/dist/frontend/npm-static-declarations.js +506 -0
- package/dist/frontend/npm-static-declarations.js.map +1 -0
- package/dist/frontend/npm-static-declarations.test.d.ts +1 -0
- package/dist/frontend/npm-static-declarations.test.js +122 -0
- package/dist/frontend/npm-static-declarations.test.js.map +1 -0
- package/dist/frontend/npm-static.d.ts +2 -0
- package/dist/frontend/npm-static.js +26 -10
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +60 -0
- package/dist/frontend/npm.js +38 -4
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.d.ts +1 -0
- package/dist/frontend/npm.test.js +50 -0
- package/dist/frontend/npm.test.js.map +1 -0
- package/dist/frontend/program.d.ts +3 -2
- package/dist/frontend/program.js +495 -68
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.d.ts +10 -2
- package/dist/frontend/resolve.js +90 -14
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/resolve.test.js +4 -1
- package/dist/frontend/resolve.test.js.map +1 -1
- package/dist/frontend/runtime-resolve.d.ts +22 -0
- package/dist/frontend/runtime-resolve.js +101 -0
- package/dist/frontend/runtime-resolve.js.map +1 -0
- package/dist/frontend/runtime-resolve.test.d.ts +1 -0
- package/dist/frontend/runtime-resolve.test.js +18 -0
- package/dist/frontend/runtime-resolve.test.js.map +1 -0
- package/dist/frontend/ts7/adapter.js +12 -13
- package/dist/frontend/ts7/adapter.js.map +1 -1
- package/dist/frontend/ts7/ast.js.map +1 -1
- package/dist/frontend/ts7/census-check.js +3 -3
- package/dist/frontend/ts7/census-check.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +3 -0
- package/dist/frontend/ts7/checker.js +12 -3
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/enums.js.map +1 -1
- package/dist/frontend/ts7/program-adapter.js +42 -3
- package/dist/frontend/ts7/program-adapter.js.map +1 -1
- package/dist/frontend/type-mapper.js +120 -7
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +50 -28
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/ir.d.ts +125 -41
- package/dist/ir/ir.js +82 -31
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +1 -1
- package/dist/ir/validate.js +127 -95
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/cache-primitives.js.map +1 -1
- package/dist/library/cache-reset.test.js.map +1 -1
- package/dist/library/compiler-self-identity.js.map +1 -1
- package/dist/library/fence-eval.js +3 -1
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/int-infer.js +12 -1
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/int-infer.test.js.map +1 -1
- package/dist/library/library-cache.test.js +5 -5
- package/dist/library/library-profile.js.map +1 -1
- package/dist/library/sidecar-validate.js.map +1 -1
- package/dist/library/sidecar.js.map +1 -1
- package/dist/startup-cache.d.ts +9 -1
- package/dist/startup-cache.js +16 -1
- package/dist/startup-cache.js.map +1 -1
- package/dist/wasi-paths.js.map +1 -1
- package/package.json +18 -5
- package/surface-manifest.json +64 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lower-async-iteration.js","sourceRoot":"","sources":["../../../src/frontend/lowering/lower-async-iteration.ts"],"names":[],"mappings":"AAAA;;;;sCAIsC;AACtC,OAAO,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,IAAI,EAAE,GAAG,EAA0B,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D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AAE,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE;gBACtG,OAAO;aACR;YACD,GAAG;SACJ,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACvB,CAAC;AACH,CAAC;AAED;;sCAEsC;AACtC,MAAM,UAAU,oBAAoB,CAClC,OAAgB,EAChB,IAAuB;IAEvB,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACxD,IAAI,IAAI;QAAE,OAAO,iBAAiB,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACtD,IAAI,GAAG;QAAE,OAAO,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACvE,IAAI,aAAa;QAAE,OAAO,uBAAuB,CAAC,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;IAChF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -2,6 +2,15 @@ import * as ts from "../ts7/adapter.js";
|
|
|
2
2
|
import type { Lowerer } from "./lowerer.js";
|
|
3
3
|
import { BuiltinModuleFn } from "./surfaces.js";
|
|
4
4
|
import { IrExpr, IrType, SrcLoc } from "../../ir/ir.js";
|
|
5
|
+
/** timers/promises.setInterval(delay, value), the first Node API built on
|
|
6
|
+
* the generic async-generator protocol. The supported form has an explicit
|
|
7
|
+
* value and no AbortSignal options. It lowers to a generated typed async
|
|
8
|
+
* generator whose loop awaits the existing promise timeout then yields the
|
|
9
|
+
* retained value; creating the iterator remains lazy. */
|
|
10
|
+
export declare function lowerTimersPromisesSetInterval(lowerer: Lowerer, expr: ts.CallExpression, bi: {
|
|
11
|
+
module: string;
|
|
12
|
+
member: string;
|
|
13
|
+
}, loc: SrcLoc): IrExpr | null;
|
|
5
14
|
/** Resolves an identifier to a supported builtin-module IMPORT BINDING:
|
|
6
15
|
* a named import (through its alias, so `import { join as j }` matches)
|
|
7
16
|
* whose declaration is an ImportSpecifier under a supported builtin
|
|
@@ -83,6 +92,15 @@ export declare function createRequireNamespaceDecl(lowerer: Lowerer, nameNode: t
|
|
|
83
92
|
* embedded it) and reports the requires-dynamic diagnostic in a static
|
|
84
93
|
* build. Null when the callee is not a createRequire require. */
|
|
85
94
|
export declare function lowerCreateRequireCall(lowerer: Lowerer, call: ts.CallExpression, loc: SrcLoc): IrExpr | null;
|
|
95
|
+
/** import.meta.resolve("literal") folds through the runtime-module
|
|
96
|
+
* resolver, never TypeScript's declaration-file resolver. Relative and
|
|
97
|
+
* URL-like names remain valid even when no file exists; bare packages use
|
|
98
|
+
* Node's import-condition exports path. */
|
|
99
|
+
export declare function lowerImportMetaResolveCall(lowerer: Lowerer, call: ts.CallExpression): IrExpr | null;
|
|
100
|
+
/** CommonJS require.resolve and require.resolve.paths for the ambient
|
|
101
|
+
* wrapper or a supported createRequire binding. Results are build-time
|
|
102
|
+
* constants; failures lower to Node's catchable error object. */
|
|
103
|
+
export declare function lowerRequireResolveCall(lowerer: Lowerer, call: ts.CallExpression): IrExpr | null;
|
|
86
104
|
/** `constants.NGHTTP2_CANCEL` / `constants.SSL_OP_NO_TICKET` (any baked-
|
|
87
105
|
* constants spelling) → the literal; unknown members fence by name.
|
|
88
106
|
* Null when the receiver is not a baked constants object (the property
|
|
@@ -7,64 +7,166 @@ import { builtinModules } from "node:module";
|
|
|
7
7
|
import { dirname, resolve } from "node:path";
|
|
8
8
|
import * as ts from "../ts7/adapter.js";
|
|
9
9
|
import { PoisonError, dynUndefinedExpr, ladderFenceExpr, nodeThrowExpr, own } from "./lowerer.js";
|
|
10
|
-
import { canonicalBuiltinModule, isJsSourceFile, locOf, requireSpecOf } from "../program.js";
|
|
10
|
+
import { canonicalBuiltinModule, isJsSourceFile, isNodeEsmFile, locOf, requireSpecOf } from "../program.js";
|
|
11
11
|
import { isRelativeSpecifier } from "../workspace-registry.js";
|
|
12
12
|
import { probeNodeRequireRefusal } from "../npm.js";
|
|
13
13
|
import { isNpmStaticPackage } from "../npm-static.js";
|
|
14
14
|
import { trackedReadFile } from "../input-tracker.js";
|
|
15
|
+
import { requireResolvePathsRuntime, resolveImportMetaRuntime, resolveRequireRuntime } from "../runtime-resolve.js";
|
|
15
16
|
import { invalidJsonModuleDiag, requiresDynamicImportDiag } from "../../diagnostics/diagnostic.js";
|
|
16
17
|
import { builtinModuleFnOf, FS_READDIR_DOCUMENTED_OPTIONS, FS_WATCH_DOCUMENTED_OPTIONS, FS_WRITE_FILE_DOCUMENTED_OPTIONS, QS_PARSE_DOCUMENTED_OPTIONS, QS_STRINGIFY_DOCUMENTED_OPTIONS, READLINE_DOCUMENTED_OPTIONS, builtinConstLit, fenceOrDropOptionKey, isChildSurfaceMember, } from "./surfaces.js";
|
|
17
|
-
import {
|
|
18
|
+
import { lowerAbsenceProbe } from "./lower-exprs.js";
|
|
19
|
+
import { conditionalSpreadOf, lowerDynObjectLiteral } from "./expressions/object-literals.js";
|
|
20
|
+
import { isSafeToDiscard } from "./expressions/evaluation-safety.js";
|
|
21
|
+
import { defaultAfterUndefined, lowerStaticallyUndefinedArgument } from "./optional-arguments.js";
|
|
18
22
|
import { HTTP2_CONSTANTS } from "./http2-constants.js";
|
|
19
23
|
import { CRYPTO_CIPHERS, CRYPTO_CONSTANTS, CRYPTO_CURVES, CRYPTO_HASHES } from "./crypto-tables.js";
|
|
20
|
-
import { timerStyleCallback } from "./lower-calls.js";
|
|
24
|
+
import { generatorMeta, timerStyleCallback } from "./lower-calls.js";
|
|
21
25
|
import { registerHttpClientFnBinding, voidizedCallback } from "./lower-server.js";
|
|
22
26
|
import { pairsSnapshotHelper } from "./pairs-snapshot.js";
|
|
23
27
|
import { BOOL, BYTES_U8, CHILD_T, CHILDSTREAM_T, DYN, F64, FILEHANDLE_T, FSWATCHER_T, PROCSTREAM_T, JSVAL, NULL_T, SEARCH_PARAMS_T, SPAWNRES_T, STRING, UNDEFINED_T, VOID, arrayOf, canBoxFuncIntoDyn, canConvertToDyn, funcOf, isUnitType, typeEquals, typeKey } from "../../ir/ir.js";
|
|
24
28
|
import { boolLit, countedFor, numLit, strLit, varRef } from "../../ir/build.js";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
ts.isSatisfiesExpression(expr)) {
|
|
35
|
-
expr = expr.expression;
|
|
36
|
-
}
|
|
37
|
-
return expr;
|
|
38
|
-
};
|
|
39
|
-
let expr = node;
|
|
40
|
-
while (ts.isParenthesizedExpression(expr))
|
|
41
|
-
expr = expr.expression;
|
|
42
|
-
if ((lowerer.typeOf(expr).flags & (ts.TypeFlags.Undefined | ts.TypeFlags.Void)) === 0)
|
|
43
|
-
return null;
|
|
44
|
-
expr = peel(expr);
|
|
45
|
-
let sawVoid = false;
|
|
46
|
-
while (ts.isVoidExpression(expr)) {
|
|
47
|
-
sawVoid = true;
|
|
48
|
-
expr = peel(expr.expression);
|
|
49
|
-
}
|
|
50
|
-
return lowerer.lowerExpr(sawVoid ? expr : node);
|
|
29
|
+
function optionalStringTags(lowerer, type) {
|
|
30
|
+
if (type.kind !== "union")
|
|
31
|
+
return null;
|
|
32
|
+
const def = lowerer.unions.get(type.unionId);
|
|
33
|
+
if (!def || def.arms.length !== 2)
|
|
34
|
+
return null;
|
|
35
|
+
const stringTag = lowerer.armTag(type.unionId, STRING);
|
|
36
|
+
const undefinedTag = lowerer.armTag(type.unionId, UNDEFINED_T);
|
|
37
|
+
return stringTag >= 0 && undefinedTag >= 0 ? { stringTag, undefinedTag } : null;
|
|
51
38
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
39
|
+
/** timers/promises.setInterval(delay, value), the first Node API built on
|
|
40
|
+
* the generic async-generator protocol. The supported form has an explicit
|
|
41
|
+
* value and no AbortSignal options. It lowers to a generated typed async
|
|
42
|
+
* generator whose loop awaits the existing promise timeout then yields the
|
|
43
|
+
* retained value; creating the iterator remains lazy. */
|
|
44
|
+
export function lowerTimersPromisesSetInterval(lowerer, expr, bi, loc) {
|
|
45
|
+
if (bi.module !== "timers/promises" || bi.member !== "setInterval")
|
|
46
|
+
return null;
|
|
47
|
+
if (expr.arguments.some(ts.isSpreadElement)) {
|
|
48
|
+
lowerer.unsupported("SC1090", expr, "spread arguments");
|
|
49
|
+
}
|
|
50
|
+
if (expr.arguments.length !== 2) {
|
|
51
|
+
lowerer.noLowering(`timers/promises.setInterval with ${expr.arguments.length} arguments`, expr, "the lowered form is setInterval(delay, value) with an explicit yielded value; AbortSignal options are not supported yet");
|
|
52
|
+
}
|
|
53
|
+
const delayNode = expr.arguments[0];
|
|
54
|
+
const valueNode = expr.arguments[1];
|
|
55
|
+
const delay = lowerer.lowerExpr(delayNode);
|
|
56
|
+
const ms = delay.kind === "unitLit"
|
|
57
|
+
? { kind: "numLit", value: 1, type: F64, loc }
|
|
58
|
+
: lowerer.coerceInto(delayNode, delay, F64);
|
|
59
|
+
const value = lowerer.lowerExpr(valueNode);
|
|
60
|
+
const callType = lowerer.mapTypeOf(lowerer.typeOf(expr));
|
|
61
|
+
if (callType?.kind !== "generator" || !callType.async) {
|
|
62
|
+
lowerer.badType(expr, lowerer.typeOf(expr));
|
|
63
|
+
}
|
|
64
|
+
const genT = callType;
|
|
65
|
+
const yielded = lowerer.coerceInto(valueNode, value, genT.yieldT);
|
|
66
|
+
const fnName = `%fn${lowerer.lambdaCounter++}_tpInterval`;
|
|
67
|
+
const msParam = { id: "%tp.ms", name: "delay", type: F64, mutable: false };
|
|
68
|
+
const valueParam = { id: "%tp.value", name: "value", type: genT.yieldT, mutable: false };
|
|
69
|
+
const promiseVoid = { kind: "promise", inner: VOID };
|
|
70
|
+
const msRef = () => ({ kind: "varRef", localId: msParam.id, type: F64, loc });
|
|
71
|
+
const valueRef = () => ({ kind: "varRef", localId: valueParam.id, type: genT.yieldT, loc });
|
|
72
|
+
const fn = {
|
|
73
|
+
name: fnName,
|
|
74
|
+
params: [
|
|
75
|
+
{ localId: msParam.id, name: msParam.name, type: msParam.type },
|
|
76
|
+
{ localId: valueParam.id, name: valueParam.name, type: valueParam.type },
|
|
77
|
+
],
|
|
78
|
+
returnType: VOID,
|
|
79
|
+
locals: [msParam, valueParam],
|
|
80
|
+
async: true,
|
|
81
|
+
generator: generatorMeta(lowerer, genT),
|
|
82
|
+
body: [
|
|
83
|
+
{
|
|
84
|
+
kind: "while",
|
|
85
|
+
cond: { kind: "boolLit", value: true, type: BOOL, loc },
|
|
86
|
+
body: [
|
|
87
|
+
{
|
|
88
|
+
kind: "exprStmt",
|
|
89
|
+
expr: {
|
|
90
|
+
kind: "awaitExpr",
|
|
91
|
+
value: { kind: "libCall", fn: "tp.setTimeout", args: [msRef()], type: promiseVoid, loc },
|
|
92
|
+
type: VOID,
|
|
93
|
+
loc,
|
|
94
|
+
},
|
|
95
|
+
loc,
|
|
96
|
+
},
|
|
97
|
+
{ kind: "exprStmt", expr: { kind: "yieldExpr", value: valueRef(), type: VOID, loc }, loc },
|
|
98
|
+
],
|
|
99
|
+
loc,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
loc,
|
|
61
103
|
};
|
|
104
|
+
lowerer.liftedFns.push(fn);
|
|
105
|
+
return { kind: "call", callee: fnName, args: [ms, yielded], type: genT, loc };
|
|
106
|
+
}
|
|
107
|
+
function lowerBuiltinValuePreservingUndefined(lowerer, node) {
|
|
108
|
+
return lowerer.runtimeOptionalIdentifierValue(node)?.value ??
|
|
109
|
+
lowerAbsenceProbe(lowerer, node) ??
|
|
110
|
+
lowerer.lowerExpr(node);
|
|
111
|
+
}
|
|
112
|
+
function checkedOptionalBuiltinArm(lowerer, value, target) {
|
|
113
|
+
const widened = lowerer.runtimeOptionalWidening(value.type, target);
|
|
114
|
+
if (!widened || widened.kind !== "union")
|
|
115
|
+
return null;
|
|
116
|
+
const helper = lowerer.narrowedArmHelper(widened.unionId, target, value.loc);
|
|
117
|
+
return helper
|
|
118
|
+
? { kind: "call", callee: helper, args: [value], type: target, loc: value.loc }
|
|
119
|
+
: null;
|
|
120
|
+
}
|
|
121
|
+
function lowerOptionalNumberPredicate(lowerer, value, fn, loc) {
|
|
122
|
+
const widened = lowerer.runtimeOptionalWidening(value.type, F64);
|
|
123
|
+
if (!widened || widened.kind !== "union")
|
|
124
|
+
return null;
|
|
125
|
+
const numberTag = lowerer.armTag(widened.unionId, F64);
|
|
126
|
+
const undefinedTag = lowerer.armTag(widened.unionId, UNDEFINED_T);
|
|
127
|
+
if (numberTag < 0 || undefinedTag < 0)
|
|
128
|
+
return null;
|
|
129
|
+
const key = `number.optionalPredicate:${fn}:${widened.unionId}`;
|
|
130
|
+
let helper = lowerer.widthHelpers.get(key);
|
|
131
|
+
if (!helper) {
|
|
132
|
+
helper = `%number.optionalPredicate.${lowerer.widthHelpers.size}`;
|
|
133
|
+
lowerer.widthHelpers.set(key, helper);
|
|
134
|
+
const input = varRef("value.0", widened, loc);
|
|
135
|
+
lowerer.liftedFns.push({
|
|
136
|
+
name: helper,
|
|
137
|
+
params: [{ localId: "value.0", name: "value", type: widened }],
|
|
138
|
+
returnType: BOOL,
|
|
139
|
+
locals: [{ id: "value.0", name: "value", type: widened, mutable: false }],
|
|
140
|
+
body: [
|
|
141
|
+
{
|
|
142
|
+
kind: "if",
|
|
143
|
+
cond: { kind: "unionIsTag", unionId: widened.unionId, tag: undefinedTag, negated: false, value: input, type: BOOL, loc },
|
|
144
|
+
then: [{ kind: "return", value: boolLit(false, loc), loc }],
|
|
145
|
+
else_: null,
|
|
146
|
+
loc,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
kind: "return",
|
|
150
|
+
value: {
|
|
151
|
+
kind: "libCall",
|
|
152
|
+
fn,
|
|
153
|
+
args: [{ kind: "unionNarrow", unionId: widened.unionId, tag: numberTag, value: input, type: F64, loc }],
|
|
154
|
+
type: BOOL,
|
|
155
|
+
loc,
|
|
156
|
+
},
|
|
157
|
+
loc,
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
loc,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return { kind: "call", callee: helper, args: [value], type: BOOL, loc };
|
|
62
164
|
}
|
|
63
165
|
/** Complete an optional builtin argument. Statically undefined spellings
|
|
64
166
|
* preserve their effects and select the default; a runtime unit-armed union
|
|
65
167
|
* uses nullish selection when every non-unit arm is the expected type. */
|
|
66
168
|
function lowerBuiltinOptionalDefault(lowerer, node, expected, dflt, nullIsDefault = false) {
|
|
67
|
-
const undefinedArg =
|
|
169
|
+
const undefinedArg = lowerStaticallyUndefinedArgument(lowerer, node);
|
|
68
170
|
if (undefinedArg)
|
|
69
171
|
return defaultAfterUndefined(undefinedArg, dflt);
|
|
70
172
|
if (nullIsDefault && (lowerer.typeOf(node).flags & ts.TypeFlags.Null) !== 0) {
|
|
@@ -434,6 +536,134 @@ export function lowerCreateRequireCall(lowerer, call, loc) {
|
|
|
434
536
|
loc,
|
|
435
537
|
};
|
|
436
538
|
}
|
|
539
|
+
function staticString(node) {
|
|
540
|
+
if (node === undefined)
|
|
541
|
+
return null;
|
|
542
|
+
const value = stripTypeCasts(node);
|
|
543
|
+
return ts.isStringLiteralLike(value) ? value.text : null;
|
|
544
|
+
}
|
|
545
|
+
function runtimeResolveThrow(error, type, loc) {
|
|
546
|
+
return nodeThrowExpr(error.name === "TypeError" ? 1 : 0, error.code, error.message, type, loc);
|
|
547
|
+
}
|
|
548
|
+
/** import.meta.resolve("literal") folds through the runtime-module
|
|
549
|
+
* resolver, never TypeScript's declaration-file resolver. Relative and
|
|
550
|
+
* URL-like names remain valid even when no file exists; bare packages use
|
|
551
|
+
* Node's import-condition exports path. */
|
|
552
|
+
export function lowerImportMetaResolveCall(lowerer, call) {
|
|
553
|
+
const callee = call.expression;
|
|
554
|
+
if (!ts.isPropertyAccessExpression(callee) || callee.questionDotToken !== undefined ||
|
|
555
|
+
callee.name.text !== "resolve" || !ts.isMetaProperty(callee.expression) ||
|
|
556
|
+
callee.expression.keywordToken !== ts.SyntaxKind.ImportKeyword ||
|
|
557
|
+
callee.expression.name.text !== "meta") {
|
|
558
|
+
return null;
|
|
559
|
+
}
|
|
560
|
+
if (call.questionDotToken !== undefined || call.arguments.length !== 1) {
|
|
561
|
+
lowerer.noLowering("import.meta.resolve with this argument shape", call, "the lowered form is import.meta.resolve(\"<static specifier>\") using the containing module as its parent");
|
|
562
|
+
}
|
|
563
|
+
const specifier = staticString(call.arguments[0]);
|
|
564
|
+
if (specifier === null) {
|
|
565
|
+
lowerer.noLowering("import.meta.resolve with a runtime-computed specifier", call.arguments[0], "a compiled binary has a fixed module graph — pass a string literal");
|
|
566
|
+
}
|
|
567
|
+
const result = resolveImportMetaRuntime(call.getSourceFile().fileName, specifier, lowerer.targetPlatform);
|
|
568
|
+
if (result === null) {
|
|
569
|
+
lowerer.noLowering(`import.meta.resolve of '${specifier}'`, call, "relative paths, URL-like names, builtins, and installed package names are supported; package-import aliases remain unsupported");
|
|
570
|
+
}
|
|
571
|
+
const loc = locOf(call);
|
|
572
|
+
return result.ok
|
|
573
|
+
? { kind: "strLit", value: result.value, type: STRING, loc }
|
|
574
|
+
: runtimeResolveThrow(result.error, STRING, loc);
|
|
575
|
+
}
|
|
576
|
+
function requireResolverBaseFile(lowerer, receiver) {
|
|
577
|
+
const created = createRequireCalleeFileOf(lowerer, receiver);
|
|
578
|
+
if (created !== null)
|
|
579
|
+
return created;
|
|
580
|
+
return lowerer.isStdlibGlobal(receiver, "require") && !isNodeEsmFile(receiver.getSourceFile())
|
|
581
|
+
? receiver.getSourceFile()
|
|
582
|
+
: null;
|
|
583
|
+
}
|
|
584
|
+
function staticResolveOptionPaths(node) {
|
|
585
|
+
if (node === undefined)
|
|
586
|
+
return undefined;
|
|
587
|
+
const value = stripTypeCasts(node);
|
|
588
|
+
if (ts.isIdentifier(value) && value.text === "undefined")
|
|
589
|
+
return undefined;
|
|
590
|
+
if (!ts.isObjectLiteralExpression(value))
|
|
591
|
+
return null;
|
|
592
|
+
let paths;
|
|
593
|
+
for (const prop of value.properties) {
|
|
594
|
+
if (!ts.isPropertyAssignment(prop))
|
|
595
|
+
return null;
|
|
596
|
+
const name = ts.isIdentifier(prop.name) || ts.isStringLiteralLike(prop.name) ? prop.name.text : null;
|
|
597
|
+
if (name !== "paths" || paths !== undefined)
|
|
598
|
+
return null;
|
|
599
|
+
const init = stripTypeCasts(prop.initializer);
|
|
600
|
+
if (!ts.isArrayLiteralExpression(init))
|
|
601
|
+
return null;
|
|
602
|
+
const entries = [];
|
|
603
|
+
for (const item of init.elements) {
|
|
604
|
+
if (!ts.isStringLiteralLike(item))
|
|
605
|
+
return null;
|
|
606
|
+
entries.push(item.text);
|
|
607
|
+
}
|
|
608
|
+
paths = entries;
|
|
609
|
+
}
|
|
610
|
+
return paths;
|
|
611
|
+
}
|
|
612
|
+
/** CommonJS require.resolve and require.resolve.paths for the ambient
|
|
613
|
+
* wrapper or a supported createRequire binding. Results are build-time
|
|
614
|
+
* constants; failures lower to Node's catchable error object. */
|
|
615
|
+
export function lowerRequireResolveCall(lowerer, call) {
|
|
616
|
+
const callee = call.expression;
|
|
617
|
+
if (!ts.isPropertyAccessExpression(callee) || callee.questionDotToken !== undefined)
|
|
618
|
+
return null;
|
|
619
|
+
let receiver;
|
|
620
|
+
let pathsCall = false;
|
|
621
|
+
if (callee.name.text === "resolve") {
|
|
622
|
+
receiver = callee.expression;
|
|
623
|
+
}
|
|
624
|
+
else if (callee.name.text === "paths" && ts.isPropertyAccessExpression(callee.expression) &&
|
|
625
|
+
callee.expression.questionDotToken === undefined && callee.expression.name.text === "resolve") {
|
|
626
|
+
receiver = callee.expression.expression;
|
|
627
|
+
pathsCall = true;
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
return null;
|
|
631
|
+
}
|
|
632
|
+
const baseFile = requireResolverBaseFile(lowerer, receiver);
|
|
633
|
+
if (baseFile === null)
|
|
634
|
+
return null;
|
|
635
|
+
if (call.questionDotToken !== undefined || call.arguments.length < 1 || call.arguments.length > (pathsCall ? 1 : 2)) {
|
|
636
|
+
lowerer.noLowering(pathsCall ? "require.resolve.paths with this argument shape" : "require.resolve with this argument shape", call);
|
|
637
|
+
}
|
|
638
|
+
const specifier = staticString(call.arguments[0]);
|
|
639
|
+
if (specifier === null) {
|
|
640
|
+
lowerer.noLowering(`${pathsCall ? "require.resolve.paths" : "require.resolve"} with a runtime-computed request`, call.arguments[0], "a compiled binary has a fixed module graph — pass a string literal");
|
|
641
|
+
}
|
|
642
|
+
const loc = locOf(call);
|
|
643
|
+
if (pathsCall) {
|
|
644
|
+
const result = requireResolvePathsRuntime(baseFile.fileName, specifier, lowerer.targetPlatform);
|
|
645
|
+
if (result !== null && !Array.isArray(result)) {
|
|
646
|
+
return runtimeResolveThrow(result, lowerer.irTypeOf(call), loc);
|
|
647
|
+
}
|
|
648
|
+
const raw = result === null
|
|
649
|
+
? { kind: "unitLit", unit: "null", type: NULL_T, loc }
|
|
650
|
+
: {
|
|
651
|
+
kind: "arrayLit",
|
|
652
|
+
elems: result.map((value) => ({ kind: "strLit", value, type: STRING, loc })),
|
|
653
|
+
type: arrayOf(STRING),
|
|
654
|
+
loc,
|
|
655
|
+
};
|
|
656
|
+
return lowerer.coerceInto(call, raw, lowerer.irTypeOf(call));
|
|
657
|
+
}
|
|
658
|
+
const paths = staticResolveOptionPaths(call.arguments[1]);
|
|
659
|
+
if (paths === null) {
|
|
660
|
+
lowerer.noLowering("require.resolve with runtime-computed options", call.arguments[1], "omit options or pass { paths: [\"<static directory>\", ...] }");
|
|
661
|
+
}
|
|
662
|
+
const result = resolveRequireRuntime(baseFile.fileName, specifier, lowerer.targetPlatform, paths);
|
|
663
|
+
return result.ok
|
|
664
|
+
? { kind: "strLit", value: result.value, type: STRING, loc }
|
|
665
|
+
: runtimeResolveThrow(result.error, STRING, loc);
|
|
666
|
+
}
|
|
437
667
|
/** The builtin modules whose `constants` object bakes as literals at
|
|
438
668
|
* every access site (the fs.constants precedent, scaled up): http2's
|
|
439
669
|
* full Node v24 table, and crypto's OpenSSL-constant table. The object
|
|
@@ -3181,7 +3411,8 @@ export function lowerStringDecoderMethodCall(lowerer, call, access) {
|
|
|
3181
3411
|
const receiver = lowerer.lowerExpr(access.expression);
|
|
3182
3412
|
if (receiver.type.kind !== "record")
|
|
3183
3413
|
lowerer.badType(access.expression, lowerer.typeOf(access.expression));
|
|
3184
|
-
|
|
3414
|
+
let chunk = lowerBuiltinValuePreservingUndefined(lowerer, call.arguments[0]);
|
|
3415
|
+
chunk = checkedOptionalBuiltinArm(lowerer, chunk, BYTES_U8) ?? chunk;
|
|
3185
3416
|
if (!(chunk.type.kind === "bytes" && chunk.type.elem === "u8")) {
|
|
3186
3417
|
lowerer.noLowering(`StringDecoder.write of '${lowerer.fmt(chunk.type)}' data`, call.arguments[0], "Buffer/Uint8Array chunks decode (narrow unions first)");
|
|
3187
3418
|
}
|
|
@@ -3314,6 +3545,9 @@ export function lowerJsonMethodCall(lowerer, call, access) {
|
|
|
3314
3545
|
const indent = stringifySpaceIndent(lowerer, call);
|
|
3315
3546
|
const argNode = call.arguments[0];
|
|
3316
3547
|
const value = lowerer.lowerExpr(argNode);
|
|
3548
|
+
const optionalString = lowerOptionalStringifyRoot(lowerer, value, indent, loc);
|
|
3549
|
+
if (optionalString)
|
|
3550
|
+
return optionalString;
|
|
3317
3551
|
// An ISLAND value (`JSON.stringify(err)` on a package handle — the
|
|
3318
3552
|
// island error-inspection idiom): the ENGINE's own JSON.stringify
|
|
3319
3553
|
// runs, so key order, nesting, toJSON, and getters match Node by
|
|
@@ -3343,7 +3577,7 @@ export function lowerJsonMethodCall(lowerer, call, access) {
|
|
|
3343
3577
|
// types the return `string`, so no static consumer can tell), and a
|
|
3344
3578
|
// runtime handle inside the tree throws (Node would walk its own
|
|
3345
3579
|
// enumerable props, which the handle does not model).
|
|
3346
|
-
if (!lowerer.
|
|
3580
|
+
if (!lowerer.jsonStringifySafe(value.type) && value.type.kind !== "dyn") {
|
|
3347
3581
|
// Bare undefined-armed unions get their own wording: Node's
|
|
3348
3582
|
// stringify of bare undefined is not a string at all — per-type
|
|
3349
3583
|
// serialization cannot match that exactly, so the fence is
|
|
@@ -3370,6 +3604,48 @@ export function lowerJsonMethodCall(lowerer, call, access) {
|
|
|
3370
3604
|
}
|
|
3371
3605
|
return null; // unknown members are tsc errors before lowering
|
|
3372
3606
|
}
|
|
3607
|
+
function lowerOptionalStringifyRoot(lowerer, value, indent, loc) {
|
|
3608
|
+
const tags = optionalStringTags(lowerer, value.type);
|
|
3609
|
+
if (!tags || value.type.kind !== "union")
|
|
3610
|
+
return null;
|
|
3611
|
+
const resultT = lowerer.withUndefinedArm(STRING);
|
|
3612
|
+
const key = `json.optionalString:${value.type.unionId}:${JSON.stringify(indent)}`;
|
|
3613
|
+
let helper = lowerer.widthHelpers.get(key);
|
|
3614
|
+
if (!helper) {
|
|
3615
|
+
helper = `%json.optionalString.${lowerer.widthHelpers.size}`;
|
|
3616
|
+
lowerer.widthHelpers.set(key, helper);
|
|
3617
|
+
const input = varRef("value.0", value.type, loc);
|
|
3618
|
+
const serialized = {
|
|
3619
|
+
kind: "jsonStringify",
|
|
3620
|
+
value: { kind: "unionNarrow", unionId: value.type.unionId, tag: tags.stringTag, value: input, type: STRING, loc },
|
|
3621
|
+
type: STRING,
|
|
3622
|
+
loc,
|
|
3623
|
+
};
|
|
3624
|
+
if (indent !== "")
|
|
3625
|
+
serialized.indent = indent;
|
|
3626
|
+
const missing = lowerer.wrappedUndefined(resultT, loc);
|
|
3627
|
+
if (!missing)
|
|
3628
|
+
throw new InternalCompilerError("optional JSON.stringify result needs an undefined arm");
|
|
3629
|
+
lowerer.liftedFns.push({
|
|
3630
|
+
name: helper,
|
|
3631
|
+
params: [{ localId: "value.0", name: "value", type: value.type }],
|
|
3632
|
+
returnType: resultT,
|
|
3633
|
+
locals: [{ id: "value.0", name: "value", type: value.type, mutable: false }],
|
|
3634
|
+
body: [
|
|
3635
|
+
{
|
|
3636
|
+
kind: "if",
|
|
3637
|
+
cond: { kind: "unionIsTag", unionId: value.type.unionId, tag: tags.undefinedTag, negated: false, value: input, type: BOOL, loc },
|
|
3638
|
+
then: [{ kind: "return", value: missing, loc }],
|
|
3639
|
+
else_: null,
|
|
3640
|
+
loc,
|
|
3641
|
+
},
|
|
3642
|
+
{ kind: "return", value: lowerer.coerceToExpected(serialized, resultT), loc },
|
|
3643
|
+
],
|
|
3644
|
+
loc,
|
|
3645
|
+
});
|
|
3646
|
+
}
|
|
3647
|
+
return { kind: "call", callee: helper, args: [value], type: resultT, loc };
|
|
3648
|
+
}
|
|
3373
3649
|
/** The compile-time indent of a `JSON.stringify(v[, replacer[, space]])`
|
|
3374
3650
|
* call, with Node's space rules applied: a number clamps to 0–10 spaces
|
|
3375
3651
|
* (ToInteger truncation), a string truncates to its first 10 code units,
|
|
@@ -3652,6 +3928,9 @@ export function lowerSearchParamsNew(lowerer, expr, loc) {
|
|
|
3652
3928
|
if (init.type.kind === "string") {
|
|
3653
3929
|
return { kind: "libCall", fn: "sp.parse", args: [init], type: SEARCH_PARAMS_T, loc };
|
|
3654
3930
|
}
|
|
3931
|
+
const optionalString = lowerOptionalStringSearchParams(lowerer, init, loc);
|
|
3932
|
+
if (optionalString)
|
|
3933
|
+
return optionalString;
|
|
3655
3934
|
if (init.type.kind === "searchParams") {
|
|
3656
3935
|
// Node ITERATES the source list — the copy is a snapshot, not a
|
|
3657
3936
|
// live alias (mutating the copy never touches the source or its
|
|
@@ -3666,6 +3945,46 @@ export function lowerSearchParamsNew(lowerer, expr, loc) {
|
|
|
3666
3945
|
}
|
|
3667
3946
|
lowerer.unsupported("SC1090", arg, `URLSearchParams from '${lowerer.fmt(init.type)}' inits (a string, a string[][], another URLSearchParams, or an inline { key: value } literal — narrow unions first)`);
|
|
3668
3947
|
}
|
|
3948
|
+
function lowerOptionalStringSearchParams(lowerer, init, loc) {
|
|
3949
|
+
const tags = optionalStringTags(lowerer, init.type);
|
|
3950
|
+
if (!tags || init.type.kind !== "union")
|
|
3951
|
+
return null;
|
|
3952
|
+
const key = `sp.optionalString:${init.type.unionId}`;
|
|
3953
|
+
let helper = lowerer.widthHelpers.get(key);
|
|
3954
|
+
if (!helper) {
|
|
3955
|
+
helper = `%sp.optionalString.${lowerer.widthHelpers.size}`;
|
|
3956
|
+
lowerer.widthHelpers.set(key, helper);
|
|
3957
|
+
const value = varRef("init.0", init.type, loc);
|
|
3958
|
+
lowerer.liftedFns.push({
|
|
3959
|
+
name: helper,
|
|
3960
|
+
params: [{ localId: "init.0", name: "init", type: init.type }],
|
|
3961
|
+
returnType: SEARCH_PARAMS_T,
|
|
3962
|
+
locals: [{ id: "init.0", name: "init", type: init.type, mutable: false }],
|
|
3963
|
+
body: [
|
|
3964
|
+
{
|
|
3965
|
+
kind: "if",
|
|
3966
|
+
cond: { kind: "unionIsTag", unionId: init.type.unionId, tag: tags.undefinedTag, negated: false, value, type: BOOL, loc },
|
|
3967
|
+
then: [{ kind: "return", value: { kind: "libCall", fn: "sp.new", args: [], type: SEARCH_PARAMS_T, loc }, loc }],
|
|
3968
|
+
else_: null,
|
|
3969
|
+
loc,
|
|
3970
|
+
},
|
|
3971
|
+
{
|
|
3972
|
+
kind: "return",
|
|
3973
|
+
value: {
|
|
3974
|
+
kind: "libCall",
|
|
3975
|
+
fn: "sp.parse",
|
|
3976
|
+
args: [{ kind: "unionNarrow", unionId: init.type.unionId, tag: tags.stringTag, value, type: STRING, loc }],
|
|
3977
|
+
type: SEARCH_PARAMS_T,
|
|
3978
|
+
loc,
|
|
3979
|
+
},
|
|
3980
|
+
loc,
|
|
3981
|
+
},
|
|
3982
|
+
],
|
|
3983
|
+
loc,
|
|
3984
|
+
});
|
|
3985
|
+
}
|
|
3986
|
+
return { kind: "call", callee: helper, args: [init], type: SEARCH_PARAMS_T, loc };
|
|
3987
|
+
}
|
|
3669
3988
|
/** Method calls on URLSearchParams-typed receivers — the WHATWG list
|
|
3670
3989
|
* surface over the runtime's decoded pairs. get answers `string | null`
|
|
3671
3990
|
* (the checker's own union; the runtime's +1-or-NULL builds the arms);
|
|
@@ -3937,7 +4256,7 @@ export function lowerFileHandleMethodCall(lowerer, call, access) {
|
|
|
3937
4256
|
const defaultValue = { kind: "numLit", value: dflt, type: F64, loc };
|
|
3938
4257
|
if (!node)
|
|
3939
4258
|
return { value: defaultValue, defaulted: boolLit(true, loc) };
|
|
3940
|
-
const undefinedArg =
|
|
4259
|
+
const undefinedArg = lowerStaticallyUndefinedArgument(lowerer, node);
|
|
3941
4260
|
if (undefinedArg) {
|
|
3942
4261
|
return { value: defaultAfterUndefined(undefinedArg, defaultValue), defaulted: boolLit(true, loc) };
|
|
3943
4262
|
}
|
|
@@ -4705,6 +5024,15 @@ export function lowerProcessProperty(lowerer, expr) {
|
|
|
4705
5024
|
const fn = expr.name.text === "node" ? "process.versionsNode" : "process.versionsOpenssl";
|
|
4706
5025
|
return { kind: "libCall", fn, args: [], type: STRING, loc: locOf(expr) };
|
|
4707
5026
|
}
|
|
5027
|
+
// process.versions?.electron is the runtime-capability probe used by
|
|
5028
|
+
// CLI packages to select Electron argument conventions. versions
|
|
5029
|
+
// itself always exists, and a native scriptc binary is not Electron,
|
|
5030
|
+
// so both the optional and ordinary property spellings read undefined.
|
|
5031
|
+
if (ts.isPropertyAccessExpression(expr.expression) &&
|
|
5032
|
+
lowerer.stdlibGlobalMember(expr.expression, "process") === "versions" &&
|
|
5033
|
+
expr.name.text === "electron") {
|
|
5034
|
+
return { kind: "unitLit", unit: "undefined", type: UNDEFINED_T, loc: locOf(expr) };
|
|
5035
|
+
}
|
|
4708
5036
|
// The capability-probe members that honestly DON'T EXIST in a
|
|
4709
5037
|
// compiled binary — each reads undefined (their declared types carry
|
|
4710
5038
|
// the undefined arm), so feature probes take their documented
|
|
@@ -5315,10 +5643,10 @@ export function lowerProcessMethodCall(lowerer, call, access) {
|
|
|
5315
5643
|
const secondNode = args[1];
|
|
5316
5644
|
const thirdNode = args[2];
|
|
5317
5645
|
const secondUndefined = secondNode
|
|
5318
|
-
?
|
|
5646
|
+
? lowerStaticallyUndefinedArgument(lowerer, secondNode)
|
|
5319
5647
|
: null;
|
|
5320
5648
|
const thirdUndefined = thirdNode
|
|
5321
|
-
?
|
|
5649
|
+
? lowerStaticallyUndefinedArgument(lowerer, thirdNode)
|
|
5322
5650
|
: null;
|
|
5323
5651
|
const secondT = secondNode && !secondUndefined ? lowerer.mapTypeOf(lowerer.typeOf(secondNode)) : undefined;
|
|
5324
5652
|
const callbackNode = args.length === 3 && !thirdUndefined
|
|
@@ -5355,7 +5683,7 @@ export function lowerProcessMethodCall(lowerer, call, access) {
|
|
|
5355
5683
|
if (canonical === raw)
|
|
5356
5684
|
return evaluated;
|
|
5357
5685
|
const normalized = { kind: "strLit", value: canonical, type: STRING, loc: locOf(encodingNode) };
|
|
5358
|
-
return
|
|
5686
|
+
return isSafeToDiscard(evaluated)
|
|
5359
5687
|
? normalized
|
|
5360
5688
|
: {
|
|
5361
5689
|
kind: "seqExpr",
|
|
@@ -5420,9 +5748,9 @@ export function lowerProcessMethodCall(lowerer, call, access) {
|
|
|
5420
5748
|
// data and encoding, even though it schedules no callback. Strings
|
|
5421
5749
|
// already evaluate encoding while producing `bytes`; byte chunks
|
|
5422
5750
|
// fold both ignored argument effects into this final ABI slot.
|
|
5423
|
-
if (thirdUndefined && !
|
|
5751
|
+
if (thirdUndefined && !isSafeToDiscard(thirdUndefined)) {
|
|
5424
5752
|
const effects = isBytes
|
|
5425
|
-
? [encoding, thirdUndefined].filter((effect) => !
|
|
5753
|
+
? [encoding, thirdUndefined].filter((effect) => !isSafeToDiscard(effect))
|
|
5426
5754
|
: [thirdUndefined];
|
|
5427
5755
|
runtimeEncoding = {
|
|
5428
5756
|
kind: "seqExpr",
|
|
@@ -5874,7 +6202,7 @@ export function lowerNumberStaticCall(lowerer, call, access) {
|
|
|
5874
6202
|
lowerer.noLowering(`Number.${member} with ${call.arguments.length} arguments`, call);
|
|
5875
6203
|
}
|
|
5876
6204
|
const argNode = call.arguments[0];
|
|
5877
|
-
const arg = lowerer
|
|
6205
|
+
const arg = lowerBuiltinValuePreservingUndefined(lowerer, argNode);
|
|
5878
6206
|
// An ISLAND ('any'-typed) argument evaluates the predicate in the
|
|
5879
6207
|
// engine — the statics never coerce, so the engine's answer over the
|
|
5880
6208
|
// real value is JS-exact where a static fence would refuse the
|
|
@@ -5886,6 +6214,9 @@ export function lowerNumberStaticCall(lowerer, call, access) {
|
|
|
5886
6214
|
const raw = { kind: "jsOp", op: "callMethod", name: member, args: [numberGlobal, arg], type: JSVAL, loc };
|
|
5887
6215
|
return { kind: "jsExit", value: raw, type: BOOL, loc };
|
|
5888
6216
|
}
|
|
6217
|
+
const optional = lowerOptionalNumberPredicate(lowerer, arg, fn, loc);
|
|
6218
|
+
if (optional)
|
|
6219
|
+
return optional;
|
|
5889
6220
|
if (arg.type.kind !== "f64") {
|
|
5890
6221
|
lowerer.noLowering(`Number.${member} of '${lowerer.fmt(arg.type)}' values`, argNode, "the Number statics never coerce — a statically non-number argument is constantly false in JS (narrow unions first, or write the constant)");
|
|
5891
6222
|
}
|