Remove unnecessary length check in getSyntacticDocumentHighlights (#22064)

This commit is contained in:
Andy 2018-03-01 13:11:45 -08:00 committed by GitHub
parent c7f65e8725
commit 7b929e090d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,11 +30,7 @@ namespace ts.DocumentHighlights {
function getSyntacticDocumentHighlights(node: Node, sourceFile: SourceFile): DocumentHighlights[] {
const highlightSpans = getHighlightSpans(node, sourceFile);
if (!highlightSpans || highlightSpans.length === 0) {
return undefined;
}
return [{ fileName: sourceFile.fileName, highlightSpans }];
return highlightSpans && [{ fileName: sourceFile.fileName, highlightSpans }];
}
function getHighlightSpans(node: Node, sourceFile: SourceFile): HighlightSpan[] | undefined {