@@ -400,6 +400,7 @@ module ts {
400
400
}
401
401
402
402
function visitArray ( array : IncrementalNodeArray ) {
403
+ array . _children = undefined ;
403
404
array . pos += delta ;
404
405
array . end += delta ;
405
406
@@ -412,6 +413,7 @@ module ts {
412
413
function adjustIntersectingElement ( element : IncrementalElement , changeStart : number , changeRangeOldEnd : number , changeRangeNewEnd : number , delta : number ) {
413
414
Debug . assert ( element . end >= changeStart , "Adjusting an element that was entirely before the change range" ) ;
414
415
Debug . assert ( element . pos <= changeRangeOldEnd , "Adjusting an element that was entirely after the change range" ) ;
416
+ Debug . assert ( element . pos <= element . end ) ;
415
417
416
418
// We have an element that intersects the change range in some way. It may have its
417
419
// start, or its end (or both) in the changed range. We want to adjust any part
@@ -522,6 +524,7 @@ module ts {
522
524
var fullEnd = child . end ;
523
525
if ( fullEnd >= changeStart ) {
524
526
child . intersectsChange = true ;
527
+ child . _children = undefined ;
525
528
526
529
// Adjust the pos or end (or both) of the intersecting element accordingly.
527
530
adjustIntersectingElement ( child , changeStart , changeRangeOldEnd , changeRangeNewEnd , delta ) ;
@@ -541,25 +544,27 @@ module ts {
541
544
// Array is entirely after the change range. We need to move it, and move any of
542
545
// its children.
543
546
moveElementEntirelyPastChangeRange ( array , /*isArray:*/ true , delta , oldText , newText , aggressiveChecks ) ;
547
+ return ;
544
548
}
545
- else {
546
- // Check if the element intersects the change range. If it does, then it is not
547
- // reusable. Also, we'll need to recurse to see what constituent portions we may
548
- // be able to use.
549
- var fullEnd = array . end ;
550
- if ( fullEnd >= changeStart ) {
551
- array . intersectsChange = true ;
552
-
553
- // Adjust the pos or end (or both) of the intersecting array accordingly.
554
- adjustIntersectingElement ( array , changeStart , changeRangeOldEnd , changeRangeNewEnd , delta ) ;
555
- for ( var i = 0 , n = array . length ; i < n ; i ++ ) {
556
- visitNode ( array [ i ] ) ;
557
- }
549
+
550
+ // Check if the element intersects the change range. If it does, then it is not
551
+ // reusable. Also, we'll need to recurse to see what constituent portions we may
552
+ // be able to use.
553
+ var fullEnd = array . end ;
554
+ if ( fullEnd >= changeStart ) {
555
+ array . intersectsChange = true ;
556
+ array . _children = undefined ;
557
+
558
+ // Adjust the pos or end (or both) of the intersecting array accordingly.
559
+ adjustIntersectingElement ( array , changeStart , changeRangeOldEnd , changeRangeNewEnd , delta ) ;
560
+ for ( var i = 0 , n = array . length ; i < n ; i ++ ) {
561
+ visitNode ( array [ i ] ) ;
558
562
}
559
- // else {
560
- // Otherwise, the array is entirely before the change range. No need to do anything with it.
561
- // }
563
+ return ;
562
564
}
565
+
566
+ // Otherwise, the array is entirely before the change range. No need to do anything with it.
567
+ Debug . assert ( fullEnd < changeStart ) ;
563
568
}
564
569
}
565
570
0 commit comments