Address code-review comments
This commit is contained in:
parent
b08cd8c9a9
commit
360d332bd4
|
@ -1651,7 +1651,7 @@ module ts {
|
||||||
return program.getDiagnostics(getSourceFile(filename).getSourceFile());
|
return program.getDiagnostics(getSourceFile(filename).getSourceFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
// In a case when '-d' is not enabled, only report semantic errors
|
// getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors
|
||||||
// If '-d' enabled, report both semantic and emitter errors
|
// If '-d' enabled, report both semantic and emitter errors
|
||||||
function getSemanticDiagnostics(filename: string) {
|
function getSemanticDiagnostics(filename: string) {
|
||||||
synchronizeHostData();
|
synchronizeHostData();
|
||||||
|
@ -1661,16 +1661,17 @@ module ts {
|
||||||
var checker = getFullTypeCheckChecker();
|
var checker = getFullTypeCheckChecker();
|
||||||
var targetSourceFile = getSourceFile(filename);
|
var targetSourceFile = getSourceFile(filename);
|
||||||
|
|
||||||
// Only perform the action per file regardless off '-out' flag
|
// Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file.
|
||||||
// As an errors message in Visual Studio will maintain an error message life-time per file
|
// Therefore only get diagnostics for given file.
|
||||||
|
|
||||||
var allDiagnostics = checker.getDiagnostics(targetSourceFile);
|
var allDiagnostics = checker.getDiagnostics(targetSourceFile);
|
||||||
if (compilerOptions.declaration) {
|
if (compilerOptions.declaration) {
|
||||||
// If '-d' is enabled, check for emitter error which requires calling to TypeChecker.emitFiles
|
// If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface
|
||||||
// Define CompilerHost.writer which does nothing as this is a side effect of emitFiles
|
// Get emitter-diagnostics requires calling TypeChecker.emitFiles so define CompilerHost.writer which does nothing as this is a side effect of emitFiles
|
||||||
|
var savedWriter = writer;
|
||||||
writer = (filename: string, data: string, writeByteOrderMark: boolean) => { };
|
writer = (filename: string, data: string, writeByteOrderMark: boolean) => { };
|
||||||
allDiagnostics = allDiagnostics.concat(checker.emitFiles(targetSourceFile).errors);
|
allDiagnostics = allDiagnostics.concat(checker.emitFiles(targetSourceFile).errors);
|
||||||
writer = undefined;
|
writer = savedWriter;
|
||||||
}
|
}
|
||||||
return allDiagnostics
|
return allDiagnostics
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
//// interface privateInterface {}
|
//// interface privateInterface {}
|
||||||
//// export class Bar implements /*1*/privateInterface/*2*/{ }
|
//// export class Bar implements /*1*/privateInterface/*2*/{ }
|
||||||
|
|
||||||
debugger
|
|
||||||
verify.numberOfErrorsInCurrentFile(0);
|
verify.numberOfErrorsInCurrentFile(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue