@@ -11,6 +11,10 @@ module ts {
11
11
var nextNodeId = 1 ;
12
12
var nextMergeId = 1 ;
13
13
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.
14
18
export function createTypeChecker ( program : Program , fullTypeCheck : boolean ) : TypeChecker {
15
19
16
20
var Symbol = objectAllocator . getSymbolConstructor ( ) ;
@@ -6322,7 +6326,9 @@ module ts {
6322
6326
forEach ( program . getSourceFiles ( ) , checkSourceFile ) ;
6323
6327
}
6324
6328
6325
- function getSortedDiagnostics ( ) : Diagnostic [ ] {
6329
+ function getSortedDiagnostics ( ) : Diagnostic [ ] {
6330
+ Debug . assert ( fullTypeCheck , "diagnostics are available only in the full typecheck mode" ) ;
6331
+
6326
6332
if ( diagnosticsModified ) {
6327
6333
diagnostics . sort ( compareDiagnostics ) ;
6328
6334
diagnostics = deduplicateSortedDiagnostics ( diagnostics ) ;
@@ -6331,7 +6337,8 @@ module ts {
6331
6337
return diagnostics ;
6332
6338
}
6333
6339
6334
- function getDiagnostics ( sourceFile ?: SourceFile ) : Diagnostic [ ] {
6340
+ function getDiagnostics ( sourceFile ?: SourceFile ) : Diagnostic [ ] {
6341
+
6335
6342
if ( sourceFile ) {
6336
6343
checkSourceFile ( sourceFile ) ;
6337
6344
return filter ( getSortedDiagnostics ( ) , d => d . file === sourceFile ) ;
0 commit comments