Skip to content

Commit 23c9b01

Browse files
Merge pull request #1037 from Microsoft/incrementalParsingPerf
Speed up incremental parsing by caching child tokens instead of walking ...
2 parents f15d87b + 8954538 commit 23c9b01

24 files changed

+3115
-6661
lines changed

src/services/formatting/indentationTrackingWalker.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ module TypeScript.Services.Formatting {
9999
}
100100

101101
public walk(element: ISyntaxElement) {
102-
if (element && !isShared(element)) {
102+
if (element) {
103103
if (isToken(element)) {
104104
this.visitToken(<ISyntaxToken>element);
105105
}
106106
else if (element.kind() === SyntaxKind.List) {
107-
for (var i = 0, n = element.childCount(); i < n; i++) {
108-
this.walk(element.childAt(i));
107+
for (var i = 0, n = childCount(element); i < n; i++) {
108+
this.walk(childAt(element, i));
109109
}
110110
}
111111
else {
@@ -126,8 +126,8 @@ module TypeScript.Services.Formatting {
126126
this._parent = this._indentationNodeContextPool.getNode(currentParent, node, this._position, indentation.indentationAmount, indentation.indentationAmountDelta);
127127

128128
// Visit node
129-
for (var i = 0, n = node.childCount(); i < n; i++) {
130-
this.walk(node.childAt(i));
129+
for (var i = 0, n = childCount(node); i < n; i++) {
130+
this.walk(childAt(node, i));
131131
}
132132

133133
// Reset state

0 commit comments

Comments
 (0)