Add a check to make sure we have results.

This commit is contained in:
Paul van Brenk
2015-03-16 17:29:56 -07:00
parent 4d3e842e9f
commit 325c8b655f

View File

@@ -3573,14 +3573,16 @@ module ts {
function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
let results = getOccurrencesAtPositionCore(fileName, position);
if (results) {
let sourceFile = getCanonicalFileName(normalizeSlashes(fileName));
let sourceFile = getCanonicalFileName(normalizeSlashes(fileName));
// ensure the results are in the file we're interested in
results.forEach((value) => {
let targetFile = getCanonicalFileName(normalizeSlashes(value.fileName));
Debug.assert(sourceFile == targetFile, `Unexpected file in results. Found results in ${targetFile} expected only results in ${sourceFile}.`);
});
// ensure the results are in the file we're interested in
results.forEach((value) => {
let targetFile = getCanonicalFileName(normalizeSlashes(value.fileName));
Debug.assert(sourceFile == targetFile, `Unexpected file in results. Found results in ${targetFile} expected only results in ${sourceFile}.`);
});
}
return results;
}