@scriptc/compiler 0.0.0 → 0.0.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/LICENSE +202 -0
- package/ambient/package.json +3 -0
- package/ambient/scriptc-node-fallback.d.ts +3001 -0
- package/ambient/scriptc-overrides.d.ts +95 -0
- package/ambient/scriptc.d.ts +74 -0
- package/dist/backend/cc.d.ts +169 -0
- package/dist/backend/cc.js +897 -0
- package/dist/backend/cc.js.map +1 -0
- package/dist/backend/emission/emit-async.d.ts +145 -0
- package/dist/backend/emission/emit-async.js +996 -0
- package/dist/backend/emission/emit-async.js.map +1 -0
- package/dist/backend/emission/emit-exprs.d.ts +3 -0
- package/dist/backend/emission/emit-exprs.js +5949 -0
- package/dist/backend/emission/emit-exprs.js.map +1 -0
- package/dist/backend/emission/emit-island.d.ts +45 -0
- package/dist/backend/emission/emit-island.js +271 -0
- package/dist/backend/emission/emit-island.js.map +1 -0
- package/dist/backend/emission/emit-shapes.d.ts +142 -0
- package/dist/backend/emission/emit-shapes.js +575 -0
- package/dist/backend/emission/emit-shapes.js.map +1 -0
- package/dist/backend/emission/emit-stmts.d.ts +78 -0
- package/dist/backend/emission/emit-stmts.js +960 -0
- package/dist/backend/emission/emit-stmts.js.map +1 -0
- package/dist/backend/emission/emit-types.d.ts +65 -0
- package/dist/backend/emission/emit-types.js +652 -0
- package/dist/backend/emission/emit-types.js.map +1 -0
- package/dist/backend/emission/emit-walkers.d.ts +154 -0
- package/dist/backend/emission/emit-walkers.js +1587 -0
- package/dist/backend/emission/emit-walkers.js.map +1 -0
- package/dist/backend/emission/emitter.d.ts +452 -0
- package/dist/backend/emission/emitter.js +1249 -0
- package/dist/backend/emission/emitter.js.map +1 -0
- package/dist/backend/emission/may-throw.d.ts +15 -0
- package/dist/backend/emission/may-throw.js +250 -0
- package/dist/backend/emission/may-throw.js.map +1 -0
- package/dist/backend/llvm/blocks.d.ts +21 -0
- package/dist/backend/llvm/blocks.js +68 -0
- package/dist/backend/llvm/blocks.js.map +1 -0
- package/dist/backend/llvm/classes.d.ts +84 -0
- package/dist/backend/llvm/classes.js +438 -0
- package/dist/backend/llvm/classes.js.map +1 -0
- package/dist/backend/llvm/dyn.d.ts +123 -0
- package/dist/backend/llvm/dyn.js +2624 -0
- package/dist/backend/llvm/dyn.js.map +1 -0
- package/dist/backend/llvm/emitter.d.ts +3 -0
- package/dist/backend/llvm/emitter.js +10102 -0
- package/dist/backend/llvm/emitter.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +78 -0
- package/dist/backend/llvm/shapes.js +754 -0
- package/dist/backend/llvm/shapes.js.map +1 -0
- package/dist/backend/llvm/unsupported.d.ts +6 -0
- package/dist/backend/llvm/unsupported.js +12 -0
- package/dist/backend/llvm/unsupported.js.map +1 -0
- package/dist/backend/llvm/walkers.d.ts +58 -0
- package/dist/backend/llvm/walkers.js +793 -0
- package/dist/backend/llvm/walkers.js.map +1 -0
- package/dist/backend/mangle.d.ts +124 -0
- package/dist/backend/mangle.js +232 -0
- package/dist/backend/mangle.js.map +1 -0
- package/dist/coverage/report.d.ts +65 -0
- package/dist/coverage/report.js +238 -0
- package/dist/coverage/report.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +140 -0
- package/dist/diagnostics/diagnostic.js +458 -0
- package/dist/diagnostics/diagnostic.js.map +1 -0
- package/dist/diagnostics/render.d.ts +11 -0
- package/dist/diagnostics/render.js +58 -0
- package/dist/diagnostics/render.js.map +1 -0
- package/dist/frontend/cjs-lexer.d.ts +20 -0
- package/dist/frontend/cjs-lexer.js +813 -0
- package/dist/frontend/cjs-lexer.js.map +1 -0
- package/dist/frontend/lowering/http2-constants.d.ts +1 -0
- package/dist/frontend/lowering/http2-constants.js +251 -0
- package/dist/frontend/lowering/http2-constants.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.d.ts +6 -0
- package/dist/frontend/lowering/lib-boundary.js +143 -0
- package/dist/frontend/lowering/lib-boundary.js.map +1 -0
- package/dist/frontend/lowering/lower-assert.d.ts +18 -0
- package/dist/frontend/lowering/lower-assert.js +1269 -0
- package/dist/frontend/lowering/lower-assert.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.d.ts +511 -0
- package/dist/frontend/lowering/lower-builtins.js +5249 -0
- package/dist/frontend/lowering/lower-builtins.js.map +1 -0
- package/dist/frontend/lowering/lower-calls.d.ts +581 -0
- package/dist/frontend/lowering/lower-calls.js +6286 -0
- package/dist/frontend/lowering/lower-calls.js.map +1 -0
- package/dist/frontend/lowering/lower-classes.d.ts +727 -0
- package/dist/frontend/lowering/lower-classes.js +4701 -0
- package/dist/frontend/lowering/lower-classes.js.map +1 -0
- package/dist/frontend/lowering/lower-comptime.d.ts +53 -0
- package/dist/frontend/lowering/lower-comptime.js +244 -0
- package/dist/frontend/lowering/lower-comptime.js.map +1 -0
- package/dist/frontend/lowering/lower-containers.d.ts +486 -0
- package/dist/frontend/lowering/lower-containers.js +6345 -0
- package/dist/frontend/lowering/lower-containers.js.map +1 -0
- package/dist/frontend/lowering/lower-dgram.d.ts +20 -0
- package/dist/frontend/lowering/lower-dgram.js +319 -0
- package/dist/frontend/lowering/lower-dgram.js.map +1 -0
- package/dist/frontend/lowering/lower-emitter.d.ts +10 -0
- package/dist/frontend/lowering/lower-emitter.js +688 -0
- package/dist/frontend/lowering/lower-emitter.js.map +1 -0
- package/dist/frontend/lowering/lower-enums.d.ts +22 -0
- package/dist/frontend/lowering/lower-enums.js +235 -0
- package/dist/frontend/lowering/lower-enums.js.map +1 -0
- package/dist/frontend/lowering/lower-expando.d.ts +35 -0
- package/dist/frontend/lowering/lower-expando.js +276 -0
- package/dist/frontend/lowering/lower-expando.js.map +1 -0
- package/dist/frontend/lowering/lower-exprs.d.ts +524 -0
- package/dist/frontend/lowering/lower-exprs.js +8111 -0
- package/dist/frontend/lowering/lower-exprs.js.map +1 -0
- package/dist/frontend/lowering/lower-generators.d.ts +50 -0
- package/dist/frontend/lowering/lower-generators.js +421 -0
- package/dist/frontend/lowering/lower-generators.js.map +1 -0
- package/dist/frontend/lowering/lower-inspect.d.ts +20 -0
- package/dist/frontend/lowering/lower-inspect.js +1074 -0
- package/dist/frontend/lowering/lower-inspect.js.map +1 -0
- package/dist/frontend/lowering/lower-island.d.ts +108 -0
- package/dist/frontend/lowering/lower-island.js +650 -0
- package/dist/frontend/lowering/lower-island.js.map +1 -0
- package/dist/frontend/lowering/lower-mixins.d.ts +96 -0
- package/dist/frontend/lowering/lower-mixins.js +534 -0
- package/dist/frontend/lowering/lower-mixins.js.map +1 -0
- package/dist/frontend/lowering/lower-modules.d.ts +135 -0
- package/dist/frontend/lowering/lower-modules.js +1613 -0
- package/dist/frontend/lowering/lower-modules.js.map +1 -0
- package/dist/frontend/lowering/lower-namespaces.d.ts +168 -0
- package/dist/frontend/lowering/lower-namespaces.js +706 -0
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -0
- package/dist/frontend/lowering/lower-server.d.ts +90 -0
- package/dist/frontend/lowering/lower-server.js +3471 -0
- package/dist/frontend/lowering/lower-server.js.map +1 -0
- package/dist/frontend/lowering/lower-stmts.d.ts +361 -0
- package/dist/frontend/lowering/lower-stmts.js +5341 -0
- package/dist/frontend/lowering/lower-stmts.js.map +1 -0
- package/dist/frontend/lowering/lower-stream.d.ts +88 -0
- package/dist/frontend/lowering/lower-stream.js +1533 -0
- package/dist/frontend/lowering/lower-stream.js.map +1 -0
- package/dist/frontend/lowering/lower-test.d.ts +27 -0
- package/dist/frontend/lowering/lower-test.js +353 -0
- package/dist/frontend/lowering/lower-test.js.map +1 -0
- package/dist/frontend/lowering/lowerer.d.ts +1748 -0
- package/dist/frontend/lowering/lowerer.js +6257 -0
- package/dist/frontend/lowering/lowerer.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +272 -0
- package/dist/frontend/lowering/surfaces.js +1096 -0
- package/dist/frontend/lowering/surfaces.js.map +1 -0
- package/dist/frontend/npm-static.d.ts +55 -0
- package/dist/frontend/npm-static.js +300 -0
- package/dist/frontend/npm-static.js.map +1 -0
- package/dist/frontend/npm.d.ts +330 -0
- package/dist/frontend/npm.js +1259 -0
- package/dist/frontend/npm.js.map +1 -0
- package/dist/frontend/program.d.ts +186 -0
- package/dist/frontend/program.js +2255 -0
- package/dist/frontend/program.js.map +1 -0
- package/dist/frontend/provenance-registry.d.ts +48 -0
- package/dist/frontend/provenance-registry.js +87 -0
- package/dist/frontend/provenance-registry.js.map +1 -0
- package/dist/frontend/provenance.d.ts +6 -0
- package/dist/frontend/provenance.js +459 -0
- package/dist/frontend/provenance.js.map +1 -0
- package/dist/frontend/resolve.d.ts +56 -0
- package/dist/frontend/resolve.js +682 -0
- package/dist/frontend/resolve.js.map +1 -0
- package/dist/frontend/shared.d.ts +67 -0
- package/dist/frontend/shared.js +241 -0
- package/dist/frontend/shared.js.map +1 -0
- package/dist/frontend/ts7/adapter.d.ts +7 -0
- package/dist/frontend/ts7/adapter.js +54 -0
- package/dist/frontend/ts7/adapter.js.map +1 -0
- package/dist/frontend/ts7/ast.d.ts +50 -0
- package/dist/frontend/ts7/ast.js +211 -0
- package/dist/frontend/ts7/ast.js.map +1 -0
- package/dist/frontend/ts7/census-check.d.ts +1 -0
- package/dist/frontend/ts7/census-check.js +12 -0
- package/dist/frontend/ts7/census-check.js.map +1 -0
- package/dist/frontend/ts7/checker.d.ts +140 -0
- package/dist/frontend/ts7/checker.js +544 -0
- package/dist/frontend/ts7/checker.js.map +1 -0
- package/dist/frontend/ts7/enums.d.ts +18 -0
- package/dist/frontend/ts7/enums.js +43 -0
- package/dist/frontend/ts7/enums.js.map +1 -0
- package/dist/frontend/ts7/program.d.ts +99 -0
- package/dist/frontend/ts7/program.js +278 -0
- package/dist/frontend/ts7/program.js.map +1 -0
- package/dist/frontend/ts7/world-check.d.ts +3 -0
- package/dist/frontend/ts7/world-check.js +34 -0
- package/dist/frontend/ts7/world-check.js.map +1 -0
- package/dist/frontend/types.d.ts +205 -0
- package/dist/frontend/types.js +2485 -0
- package/dist/frontend/types.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +429 -0
- package/dist/index.js.map +1 -0
- package/dist/ir/nodes.d.ts +4334 -0
- package/dist/ir/nodes.js +1906 -0
- package/dist/ir/nodes.js.map +1 -0
- package/dist/ir/serialize.d.ts +4 -0
- package/dist/ir/serialize.js +34 -0
- package/dist/ir/serialize.js.map +1 -0
- package/dist/ir/validate.d.ts +36 -0
- package/dist/ir/validate.js +4885 -0
- package/dist/ir/validate.js.map +1 -0
- package/package.json +30 -6
- package/README.md +0 -3
- package/index.js +0 -2
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/* The AST layer of the census under the 5.9.3 names, over 7.0.2's client
|
|
2
|
+
* AST (typescript/unstable/ast — fully client-side, no IPC anywhere in this
|
|
3
|
+
* module).
|
|
4
|
+
*
|
|
5
|
+
* Guards: 82 of the census's 90 is* guards re-export same-name; seven were
|
|
6
|
+
* renamed in 7 (isParameter -> isParameterDeclaration and friends) and alias
|
|
7
|
+
* back here; isExternalModule was dropped (the client SourceFile exposes
|
|
8
|
+
* externalModuleIndicator instead) and is shimmed. isFunctionLike is the one
|
|
9
|
+
* SEMANTIC rename: 7's isFunctionLikeDeclaration is narrower (declarations
|
|
10
|
+
* only), so the shim composes 7's isSignatureDeclaration — the same kind set
|
|
11
|
+
* 5.9.3's isFunctionLike accepts, minus the JSDoc closure-syntax function
|
|
12
|
+
* type (tsgo dropped that node kind) — plus JSDocSignature.
|
|
13
|
+
*
|
|
14
|
+
* Helpers: the free-function forms 7 moved onto Node/SourceFile methods
|
|
15
|
+
* (forEachChild, getLineAndCharacterOfPosition), and the pure-AST utilities
|
|
16
|
+
* the package dropped (getCombinedNodeFlags/getCombinedModifierFlags/
|
|
17
|
+
* canHaveModifiers/getModifiers), reimplemented from the 5.9.3 semantics
|
|
18
|
+
* over 7's nodes with 7's enum values only. */
|
|
19
|
+
import { isAccessorDeclaration, isBindingElement, isGetAccessorDeclaration, isJSDocSignature, isParameterDeclaration, isPropertySignatureDeclaration, isSetAccessorDeclaration, isSignatureDeclaration, isStringLiteralLikeNode, isVariableDeclaration, isVariableDeclarationList, isVariableStatement, } from "typescript/unstable/ast/is";
|
|
20
|
+
import { ModifierFlags, SyntaxKind } from "./enums.js";
|
|
21
|
+
/* ---- everything 7 kept under the same name ---- */
|
|
22
|
+
// The full client AST: every census type-position name (Expression,
|
|
23
|
+
// CallExpression, Statement, SourceFile, NodeArray, ...), all same-name
|
|
24
|
+
// guards, tokenToString, escape helpers, the scanner, and the visitor.
|
|
25
|
+
export * from "typescript/unstable/ast";
|
|
26
|
+
/* ---- the seven renamed guards, under their 5.9.3 names ---- */
|
|
27
|
+
export const isParameter = isParameterDeclaration;
|
|
28
|
+
export const isPropertySignature = isPropertySignatureDeclaration;
|
|
29
|
+
export const isStringLiteralLike = isStringLiteralLikeNode;
|
|
30
|
+
export const isGetAccessor = isGetAccessorDeclaration;
|
|
31
|
+
export const isSetAccessor = isSetAccessorDeclaration;
|
|
32
|
+
export const isAccessor = isAccessorDeclaration;
|
|
33
|
+
/** 5.9.3's isFunctionLike: true for every SignatureDeclaration kind. 7's
|
|
34
|
+
* same-set guard is isSignatureDeclaration (its isFunctionLikeDeclaration is
|
|
35
|
+
* the narrower declarations-only check); JSDocSignature joins because 5.9.3
|
|
36
|
+
* counts it. 5.9.3 also accepted JSDocFunctionType — a node kind tsgo no
|
|
37
|
+
* longer produces, so no walk over a 7 AST can present one. */
|
|
38
|
+
export function isFunctionLike(node) {
|
|
39
|
+
return isSignatureDeclaration(node) || isJSDocSignature(node);
|
|
40
|
+
}
|
|
41
|
+
/** 5.9.3's isExternalModule: 7 exposes the indicator on the SourceFile. */
|
|
42
|
+
export function isExternalModule(file) {
|
|
43
|
+
return file.externalModuleIndicator !== undefined;
|
|
44
|
+
}
|
|
45
|
+
/* ---- free-function forms 7 moved onto the nodes ---- */
|
|
46
|
+
export function forEachChild(node, cbNode, cbNodes) {
|
|
47
|
+
return node.forEachChild(cbNode, cbNodes);
|
|
48
|
+
}
|
|
49
|
+
/** Preorder walk over a whole subtree with an EXPLICIT stack. The idiomatic
|
|
50
|
+
* recursive forEachChild visit costs two JS frames per AST level, so a
|
|
51
|
+
* pathologically deep tree — the ~6500-term left-nested binary chain of the
|
|
52
|
+
* binderBinaryExpressionStress corpus pair — overflows the stack as an ICE
|
|
53
|
+
* before the lowering's SC1090 nesting fence (200 levels) ever sees the
|
|
54
|
+
* expression. Whole-file sweeps (prefetch, require scans, `arguments`
|
|
55
|
+
* detection) walk this way instead, so absurd nesting always reaches the
|
|
56
|
+
* named fence. The callback may answer "skip" to leave a node's children
|
|
57
|
+
* unvisited (scope and depth cut-offs — `depth` counts levels below the
|
|
58
|
+
* root) or "stop" to end the walk early. */
|
|
59
|
+
export function walkPreorder(root, cb) {
|
|
60
|
+
const stack = [[root, 0]];
|
|
61
|
+
const children = [];
|
|
62
|
+
while (stack.length > 0) {
|
|
63
|
+
const [n, depth] = stack.pop();
|
|
64
|
+
const verdict = cb(n, depth);
|
|
65
|
+
if (verdict === "stop")
|
|
66
|
+
return;
|
|
67
|
+
if (verdict === "skip")
|
|
68
|
+
continue;
|
|
69
|
+
children.length = 0;
|
|
70
|
+
n.forEachChild((c) => {
|
|
71
|
+
children.push(c);
|
|
72
|
+
});
|
|
73
|
+
for (let i = children.length - 1; i >= 0; i--)
|
|
74
|
+
stack.push([children[i], depth + 1]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export function getLineAndCharacterOfPosition(sourceFile, position) {
|
|
78
|
+
return sourceFile.getLineAndCharacterOfPosition(position);
|
|
79
|
+
}
|
|
80
|
+
/* ---- pure-AST utilities the package dropped ---- */
|
|
81
|
+
/* 5.9.3's canHaveModifiers kind set, spelled with 7's SyntaxKind keys (all
|
|
82
|
+
* fifteen exist under the same names in 7; kinds are compared symbolically,
|
|
83
|
+
* never numerically). */
|
|
84
|
+
const MODIFIER_HOSTS = new Set([
|
|
85
|
+
SyntaxKind.TypeParameter,
|
|
86
|
+
SyntaxKind.Parameter,
|
|
87
|
+
SyntaxKind.PropertySignature,
|
|
88
|
+
SyntaxKind.PropertyDeclaration,
|
|
89
|
+
SyntaxKind.MethodSignature,
|
|
90
|
+
SyntaxKind.MethodDeclaration,
|
|
91
|
+
SyntaxKind.Constructor,
|
|
92
|
+
SyntaxKind.GetAccessor,
|
|
93
|
+
SyntaxKind.SetAccessor,
|
|
94
|
+
SyntaxKind.IndexSignature,
|
|
95
|
+
SyntaxKind.ConstructorType,
|
|
96
|
+
SyntaxKind.FunctionExpression,
|
|
97
|
+
SyntaxKind.ArrowFunction,
|
|
98
|
+
SyntaxKind.ClassExpression,
|
|
99
|
+
SyntaxKind.VariableStatement,
|
|
100
|
+
SyntaxKind.FunctionDeclaration,
|
|
101
|
+
SyntaxKind.ClassDeclaration,
|
|
102
|
+
SyntaxKind.InterfaceDeclaration,
|
|
103
|
+
SyntaxKind.TypeAliasDeclaration,
|
|
104
|
+
SyntaxKind.EnumDeclaration,
|
|
105
|
+
SyntaxKind.ModuleDeclaration,
|
|
106
|
+
SyntaxKind.ImportEqualsDeclaration,
|
|
107
|
+
SyntaxKind.ImportDeclaration,
|
|
108
|
+
SyntaxKind.ExportAssignment,
|
|
109
|
+
SyntaxKind.ExportDeclaration,
|
|
110
|
+
]);
|
|
111
|
+
export function canHaveModifiers(node) {
|
|
112
|
+
return MODIFIER_HOSTS.has(node.kind);
|
|
113
|
+
}
|
|
114
|
+
/** The node's modifier tokens, decorators excluded (5.9.3's getModifiers). */
|
|
115
|
+
export function getModifiers(node) {
|
|
116
|
+
const modifiers = node.modifiers;
|
|
117
|
+
if (modifiers === undefined)
|
|
118
|
+
return undefined;
|
|
119
|
+
return modifiers.filter((m) => m.kind !== SyntaxKind.Decorator);
|
|
120
|
+
}
|
|
121
|
+
/* Modifier token kind -> ModifierFlags bit, both sides 7's enums. */
|
|
122
|
+
function modifierToFlag(kind) {
|
|
123
|
+
switch (kind) {
|
|
124
|
+
case SyntaxKind.StaticKeyword: return ModifierFlags.Static;
|
|
125
|
+
case SyntaxKind.PublicKeyword: return ModifierFlags.Public;
|
|
126
|
+
case SyntaxKind.ProtectedKeyword: return ModifierFlags.Protected;
|
|
127
|
+
case SyntaxKind.PrivateKeyword: return ModifierFlags.Private;
|
|
128
|
+
case SyntaxKind.AbstractKeyword: return ModifierFlags.Abstract;
|
|
129
|
+
case SyntaxKind.AccessorKeyword: return ModifierFlags.Accessor;
|
|
130
|
+
case SyntaxKind.AsyncKeyword: return ModifierFlags.Async;
|
|
131
|
+
case SyntaxKind.ReadonlyKeyword: return ModifierFlags.Readonly;
|
|
132
|
+
case SyntaxKind.OverrideKeyword: return ModifierFlags.Override;
|
|
133
|
+
case SyntaxKind.ExportKeyword: return ModifierFlags.Export;
|
|
134
|
+
case SyntaxKind.DeclareKeyword: return ModifierFlags.Ambient;
|
|
135
|
+
case SyntaxKind.ConstKeyword: return ModifierFlags.Const;
|
|
136
|
+
case SyntaxKind.DefaultKeyword: return ModifierFlags.Default;
|
|
137
|
+
case SyntaxKind.InKeyword: return ModifierFlags.In;
|
|
138
|
+
case SyntaxKind.OutKeyword: return ModifierFlags.Out;
|
|
139
|
+
case SyntaxKind.Decorator: return ModifierFlags.Decorator;
|
|
140
|
+
default: return ModifierFlags.None;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function modifierFlagsOfNode(node) {
|
|
144
|
+
const modifiers = node.modifiers;
|
|
145
|
+
let flags = ModifierFlags.None;
|
|
146
|
+
if (modifiers !== undefined) {
|
|
147
|
+
for (const m of modifiers)
|
|
148
|
+
flags |= modifierToFlag(m.kind);
|
|
149
|
+
}
|
|
150
|
+
// 5.9.3 counts an identifier-flagged this-keyword edge case we skip: it
|
|
151
|
+
// only arises for parser-manufactured identifiers, which client walks
|
|
152
|
+
// never observe.
|
|
153
|
+
return flags;
|
|
154
|
+
}
|
|
155
|
+
/* The shared declaration-chain walk of 5.9.3's getCombinedNodeFlags /
|
|
156
|
+
* getCombinedModifierFlags, mirrored exactly: a binding element climbs to
|
|
157
|
+
* the declaration that hosts its outermost pattern; a variable declaration
|
|
158
|
+
* merges its list's flags, the list its statement's. */
|
|
159
|
+
function walkUpBindingElementsAndPatterns(bindingElement) {
|
|
160
|
+
let node = bindingElement.parent; // the binding pattern
|
|
161
|
+
while (isBindingElement(node.parent)) {
|
|
162
|
+
node = node.parent.parent;
|
|
163
|
+
}
|
|
164
|
+
return node.parent; // VariableDeclaration or ParameterDeclaration
|
|
165
|
+
}
|
|
166
|
+
function getCombinedFlags(node, getFlags) {
|
|
167
|
+
let n = isBindingElement(node) ? walkUpBindingElementsAndPatterns(node) : node;
|
|
168
|
+
let flags = getFlags(n);
|
|
169
|
+
if (isVariableDeclaration(n))
|
|
170
|
+
n = n.parent;
|
|
171
|
+
if (n !== undefined && isVariableDeclarationList(n)) {
|
|
172
|
+
flags |= getFlags(n);
|
|
173
|
+
n = n.parent;
|
|
174
|
+
}
|
|
175
|
+
if (n !== undefined && isVariableStatement(n)) {
|
|
176
|
+
flags |= getFlags(n);
|
|
177
|
+
}
|
|
178
|
+
return flags;
|
|
179
|
+
}
|
|
180
|
+
/** 5.9.3's getCombinedNodeFlags (the Const/Let/Using answer for a
|
|
181
|
+
* declaration, wherever in the binding chain the flag sits). */
|
|
182
|
+
export function getCombinedNodeFlags(node) {
|
|
183
|
+
return getCombinedFlags(node, (n) => n.flags);
|
|
184
|
+
}
|
|
185
|
+
/** 5.9.3's getCombinedModifierFlags. */
|
|
186
|
+
export function getCombinedModifierFlags(node) {
|
|
187
|
+
return getCombinedFlags(node, modifierFlagsOfNode);
|
|
188
|
+
}
|
|
189
|
+
/* ---- diagnostics text ---- */
|
|
190
|
+
/** 5.9.3's flattenDiagnosticMessageText, widened for the 7 world: 7's
|
|
191
|
+
* Diagnostic carries flat text plus a messageChain of the same shape, so
|
|
192
|
+
* this accepts either a plain string (already flat) or a 7 Diagnostic and
|
|
193
|
+
* renders the chain with 5.9.3's indentation layout. */
|
|
194
|
+
export function flattenDiagnosticMessageText(diag, newLine, indent = 0) {
|
|
195
|
+
if (diag === undefined)
|
|
196
|
+
return "";
|
|
197
|
+
if (typeof diag === "string")
|
|
198
|
+
return diag;
|
|
199
|
+
let result = "";
|
|
200
|
+
if (indent > 0) {
|
|
201
|
+
result += newLine;
|
|
202
|
+
for (let i = 0; i < indent; i++)
|
|
203
|
+
result += " ";
|
|
204
|
+
}
|
|
205
|
+
result += diag.text;
|
|
206
|
+
for (const child of diag.messageChain ?? []) {
|
|
207
|
+
result += flattenDiagnosticMessageText(child, newLine, indent + 1);
|
|
208
|
+
}
|
|
209
|
+
return result;
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=ast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../src/frontend/ts7/ast.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;+CAiB+C;AAe/C,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,EAC9B,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvD,qDAAqD;AAErD,oEAAoE;AACpE,wEAAwE;AACxE,uEAAuE;AACvE,cAAc,yBAAyB,CAAC;AAExC,iEAAiE;AAEjE,MAAM,CAAC,MAAM,WAAW,GAAiD,sBAAsB,CAAC;AAChG,MAAM,CAAC,MAAM,mBAAmB,GAC9B,8BAA8B,CAAC;AACjC,MAAM,CAAC,MAAM,mBAAmB,GAAkD,uBAAuB,CAAC;AAC1G,MAAM,CAAC,MAAM,aAAa,GAAmD,wBAAwB,CAAC;AACtG,MAAM,CAAC,MAAM,aAAa,GAAmD,wBAAwB,CAAC;AACtG,MAAM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AE,MAAM,GAAG,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* Census TYPE coverage, enforced at build time: every type-position name
|
|
2
|
+
* the frontend census uses (census-ts-members.tsv — the top-40 table and
|
|
3
|
+
* the long tail) must resolve through the adapter, so the phase-2 port
|
|
4
|
+
* never discovers a missing type mid-swap. pnpm build fails here if any
|
|
5
|
+
* name drops out of the adapter's surface.
|
|
6
|
+
*
|
|
7
|
+
* Not present, per the survey's MISSING list and the two-world design:
|
|
8
|
+
* ts.Types (a comment-text census artifact, not an API), and the island
|
|
9
|
+
* surface that stays 5.9.3 (createSourceFile/preProcessFile/transpileModule
|
|
10
|
+
* and the resolution/config-file helpers' 5.9.3 types). */
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=census-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"census-check.js","sourceRoot":"","sources":["../../../src/frontend/ts7/census-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;2DAS2D"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Node, SourceFile } from "typescript/unstable/ast";
|
|
2
|
+
import type { Checker, IndexInfo, Project, Signature, Symbol as Ts7Symbol, Type, TypePredicate, TypeReference } from "typescript/unstable/sync";
|
|
3
|
+
export declare class CheckerFacade {
|
|
4
|
+
/** The underlying 7.0.2 sync checker — exposed for methods the facade
|
|
5
|
+
* does not shim; going around the facade forfeits memoization only. */
|
|
6
|
+
readonly raw: Checker;
|
|
7
|
+
private readonly options;
|
|
8
|
+
/** Node-keyed memos. `undefined` results are represented by map presence
|
|
9
|
+
* (WeakMap.has), so misses and cached-undefined are distinguishable. */
|
|
10
|
+
private readonly typeAtLocation;
|
|
11
|
+
private readonly symbolAtLocation;
|
|
12
|
+
private readonly contextualType;
|
|
13
|
+
private readonly typeFromTypeNode;
|
|
14
|
+
private readonly shorthandValueSymbol;
|
|
15
|
+
private readonly resolvedSignature;
|
|
16
|
+
private readonly signatureFromDeclaration;
|
|
17
|
+
/** Symbol-keyed memos. */
|
|
18
|
+
private readonly typeOfSymbol;
|
|
19
|
+
private readonly aliasedSymbol;
|
|
20
|
+
private readonly declaredTypeOfSymbol;
|
|
21
|
+
/** Type-keyed memos. */
|
|
22
|
+
private readonly baseTypeOfLiteral;
|
|
23
|
+
private readonly nonNullableType;
|
|
24
|
+
private readonly propertiesOfType;
|
|
25
|
+
private readonly indexInfosOfType;
|
|
26
|
+
private readonly typeArgumentsOf;
|
|
27
|
+
private readonly arrayTypeAnswer;
|
|
28
|
+
private readonly arrayLikeAnswer;
|
|
29
|
+
private readonly typeStringOf;
|
|
30
|
+
private readonly awaitedTypeOf;
|
|
31
|
+
/** Signature-keyed memos. */
|
|
32
|
+
private readonly returnTypeOf;
|
|
33
|
+
private readonly typePredicateOf;
|
|
34
|
+
/** Files whose nodes have been batch-prefetched, per query kind. */
|
|
35
|
+
private readonly prefetchedTypes;
|
|
36
|
+
private readonly prefetchedSymbols;
|
|
37
|
+
private unknownType;
|
|
38
|
+
/** Intrinsic singletons (string/number/bigint/boolean), fetched once. */
|
|
39
|
+
private readonly intrinsics;
|
|
40
|
+
private readonly tupleTypeAnswer;
|
|
41
|
+
constructor(
|
|
42
|
+
/** The underlying 7.0.2 sync checker — exposed for methods the facade
|
|
43
|
+
* does not shim; going around the facade forfeits memoization only. */
|
|
44
|
+
raw: Checker, options?: {
|
|
45
|
+
autoPrefetch?: boolean;
|
|
46
|
+
project?: Project;
|
|
47
|
+
});
|
|
48
|
+
private readonly declsOf;
|
|
49
|
+
private readonly valueDeclOf;
|
|
50
|
+
private requireProject;
|
|
51
|
+
/** 5.9.3's symbol.declarations (never undefined here: 7 answers an empty
|
|
52
|
+
* array where 5.9.3 answered undefined — callers treat them alike). */
|
|
53
|
+
declarationsOf(symbol: Ts7Symbol): readonly Node[];
|
|
54
|
+
/** 5.9.3's symbol.valueDeclaration. */
|
|
55
|
+
valueDeclarationOf(symbol: Ts7Symbol): Node | undefined;
|
|
56
|
+
/** 5.9.3's signature.getDeclaration() (undefined for synthesized
|
|
57
|
+
* signatures — same contract as sig.declaration there). */
|
|
58
|
+
signatureDeclaration(signature: Signature): Node | undefined;
|
|
59
|
+
private readonly sigDeclOf;
|
|
60
|
+
/** 5.9.3's type.getCallSignatures(). */
|
|
61
|
+
getCallSignatures(type: Type): readonly Signature[];
|
|
62
|
+
private readonly callSigsOf;
|
|
63
|
+
/** 5.9.3's type.getConstructSignatures(). */
|
|
64
|
+
getConstructSignatures(type: Type): readonly Signature[];
|
|
65
|
+
private readonly ctorSigsOf;
|
|
66
|
+
/** 5.9.3's type.getProperty(name). */
|
|
67
|
+
getPropertyOfType(type: Type, name: string): Ts7Symbol | undefined;
|
|
68
|
+
/** The 5.9.3 checker never answered undefined from getTypeAtLocation-
|
|
69
|
+
* family queries (errorType/anyType stood in); the 7 client loosens them
|
|
70
|
+
* to `T | undefined`. The lowering is written against the 5.9.3 contract,
|
|
71
|
+
* so the facade restores it: undefined becomes anyType — exactly the
|
|
72
|
+
* equivalence the parity battery pinned (a 7-side undefined renders as
|
|
73
|
+
* "any" wherever 5.9.3 said any). */
|
|
74
|
+
private anyType;
|
|
75
|
+
/** Batch-prefetches getTypeAtLocation and getSymbolAtLocation for every
|
|
76
|
+
* node of the file, plus getTypeOfSymbol for every symbol those answers
|
|
77
|
+
* surfaced — the per-file hook that turns the lowering's walk into three
|
|
78
|
+
* array requests instead of thousands of round trips. */
|
|
79
|
+
prefetchSourceFile(sf: SourceFile): void;
|
|
80
|
+
private prefetchTypes;
|
|
81
|
+
/** withPanicFence over the type sweep (observed panic: GetTypeAtLocation
|
|
82
|
+
* over an unresolved npm import's clause — a server-side nil deref). */
|
|
83
|
+
private typesWithPanicFence;
|
|
84
|
+
private prefetchSymbols;
|
|
85
|
+
private autoPrefetch;
|
|
86
|
+
getTypeAtLocation(node: Node): Type;
|
|
87
|
+
getSymbolAtLocation(node: Node): Ts7Symbol | undefined;
|
|
88
|
+
getTypeOfSymbol(symbol: Ts7Symbol): Type;
|
|
89
|
+
getAliasedSymbol(symbol: Ts7Symbol): Ts7Symbol;
|
|
90
|
+
getDeclaredTypeOfSymbol(symbol: Ts7Symbol): Type;
|
|
91
|
+
getContextualType(node: Node): Type | undefined;
|
|
92
|
+
getTypeFromTypeNode(node: Node): Type;
|
|
93
|
+
getShorthandAssignmentValueSymbol(node: Node): Ts7Symbol | undefined;
|
|
94
|
+
getResolvedSignature(node: Node): Signature | undefined;
|
|
95
|
+
getSignatureFromDeclaration(node: Node): Signature | undefined;
|
|
96
|
+
getReturnTypeOfSignature(signature: Signature): Type;
|
|
97
|
+
getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
|
|
98
|
+
/** 5.9.3 semantics, answered client-side wherever type.flags suffices:
|
|
99
|
+
* string/number/bigint/boolean literals map to the intrinsic singletons
|
|
100
|
+
* (one IPC ever per intrinsic); enum-ish and union types round-trip
|
|
101
|
+
* (memoized); everything else is itself. */
|
|
102
|
+
getBaseTypeOfLiteralType(type: Type): Type;
|
|
103
|
+
private intrinsic;
|
|
104
|
+
/** 5.9.3's checker.getConstantValue, memoized per node. The one caller
|
|
105
|
+
* (enum lowering) passes ENUM MEMBER declaration nodes only: 7 answers
|
|
106
|
+
* the member's computed constant there for const and regular enums alike
|
|
107
|
+
* (access-expression queries answer const enums only — same as 5.9.3 —
|
|
108
|
+
* so the lowering resolves the member symbol and asks its declaration). */
|
|
109
|
+
getConstantValue(node: Node): string | number | undefined;
|
|
110
|
+
private readonly constantValueOf;
|
|
111
|
+
getNonNullableType(type: Type): Type;
|
|
112
|
+
getPropertiesOfType(type: Type): readonly Ts7Symbol[];
|
|
113
|
+
getIndexInfosOfType(type: Type): readonly IndexInfo[];
|
|
114
|
+
getTypeArguments(type: TypeReference): readonly Type[];
|
|
115
|
+
isArrayType(type: Type): boolean;
|
|
116
|
+
/** 5.9.3's checker.isTupleType answers true for tuple SHAPES and for
|
|
117
|
+
* REFERENCES to them (Pair<number>, a readonly [T, T] instantiation).
|
|
118
|
+
* The 7.0.2 client-side Type.isTupleType() sees only the shape — a
|
|
119
|
+
* reference answers false there (measured; the facade suite pins it) —
|
|
120
|
+
* so shape-true and non-object-false resolve locally and only object
|
|
121
|
+
* types that are not visibly tuples round-trip, memoized. */
|
|
122
|
+
isTupleType(type: Type): boolean;
|
|
123
|
+
isArrayLikeType(type: Type): boolean;
|
|
124
|
+
typeToString(type: Type, enclosingDeclaration?: Node, flags?: number): string;
|
|
125
|
+
getTypeOfSymbolAtLocation(symbol: Ts7Symbol, location: Node): Type;
|
|
126
|
+
getUnknownType(): Type;
|
|
127
|
+
/** 7.0.2 dropped getAwaitedType (the census's one MISSING checker method).
|
|
128
|
+
* Shimmed per the survey: unwrap Promise/PromiseLike references through
|
|
129
|
+
* their type argument, distributing over unions. The client cannot BUILD
|
|
130
|
+
* union types, so a union whose arms unwrap to more than one distinct type
|
|
131
|
+
* returns undefined (callers fall back to the input; the census's one call
|
|
132
|
+
* site does exactly that) — a union like `T | PromiseLike<T>` collapses by
|
|
133
|
+
* object identity to T, which is the pattern that call site exists for. */
|
|
134
|
+
getAwaitedType(type: Type): Type | undefined;
|
|
135
|
+
private computeAwaitedType;
|
|
136
|
+
/** The type argument of a Promise/PromiseLike reference, or null when the
|
|
137
|
+
* type is not one. Global-ness is approximated by symbol name — scriptc
|
|
138
|
+
* programs see the es2025 lib's Promise (the ambient world forces it). */
|
|
139
|
+
private promiseArgumentOf;
|
|
140
|
+
}
|