@scriptc/compiler 0.0.3 → 0.0.5
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 +145 -9
- package/dist/backend/cc.d.ts +23 -0
- package/dist/backend/cc.js +89 -0
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/emission/emit-async.js +2 -2
- package/dist/backend/emission/emit-async.js.map +1 -1
- package/dist/backend/emission/emit-exprs.js +37 -2
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-shapes.js +3 -2
- package/dist/backend/emission/emit-shapes.js.map +1 -1
- package/dist/backend/emission/emit-walkers.js +7 -8
- package/dist/backend/emission/emit-walkers.js.map +1 -1
- package/dist/backend/emission/emitter.d.ts +1 -0
- package/dist/backend/emission/emitter.js +123 -3
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.js +198 -15
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/shapes.js +1 -0
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +25 -0
- package/dist/diagnostics/diagnostic.js +88 -2
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/frontend/lib-exports.d.ts +16 -0
- package/dist/frontend/lib-exports.js +35 -0
- package/dist/frontend/lib-exports.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.js +76 -6
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +37 -4
- package/dist/frontend/lowering/lower-builtins.js +240 -6
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +124 -34
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +34 -2
- package/dist/frontend/lowering/lower-classes.js +257 -34
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.js +25 -3
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +10 -0
- package/dist/frontend/lowering/lower-exprs.js +411 -10
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +16 -1
- package/dist/frontend/lowering/lower-inspect.js +132 -5
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.js +25 -4
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +4 -2
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +6 -5
- package/dist/frontend/lowering/lower-modules.js +56 -18
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +163 -0
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +72 -2
- package/dist/frontend/lowering/lowerer.js +339 -19
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +9 -2
- package/dist/frontend/lowering/surfaces.js +44 -7
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/npm-static-rewrite.d.ts +3 -0
- package/dist/frontend/npm-static-rewrite.js +677 -0
- package/dist/frontend/npm-static-rewrite.js.map +1 -0
- package/dist/frontend/npm-static.d.ts +8 -1
- package/dist/frontend/npm-static.js +159 -18
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.js +2 -2
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/program.d.ts +6 -0
- package/dist/frontend/program.js +110 -22
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.js +120 -5
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/shared.d.ts +8 -2
- package/dist/frontend/shared.js +22 -6
- package/dist/frontend/shared.js.map +1 -1
- package/dist/frontend/ts7/checker.js +1 -1
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/types.d.ts +25 -1
- package/dist/frontend/types.js +121 -7
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/index.js +256 -17
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +86 -1
- package/dist/ir/nodes.js +183 -0
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +89 -6
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/profile.d.ts +52 -0
- package/dist/library/profile.js +232 -0
- package/dist/library/profile.js.map +1 -0
- package/package.json +2 -2
- package/surface-manifest.json +67 -2
|
@@ -33,6 +33,10 @@ export type WidthLift = {
|
|
|
33
33
|
how: "width";
|
|
34
34
|
} | {
|
|
35
35
|
how: "arr";
|
|
36
|
+
} | {
|
|
37
|
+
how: "tupleArr";
|
|
38
|
+
} | {
|
|
39
|
+
how: "emptyArr";
|
|
36
40
|
} | {
|
|
37
41
|
how: "objWidth";
|
|
38
42
|
} | {
|
|
@@ -191,6 +195,12 @@ export interface LowerOptions {
|
|
|
191
195
|
* resolution walk and CJS named-import link check): the program
|
|
192
196
|
* compiles to that startup crash. */
|
|
193
197
|
startupCrash?: StartupCrash | null;
|
|
198
|
+
/** LIBRARY mode's reachability roots: the profile-mapped exports of the
|
|
199
|
+
* entry module. Executable builds root at the entry's top level alone
|
|
200
|
+
* (an unreferenced export dead-strips); a library's exports are called from
|
|
201
|
+
* OUTSIDE the graph, so discovery seeds them alongside the init
|
|
202
|
+
* bodies. Names are the entry file's unqualified declaration names. */
|
|
203
|
+
libRoots?: readonly string[];
|
|
194
204
|
}
|
|
195
205
|
/** The Lowerer's pass configuration (see lowerToIr). */
|
|
196
206
|
export interface LowererMode {
|
|
@@ -436,6 +446,12 @@ export declare class Lowerer {
|
|
|
436
446
|
/** Synthetic URLSearchParams.forEach loop functions, interned per
|
|
437
447
|
* callback arity/return — Map's pattern over the sp index walk. */
|
|
438
448
|
readonly spHofHelpers: Map<string, string>;
|
|
449
|
+
/** The primitive-constructor VALUES (`String`/`Number`/`Boolean` as
|
|
450
|
+
* bare identifiers — CLI option tables store and compare them): one
|
|
451
|
+
* synthesized coercion function per constructor per program, interned
|
|
452
|
+
* here by name so every reference is the SAME zero-capture closure and
|
|
453
|
+
* `opt.type === String` is JS identity (see primitiveCtorClosure). */
|
|
454
|
+
readonly primitiveCtorFns: Map<string, string>;
|
|
439
455
|
/** Optional-chain lowering state. While a chain body lowers, the guarded
|
|
440
456
|
* receiver NODE reads as a chainRecv (typed by the narrowed arm) instead
|
|
441
457
|
* of re-lowering, its checker type reads non-nullish (typeOf), and the
|
|
@@ -672,6 +688,17 @@ export declare class Lowerer {
|
|
|
672
688
|
* point for deferred collection diagnostics: resolving a reference to a
|
|
673
689
|
* broken declaration reports what collection deferred. */
|
|
674
690
|
resolveValueSymbol(ident: ts.Identifier): ts.Symbol | null;
|
|
691
|
+
/** The default-snapshot storage symbol a DEFAULT-import alias chain
|
|
692
|
+
* lands on, or null. A mutable entity-name default (`export default
|
|
693
|
+
* someLet`) registers its Node-semantics snapshot global under the
|
|
694
|
+
* exporter's default ALIAS symbol; the checker's getAliasedSymbol
|
|
695
|
+
* resolves through that symbol to the live let, so this walk follows
|
|
696
|
+
* the default hops syntactically — default import clauses, `{ default
|
|
697
|
+
* as x }` specifiers, `export { default } from` re-exports — and stops
|
|
698
|
+
* at the first default symbol carrying registered storage. Local
|
|
699
|
+
* `export { x as default }` specifiers (no module specifier) are LIVE
|
|
700
|
+
* bindings in Node and fall through to ordinary alias resolution. */
|
|
701
|
+
private defaultSnapshotSymbolOf;
|
|
675
702
|
/** A module's CJS export-table member symbol by NAME (the checker's
|
|
676
703
|
* module-symbol exports map — present in tsgo even where no expando
|
|
677
704
|
* property symbol exists at the attachment/use sites). */
|
|
@@ -734,6 +761,15 @@ export declare class Lowerer {
|
|
|
734
761
|
collectNpmImports(parts: FileParts[]): void;
|
|
735
762
|
collectJsonImports(parts: FileParts[]): void;
|
|
736
763
|
run(): LowerResult;
|
|
764
|
+
/** The unregistered-class type sweep (run()'s last step before the
|
|
765
|
+
* module assembles): every `{kind:"object"}` TYPE naming a class with
|
|
766
|
+
* no registered ClassInfo is rewritten IN PLACE to the f64 dummy.
|
|
767
|
+
* classval types are exempt (they emit the class-independent
|
|
768
|
+
* `ScrClassObj *` — inert-but-valid storage, the validator's own
|
|
769
|
+
* stance), and only type objects rewrite — node-level classNames
|
|
770
|
+
* (`new`, upcasts) cannot reach here (their lowerings fence without a
|
|
771
|
+
* registered class), so the validator still backstops those. */
|
|
772
|
+
sanitizeUnregisteredClassTypes(roots: unknown[]): void;
|
|
737
773
|
/** True when `t` (recursively) names a class instance type with no
|
|
738
774
|
* registered ClassInfo — the shape of a JS class whose collection fenced.
|
|
739
775
|
* Used by run()'s global pruning; shapes/unions recurse with a seen-set
|
|
@@ -756,7 +792,7 @@ export declare class Lowerer {
|
|
|
756
792
|
* demand-driven) and lifted lambdas lower inline with their enclosing
|
|
757
793
|
* body; both fire edges through the same hooks and are not units
|
|
758
794
|
* themselves. */
|
|
759
|
-
discover(): Set<string>;
|
|
795
|
+
discover(extraRoots?: readonly string[]): Set<string>;
|
|
760
796
|
/** Discovery hook (see discover): fires when lowering resolves a
|
|
761
797
|
* reference to a lowerable body. Inert in the emit pass. */
|
|
762
798
|
noteEdge(name: string): void;
|
|
@@ -904,6 +940,9 @@ export declare class Lowerer {
|
|
|
904
940
|
* copy loop, arrayWidthHelper)
|
|
905
941
|
* Null when the pair isn't in the relation — callers keep their fences. */
|
|
906
942
|
widthLiftPlan(src: IrType, dst: IrType): WidthLift | null;
|
|
943
|
+
/** True for the unit-only element types (`(null | undefined)[]`, the
|
|
944
|
+
* `readonly []` mapping): a union whose every arm is a unit. */
|
|
945
|
+
unitOnlyElem(t: IrType): boolean;
|
|
907
946
|
/** The build side of widthLiftPlan: the IrExpr converting `value` into
|
|
908
947
|
* `dst` under a plan the caller validated. Interns whatever helpers the
|
|
909
948
|
* lift needs (planned first, so the interns cannot fail — a failure here
|
|
@@ -932,6 +971,8 @@ export declare class Lowerer {
|
|
|
932
971
|
} | {
|
|
933
972
|
absent: true;
|
|
934
973
|
utag: number;
|
|
974
|
+
} | {
|
|
975
|
+
absentDyn: true;
|
|
935
976
|
}> | null;
|
|
936
977
|
recordWidthHelper(fromId: string, toId: string, loc: SrcLoc): string | null;
|
|
937
978
|
/** Interned `%arr.width.<n>(a)` — the per-element copy loop over
|
|
@@ -947,6 +988,16 @@ export declare class Lowerer {
|
|
|
947
988
|
tupleArrayWidthHelper(fromId: string, toT: IrType & {
|
|
948
989
|
kind: "array";
|
|
949
990
|
}, loc: SrcLoc): string | null;
|
|
991
|
+
/** Interned `%arr.empty.<n>(a)` — the EMPTY-array lift's build side: a
|
|
992
|
+
* unit-only-element array reshapes into any data-element array by
|
|
993
|
+
* answering a FRESH empty array, after a runtime non-empty trap (a
|
|
994
|
+
* genuinely inhabited `(null | undefined)[]` cannot reshape — the
|
|
995
|
+
* catchable-TypeError stance every checked extraction takes). */
|
|
996
|
+
emptyArrayLiftHelper(fromT: IrType & {
|
|
997
|
+
kind: "array";
|
|
998
|
+
}, toT: IrType & {
|
|
999
|
+
kind: "array";
|
|
1000
|
+
}, loc: SrcLoc): string;
|
|
950
1001
|
arrayWidthHelper(fromT: IrType & {
|
|
951
1002
|
kind: "array";
|
|
952
1003
|
}, toT: IrType & {
|
|
@@ -1145,6 +1196,17 @@ export declare class Lowerer {
|
|
|
1145
1196
|
* impossible value flow on). Null when the target isn't a non-unit arm
|
|
1146
1197
|
* of the union — those uses keep their erasure/fences. */
|
|
1147
1198
|
narrowedArmHelper(fromId: string, target: IrType, loc: SrcLoc): string | null;
|
|
1199
|
+
/** The DEFERRED-INIT field read (`stream!: T` assigned past the
|
|
1200
|
+
* constructor's top level — the slot is `T | undefined`): interned
|
|
1201
|
+
* `%deferred.read.<n>(u)` extracting the declared type. SCALAR arms
|
|
1202
|
+
* whose JS-undefined behavior a unit default reproduces read that
|
|
1203
|
+
* default — bool false (conditions are exact: undefined and false are
|
|
1204
|
+
* both falsy; only printing/strict-equality could tell) and f64 NaN
|
|
1205
|
+
* (arithmetic and conditions exact) — while string and REF arms keep
|
|
1206
|
+
* the checked-extraction TRAP: JS itself TypeErrors the first member
|
|
1207
|
+
* use of such an undefined, so the catchable TypeError at the read is
|
|
1208
|
+
* the same failure, named earlier (SEMANTICS.md). */
|
|
1209
|
+
deferredReadHelper(fromId: string, target: IrType, loc: SrcLoc): string | null;
|
|
1148
1210
|
/** True when a static value can become ONE island value: jsval itself,
|
|
1149
1211
|
* anything boundary-safe (the deep JSON marshal), a record whose fields
|
|
1150
1212
|
* all can (built as an island OBJECT literal, field by field), or an
|
|
@@ -1467,6 +1529,14 @@ export declare class Lowerer {
|
|
|
1467
1529
|
* through arrows (function expressions/declarations reset `this` in JS;
|
|
1468
1530
|
* their bodies never see an enclosing method's binding). */
|
|
1469
1531
|
resolveThis(): IrLocal | null;
|
|
1532
|
+
/** READ-ONLY twin of resolveLocal for PROBES (isIslandExpr): answers
|
|
1533
|
+
* the nearest binding entry without boxing, threading, or predeclaring.
|
|
1534
|
+
* resolveKey mutates capture state as a side effect, and a speculative
|
|
1535
|
+
* island-ness query through a context that takes no captures (a plain
|
|
1536
|
+
* declared function between the origin and the reference) was an ICE —
|
|
1537
|
+
* the REAL lowering path still resolves (and diagnoses) the reference
|
|
1538
|
+
* itself. */
|
|
1539
|
+
peekLocal(ident: ts.Identifier): IrLocal | null;
|
|
1470
1540
|
resolveKey(symbol: ts.Symbol, blame?: ts.Node): IrLocal | null;
|
|
1471
1541
|
isSelfReference(ident: ts.Identifier): boolean;
|
|
1472
1542
|
lowerStmts(stmts: readonly ts.Statement[]): IrStmt[];
|
|
@@ -1625,7 +1695,7 @@ export declare class Lowerer {
|
|
|
1625
1695
|
rejectComptimeCaptures(cb: ts.ArrowFunction | ts.FunctionExpression): void;
|
|
1626
1696
|
comptimeValueToIr(value: unknown, expected: IrType, path: string, blame: ts.Node): IrExpr;
|
|
1627
1697
|
isConsoleLog(call: ts.CallExpression): boolean;
|
|
1628
|
-
consoleCallMember(call: ts.CallExpression): "log" | "error" | "warn" | null;
|
|
1698
|
+
consoleCallMember(call: ts.CallExpression): "log" | "info" | "debug" | "error" | "warn" | null;
|
|
1629
1699
|
builtinImportOf(ident: ts.Identifier): {
|
|
1630
1700
|
module: string;
|
|
1631
1701
|
member: string;
|