Skip to content

Commit 7f1e10c

Browse files
committed
Remove redundant null checks and unreachable case
1 parent a12e29e commit 7f1e10c

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/server/session.ts

+10-13
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,11 @@ namespace ts.server {
329329
const seen = createDocumentSpanSet();
330330

331331
perProjectResults.forEach((projectResults, project) => {
332-
if (projectResults) {
333-
for (const result of projectResults) {
334-
// If there's a mapped location, it'll appear in the results for another project
335-
if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project)) {
336-
results.push(result);
337-
seen.add(result);
338-
}
332+
for (const result of projectResults) {
333+
// If there's a mapped location, it'll appear in the results for another project
334+
if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project)) {
335+
results.push(result);
336+
seen.add(result);
339337
}
340338
}
341339
});
@@ -385,11 +383,9 @@ namespace ts.server {
385383
if (defaultProjectResults?.[0]?.references[0]?.isDefinition === undefined) {
386384
// Clear all isDefinition properties
387385
perProjectResults.forEach(projectResults => {
388-
if (projectResults) {
389-
for (const referencedSymbol of projectResults) {
390-
for (const ref of referencedSymbol.references) {
391-
delete ref.isDefinition;
392-
}
386+
for (const referencedSymbol of projectResults) {
387+
for (const ref of referencedSymbol.references) {
388+
delete ref.isDefinition;
393389
}
394390
}
395391
});
@@ -588,7 +584,8 @@ namespace ts.server {
588584
// it easier for the caller to skip post-processing.
589585
if (resultsMap.size === 1) {
590586
const it = resultsMap.values().next();
591-
return it.done ? emptyArray : it.value; // There may not be any results at all
587+
Debug.assert(!it.done);
588+
return it.value;
592589
}
593590

594591
return resultsMap;

0 commit comments

Comments
 (0)