tsc-ts 0.0.5 → 0.0.7
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/README.md +1 -1
- package/dist/api/compiler/ast.d.ts +67 -27
- package/dist/api/compiler/ast.js +156 -55
- package/dist/api/compiler/binder-utilities.js +4 -3
- package/dist/api/compiler/binder.js +14 -13
- package/dist/api/compiler/checker-calls.js +7 -6
- package/dist/api/compiler/checker-contextual.js +1 -1
- package/dist/api/compiler/checker-declaration-order.js +2 -1
- package/dist/api/compiler/checker-declarations.js +14 -14
- package/dist/api/compiler/checker-declared-types.d.ts +1 -1
- package/dist/api/compiler/checker-declared-types.js +12 -11
- package/dist/api/compiler/checker-decorators.js +3 -3
- package/dist/api/compiler/checker-deprecation.js +17 -18
- package/dist/api/compiler/checker-destructuring.d.ts +1 -1
- package/dist/api/compiler/checker-destructuring.js +3 -3
- package/dist/api/compiler/checker-elaboration.js +8 -7
- package/dist/api/compiler/checker-emit-helpers.d.ts +2 -1
- package/dist/api/compiler/checker-emit-helpers.js +5 -4
- package/dist/api/compiler/checker-emit-resolver.d.ts +1 -1
- package/dist/api/compiler/checker-emit-resolver.js +5 -4
- package/dist/api/compiler/checker-grammar.js +23 -9
- package/dist/api/compiler/checker-heritage.d.ts +1 -1
- package/dist/api/compiler/checker-heritage.js +14 -13
- package/dist/api/compiler/checker-inference.d.ts +21 -11
- package/dist/api/compiler/checker-inference.js +57 -34
- package/dist/api/compiler/checker-javascript.d.ts +1 -1
- package/dist/api/compiler/checker-javascript.js +5 -4
- package/dist/api/compiler/checker-jsx.d.ts +1 -1
- package/dist/api/compiler/checker-jsx.js +4 -4
- package/dist/api/compiler/checker-literals.js +2 -2
- package/dist/api/compiler/checker-members.d.ts +32 -3
- package/dist/api/compiler/checker-members.js +240 -53
- package/dist/api/compiler/checker-modules.d.ts +15 -1
- package/dist/api/compiler/checker-modules.js +86 -14
- package/dist/api/compiler/checker-object-literals.d.ts +1 -1
- package/dist/api/compiler/checker-object-literals.js +11 -7
- package/dist/api/compiler/checker-overloads.d.ts +1 -1
- package/dist/api/compiler/checker-overloads.js +4 -3
- package/dist/api/compiler/checker-property-access.d.ts +1 -1
- package/dist/api/compiler/checker-property-access.js +2 -2
- package/dist/api/compiler/checker-services.js +2 -2
- package/dist/api/compiler/checker-signatures.d.ts +1 -1
- package/dist/api/compiler/checker-signatures.js +9 -8
- package/dist/api/compiler/checker-symbol-types.d.ts +2 -18
- package/dist/api/compiler/checker-symbol-types.js +22 -952
- package/dist/api/compiler/checker-symbols.d.ts +2 -2
- package/dist/api/compiler/checker-symbols.js +29 -27
- package/dist/api/compiler/checker-type-factory.d.ts +2 -2
- package/dist/api/compiler/checker-type-factory.js +57 -16
- package/dist/api/compiler/checker-type-nodes.d.ts +1 -1
- package/dist/api/compiler/checker-type-nodes.js +2 -2
- package/dist/api/compiler/checker-type-operators.d.ts +1 -1
- package/dist/api/compiler/checker-type-operators.js +5 -5
- package/dist/api/compiler/checker-types.d.ts +73 -7
- package/dist/api/compiler/checker-types.js +220 -43
- package/dist/api/compiler/checker-unused.d.ts +1 -1
- package/dist/api/compiler/checker-unused.js +3 -3
- package/dist/api/compiler/checker.d.ts +45 -8
- package/dist/api/compiler/checker.js +46 -9
- package/dist/api/compiler/diagnostics.d.ts +2 -8
- package/dist/api/compiler/diagnostics.js +13 -45
- package/dist/api/compiler/file-include.d.ts +35 -8
- package/dist/api/compiler/file-include.js +81 -18
- package/dist/api/compiler/file-loader.d.ts +33 -4
- package/dist/api/compiler/file-loader.js +90 -24
- package/dist/api/compiler/instantiation.d.ts +1 -1
- package/dist/api/compiler/instantiation.js +86 -50
- package/dist/api/compiler/link-tables.d.ts +69 -0
- package/dist/api/compiler/link-tables.js +236 -0
- package/dist/api/compiler/name-resolver.js +3 -3
- package/dist/api/compiler/node-builder-names.d.ts +1 -1
- package/dist/api/compiler/node-builder-names.js +12 -12
- package/dist/api/compiler/node-builder-pseudo.d.ts +1 -1
- package/dist/api/compiler/node-builder-pseudo.js +2 -1
- package/dist/api/compiler/node-builder.d.ts +1 -1
- package/dist/api/compiler/node-builder.js +16 -16
- package/dist/api/compiler/parallel-parse.d.ts +2 -0
- package/dist/api/compiler/parallel-parse.js +7 -1
- package/dist/api/compiler/parser.d.ts +33 -16
- package/dist/api/compiler/parser.js +127 -98
- package/dist/api/compiler/printer/emit-context.d.ts +5 -2
- package/dist/api/compiler/printer/emit-context.js +19 -13
- package/dist/api/compiler/printer/factory-base.js +8 -8
- package/dist/api/compiler/printer/factory.js +4 -4
- package/dist/api/compiler/printer/printer.js +6 -6
- package/dist/api/compiler/program-checker.d.ts +5 -0
- package/dist/api/compiler/program-checker.js +14 -1
- package/dist/api/compiler/program.js +9 -1
- package/dist/api/compiler/relations.d.ts +1 -1
- package/dist/api/compiler/relations.js +18 -13
- package/dist/api/compiler/reparser.js +13 -5
- package/dist/api/compiler/symbol-accessibility.d.ts +1 -1
- package/dist/api/compiler/symbol-accessibility.js +123 -26
- package/dist/api/compiler/symbol.d.ts +45 -3
- package/dist/api/compiler/symbol.js +121 -10
- package/dist/api/compiler/transformers/alias-references.d.ts +1 -1
- package/dist/api/compiler/transformers/alias-references.js +2 -1
- package/dist/api/compiler/transformers/class-fields.js +3 -3
- package/dist/api/compiler/transformers/commonjs-module.js +3 -3
- package/dist/api/compiler/transformers/declarations-diagnostics.js +2 -1
- package/dist/api/compiler/transformers/declarations-pseudo.js +6 -4
- package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -1
- package/dist/api/compiler/transformers/declarations-syntactic.js +9 -9
- package/dist/api/compiler/transformers/declarations-tracker.d.ts +1 -1
- package/dist/api/compiler/transformers/declarations-tracker.js +3 -2
- package/dist/api/compiler/transformers/declarations.js +6 -5
- package/dist/api/compiler/transformers/module.js +2 -2
- package/dist/api/compiler/transformers/optional-chain.js +3 -3
- package/dist/api/compiler/transformers/reference-resolver.d.ts +2 -1
- package/dist/api/compiler/transformers/reference-resolver.js +26 -24
- package/dist/api/compiler/transformers/subtree-facts.d.ts +1 -0
- package/dist/api/compiler/transformers/subtree-facts.js +9 -7
- package/dist/api/compiler/transformers/syntax-facts.d.ts +1 -0
- package/dist/api/compiler/transformers/syntax-facts.js +9 -5
- package/dist/api/compiler/transformers/tagged-template.js +2 -2
- package/dist/api/compiler/transformers/type-eraser.js +2 -2
- package/dist/api/compiler/transformers/type-serialization.js +12 -12
- package/dist/api/compiler/transformers/visitor-base.js +3 -3
- package/dist/api/compiler/tsconfig.js +2 -2
- package/package.json +9 -9
- package/src/compiler/ast.ts +211 -78
- package/src/compiler/binder-utilities.ts +4 -3
- package/src/compiler/binder.ts +26 -16
- package/src/compiler/checker-calls.ts +8 -6
- package/src/compiler/checker-contextual.ts +1 -1
- package/src/compiler/checker-declaration-order.ts +2 -2
- package/src/compiler/checker-declarations.ts +21 -14
- package/src/compiler/checker-declared-types.ts +12 -12
- package/src/compiler/checker-decorators.ts +3 -3
- package/src/compiler/checker-deprecation.ts +17 -21
- package/src/compiler/checker-destructuring.ts +3 -3
- package/src/compiler/checker-elaboration.ts +8 -8
- package/src/compiler/checker-emit-helpers.ts +5 -4
- package/src/compiler/checker-emit-resolver.ts +5 -5
- package/src/compiler/checker-grammar.ts +22 -8
- package/src/compiler/checker-heritage.ts +21 -14
- package/src/compiler/checker-inference.ts +66 -34
- package/src/compiler/checker-javascript.ts +5 -5
- package/src/compiler/checker-jsx.ts +12 -8
- package/src/compiler/checker-literals.ts +2 -2
- package/src/compiler/checker-members.ts +255 -47
- package/src/compiler/checker-modules.ts +115 -14
- package/src/compiler/checker-object-literals.ts +22 -6
- package/src/compiler/checker-overloads.ts +6 -6
- package/src/compiler/checker-property-access.ts +2 -2
- package/src/compiler/checker-services.ts +2 -2
- package/src/compiler/checker-signatures.ts +9 -9
- package/src/compiler/checker-symbol-types.ts +20 -940
- package/src/compiler/checker-symbols.ts +42 -35
- package/src/compiler/checker-type-factory.ts +53 -16
- package/src/compiler/checker-type-nodes.ts +2 -2
- package/src/compiler/checker-type-operators.ts +13 -5
- package/src/compiler/checker-types.ts +223 -43
- package/src/compiler/checker-unused.ts +3 -3
- package/src/compiler/checker.ts +50 -9
- package/src/compiler/decoder.ts +5 -4
- package/src/compiler/diagnostics.ts +14 -48
- package/src/compiler/encoder.ts +10 -5
- package/src/compiler/file-include.ts +85 -17
- package/src/compiler/file-loader.ts +104 -35
- package/src/compiler/incremental.ts +39 -5
- package/src/compiler/instantiation.ts +99 -55
- package/src/compiler/link-tables.ts +245 -0
- package/src/compiler/name-resolver.ts +3 -3
- package/src/compiler/node-builder-names.ts +21 -19
- package/src/compiler/node-builder-pseudo.ts +2 -2
- package/src/compiler/node-builder.ts +24 -16
- package/src/compiler/parallel-check.ts +11 -8
- package/src/compiler/parallel-parse.ts +8 -1
- package/src/compiler/parse-thread.ts +0 -4
- package/src/compiler/parser.ts +173 -93
- package/src/compiler/printer/emit-context.ts +20 -15
- package/src/compiler/printer/factory-base.ts +14 -7
- package/src/compiler/printer/factory.ts +5 -3
- package/src/compiler/printer/printer.ts +8 -6
- package/src/compiler/program-checker.ts +12 -1
- package/src/compiler/program.ts +8 -1
- package/src/compiler/relations.ts +20 -12
- package/src/compiler/reparser.ts +14 -4
- package/src/compiler/symbol-accessibility.ts +120 -25
- package/src/compiler/symbol.ts +127 -9
- package/src/compiler/transformers/alias-references.ts +2 -2
- package/src/compiler/transformers/class-fields.ts +12 -2
- package/src/compiler/transformers/commonjs-module.ts +3 -2
- package/src/compiler/transformers/declarations-diagnostics.ts +2 -1
- package/src/compiler/transformers/declarations-pseudo.ts +9 -5
- package/src/compiler/transformers/declarations-syntactic.ts +17 -9
- package/src/compiler/transformers/declarations-tracker.ts +3 -3
- package/src/compiler/transformers/declarations.ts +7 -7
- package/src/compiler/transformers/module.ts +2 -1
- package/src/compiler/transformers/optional-chain.ts +5 -2
- package/src/compiler/transformers/reference-resolver.ts +37 -25
- package/src/compiler/transformers/subtree-facts.ts +15 -6
- package/src/compiler/transformers/syntax-facts.ts +10 -5
- package/src/compiler/transformers/tagged-template.ts +2 -2
- package/src/compiler/transformers/type-eraser.ts +2 -1
- package/src/compiler/transformers/type-serialization.ts +12 -12
- package/src/compiler/transformers/visitor-base.ts +10 -5
- package/src/compiler/tsc-build.ts +17 -13
- package/src/compiler/tsc-cli.ts +9 -6
- package/src/compiler/tsc-compile.ts +16 -7
- package/src/compiler/tsc-watch.ts +94 -26
- package/src/compiler/tsconfig.ts +2 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ npx tsc-ts --noEmit src/index.ts
|
|
|
33
33
|
|
|
34
34
|
`tsc-ts --api` serves the TypeScript API over stdin and stdout, like `tsc --api`.
|
|
35
35
|
|
|
36
|
-
`--checkers N` checks the program on N threads. Unless `--checkers` or `--singleThreaded` is given, the native executable uses one checker per CPU it may run on (up to 16), and at least tsgo's four; it uses fewer than the CPUs, but never fewer than four, when the estimated peak memory of more checkers would not fit 85% of the machine's memory (`TSC_TS_CHECKERS=fixed` keeps tsgo's four), and checkers beyond the fourth stop taking files, one at a time, when the process's memory reaches that share; it shares one program between its threads and also parses and binds the program's files on them. Files that share costly declarations, such as a large generated schema and the few files importing it, are checked together on one checker. Under Node.js, where every thread builds its own copy of the program, tsc-ts checks on one thread unless `--checkers` is given. `--incremental`, `--watch` and `--build` always check on one thread. The diagnostics are the same as with one checker.
|
|
36
|
+
`--checkers N` checks the program on N threads. Unless `--checkers` or `--singleThreaded` is given, the native executable uses one checker per CPU it may run on (up to 16), and at least tsgo's four; it uses fewer than the CPUs, but never fewer than four, when the estimated peak memory of more checkers would not fit 85% of the machine's memory (`TSC_TS_CHECKERS=fixed` keeps tsgo's four), and checkers beyond the fourth stop taking files, one at a time, when the process's memory reaches that share; it shares one program between its threads and also parses and binds the program's files on them. Unless `--singleThreaded` is given, the program's files are parsed and bound on threads also with `--checkers 1`, as tsgo does. Files that share costly declarations, such as a large generated schema and the few files importing it, are checked together on one checker. Under Node.js, where every thread builds its own copy of the program, tsc-ts checks on one thread unless `--checkers` is given. `--incremental`, `--watch` and `--build` always check on one thread. The diagnostics are the same as with one checker.
|
|
37
37
|
|
|
38
38
|
The native executable never frees syntax trees, types, signatures or symbols: it keeps them until it exits, which saves the cost of tracking them during a build. A one-shot build is unaffected, but a long-running process grows with each rebuild or project update. Native `--watch` (also with `--build`) runs in a child process, and when a change arrives while that process holds more than 2.5 times the memory it held after its first build, a new process replaces it and builds the change, reporting what the old process would have. `TSC_TS_WATCH_MEMORY` sets that limit in megabytes, and `TSC_TS_WATCH_MEMORY=0` turns the replacement off. A `--api` process grows with each project update; restart it to reclaim the memory.
|
|
39
39
|
|
|
@@ -243,13 +243,22 @@ export declare class Token extends Node {
|
|
|
243
243
|
}
|
|
244
244
|
export declare class Identifier extends Node {
|
|
245
245
|
text: string;
|
|
246
|
-
flowNode: FlowNode | undefined;
|
|
247
246
|
constructor(text: string);
|
|
248
247
|
forEachChild(_v: NodeVisitor): boolean;
|
|
249
248
|
setParentOfChildren(): void;
|
|
250
249
|
deepClone(): Node;
|
|
251
250
|
copy(): Identifier;
|
|
252
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* An identifier that can be read as a reference, such as an expression or a shorthand property
|
|
254
|
+
* name, and so holds the binder's flow node. The parser creates a plain `Identifier` for names
|
|
255
|
+
* whose flow node nothing reads: declaration names, property names and property access names.
|
|
256
|
+
*/
|
|
257
|
+
export declare class ReferenceIdentifier extends Identifier {
|
|
258
|
+
flowNode: FlowNode | undefined;
|
|
259
|
+
constructor(text: string);
|
|
260
|
+
copy(): Identifier;
|
|
261
|
+
}
|
|
253
262
|
export declare class PrivateIdentifier extends Node {
|
|
254
263
|
text: string;
|
|
255
264
|
constructor(text: string);
|
|
@@ -1174,16 +1183,30 @@ export declare class ElementAccessExpression extends Node {
|
|
|
1174
1183
|
}
|
|
1175
1184
|
export declare class CallExpression extends Node {
|
|
1176
1185
|
expression: Expression;
|
|
1186
|
+
arguments: NodeList;
|
|
1187
|
+
constructor(expression: Expression, args: NodeList, flags: NodeFlags);
|
|
1188
|
+
forEachChild(v: NodeVisitor): boolean;
|
|
1189
|
+
setParentOfChildren(): void;
|
|
1190
|
+
deepClone(): Node;
|
|
1191
|
+
copy(): CallExpression;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* A call with `?.` or type arguments, or in a JavaScript file, where the binder can declare a symbol
|
|
1195
|
+
* for it (`Object.defineProperty`). Other calls are a plain `CallExpression`, without these fields.
|
|
1196
|
+
*/
|
|
1197
|
+
export declare class FullCallExpression extends CallExpression {
|
|
1177
1198
|
questionDotToken: Token | undefined;
|
|
1178
1199
|
typeArguments: NodeList | undefined;
|
|
1179
|
-
arguments: NodeList;
|
|
1180
1200
|
symbol: Symbol | undefined;
|
|
1181
1201
|
constructor(expression: Expression, questionDotToken: Token | undefined, typeArguments: NodeList | undefined, args: NodeList, flags: NodeFlags);
|
|
1182
1202
|
forEachChild(v: NodeVisitor): boolean;
|
|
1183
1203
|
setParentOfChildren(): void;
|
|
1184
|
-
deepClone(): Node;
|
|
1185
1204
|
copy(): CallExpression;
|
|
1186
1205
|
}
|
|
1206
|
+
/** A `FullCallExpression` when one of its fields is set or `inJavaScript`, else a `CallExpression`. */
|
|
1207
|
+
export declare function newCallExpression(expression: Expression, questionDotToken: Token | undefined, typeArguments: NodeList | undefined, args: NodeList, flags: NodeFlags, inJavaScript: boolean): CallExpression;
|
|
1208
|
+
export declare function callQuestionDotToken(node: CallExpression): Token | undefined;
|
|
1209
|
+
export declare function callTypeArguments(node: CallExpression): NodeList | undefined;
|
|
1187
1210
|
export declare class NewExpression extends Node {
|
|
1188
1211
|
expression: Expression;
|
|
1189
1212
|
typeArguments: NodeList | undefined;
|
|
@@ -1286,18 +1309,34 @@ export declare class SpreadAssignment extends Node {
|
|
|
1286
1309
|
copy(): SpreadAssignment;
|
|
1287
1310
|
}
|
|
1288
1311
|
export declare class PropertyAssignment extends Node {
|
|
1289
|
-
modifiers: ModifierList | undefined;
|
|
1290
1312
|
name: PropertyName;
|
|
1291
|
-
postfixToken: Token | undefined;
|
|
1292
|
-
type: TypeNode | undefined;
|
|
1293
1313
|
initializer: Expression;
|
|
1294
1314
|
symbol: Symbol | undefined;
|
|
1295
|
-
constructor(
|
|
1315
|
+
constructor(name: PropertyName, initializer: Expression);
|
|
1296
1316
|
forEachChild(v: NodeVisitor): boolean;
|
|
1297
1317
|
setParentOfChildren(): void;
|
|
1298
1318
|
deepClone(): Node;
|
|
1299
1319
|
copy(): PropertyAssignment;
|
|
1300
1320
|
}
|
|
1321
|
+
/**
|
|
1322
|
+
* A property assignment with modifiers, a `?` or `!`, or a type annotation (which the grammar checker
|
|
1323
|
+
* reports), or in a JavaScript file, where JSDoc can give it a type or modifiers. Other property
|
|
1324
|
+
* assignments are a plain `PropertyAssignment`, without these fields.
|
|
1325
|
+
*/
|
|
1326
|
+
export declare class FullPropertyAssignment extends PropertyAssignment {
|
|
1327
|
+
modifiers: ModifierList | undefined;
|
|
1328
|
+
postfixToken: Token | undefined;
|
|
1329
|
+
type: TypeNode | undefined;
|
|
1330
|
+
constructor(modifiers: ModifierList | undefined, name: PropertyName, postfixToken: Token | undefined, type: TypeNode | undefined, initializer: Expression);
|
|
1331
|
+
forEachChild(v: NodeVisitor): boolean;
|
|
1332
|
+
setParentOfChildren(): void;
|
|
1333
|
+
copy(): PropertyAssignment;
|
|
1334
|
+
}
|
|
1335
|
+
/** A `FullPropertyAssignment` when one of its fields is set or `inJavaScript`, else a `PropertyAssignment`. */
|
|
1336
|
+
export declare function newPropertyAssignment(modifiers: ModifierList | undefined, name: PropertyName, postfixToken: Token | undefined, type: TypeNode | undefined, initializer: Expression, inJavaScript: boolean): PropertyAssignment;
|
|
1337
|
+
export declare function propertyAssignmentModifiers(node: PropertyAssignment): ModifierList | undefined;
|
|
1338
|
+
export declare function propertyAssignmentPostfixToken(node: PropertyAssignment): Token | undefined;
|
|
1339
|
+
export declare function propertyAssignmentType(node: PropertyAssignment): TypeNode | undefined;
|
|
1301
1340
|
export declare class ShorthandPropertyAssignment extends Node {
|
|
1302
1341
|
modifiers: ModifierList | undefined;
|
|
1303
1342
|
name: PropertyName;
|
|
@@ -2211,6 +2250,15 @@ export declare class JSDocParameterOrPropertyTag extends Node {
|
|
|
2211
2250
|
deepClone(): Node;
|
|
2212
2251
|
copy(): JSDocParameterOrPropertyTag;
|
|
2213
2252
|
}
|
|
2253
|
+
export declare const emptyDiagnostics: readonly Diagnostic[];
|
|
2254
|
+
export declare const emptyNodes: readonly Node[];
|
|
2255
|
+
export declare const emptyStrings: readonly string[];
|
|
2256
|
+
export declare const emptyCommentDirectives: readonly CommentDirective[];
|
|
2257
|
+
export declare const emptyPragmas: readonly Pragma[];
|
|
2258
|
+
export declare const emptyFileReferences: readonly FileReference[];
|
|
2259
|
+
export declare const emptyPatternAmbientModules: readonly PatternAmbientModule[];
|
|
2260
|
+
/** `list` with `item` appended: a new array when `list` is empty (it may be shared), else `list` itself. */
|
|
2261
|
+
export declare function appendToList<T>(list: readonly T[], item: T): readonly T[];
|
|
2214
2262
|
export declare class SourceFile extends Node {
|
|
2215
2263
|
readonly fileName: string;
|
|
2216
2264
|
readonly path: string;
|
|
@@ -2218,10 +2266,10 @@ export declare class SourceFile extends Node {
|
|
|
2218
2266
|
readonly externalModuleIndicatorOptions: ExternalModuleIndicatorOptions;
|
|
2219
2267
|
statements: NodeList;
|
|
2220
2268
|
endOfFileToken: Token;
|
|
2221
|
-
diagnostics: Diagnostic[];
|
|
2269
|
+
diagnostics: readonly Diagnostic[];
|
|
2222
2270
|
/** Diagnostics for TypeScript-only syntax in JavaScript files. */
|
|
2223
|
-
jsDiagnostics: Diagnostic[];
|
|
2224
|
-
jsDocDiagnostics: Diagnostic[];
|
|
2271
|
+
jsDiagnostics: readonly Diagnostic[];
|
|
2272
|
+
jsDocDiagnostics: readonly Diagnostic[];
|
|
2225
2273
|
languageVariant: LanguageVariant;
|
|
2226
2274
|
scriptKind: ScriptKind;
|
|
2227
2275
|
isDeclarationFile: boolean;
|
|
@@ -2236,20 +2284,20 @@ export declare class SourceFile extends Node {
|
|
|
2236
2284
|
/** Module specifiers of imports, exports, `require` calls and `import()` types, in source order. */
|
|
2237
2285
|
imports: Node[];
|
|
2238
2286
|
/** Names of `declare module "x"` augmentations and `declare global` blocks in modules. */
|
|
2239
|
-
moduleAugmentations: Node[];
|
|
2240
|
-
ambientModuleNames: string[];
|
|
2287
|
+
moduleAugmentations: readonly Node[];
|
|
2288
|
+
ambientModuleNames: readonly string[];
|
|
2241
2289
|
commentDirectives: readonly CommentDirective[];
|
|
2242
|
-
pragmas: Pragma[];
|
|
2243
|
-
referencedFiles: FileReference[];
|
|
2244
|
-
typeReferenceDirectives: FileReference[];
|
|
2245
|
-
libReferenceDirectives: FileReference[];
|
|
2290
|
+
pragmas: readonly Pragma[];
|
|
2291
|
+
referencedFiles: readonly FileReference[];
|
|
2292
|
+
typeReferenceDirectives: readonly FileReference[];
|
|
2293
|
+
libReferenceDirectives: readonly FileReference[];
|
|
2246
2294
|
checkJsDirective: CheckJsDirective | undefined;
|
|
2247
2295
|
/** The first CommonJS `module.exports`/`exports.x` use in a JavaScript file. */
|
|
2248
2296
|
commonJSModuleIndicator: Node | undefined;
|
|
2249
2297
|
/** What makes this file a module: an import or export statement, `import.meta`, a JSX tag, or the file itself when forced. */
|
|
2250
2298
|
externalModuleIndicator: Node | undefined;
|
|
2251
2299
|
/** Nodes cloned by JSDoc reparsing, sorted by position. */
|
|
2252
|
-
reparsedClones: Node[];
|
|
2300
|
+
reparsedClones: readonly Node[];
|
|
2253
2301
|
/** Whether JSDoc of TypeScript files is parsed on first use. */
|
|
2254
2302
|
hasLazyJSDoc: boolean;
|
|
2255
2303
|
/**
|
|
@@ -2262,20 +2310,14 @@ export declare class SourceFile extends Node {
|
|
|
2262
2310
|
locals: SymbolTable | undefined;
|
|
2263
2311
|
nextContainer: Node | undefined;
|
|
2264
2312
|
isBound: boolean;
|
|
2265
|
-
bindDiagnostics: Diagnostic[];
|
|
2313
|
+
bindDiagnostics: readonly Diagnostic[];
|
|
2266
2314
|
/** The flow at the end of the file. */
|
|
2267
2315
|
endFlowNode: FlowNode | undefined;
|
|
2268
2316
|
symbolCount: number;
|
|
2269
2317
|
/** Ambient modules with a `*` in their name, like `declare module "*.css"`. */
|
|
2270
|
-
patternAmbientModules: PatternAmbientModule[];
|
|
2318
|
+
patternAmbientModules: readonly PatternAmbientModule[];
|
|
2271
2319
|
/** UMD exports from `export as namespace N`. */
|
|
2272
2320
|
globalExports: SymbolTable | undefined;
|
|
2273
|
-
/**
|
|
2274
|
-
* By name, the first property of the unions of the file's object literals that leave the name
|
|
2275
|
-
* missing (checker-symbol-types.ts `scanSiblingProperties`), where a parse thread scanned the file
|
|
2276
|
-
* and could resolve the enums the scan needed.
|
|
2277
|
-
*/
|
|
2278
|
-
siblingProperties: Map<string, Node> | undefined;
|
|
2279
2321
|
constructor(fileName: string, path: string, text: string, externalModuleIndicatorOptions: ExternalModuleIndicatorOptions, statements: NodeList, endOfFileToken: Token);
|
|
2280
2322
|
forEachChild(v: NodeVisitor): boolean;
|
|
2281
2323
|
setParentOfChildren(): void;
|
|
@@ -2287,8 +2329,6 @@ export declare class SourceFile extends Node {
|
|
|
2287
2329
|
* never writes to the file (UTF-8 offsets are computed on first use, `DiagnosticFile.computeCaches`).
|
|
2288
2330
|
*/
|
|
2289
2331
|
computeCaches(): void;
|
|
2290
|
-
/** Like `computeCaches`, from the UTF-16 code units of the text (at least `text.length` of them). */
|
|
2291
|
-
computeCachesFromUnits(units: Uint16Array): void;
|
|
2292
2332
|
/** The file as diagnostics see it. */
|
|
2293
2333
|
diagnosticFile(): DiagnosticFile;
|
|
2294
2334
|
isJS(): boolean;
|
package/dist/api/compiler/ast.js
CHANGED
|
@@ -222,12 +222,9 @@ export class Token extends Node {
|
|
|
222
222
|
}
|
|
223
223
|
export class Identifier extends Node {
|
|
224
224
|
text;
|
|
225
|
-
// Set by the binder.
|
|
226
|
-
flowNode;
|
|
227
225
|
constructor(text) {
|
|
228
226
|
super(79 /* SyntaxKind.Identifier */);
|
|
229
227
|
this.text = text;
|
|
230
|
-
this.flowNode = undefined;
|
|
231
228
|
}
|
|
232
229
|
forEachChild(_v) {
|
|
233
230
|
return false;
|
|
@@ -244,6 +241,26 @@ export class Identifier extends Node {
|
|
|
244
241
|
return node;
|
|
245
242
|
}
|
|
246
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* An identifier that can be read as a reference, such as an expression or a shorthand property
|
|
246
|
+
* name, and so holds the binder's flow node. The parser creates a plain `Identifier` for names
|
|
247
|
+
* whose flow node nothing reads: declaration names, property names and property access names.
|
|
248
|
+
*/
|
|
249
|
+
export class ReferenceIdentifier extends Identifier {
|
|
250
|
+
// Set by the binder.
|
|
251
|
+
flowNode;
|
|
252
|
+
constructor(text) {
|
|
253
|
+
super(text);
|
|
254
|
+
this.flowNode = undefined;
|
|
255
|
+
}
|
|
256
|
+
copy() {
|
|
257
|
+
const node = new ReferenceIdentifier(this.text);
|
|
258
|
+
node.flags = this.flags;
|
|
259
|
+
node.pos = this.pos;
|
|
260
|
+
node.end = this.end;
|
|
261
|
+
return node;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
247
264
|
export class PrivateIdentifier extends Node {
|
|
248
265
|
text;
|
|
249
266
|
constructor(text) {
|
|
@@ -3213,18 +3230,46 @@ export class ElementAccessExpression extends Node {
|
|
|
3213
3230
|
}
|
|
3214
3231
|
export class CallExpression extends Node {
|
|
3215
3232
|
expression;
|
|
3233
|
+
arguments;
|
|
3234
|
+
constructor(expression, args, flags) {
|
|
3235
|
+
super(214 /* SyntaxKind.CallExpression */);
|
|
3236
|
+
this.expression = expression;
|
|
3237
|
+
this.arguments = args;
|
|
3238
|
+
this.flags |= flags & 32 /* NodeFlags.OptionalChain */;
|
|
3239
|
+
}
|
|
3240
|
+
forEachChild(v) {
|
|
3241
|
+
if (v.visitNode(this.expression))
|
|
3242
|
+
return true;
|
|
3243
|
+
return v.visitList(this.arguments);
|
|
3244
|
+
}
|
|
3245
|
+
setParentOfChildren() {
|
|
3246
|
+
this.expression.parent = this;
|
|
3247
|
+
setParents(this.arguments.nodes, this);
|
|
3248
|
+
}
|
|
3249
|
+
deepClone() {
|
|
3250
|
+
return this.copy();
|
|
3251
|
+
}
|
|
3252
|
+
copy() {
|
|
3253
|
+
const node = new CallExpression(this.expression.deepClone(), cloneList(this.arguments), this.flags);
|
|
3254
|
+
node.flags = this.flags;
|
|
3255
|
+
node.pos = this.pos;
|
|
3256
|
+
node.end = this.end;
|
|
3257
|
+
return node;
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
/**
|
|
3261
|
+
* A call with `?.` or type arguments, or in a JavaScript file, where the binder can declare a symbol
|
|
3262
|
+
* for it (`Object.defineProperty`). Other calls are a plain `CallExpression`, without these fields.
|
|
3263
|
+
*/
|
|
3264
|
+
export class FullCallExpression extends CallExpression {
|
|
3216
3265
|
questionDotToken;
|
|
3217
3266
|
typeArguments;
|
|
3218
|
-
arguments;
|
|
3219
3267
|
// Set by the binder.
|
|
3220
3268
|
symbol;
|
|
3221
3269
|
constructor(expression, questionDotToken, typeArguments, args, flags) {
|
|
3222
|
-
super(
|
|
3223
|
-
this.expression = expression;
|
|
3270
|
+
super(expression, args, flags);
|
|
3224
3271
|
this.questionDotToken = questionDotToken;
|
|
3225
3272
|
this.typeArguments = typeArguments;
|
|
3226
|
-
this.arguments = args;
|
|
3227
|
-
this.flags |= flags & 32 /* NodeFlags.OptionalChain */;
|
|
3228
3273
|
this.symbol = undefined;
|
|
3229
3274
|
}
|
|
3230
3275
|
forEachChild(v) {
|
|
@@ -3244,17 +3289,26 @@ export class CallExpression extends Node {
|
|
|
3244
3289
|
setParents(this.typeArguments.nodes, this);
|
|
3245
3290
|
setParents(this.arguments.nodes, this);
|
|
3246
3291
|
}
|
|
3247
|
-
deepClone() {
|
|
3248
|
-
return this.copy();
|
|
3249
|
-
}
|
|
3250
3292
|
copy() {
|
|
3251
|
-
const node = new
|
|
3293
|
+
const node = new FullCallExpression(this.expression.deepClone(), this.questionDotToken === undefined ? undefined : this.questionDotToken.copy(), this.typeArguments === undefined ? undefined : cloneList(this.typeArguments), cloneList(this.arguments), this.flags);
|
|
3252
3294
|
node.flags = this.flags;
|
|
3253
3295
|
node.pos = this.pos;
|
|
3254
3296
|
node.end = this.end;
|
|
3255
3297
|
return node;
|
|
3256
3298
|
}
|
|
3257
3299
|
}
|
|
3300
|
+
/** A `FullCallExpression` when one of its fields is set or `inJavaScript`, else a `CallExpression`. */
|
|
3301
|
+
export function newCallExpression(expression, questionDotToken, typeArguments, args, flags, inJavaScript) {
|
|
3302
|
+
if (inJavaScript || questionDotToken !== undefined || typeArguments !== undefined)
|
|
3303
|
+
return new FullCallExpression(expression, questionDotToken, typeArguments, args, flags);
|
|
3304
|
+
return new CallExpression(expression, args, flags);
|
|
3305
|
+
}
|
|
3306
|
+
export function callQuestionDotToken(node) {
|
|
3307
|
+
return node instanceof FullCallExpression ? node.questionDotToken : undefined;
|
|
3308
|
+
}
|
|
3309
|
+
export function callTypeArguments(node) {
|
|
3310
|
+
return node instanceof FullCallExpression ? node.typeArguments : undefined;
|
|
3311
|
+
}
|
|
3258
3312
|
export class NewExpression extends Node {
|
|
3259
3313
|
expression;
|
|
3260
3314
|
typeArguments;
|
|
@@ -3565,22 +3619,51 @@ export class SpreadAssignment extends Node {
|
|
|
3565
3619
|
}
|
|
3566
3620
|
}
|
|
3567
3621
|
export class PropertyAssignment extends Node {
|
|
3568
|
-
modifiers;
|
|
3569
3622
|
name;
|
|
3570
|
-
postfixToken;
|
|
3571
|
-
type;
|
|
3572
3623
|
initializer;
|
|
3573
3624
|
// Set by the binder.
|
|
3574
3625
|
symbol;
|
|
3575
|
-
constructor(
|
|
3626
|
+
constructor(name, initializer) {
|
|
3576
3627
|
super(303 /* SyntaxKind.PropertyAssignment */);
|
|
3577
|
-
this.modifiers = modifiers;
|
|
3578
3628
|
this.name = name;
|
|
3579
|
-
this.postfixToken = postfixToken;
|
|
3580
|
-
this.type = type;
|
|
3581
3629
|
this.initializer = initializer;
|
|
3582
3630
|
this.symbol = undefined;
|
|
3583
3631
|
}
|
|
3632
|
+
forEachChild(v) {
|
|
3633
|
+
if (v.visitNode(this.name))
|
|
3634
|
+
return true;
|
|
3635
|
+
return v.visitNode(this.initializer);
|
|
3636
|
+
}
|
|
3637
|
+
setParentOfChildren() {
|
|
3638
|
+
this.name.parent = this;
|
|
3639
|
+
this.initializer.parent = this;
|
|
3640
|
+
}
|
|
3641
|
+
deepClone() {
|
|
3642
|
+
return this.copy();
|
|
3643
|
+
}
|
|
3644
|
+
copy() {
|
|
3645
|
+
const node = new PropertyAssignment(this.name.deepClone(), this.initializer.deepClone());
|
|
3646
|
+
node.flags = this.flags;
|
|
3647
|
+
node.pos = this.pos;
|
|
3648
|
+
node.end = this.end;
|
|
3649
|
+
return node;
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
/**
|
|
3653
|
+
* A property assignment with modifiers, a `?` or `!`, or a type annotation (which the grammar checker
|
|
3654
|
+
* reports), or in a JavaScript file, where JSDoc can give it a type or modifiers. Other property
|
|
3655
|
+
* assignments are a plain `PropertyAssignment`, without these fields.
|
|
3656
|
+
*/
|
|
3657
|
+
export class FullPropertyAssignment extends PropertyAssignment {
|
|
3658
|
+
modifiers;
|
|
3659
|
+
postfixToken;
|
|
3660
|
+
type;
|
|
3661
|
+
constructor(modifiers, name, postfixToken, type, initializer) {
|
|
3662
|
+
super(name, initializer);
|
|
3663
|
+
this.modifiers = modifiers;
|
|
3664
|
+
this.postfixToken = postfixToken;
|
|
3665
|
+
this.type = type;
|
|
3666
|
+
}
|
|
3584
3667
|
forEachChild(v) {
|
|
3585
3668
|
if (this.modifiers !== undefined && v.visitModifiers(this.modifiers))
|
|
3586
3669
|
return true;
|
|
@@ -3602,17 +3685,29 @@ export class PropertyAssignment extends Node {
|
|
|
3602
3685
|
this.type.parent = this;
|
|
3603
3686
|
this.initializer.parent = this;
|
|
3604
3687
|
}
|
|
3605
|
-
deepClone() {
|
|
3606
|
-
return this.copy();
|
|
3607
|
-
}
|
|
3608
3688
|
copy() {
|
|
3609
|
-
const node = new
|
|
3689
|
+
const node = new FullPropertyAssignment(this.modifiers === undefined ? undefined : cloneModifiers(this.modifiers), this.name.deepClone(), this.postfixToken === undefined ? undefined : this.postfixToken.copy(), this.type === undefined ? undefined : this.type.deepClone(), this.initializer.deepClone());
|
|
3610
3690
|
node.flags = this.flags;
|
|
3611
3691
|
node.pos = this.pos;
|
|
3612
3692
|
node.end = this.end;
|
|
3613
3693
|
return node;
|
|
3614
3694
|
}
|
|
3615
3695
|
}
|
|
3696
|
+
/** A `FullPropertyAssignment` when one of its fields is set or `inJavaScript`, else a `PropertyAssignment`. */
|
|
3697
|
+
export function newPropertyAssignment(modifiers, name, postfixToken, type, initializer, inJavaScript) {
|
|
3698
|
+
if (inJavaScript || modifiers !== undefined || postfixToken !== undefined || type !== undefined)
|
|
3699
|
+
return new FullPropertyAssignment(modifiers, name, postfixToken, type, initializer);
|
|
3700
|
+
return new PropertyAssignment(name, initializer);
|
|
3701
|
+
}
|
|
3702
|
+
export function propertyAssignmentModifiers(node) {
|
|
3703
|
+
return node instanceof FullPropertyAssignment ? node.modifiers : undefined;
|
|
3704
|
+
}
|
|
3705
|
+
export function propertyAssignmentPostfixToken(node) {
|
|
3706
|
+
return node instanceof FullPropertyAssignment ? node.postfixToken : undefined;
|
|
3707
|
+
}
|
|
3708
|
+
export function propertyAssignmentType(node) {
|
|
3709
|
+
return node instanceof FullPropertyAssignment ? node.type : undefined;
|
|
3710
|
+
}
|
|
3616
3711
|
export class ShorthandPropertyAssignment extends Node {
|
|
3617
3712
|
modifiers;
|
|
3618
3713
|
name;
|
|
@@ -6506,6 +6601,23 @@ export class JSDocParameterOrPropertyTag extends Node {
|
|
|
6506
6601
|
return node;
|
|
6507
6602
|
}
|
|
6508
6603
|
}
|
|
6604
|
+
// The lists of a source file that has none. Most files have no diagnostics, references, pragmas
|
|
6605
|
+
// or ambient modules, so they share these instead of holding empty arrays of their own. A list
|
|
6606
|
+
// that grows replaces an empty one rather than pushing to it (appendToList).
|
|
6607
|
+
export const emptyDiagnostics = [];
|
|
6608
|
+
export const emptyNodes = [];
|
|
6609
|
+
export const emptyStrings = [];
|
|
6610
|
+
export const emptyCommentDirectives = [];
|
|
6611
|
+
export const emptyPragmas = [];
|
|
6612
|
+
export const emptyFileReferences = [];
|
|
6613
|
+
export const emptyPatternAmbientModules = [];
|
|
6614
|
+
/** `list` with `item` appended: a new array when `list` is empty (it may be shared), else `list` itself. */
|
|
6615
|
+
export function appendToList(list, item) {
|
|
6616
|
+
if (list.length === 0)
|
|
6617
|
+
return [item];
|
|
6618
|
+
list.push(item);
|
|
6619
|
+
return list;
|
|
6620
|
+
}
|
|
6509
6621
|
export class SourceFile extends Node {
|
|
6510
6622
|
fileName;
|
|
6511
6623
|
path;
|
|
@@ -6567,12 +6679,6 @@ export class SourceFile extends Node {
|
|
|
6567
6679
|
patternAmbientModules;
|
|
6568
6680
|
/** UMD exports from `export as namespace N`. */
|
|
6569
6681
|
globalExports;
|
|
6570
|
-
/**
|
|
6571
|
-
* By name, the first property of the unions of the file's object literals that leave the name
|
|
6572
|
-
* missing (checker-symbol-types.ts `scanSiblingProperties`), where a parse thread scanned the file
|
|
6573
|
-
* and could resolve the enums the scan needed.
|
|
6574
|
-
*/
|
|
6575
|
-
siblingProperties;
|
|
6576
6682
|
constructor(fileName, path, text, externalModuleIndicatorOptions, statements, endOfFileToken) {
|
|
6577
6683
|
super(307 /* SyntaxKind.SourceFile */);
|
|
6578
6684
|
this.fileName = fileName;
|
|
@@ -6581,9 +6687,9 @@ export class SourceFile extends Node {
|
|
|
6581
6687
|
this.externalModuleIndicatorOptions = externalModuleIndicatorOptions;
|
|
6582
6688
|
this.statements = statements;
|
|
6583
6689
|
this.endOfFileToken = endOfFileToken;
|
|
6584
|
-
this.diagnostics =
|
|
6585
|
-
this.jsDiagnostics =
|
|
6586
|
-
this.jsDocDiagnostics =
|
|
6690
|
+
this.diagnostics = emptyDiagnostics;
|
|
6691
|
+
this.jsDiagnostics = emptyDiagnostics;
|
|
6692
|
+
this.jsDocDiagnostics = emptyDiagnostics;
|
|
6587
6693
|
this.languageVariant = 0;
|
|
6588
6694
|
this.scriptKind = 0 /* ScriptKind.Unknown */;
|
|
6589
6695
|
this.isDeclarationFile = false;
|
|
@@ -6594,17 +6700,17 @@ export class SourceFile extends Node {
|
|
|
6594
6700
|
this.nodeCount = 0;
|
|
6595
6701
|
this.textCount = 0;
|
|
6596
6702
|
this.imports = [];
|
|
6597
|
-
this.moduleAugmentations =
|
|
6598
|
-
this.ambientModuleNames =
|
|
6599
|
-
this.commentDirectives =
|
|
6600
|
-
this.pragmas =
|
|
6601
|
-
this.referencedFiles =
|
|
6602
|
-
this.typeReferenceDirectives =
|
|
6603
|
-
this.libReferenceDirectives =
|
|
6703
|
+
this.moduleAugmentations = emptyNodes;
|
|
6704
|
+
this.ambientModuleNames = emptyStrings;
|
|
6705
|
+
this.commentDirectives = emptyCommentDirectives;
|
|
6706
|
+
this.pragmas = emptyPragmas;
|
|
6707
|
+
this.referencedFiles = emptyFileReferences;
|
|
6708
|
+
this.typeReferenceDirectives = emptyFileReferences;
|
|
6709
|
+
this.libReferenceDirectives = emptyFileReferences;
|
|
6604
6710
|
this.checkJsDirective = undefined;
|
|
6605
6711
|
this.commonJSModuleIndicator = undefined;
|
|
6606
6712
|
this.externalModuleIndicator = undefined;
|
|
6607
|
-
this.reparsedClones =
|
|
6713
|
+
this.reparsedClones = emptyNodes;
|
|
6608
6714
|
this.hasLazyJSDoc = false;
|
|
6609
6715
|
this.jsDocs = undefined;
|
|
6610
6716
|
this.diagnosticFileCache = undefined;
|
|
@@ -6612,12 +6718,11 @@ export class SourceFile extends Node {
|
|
|
6612
6718
|
this.locals = undefined;
|
|
6613
6719
|
this.nextContainer = undefined;
|
|
6614
6720
|
this.isBound = false;
|
|
6615
|
-
this.bindDiagnostics =
|
|
6721
|
+
this.bindDiagnostics = emptyDiagnostics;
|
|
6616
6722
|
this.endFlowNode = undefined;
|
|
6617
6723
|
this.symbolCount = 0;
|
|
6618
|
-
this.patternAmbientModules =
|
|
6724
|
+
this.patternAmbientModules = emptyPatternAmbientModules;
|
|
6619
6725
|
this.globalExports = undefined;
|
|
6620
|
-
this.siblingProperties = undefined;
|
|
6621
6726
|
}
|
|
6622
6727
|
forEachChild(v) {
|
|
6623
6728
|
return v.visitList(this.statements) || v.visitNode(this.endOfFileToken);
|
|
@@ -6640,10 +6745,6 @@ export class SourceFile extends Node {
|
|
|
6640
6745
|
computeCaches() {
|
|
6641
6746
|
this.diagnosticFile().computeCaches();
|
|
6642
6747
|
}
|
|
6643
|
-
/** Like `computeCaches`, from the UTF-16 code units of the text (at least `text.length` of them). */
|
|
6644
|
-
computeCachesFromUnits(units) {
|
|
6645
|
-
this.diagnosticFile().computeCachesFromUnits(units);
|
|
6646
|
-
}
|
|
6647
6748
|
/** The file as diagnostics see it. */
|
|
6648
6749
|
diagnosticFile() {
|
|
6649
6750
|
let file = this.diagnosticFileCache;
|
|
@@ -7084,7 +7185,7 @@ export function getModifiers(node) {
|
|
|
7084
7185
|
}
|
|
7085
7186
|
break;
|
|
7086
7187
|
case 303 /* SyntaxKind.PropertyAssignment */:
|
|
7087
|
-
if (node instanceof
|
|
7188
|
+
if (node instanceof FullPropertyAssignment) {
|
|
7088
7189
|
const holder = node;
|
|
7089
7190
|
return holder.modifiers;
|
|
7090
7191
|
}
|
|
@@ -7455,7 +7556,7 @@ export function getType(node) {
|
|
|
7455
7556
|
}
|
|
7456
7557
|
break;
|
|
7457
7558
|
case 303 /* SyntaxKind.PropertyAssignment */:
|
|
7458
|
-
if (node instanceof
|
|
7559
|
+
if (node instanceof FullPropertyAssignment) {
|
|
7459
7560
|
const holder = node;
|
|
7460
7561
|
return holder.type;
|
|
7461
7562
|
}
|
|
@@ -7940,7 +8041,7 @@ export function getPostfixToken(node) {
|
|
|
7940
8041
|
}
|
|
7941
8042
|
break;
|
|
7942
8043
|
case 303 /* SyntaxKind.PropertyAssignment */:
|
|
7943
|
-
if (node instanceof
|
|
8044
|
+
if (node instanceof FullPropertyAssignment) {
|
|
7944
8045
|
const holder = node;
|
|
7945
8046
|
return holder.postfixToken;
|
|
7946
8047
|
}
|
|
@@ -7957,7 +8058,7 @@ export function getPostfixToken(node) {
|
|
|
7957
8058
|
export function getTypeArguments(node) {
|
|
7958
8059
|
switch (node.kind) {
|
|
7959
8060
|
case 214 /* SyntaxKind.CallExpression */:
|
|
7960
|
-
if (node instanceof
|
|
8061
|
+
if (node instanceof FullCallExpression) {
|
|
7961
8062
|
const holder = node;
|
|
7962
8063
|
return holder.typeArguments;
|
|
7963
8064
|
}
|
|
@@ -9189,7 +9290,7 @@ export function getSymbol(node) {
|
|
|
9189
9290
|
}
|
|
9190
9291
|
break;
|
|
9191
9292
|
case 214 /* SyntaxKind.CallExpression */:
|
|
9192
|
-
if (node instanceof
|
|
9293
|
+
if (node instanceof FullCallExpression) {
|
|
9193
9294
|
const holder = node;
|
|
9194
9295
|
return holder.symbol;
|
|
9195
9296
|
}
|
|
@@ -9520,7 +9621,7 @@ export function setSymbol(node, value) {
|
|
|
9520
9621
|
}
|
|
9521
9622
|
break;
|
|
9522
9623
|
case 214 /* SyntaxKind.CallExpression */:
|
|
9523
|
-
if (node instanceof
|
|
9624
|
+
if (node instanceof FullCallExpression) {
|
|
9524
9625
|
const target = node;
|
|
9525
9626
|
target.symbol = value;
|
|
9526
9627
|
}
|
|
@@ -10503,7 +10604,7 @@ export function setNextContainer(node, value) {
|
|
|
10503
10604
|
export function getFlowNode(node) {
|
|
10504
10605
|
switch (node.kind) {
|
|
10505
10606
|
case 79 /* SyntaxKind.Identifier */:
|
|
10506
|
-
if (node instanceof
|
|
10607
|
+
if (node instanceof ReferenceIdentifier) {
|
|
10507
10608
|
const holder = node;
|
|
10508
10609
|
return holder.flowNode;
|
|
10509
10610
|
}
|
|
@@ -10774,7 +10875,7 @@ export function getFlowNode(node) {
|
|
|
10774
10875
|
export function setFlowNode(node, value) {
|
|
10775
10876
|
switch (node.kind) {
|
|
10776
10877
|
case 79 /* SyntaxKind.Identifier */:
|
|
10777
|
-
if (node instanceof
|
|
10878
|
+
if (node instanceof ReferenceIdentifier) {
|
|
10778
10879
|
const target = node;
|
|
10779
10880
|
target.flowNode = value;
|
|
10780
10881
|
}
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
// Fields of `instanceof`-narrowed nodes are read through `as` casts: scriptc reads them
|
|
5
5
|
// statically, but reads fields of a narrowed value dynamically.
|
|
6
|
-
import { BinaryExpression, CallExpression, ElementAccessExpression, ExpressionStatement, Identifier, JSDoc, JSDocSatisfiesTag, JsxNamespacedName, MetaProperty, ModuleDeclaration, NodeVisitor, PrefixUnaryExpression, ParenthesizedExpression, PropertyAccessExpression, TaggedTemplateExpression, TypeReferenceNode, VariableDeclaration, VariableStatement, getArguments, getAsteriskToken, getBody, getElements, getExpression, getInitializer, getMembers, getModifiers, getName, getProperties, getPropertyName, getStatements, getTagName, getText, getType, } from './ast.js';
|
|
6
|
+
import { BinaryExpression, CallExpression, ElementAccessExpression, ExpressionStatement, Identifier, JSDoc, JSDocSatisfiesTag, JsxNamespacedName, MetaProperty, ModuleDeclaration, NodeVisitor, PrefixUnaryExpression, ParenthesizedExpression, PropertyAccessExpression, TaggedTemplateExpression, TypeReferenceNode, VariableDeclaration, VariableStatement, getArguments, getAsteriskToken, getBody, getElements, getExpression, getInitializer, getMembers, getModifiers, getName, getProperties, getPropertyName, getStatements, getTagName, getText, getType, callQuestionDotToken, } from './ast.js';
|
|
7
7
|
import { getJSDoc } from './parser.js';
|
|
8
8
|
import { isAssignmentOperator, isLeftHandSideExpression, isStringLiteralLike, nodeIsMissing } from './ast-utilities.js';
|
|
9
9
|
import { Scanner, computeLineOfPosition, skipTrivia } from './scanner.js';
|
|
10
|
+
import { getDeclarations } from './symbol.js';
|
|
10
11
|
// Modifiers and flags
|
|
11
12
|
export function getModifierFlags(node) {
|
|
12
13
|
const modifiers = getModifiers(node);
|
|
@@ -265,7 +266,7 @@ function getQuestionDotToken(node) {
|
|
|
265
266
|
if (node instanceof ElementAccessExpression)
|
|
266
267
|
return node.questionDotToken;
|
|
267
268
|
if (node instanceof CallExpression)
|
|
268
|
-
return node
|
|
269
|
+
return callQuestionDotToken(node);
|
|
269
270
|
if (node instanceof TaggedTemplateExpression)
|
|
270
271
|
return node.questionDotToken;
|
|
271
272
|
return undefined;
|
|
@@ -861,7 +862,7 @@ export function moduleExportNameIsDefault(node) {
|
|
|
861
862
|
return getText(node) === "default" /* InternalSymbolName.Default */;
|
|
862
863
|
}
|
|
863
864
|
export function getDeclarationOfKind(symbol, kind) {
|
|
864
|
-
for (const declaration of symbol
|
|
865
|
+
for (const declaration of getDeclarations(symbol))
|
|
865
866
|
if (declaration.kind === kind)
|
|
866
867
|
return declaration;
|
|
867
868
|
return undefined;
|