Properly adjust nodes while walking down the tree.

This commit is contained in:
Cyrus Najmabadi 2014-12-12 02:34:53 -08:00
parent 2f833d5f97
commit 9c0e4211bc
2 changed files with 5 additions and 3 deletions

View File

@ -801,7 +801,7 @@ module ts {
// Adjust the pos or end (or both) of the intersecting array accordingly.
adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
for (var i = 0, n = array.length; i < n; i++) {
forEachChild(array[i], visitNode, visitArray);
visitNode(array[i]);
}
}
// else {
@ -908,7 +908,7 @@ module ts {
array.end += delta;
for (var i = 0, n = array.length; i < n; i++) {
forEachChild(array[i], visitNode, visitArray);
visitNode(array[i]);
}
}
}

View File

@ -55,7 +55,7 @@ module ts {
Utils.assertInvariants(newTree, /*parent:*/ undefined);
// Create a tree for the new text, in an incremental fashion.
var incrementalNewTree = updateLanguageServiceSourceFile(oldTree, newText, oldTree.version + ".", /*isOpen:*/ true, textChangeRange, /*useIncremental:*/ false);
var incrementalNewTree = updateLanguageServiceSourceFile(oldTree, newText, oldTree.version + ".", /*isOpen:*/ true, textChangeRange, /*useIncremental:*/ true);
Utils.assertInvariants(incrementalNewTree, /*parent:*/ undefined);
// We should get the same tree when doign a full or incremental parse.
@ -177,7 +177,9 @@ module ts {
}
describe('Incremental',() => {
debugger;
it('Inserting into method',() => {
debugger;
var source = "class C {\r\n" +
" public foo1() { }\r\n" +
" public foo2() {\r\n" +