@scriptc/compiler 0.0.36 → 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 +7 -5
- package/ambient/scriptc-overrides.d.ts +0 -7
- package/ambient/scriptc.d.ts +1 -1
- package/dist/backend/c/exprs.js +69 -45
- package/dist/backend/c/exprs.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.js +18 -0
- package/dist/backend/c/stmts.js.map +1 -1
- package/dist/backend/c/walkers.js +5 -7
- 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/dyn.js +7 -0
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.js +34 -7
- package/dist/backend/llvm/emitter.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 +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-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-stream-bridges.js +25 -1
- package/dist/backend/llvm/expr-stream-bridges.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 +42 -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.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/coverage/surface-manifest.js +10 -1
- package/dist/coverage/surface-manifest.js.map +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/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-builtins.js +164 -4
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +3 -4
- package/dist/frontend/lowering/lower-calls.js +260 -27
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.js +728 -655
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +4 -0
- package/dist/frontend/lowering/lower-exprs.js +769 -101
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +47 -33
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +5 -4
- package/dist/frontend/lowering/lower-island.js +10 -5
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +10 -0
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +302 -71
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +74 -2
- package/dist/frontend/lowering/lowerer.js +1087 -10
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- 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/index.d.ts +3 -3
- package/dist/index.js +45 -23
- package/dist/index.js.map +1 -1
- package/dist/ir/ir.d.ts +65 -11
- package/dist/ir/ir.js +25 -25
- 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 +84 -37
- package/dist/ir/validate.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/library-cache.test.js +5 -5
- package/dist/startup-cache.d.ts +9 -1
- package/dist/startup-cache.js +16 -1
- package/dist/startup-cache.js.map +1 -1
- package/package.json +17 -4
- package/surface-manifest.json +5 -5
|
@@ -504,10 +504,69 @@ export declare class Lowerer {
|
|
|
504
504
|
/** All storage slots widened for runtime absence, including slots whose
|
|
505
505
|
* current control-flow branch has temporarily narrowed the value. */
|
|
506
506
|
readonly runtimeOptionalStorageLocals: Set<IrLocal>;
|
|
507
|
+
/** Globals whose checker-bare type was widened because an indexed read can
|
|
508
|
+
* carry undefined at runtime. Identifier reads keep the union tag so
|
|
509
|
+
* typeof and later boundaries observe the real value. */
|
|
510
|
+
readonly runtimeOptionalGlobals: Set<IrGlobal>;
|
|
511
|
+
/** Bindings whose unchecked string arithmetic can produce either a number
|
|
512
|
+
* (NaN for an absent read) or a string. Preserve that result union at bare
|
|
513
|
+
* reads instead of applying the checker-bare string narrowing adapter. */
|
|
514
|
+
readonly runtimeOptionalArithmeticLocals: Set<IrLocal>;
|
|
515
|
+
readonly runtimeOptionalArithmeticGlobals: Set<IrGlobal>;
|
|
516
|
+
/** Binding symbols whose IR storage type was widened by the indexed-read
|
|
517
|
+
* prepass. This includes explicit annotations: unchecked TS annotations do
|
|
518
|
+
* not prove that an array property read produced a value. */
|
|
519
|
+
readonly runtimeOptionalBindingTypes: Map<ts.Symbol, IrType>;
|
|
520
|
+
/** Concise callback/lambda returns promoted by the HOF callback prepass;
|
|
521
|
+
* arrows have no declaration symbol to key in fnSigsBySymbol. */
|
|
522
|
+
readonly runtimeOptionalFunctionReturns: WeakMap<ts.Node, IrType>;
|
|
523
|
+
/** Arithmetic over an unchecked string read can answer either NaN or a
|
|
524
|
+
* string. Bindings and returns use this marker to retain that result union
|
|
525
|
+
* through checker-bare string annotations. */
|
|
526
|
+
readonly runtimeOptionalArithmeticTypes: WeakMap<ts.Node, IrType>;
|
|
527
|
+
/** Record fields promoted to an undefined-armed union by an indexed-read
|
|
528
|
+
* value. The key is the concrete emitted shape and field name. */
|
|
529
|
+
readonly runtimeOptionalFields: Set<string>;
|
|
530
|
+
/** Callback pattern parameters carry an optional source without making
|
|
531
|
+
* every name destructured from a present source optional. */
|
|
532
|
+
readonly runtimeOptionalPatternTypes: WeakMap<ts.Node, IrType>;
|
|
533
|
+
readonly runtimeOptionalReduceTypes: WeakMap<ts.CallExpression, IrType>;
|
|
507
534
|
/** Capture entries and their origin share one mutable box. Normalize each
|
|
508
535
|
* entry to the origin so writes and flow proofs stay synchronized. */
|
|
509
536
|
readonly runtimeOptionalRoots: Map<IrLocal, IrLocal>;
|
|
510
537
|
runtimeOptionalRootOf(local: IrLocal): IrLocal;
|
|
538
|
+
runtimeOptionalBindingType(node: ts.Node): IrType | null;
|
|
539
|
+
runtimeOptionalBindingType(node: ts.Node, fallback: IrType): IrType;
|
|
540
|
+
runtimeOptionalIdentifierValue(node: ts.Expression): {
|
|
541
|
+
value: IrExpr;
|
|
542
|
+
present: IrType;
|
|
543
|
+
unionId: string;
|
|
544
|
+
} | null;
|
|
545
|
+
/** Recover the original optional union when a checked single-arm helper
|
|
546
|
+
* was installed before a strict property consumer could name its member.
|
|
547
|
+
* Recovery is limited to array element reads and storage roots marked by
|
|
548
|
+
* the optional-read analysis, so ordinary assertions keep their generic
|
|
549
|
+
* checked-narrow behavior. */
|
|
550
|
+
runtimeOptionalSourceValue(node: ts.Expression, value: IrExpr): IrExpr | null;
|
|
551
|
+
/** A strict property or method receiver over an array-derived optional
|
|
552
|
+
* value. Stabilize the receiver once, throw Node's member-read TypeError
|
|
553
|
+
* for a unit arm, and extract the expected present arm otherwise. */
|
|
554
|
+
runtimeOptionalPropertyReceiver(node: ts.Expression, value: IrExpr, expected: IrType, member: string): IrExpr | null;
|
|
555
|
+
runtimeOptionalFieldKey(shapeId: string, field: string): string;
|
|
556
|
+
isRuntimeOptionalField(shapeId: string, field: string): boolean;
|
|
557
|
+
isRuntimeOptionalGlobal(global: IrGlobal): boolean;
|
|
558
|
+
isRuntimeOptionalArithmeticGlobal(global: IrGlobal): boolean;
|
|
559
|
+
/** The union produced when an unchecked array read reaches a typed slot
|
|
560
|
+
* whose checker type is the corresponding bare arm. */
|
|
561
|
+
runtimeOptionalWidening(actual: IrType, expected: IrType): IrType | null;
|
|
562
|
+
runtimeOptionalType(t: IrType): IrType;
|
|
563
|
+
promoteRuntimeOptionalParameter(node: ts.Node, type: IrType): IrType;
|
|
564
|
+
promoteRuntimeOptionalFunctionReturn(node: ts.Node, type: IrType): IrType;
|
|
565
|
+
runtimeOptionalFunctionReturnType(node: ts.Node, fallback: IrType): IrType;
|
|
566
|
+
/** Promote one field of a record storage shape to the value's runtime
|
|
567
|
+
* type. Shapes are immutable by identity, so this interns a sibling shape
|
|
568
|
+
* and records the field as runtime-optional for property-read narrowing. */
|
|
569
|
+
runtimeOptionalRecordField(type: IrType, field: string, fieldType: IrType): IrType;
|
|
511
570
|
/** Runs `fn` with the given aliased-typeof narrows applied (and restored
|
|
512
571
|
* after) — the branch-scoping primitive. */
|
|
513
572
|
narrowingAliases<T>(narrows: readonly {
|
|
@@ -592,6 +651,10 @@ export declare class Lowerer {
|
|
|
592
651
|
};
|
|
593
652
|
}>;
|
|
594
653
|
readonly narrowHelpers: Map<string, string>;
|
|
654
|
+
/** Exact members of narrowHelpers produced by narrowedArmHelper. This
|
|
655
|
+
* lets property consumers recognize an earlier checked extraction by
|
|
656
|
+
* provenance instead of relying on its generated-name prefix. */
|
|
657
|
+
private readonly checkedNarrowHelpers;
|
|
595
658
|
/** Interned `%iter.drain.<n>` helpers (classIteratorDrainCall): one per
|
|
596
659
|
* receiver class — the eager drain of a class iterable's protocol into
|
|
597
660
|
* a fresh element array, behind array/call spreads. */
|
|
@@ -1006,6 +1069,12 @@ export declare class Lowerer {
|
|
|
1006
1069
|
wantBody(name: string): boolean;
|
|
1007
1070
|
collectNpmImports(parts: FileParts[]): void;
|
|
1008
1071
|
collectJsonImports(parts: FileParts[]): void;
|
|
1072
|
+
/** Discover the unchecked-array values that cross static ABI/storage
|
|
1073
|
+
* boundaries before any function body or module initializer is emitted.
|
|
1074
|
+
* TypeScript's default indexed-access type is a useful source annotation,
|
|
1075
|
+
* but it is not a runtime proof; promoting only the affected slots keeps
|
|
1076
|
+
* the rest of the dense ABI unchanged. */
|
|
1077
|
+
analyzeRuntimeOptionalArrayReads(parts: FileParts[]): void;
|
|
1009
1078
|
run(): LowerResult;
|
|
1010
1079
|
/** Final retention, pruning, and module assembly shared by ordinary emit
|
|
1011
1080
|
* and the retained reachability worklist. */
|
|
@@ -1142,9 +1211,10 @@ export declare class Lowerer {
|
|
|
1142
1211
|
* isArrayValueType so Array.isArray's predicate and its narrowing bridge
|
|
1143
1212
|
* cannot disagree about fixed tuple arms. */
|
|
1144
1213
|
arrayValueTags(unionId: string): number[];
|
|
1145
|
-
/**
|
|
1146
|
-
*
|
|
1214
|
+
/** Checked JSON conversion excludes undefined array slots because JSON
|
|
1215
|
+
* text cannot preserve that distinction. */
|
|
1147
1216
|
jsonSafe(t: IrType): boolean;
|
|
1217
|
+
jsonStringifySafe(t: IrType): boolean;
|
|
1148
1218
|
/** True when a type is a BARE undefined-armed union — the one JSON-unsafe
|
|
1149
1219
|
* shape whose rejections deserve their own wording: Node's stringify of
|
|
1150
1220
|
* bare undefined is not a string at all and JSON text never matches the
|
|
@@ -1981,6 +2051,8 @@ export declare class Lowerer {
|
|
|
1981
2051
|
caughtLocalOf(node: ts.Expression): IrLocal | null;
|
|
1982
2052
|
caughtToString(node: ts.Expression): IrExpr | null;
|
|
1983
2053
|
lowerInstanceOf(expr: ts.BinaryExpression, loc: SrcLoc): IrExpr;
|
|
2054
|
+
private withRuntimeOptionalClassValue;
|
|
2055
|
+
private withExpressionOverride;
|
|
1984
2056
|
lowerCall(expr: ts.CallExpression): IrExpr;
|
|
1985
2057
|
isTopLevelFnSymbol(ident: ts.Identifier): boolean;
|
|
1986
2058
|
lowerNestedFunctionDecl(stmt: ts.FunctionDeclaration): IrStmt;
|