Skip to content

Commit 318aa8c

Browse files
Don't use dynamic type checks while incrementally parsing.
1 parent a710902 commit 318aa8c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/compiler/parser.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ module ts {
371371
return false;
372372
}
373373

374-
function moveElementEntirelyPastChangeRange(element: IncrementalElement, delta: number, oldText: string, newText: string, aggressiveChecks: boolean) {
375-
if (element.length) {
374+
function moveElementEntirelyPastChangeRange(element: IncrementalElement, isArray: boolean, delta: number, oldText: string, newText: string, aggressiveChecks: boolean) {
375+
if (isArray) {
376376
visitArray(<IncrementalNodeArray>element);
377377
}
378378
else {
@@ -511,7 +511,7 @@ module ts {
511511
if (child.pos > changeRangeOldEnd) {
512512
// Node is entirely past the change range. We need to move both its pos and
513513
// end, forward or backward appropriately.
514-
moveElementEntirelyPastChangeRange(child, delta, oldText, newText, aggressiveChecks);
514+
moveElementEntirelyPastChangeRange(child, /*isArray:*/ false, delta, oldText, newText, aggressiveChecks);
515515
return;
516516
}
517517

@@ -537,7 +537,7 @@ module ts {
537537
if (array.pos > changeRangeOldEnd) {
538538
// Array is entirely after the change range. We need to move it, and move any of
539539
// its children.
540-
moveElementEntirelyPastChangeRange(array, delta, oldText, newText, aggressiveChecks);
540+
moveElementEntirelyPastChangeRange(array, /*isArray:*/ true, delta, oldText, newText, aggressiveChecks);
541541
}
542542
else {
543543
// Check if the element intersects the change range. If it does, then it is not

0 commit comments

Comments
 (0)