Skip to content

Commit ba53b42

Browse files
author
Andy
authored
Clean up findChildIndex (microsoft#16984)
1 parent ba8e5a7 commit ba53b42

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/server/scriptVersionCache.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -839,10 +839,9 @@ namespace ts.server {
839839
this.children.length--;
840840
}
841841

842-
findChildIndex(child: LineCollection) {
843-
let childIndex = 0;
844-
const clen = this.children.length;
845-
while ((this.children[childIndex] !== child) && (childIndex < clen)) childIndex++;
842+
private findChildIndex(child: LineCollection) {
843+
const childIndex = this.children.indexOf(child);
844+
Debug.assert(childIndex !== -1);
846845
return childIndex;
847846
}
848847

0 commit comments

Comments
 (0)