Skip to content

Commit 8475a33

Browse files
committed
added comment to fullTypeCheck parameter
1 parent 72fc5db commit 8475a33

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/compiler/checker.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ module ts {
1111
var nextNodeId = 1;
1212
var nextMergeId = 1;
1313

14+
/// fullTypeCheck denotes if this instance of the typechecker will be used to get semantic diagnostics.
15+
/// If fullTypeCheck === true - then typechecker should do every possible check to produce all errors
16+
/// If fullTypeCheck === false - typechecker can shortcut and skip checks that only produce errors.
17+
/// NOTE: checks that somehow affects decisions being made during typechecking should be executed in both cases.
1418
export function createTypeChecker(program: Program, fullTypeCheck: boolean): TypeChecker {
1519

1620
var Symbol = objectAllocator.getSymbolConstructor();
@@ -6322,7 +6326,9 @@ module ts {
63226326
forEach(program.getSourceFiles(), checkSourceFile);
63236327
}
63246328

6325-
function getSortedDiagnostics(): Diagnostic[] {
6329+
function getSortedDiagnostics(): Diagnostic[]{
6330+
Debug.assert(fullTypeCheck, "diagnostics are available only in the full typecheck mode");
6331+
63266332
if (diagnosticsModified) {
63276333
diagnostics.sort(compareDiagnostics);
63286334
diagnostics = deduplicateSortedDiagnostics(diagnostics);
@@ -6331,7 +6337,8 @@ module ts {
63316337
return diagnostics;
63326338
}
63336339

6334-
function getDiagnostics(sourceFile?: SourceFile): Diagnostic[] {
6340+
function getDiagnostics(sourceFile?: SourceFile): Diagnostic[]{
6341+
63356342
if (sourceFile) {
63366343
checkSourceFile(sourceFile);
63376344
return filter(getSortedDiagnostics(), d => d.file === sourceFile);

0 commit comments

Comments
 (0)