refactor(language-service): remove unnecessary size check (#32587)

Presumably, the size of the results array was checked so that a TS
source file wouldn't have to be created if there were no diagnostics.
However, it is very likely that a TS program already has the
`ts.SourceFile` for file when diagnostics are queried. This removal is
just to make the function a minimal amount simpler.

PR Close #32587
This commit is contained in:
ayazhafiz 2019-09-10 11:04:18 -05:00 committed by Matias Niemelä
parent d30cd3309b
commit b6f439d91b
1 changed files with 0 additions and 3 deletions

View File

@ -49,9 +49,6 @@ class LanguageServiceImpl implements LanguageService {
if (declarations && declarations.length) {
results.push(...getDeclarationDiagnostics(declarations, analyzedModules));
}
if (!results.length) {
return [];
}
const sourceFile = fileName.endsWith('.ts') ? this.host.getSourceFile(fileName) : undefined;
return uniqueBySpan(results).map(d => ngDiagnosticToTsDiagnostic(d, sourceFile));
}