buildTreeFromBottom: simplify loop (#17091)
This commit is contained in:
parent
23da0ab501
commit
1408109487
1 changed files with 2 additions and 6 deletions
|
@ -531,16 +531,12 @@ namespace ts.server {
|
||||||
const interiorNode = interiorNodes[i] = new LineNode();
|
const interiorNode = interiorNodes[i] = new LineNode();
|
||||||
let charCount = 0;
|
let charCount = 0;
|
||||||
let lineCount = 0;
|
let lineCount = 0;
|
||||||
for (let j = 0; j < lineCollectionCapacity; j++) {
|
const end = Math.min(nodeIndex + lineCollectionCapacity, nodes.length);
|
||||||
if (nodeIndex >= nodes.length) {
|
for (; nodeIndex < end; nodeIndex++) {
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const node = nodes[nodeIndex];
|
const node = nodes[nodeIndex];
|
||||||
interiorNode.add(node);
|
interiorNode.add(node);
|
||||||
charCount += node.charCount();
|
charCount += node.charCount();
|
||||||
lineCount += node.lineCount();
|
lineCount += node.lineCount();
|
||||||
nodeIndex++;
|
|
||||||
}
|
}
|
||||||
interiorNode.totalChars = charCount;
|
interiorNode.totalChars = charCount;
|
||||||
interiorNode.totalLines = lineCount;
|
interiorNode.totalLines = lineCount;
|
||||||
|
|
Loading…
Reference in a new issue