@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
|
@@ -85,6 +85,9 @@ export interface FnCtx {
|
|
|
85
85
|
generator?: {
|
|
86
86
|
yieldT: IrType;
|
|
87
87
|
nextT: IrType;
|
|
88
|
+
resultType: IrType & {
|
|
89
|
+
kind: "record";
|
|
90
|
+
};
|
|
88
91
|
} | null;
|
|
89
92
|
/** VARIADIC `arguments` form (rest-marked func type with no declared
|
|
90
93
|
* rest param): the synthetic trailing dyn-array param `arguments`
|
|
@@ -103,17 +106,13 @@ export interface FnCtx {
|
|
|
103
106
|
node: ts.Expression | null;
|
|
104
107
|
}[];
|
|
105
108
|
} | null;
|
|
106
|
-
/** Enclosing
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* finally BLOCKS themselves ("finallyBlock" — jumps out stay rejected: a
|
|
112
|
-
* return there would REPLACE a pending completion, a model the emitter
|
|
113
|
-
* doesn't implement; see rejectJumpCrossingFinally). Per function: a
|
|
114
|
-
* nested function's jumps never bind to enclosing constructs. */
|
|
109
|
+
/** Enclosing jump targets, innermost last. `labels` carries the source
|
|
110
|
+
* statement's JS label names so labeled break/continue resolve. Finally
|
|
111
|
+
* regions do not appear here: the backends route every abrupt completion
|
|
112
|
+
* through the cleanup regions it crosses. Per function, so a nested
|
|
113
|
+
* function's jumps never bind to enclosing constructs. */
|
|
115
114
|
ctl: {
|
|
116
|
-
kind: "loop" | "switch" | "block"
|
|
115
|
+
kind: "loop" | "switch" | "block";
|
|
117
116
|
labels?: string[];
|
|
118
117
|
}[];
|
|
119
118
|
}
|
|
@@ -191,7 +190,7 @@ export interface LowerOptions {
|
|
|
191
190
|
* path.win32 keep answering THEIR platform everywhere, like Node's. */
|
|
192
191
|
targetPlatform?: string;
|
|
193
192
|
/** Node's startup refusal (LoadResult.startupCrash — preflight's
|
|
194
|
-
* resolution walk and
|
|
193
|
+
* resolution walk and named-import link checks): the program
|
|
195
194
|
* compiles to that startup crash. */
|
|
196
195
|
startupCrash?: StartupCrash | null;
|
|
197
196
|
/** LIBRARY mode's reachability roots: the profile-mapped exports of the
|
|
@@ -242,10 +241,7 @@ interface RuntimeFenceFunctionTarget extends RuntimeFenceBase {
|
|
|
242
241
|
returnType: IrType;
|
|
243
242
|
paramsMutable?: boolean;
|
|
244
243
|
async?: true;
|
|
245
|
-
generator?:
|
|
246
|
-
yieldT: IrType;
|
|
247
|
-
nextT: IrType;
|
|
248
|
-
};
|
|
244
|
+
generator?: NonNullable<IrFunction["generator"]>;
|
|
249
245
|
}
|
|
250
246
|
interface RuntimeFenceClosureTarget extends Omit<RuntimeFenceFunctionTarget, "kind"> {
|
|
251
247
|
kind: "closure";
|
|
@@ -267,8 +263,8 @@ export interface LowererMode {
|
|
|
267
263
|
/** The build's target platform (LowerOptions.targetPlatform — lowerToIr
|
|
268
264
|
* passes it to every pass). Defaults to the host. */
|
|
269
265
|
targetPlatform?: string;
|
|
270
|
-
/** Node's startup refusal (preflight's resolution walk /
|
|
271
|
-
*
|
|
266
|
+
/** Node's startup refusal (preflight's resolution walk / named-import
|
|
267
|
+
* link checks): %main opens with exactly this throw, before any
|
|
272
268
|
* module init — Node refuses the whole graph before anything evaluates,
|
|
273
269
|
* so nothing runs. */
|
|
274
270
|
startupCrash?: StartupCrash | null;
|
|
@@ -432,7 +428,7 @@ export declare class Lowerer {
|
|
|
432
428
|
* (reading 'fn')"); nullish-to-nullish flows lower to nothing. The map
|
|
433
429
|
* answers which unit the binding holds (the TypeError names it). Null
|
|
434
430
|
* entries cache probed non-qualifiers. */
|
|
435
|
-
readonly nullishBindings: Map<ts.Symbol, "
|
|
431
|
+
readonly nullishBindings: Map<ts.Symbol, "null" | "undefined" | null>;
|
|
436
432
|
/** DEAD bindings of unmappable types: never READ anywhere in the
|
|
437
433
|
* program, declared with no initializer or a value-only one (a function
|
|
438
434
|
* literal), every write's RHS side-effect-free. Node materializes the
|
|
@@ -504,10 +500,70 @@ export declare class Lowerer {
|
|
|
504
500
|
/** All storage slots widened for runtime absence, including slots whose
|
|
505
501
|
* current control-flow branch has temporarily narrowed the value. */
|
|
506
502
|
readonly runtimeOptionalStorageLocals: Set<IrLocal>;
|
|
503
|
+
/** Globals whose checker-bare type was widened because an indexed read can
|
|
504
|
+
* carry undefined at runtime. Identifier reads keep the union tag so
|
|
505
|
+
* typeof and later boundaries observe the real value. */
|
|
506
|
+
readonly runtimeOptionalGlobals: Set<IrGlobal>;
|
|
507
|
+
/** Bindings whose unchecked string arithmetic can produce either a number
|
|
508
|
+
* (NaN for an absent read) or a string. Preserve that result union at bare
|
|
509
|
+
* reads instead of applying the checker-bare string narrowing adapter. */
|
|
510
|
+
readonly runtimeOptionalArithmeticLocals: Set<IrLocal>;
|
|
511
|
+
readonly runtimeOptionalArithmeticGlobals: Set<IrGlobal>;
|
|
512
|
+
/** Binding symbols whose IR storage type was widened by the indexed-read
|
|
513
|
+
* prepass. This includes explicit annotations: unchecked TS annotations do
|
|
514
|
+
* not prove that an array property read produced a value. */
|
|
515
|
+
readonly runtimeOptionalBindingTypes: Map<ts.Symbol, IrType>;
|
|
516
|
+
/** Concise callback/lambda returns promoted by the HOF callback prepass;
|
|
517
|
+
* arrows have no declaration symbol to key in fnSigsBySymbol. */
|
|
518
|
+
readonly runtimeOptionalFunctionReturns: WeakMap<ts.Node, IrType>;
|
|
519
|
+
/** Arithmetic over an unchecked string read can answer either NaN or a
|
|
520
|
+
* string. Bindings and returns use this marker to retain that result union
|
|
521
|
+
* through checker-bare string annotations. */
|
|
522
|
+
readonly runtimeOptionalArithmeticTypes: WeakMap<ts.Node, IrType>;
|
|
523
|
+
/** Record fields promoted to an undefined-armed union by an indexed-read
|
|
524
|
+
* value. The key is the concrete emitted shape and field name. */
|
|
525
|
+
readonly runtimeOptionalFields: Set<string>;
|
|
526
|
+
/** Callback pattern parameters carry an optional source without making
|
|
527
|
+
* every name destructured from a present source optional. */
|
|
528
|
+
readonly runtimeOptionalPatternTypes: WeakMap<ts.Node, IrType>;
|
|
529
|
+
readonly runtimeOptionalReduceTypes: WeakMap<ts.CallExpression, IrType>;
|
|
507
530
|
/** Capture entries and their origin share one mutable box. Normalize each
|
|
508
531
|
* entry to the origin so writes and flow proofs stay synchronized. */
|
|
509
532
|
readonly runtimeOptionalRoots: Map<IrLocal, IrLocal>;
|
|
510
533
|
runtimeOptionalRootOf(local: IrLocal): IrLocal;
|
|
534
|
+
runtimeOptionalBindingType(node: ts.Node): IrType | null;
|
|
535
|
+
runtimeOptionalBindingType(node: ts.Node, fallback: IrType): IrType;
|
|
536
|
+
runtimeOptionalIdentifierValue(node: ts.Expression): {
|
|
537
|
+
value: IrExpr;
|
|
538
|
+
present: IrType;
|
|
539
|
+
unionId: string;
|
|
540
|
+
} | null;
|
|
541
|
+
/** Recover the original optional union when a checked single-arm helper
|
|
542
|
+
* was installed before a strict property consumer could name its member.
|
|
543
|
+
* Recovery is limited to array element reads and storage roots marked by
|
|
544
|
+
* the optional-read analysis, so ordinary assertions keep their generic
|
|
545
|
+
* checked-narrow behavior. */
|
|
546
|
+
runtimeOptionalSourceValue(node: ts.Expression, value: IrExpr): IrExpr | null;
|
|
547
|
+
/** A strict property or method receiver over an array-derived optional
|
|
548
|
+
* value. Reuse a plain read directly or stabilize an effectful receiver
|
|
549
|
+
* once, throw Node's member-read TypeError for a unit arm, and extract the
|
|
550
|
+
* expected present arm otherwise. */
|
|
551
|
+
runtimeOptionalPropertyReceiver(node: ts.Expression, value: IrExpr, expected: IrType, member: string): IrExpr | null;
|
|
552
|
+
runtimeOptionalFieldKey(shapeId: string, field: string): string;
|
|
553
|
+
isRuntimeOptionalField(shapeId: string, field: string): boolean;
|
|
554
|
+
isRuntimeOptionalGlobal(global: IrGlobal): boolean;
|
|
555
|
+
isRuntimeOptionalArithmeticGlobal(global: IrGlobal): boolean;
|
|
556
|
+
/** The union produced when an unchecked array read reaches a typed slot
|
|
557
|
+
* whose checker type is the corresponding bare arm. */
|
|
558
|
+
runtimeOptionalWidening(actual: IrType, expected: IrType): IrType | null;
|
|
559
|
+
runtimeOptionalType(t: IrType): IrType;
|
|
560
|
+
promoteRuntimeOptionalParameter(node: ts.Node, type: IrType): IrType;
|
|
561
|
+
promoteRuntimeOptionalFunctionReturn(node: ts.Node, type: IrType): IrType;
|
|
562
|
+
runtimeOptionalFunctionReturnType(node: ts.Node, fallback: IrType): IrType;
|
|
563
|
+
/** Promote one field of a record storage shape to the value's runtime
|
|
564
|
+
* type. Shapes are immutable by identity, so this interns a sibling shape
|
|
565
|
+
* and records the field as runtime-optional for property-read narrowing. */
|
|
566
|
+
runtimeOptionalRecordField(type: IrType, field: string, fieldType: IrType): IrType;
|
|
511
567
|
/** Runs `fn` with the given aliased-typeof narrows applied (and restored
|
|
512
568
|
* after) — the branch-scoping primitive. */
|
|
513
569
|
narrowingAliases<T>(narrows: readonly {
|
|
@@ -592,6 +648,10 @@ export declare class Lowerer {
|
|
|
592
648
|
};
|
|
593
649
|
}>;
|
|
594
650
|
readonly narrowHelpers: Map<string, string>;
|
|
651
|
+
/** Exact members of narrowHelpers produced by narrowedArmHelper. This
|
|
652
|
+
* lets property consumers recognize an earlier checked extraction by
|
|
653
|
+
* provenance instead of relying on its generated-name prefix. */
|
|
654
|
+
private readonly checkedNarrowHelpers;
|
|
595
655
|
/** Interned `%iter.drain.<n>` helpers (classIteratorDrainCall): one per
|
|
596
656
|
* receiver class — the eager drain of a class iterable's protocol into
|
|
597
657
|
* a fresh element array, behind array/call spreads. */
|
|
@@ -722,11 +782,17 @@ export declare class Lowerer {
|
|
|
722
782
|
* non-instantiated one (its only value members are import= aliases,
|
|
723
783
|
* still resolved statically). Ambient blocks never register — their
|
|
724
784
|
* members keep the ReferenceError/fence paths (lower-namespaces.ts). */
|
|
725
|
-
readonly nsBlocks: Map<ts.Node, "
|
|
785
|
+
readonly nsBlocks: Map<ts.Node, "flattened" | "typeOnly">;
|
|
726
786
|
/** File → its %init function name, filled by prepareModuleInits before
|
|
727
787
|
* any body lowers: import headers and inline require statements call
|
|
728
788
|
* dependency inits by these names. */
|
|
729
789
|
readonly initNameOf: Map<ts.SourceFile, string>;
|
|
790
|
+
/** CommonJS module objects are scalar handles into the runtime registry.
|
|
791
|
+
* IDs are assigned in deterministic module order before any body lowers;
|
|
792
|
+
* the feature gate stays false for programs that never inspect the graph. */
|
|
793
|
+
readonly cjsModuleIdOf: Map<ts.SourceFile, number>;
|
|
794
|
+
readonly cjsModuleFiles: ts.SourceFile[];
|
|
795
|
+
cjsModuleGraphEnabled: boolean;
|
|
730
796
|
/** File → the id of its run-once guard global (a bool module global,
|
|
731
797
|
* false at program start). Every non-entry module gets one: its %init
|
|
732
798
|
* may be called from several importers/requirers, and the guard is what
|
|
@@ -924,8 +990,8 @@ export declare class Lowerer {
|
|
|
924
990
|
* references never call this helper and remain ordinary checker input. */
|
|
925
991
|
externalTypeSpecifierOf(expr: ts.Expression): string | null;
|
|
926
992
|
/** The source file a checker-resolved module-specifier node names. The
|
|
927
|
-
* checker path
|
|
928
|
-
*
|
|
993
|
+
* checker path is preferred; resolveImport is the canonical fallback for
|
|
994
|
+
* every project-module spelling. */
|
|
929
995
|
private moduleSourceFileOf;
|
|
930
996
|
/** Follow one project-module export through the checker's resolved export
|
|
931
997
|
* table, then recover its exact external route where alias declarations
|
|
@@ -966,10 +1032,10 @@ export declare class Lowerer {
|
|
|
966
1032
|
* machinery. */
|
|
967
1033
|
private cjsDefaultImportDepOf;
|
|
968
1034
|
/** True when `expr` is an identifier bound by a top-level
|
|
969
|
-
* `const x = require("./local")` of a
|
|
970
|
-
*
|
|
971
|
-
* --npm-static package (its CJS entry is a program
|
|
972
|
-
* binding is the same namespace over the same export table), or by a
|
|
1035
|
+
* `const x = require("./local")` of a project module — relative,
|
|
1036
|
+
* tsconfig-aliased, or package.json-mediated — or of a bare specifier
|
|
1037
|
+
* naming an opted-in --npm-static package (its CJS entry is a program
|
|
1038
|
+
* module, so the binding is the same namespace over the same export table), or by a
|
|
973
1039
|
* DEFAULT import of a CommonJS JS module (`import d from "./lib.cjs"`:
|
|
974
1040
|
* Node binds d to module.exports, the same value require answers).
|
|
975
1041
|
* Member accesses on it resolve through the export table (property
|
|
@@ -1006,6 +1072,12 @@ export declare class Lowerer {
|
|
|
1006
1072
|
wantBody(name: string): boolean;
|
|
1007
1073
|
collectNpmImports(parts: FileParts[]): void;
|
|
1008
1074
|
collectJsonImports(parts: FileParts[]): void;
|
|
1075
|
+
/** Discover the unchecked-array values that cross static ABI/storage
|
|
1076
|
+
* boundaries before any function body or module initializer is emitted.
|
|
1077
|
+
* TypeScript's default indexed-access type is a useful source annotation,
|
|
1078
|
+
* but it is not a runtime proof; promoting only the affected slots keeps
|
|
1079
|
+
* the rest of the dense ABI unchanged. */
|
|
1080
|
+
analyzeRuntimeOptionalArrayReads(parts: FileParts[]): void;
|
|
1009
1081
|
run(): LowerResult;
|
|
1010
1082
|
/** Final retention, pruning, and module assembly shared by ordinary emit
|
|
1011
1083
|
* and the retained reachability worklist. */
|
|
@@ -1142,9 +1214,10 @@ export declare class Lowerer {
|
|
|
1142
1214
|
* isArrayValueType so Array.isArray's predicate and its narrowing bridge
|
|
1143
1215
|
* cannot disagree about fixed tuple arms. */
|
|
1144
1216
|
arrayValueTags(unionId: string): number[];
|
|
1145
|
-
/**
|
|
1146
|
-
*
|
|
1217
|
+
/** Checked JSON conversion excludes undefined array slots because JSON
|
|
1218
|
+
* text cannot preserve that distinction. */
|
|
1147
1219
|
jsonSafe(t: IrType): boolean;
|
|
1220
|
+
jsonStringifySafe(t: IrType): boolean;
|
|
1148
1221
|
/** True when a type is a BARE undefined-armed union — the one JSON-unsafe
|
|
1149
1222
|
* shape whose rejections deserve their own wording: Node's stringify of
|
|
1150
1223
|
* bare undefined is not a string at all and JSON text never matches the
|
|
@@ -1898,12 +1971,9 @@ export declare class Lowerer {
|
|
|
1898
1971
|
rejectUnresolved(ident: ts.Identifier, fallback: string): never;
|
|
1899
1972
|
rejectUnresolvedSymbol(symbol: ts.Symbol | null, name: string, node: ts.Node, fallback: string): never;
|
|
1900
1973
|
lowerScopedBlock(stmt: ts.Statement): IrStmt[];
|
|
1901
|
-
/** Lowers inside a
|
|
1902
|
-
*
|
|
1903
|
-
|
|
1904
|
-
* label names when the source statement was labeled — labeled jumps
|
|
1905
|
-
* resolve against them. */
|
|
1906
|
-
inCtl<T>(kind: "loop" | "switch" | "block" | "tryFinally" | "finallyBlock", fn: () => T, labels?: string[]): T;
|
|
1974
|
+
/** Lowers inside a jump-target marker. `labels` carries the construct's
|
|
1975
|
+
* source label names so labeled jumps resolve against them. */
|
|
1976
|
+
inCtl<T>(kind: "loop" | "switch" | "block", fn: () => T, labels?: string[]): T;
|
|
1907
1977
|
/** The label names a `lbl:` chain put on the statement currently being
|
|
1908
1978
|
* lowered — set by lowerLabeled around lowering the labeled construct,
|
|
1909
1979
|
* consumed exactly once by the construct's own lowering (takeLabels).
|
|
@@ -1911,7 +1981,6 @@ export declare class Lowerer {
|
|
|
1911
1981
|
* silently dropping a label would compile `break lbl` wrong. */
|
|
1912
1982
|
pendingLabels: string[] | null;
|
|
1913
1983
|
takeLabels(): string[] | undefined;
|
|
1914
|
-
rejectJumpCrossingFinally(kw: "break" | "continue" | "return", stmt: ts.Statement, label?: string): void;
|
|
1915
1984
|
lowerStmt(stmt: ts.Statement): IrStmt | IrStmt[] | null;
|
|
1916
1985
|
lowerVarStatement(stmt: ts.VariableStatement): IrStmt[];
|
|
1917
1986
|
lowerDestructuringDecl(decl: ts.VariableDeclaration, isLet: boolean): IrStmt[];
|
|
@@ -1981,6 +2050,8 @@ export declare class Lowerer {
|
|
|
1981
2050
|
caughtLocalOf(node: ts.Expression): IrLocal | null;
|
|
1982
2051
|
caughtToString(node: ts.Expression): IrExpr | null;
|
|
1983
2052
|
lowerInstanceOf(expr: ts.BinaryExpression, loc: SrcLoc): IrExpr;
|
|
2053
|
+
private withRuntimeOptionalClassValue;
|
|
2054
|
+
private withExpressionOverride;
|
|
1984
2055
|
lowerCall(expr: ts.CallExpression): IrExpr;
|
|
1985
2056
|
isTopLevelFnSymbol(ident: ts.Identifier): boolean;
|
|
1986
2057
|
lowerNestedFunctionDecl(stmt: ts.FunctionDeclaration): IrStmt;
|
|
@@ -2083,6 +2154,10 @@ export declare class Lowerer {
|
|
|
2083
2154
|
module: string;
|
|
2084
2155
|
member: string;
|
|
2085
2156
|
}, fn: BuiltinModuleFn, loc: SrcLoc): IrExpr;
|
|
2157
|
+
lowerTimersPromisesSetInterval(expr: ts.CallExpression, bi: {
|
|
2158
|
+
module: string;
|
|
2159
|
+
member: string;
|
|
2160
|
+
}, loc: SrcLoc): IrExpr | null;
|
|
2086
2161
|
lowerFsToUnixTimestampCall(expr: ts.CallExpression, bi: {
|
|
2087
2162
|
module: string;
|
|
2088
2163
|
member: string;
|