tsc-ts 0.0.7 → 0.0.9
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/checker-declaration-order.js +3 -2
- package/dist/api/compiler/checker-declared-types.js +6 -3
- package/dist/api/compiler/checker-deprecation.js +14 -13
- package/dist/api/compiler/checker-destructuring.js +3 -2
- package/dist/api/compiler/checker-members.js +6 -2
- package/dist/api/compiler/checker-source-file.d.ts +12 -0
- package/dist/api/compiler/checker-source-file.js +35 -0
- package/dist/api/compiler/checker-symbol-types.js +5 -5
- package/dist/api/compiler/checker-symbols.js +5 -2
- package/dist/api/compiler/checker.d.ts +6 -1
- package/dist/api/compiler/checker.js +9 -1
- package/dist/api/compiler/file-loader.d.ts +2 -2
- package/dist/api/compiler/file-loader.js +43 -23
- package/dist/api/compiler/link-tables.d.ts +7 -0
- package/dist/api/compiler/link-tables.js +22 -0
- package/dist/api/compiler/parser.d.ts +7 -0
- package/dist/api/compiler/parser.js +55 -32
- package/dist/api/compiler/program-checker.d.ts +18 -0
- package/dist/api/compiler/program-checker.js +35 -2
- package/dist/api/library/diagnostics.d.ts +10 -0
- package/dist/api/library/diagnostics.js +20 -0
- package/package.json +9 -9
- package/src/compiler/checker-declaration-order.ts +3 -2
- package/src/compiler/checker-declared-types.ts +6 -3
- package/src/compiler/checker-deprecation.ts +13 -11
- package/src/compiler/checker-destructuring.ts +11 -2
- package/src/compiler/checker-members.ts +6 -2
- package/src/compiler/checker-source-file.ts +34 -0
- package/src/compiler/checker-symbol-types.ts +14 -4
- package/src/compiler/checker-symbols.ts +6 -2
- package/src/compiler/checker.ts +8 -1
- package/src/compiler/file-loader.ts +49 -24
- package/src/compiler/link-tables.ts +32 -0
- package/src/compiler/parallel-check.ts +199 -20
- package/src/compiler/parser.ts +55 -32
- package/src/compiler/program-checker.ts +36 -2
- package/src/compiler/thread-entry.ts +16 -1
- package/src/library/diagnostics.ts +23 -0
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
type SourceFileMetadata,
|
|
27
27
|
} from './program-utilities.js';
|
|
28
28
|
import { bindSourceFile } from './binder.js';
|
|
29
|
+
import { checkSourceFileRange } from './checker-source-file.js';
|
|
29
30
|
import { computeLineOfPosition } from './scanner.js';
|
|
30
31
|
import { CommentDirectiveKind } from './types.js';
|
|
31
32
|
|
|
@@ -313,6 +314,38 @@ export class CheckedProgram {
|
|
|
313
314
|
return result;
|
|
314
315
|
}
|
|
315
316
|
|
|
317
|
+
/**
|
|
318
|
+
* Checks the statements `start` to `end` of the declaration file `file` with this checker, one of the
|
|
319
|
+
* ranges that several checkers check it in (`checkSourceFileRange`, parallel-check.ts), and returns
|
|
320
|
+
* whether the checker then has diagnostics in the file.
|
|
321
|
+
*/
|
|
322
|
+
checkRange(file: SourceFile, start: number, end: number): boolean {
|
|
323
|
+
return checkSourceFileRange(this.checker, file, start, end);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* The diagnostics of `file`, as `unfilteredDiagnosticsOfFile` gives them, where checkers checked it in
|
|
328
|
+
* ranges and found no diagnostics in it (`checkRange`).
|
|
329
|
+
*/
|
|
330
|
+
unfilteredDiagnosticsOfCleanRanges(file: SourceFile): Diagnostic[] {
|
|
331
|
+
const result = this.getBindAndCheckDiagnostics(file, []);
|
|
332
|
+
for (const d of this.getIncludeProcessorDiagnostics(file)) result.push(d);
|
|
333
|
+
return result;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* The diagnostics of `file`, as `unfilteredDiagnosticsOfFile` gives them, from a new checker that checks it
|
|
338
|
+
* whole: for a file checked in ranges that found diagnostics in it (parallel-check.ts), part of which this
|
|
339
|
+
* thread's checker may have checked.
|
|
340
|
+
*/
|
|
341
|
+
unfilteredDiagnosticsOfFileOnNewChecker(file: SourceFile): Diagnostic[] {
|
|
342
|
+
const checker = this.createChecker();
|
|
343
|
+
const result = this.getBindAndCheckDiagnostics(file, checker.getDiagnostics(file));
|
|
344
|
+
disposeChecker(checker);
|
|
345
|
+
for (const d of this.getIncludeProcessorDiagnostics(file)) result.push(d);
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
348
|
+
|
|
316
349
|
/**
|
|
317
350
|
* The bind and check diagnostics of `file` before `noEmit` filtering and without include errors.
|
|
318
351
|
* Once checker threads checked the program, they come from the threads' diagnostics of the file,
|
|
@@ -395,10 +428,11 @@ export class CheckedProgram {
|
|
|
395
428
|
return sortAndDeduplicateDiagnostics(result);
|
|
396
429
|
}
|
|
397
430
|
|
|
398
|
-
|
|
431
|
+
/** `checks` are the checker's diagnostics of `file`. */
|
|
432
|
+
private getBindAndCheckDiagnostics(file: SourceFile, checks?: readonly Diagnostic[]): Diagnostic[] {
|
|
399
433
|
const options = this.program.options;
|
|
400
434
|
const diagnostics = file.bindDiagnostics.slice();
|
|
401
|
-
for (const d of this.checker.getDiagnostics(file)) diagnostics.push(d);
|
|
435
|
+
for (const d of checks ?? this.checker.getDiagnostics(file)) diagnostics.push(d);
|
|
402
436
|
if (isPlainJSFile(file, options)) {
|
|
403
437
|
const result: Diagnostic[] = [];
|
|
404
438
|
for (const d of diagnostics) if (plainJSErrors.has(d.code)) result.push(d);
|
|
@@ -54,6 +54,7 @@ export interface CheckerThreadData {
|
|
|
54
54
|
readonly emits: boolean;
|
|
55
55
|
readonly emitKinds: number[] | undefined;
|
|
56
56
|
readonly checking: boolean;
|
|
57
|
+
readonly units: number[];
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
export interface ParseThreadData {
|
|
@@ -75,7 +76,19 @@ export interface ReferenceThreadData {
|
|
|
75
76
|
*/
|
|
76
77
|
export function startThreads(spawn: ThreadSpawn, drivers: ThreadDrivers, args: readonly string[]): void {
|
|
77
78
|
parallelCheck.writer = drivers.outputWriter();
|
|
78
|
-
parallelCheck.spawn = (
|
|
79
|
+
parallelCheck.spawn = (
|
|
80
|
+
program,
|
|
81
|
+
index,
|
|
82
|
+
counter,
|
|
83
|
+
order,
|
|
84
|
+
nodeIds,
|
|
85
|
+
symbolIds,
|
|
86
|
+
reserved,
|
|
87
|
+
emits,
|
|
88
|
+
emitKinds,
|
|
89
|
+
checking,
|
|
90
|
+
units,
|
|
91
|
+
) =>
|
|
79
92
|
spawn({
|
|
80
93
|
kind: 'check',
|
|
81
94
|
program,
|
|
@@ -89,6 +102,7 @@ export function startThreads(spawn: ThreadSpawn, drivers: ThreadDrivers, args: r
|
|
|
89
102
|
emits,
|
|
90
103
|
emitKinds,
|
|
91
104
|
checking,
|
|
105
|
+
units,
|
|
92
106
|
});
|
|
93
107
|
if (sharesPublishedGraphs) {
|
|
94
108
|
parallelParse.spawn = (configFileName, counter, index) =>
|
|
@@ -161,6 +175,7 @@ function runCheckerThread(job: CheckerThreadData, drivers: ThreadDrivers): void
|
|
|
161
175
|
job.emits,
|
|
162
176
|
job.emitKinds,
|
|
163
177
|
job.checking,
|
|
178
|
+
job.units,
|
|
164
179
|
);
|
|
165
180
|
// Packed results are copied: nothing this thread allocated stays reachable after it ends.
|
|
166
181
|
if (packsResults) parentPort!.postMessage(packResult(result, program!));
|
|
@@ -70,3 +70,26 @@ export function programDiagnostics(
|
|
|
70
70
|
return [];
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* What `semantic` answers for each of `files` and what `global` answers, after checking `files` and
|
|
76
|
+
* no other file. Checking one file can add diagnostics located in another, so every file is checked
|
|
77
|
+
* before any file's diagnostics are collected. With every file of the program listed, the answers are
|
|
78
|
+
* those of the full check.
|
|
79
|
+
*/
|
|
80
|
+
export function checkedFileDiagnostics(
|
|
81
|
+
checked: CheckedProgram,
|
|
82
|
+
files: readonly SourceFile[],
|
|
83
|
+
): { files: (readonly CompilerDiagnostic[])[]; global: readonly CompilerDiagnostic[] } {
|
|
84
|
+
for (const file of files) checked.getSemanticDiagnostics(file);
|
|
85
|
+
const program = checked.program;
|
|
86
|
+
const global = [
|
|
87
|
+
...program.getConfigFileParsingDiagnostics(),
|
|
88
|
+
...program.getProgramDiagnostics(),
|
|
89
|
+
...checked.getGlobalDiagnostics(),
|
|
90
|
+
];
|
|
91
|
+
return {
|
|
92
|
+
files: files.map((file) => checked.getSemanticDiagnostics(file)),
|
|
93
|
+
global: sortAndDeduplicateDiagnostics(global).filter((d) => d.file === undefined),
|
|
94
|
+
};
|
|
95
|
+
}
|