@@ -480,32 +480,9 @@ protected Rope concat(ManagedRope left, ManagedRope right, Encoding encoding,
480
480
left .getCodeRange (),
481
481
right .getCodeRange (),
482
482
sameCodeRangeProfile ,
483
- brokenCodeRangeProfile ),
484
- isBalanced (left , right ));
485
- }
486
-
487
- private boolean isBalanced (Rope left , Rope right ) {
488
- // Our definition of balanced is centered around the notion of rebalancing. We could have a simple structure
489
- // such as ConcatRope(ConcatRope(LeafRope, LeafRope), LeafRope) that is balanced on its own but may contribute
490
- // to an unbalanced rope when combined with another rope of similar structure. To keep things simple, we only
491
- // consider ConcatRopes that consist of two non-ConcatRopes balanced as the base case and ConcatRopes that
492
- // have balanced ConcatRopes for both children are balanced by induction.
493
- if (left instanceof ConcatRope ) {
494
- if (right instanceof ConcatRope ) {
495
- return ((ConcatRope ) left ).isBalanced () && ((ConcatRope ) right ).isBalanced ();
496
- }
497
-
498
- return false ;
499
- } else {
500
- // We treat the concatenation of two non-ConcatRopes as balanced, even if their children not balanced.
501
- // E.g., a SubstringRope whose child is an unbalanced ConcatRope arguable isn't balanced. However,
502
- // the code is much simpler by handling it this way. Balanced ConcatRopes will never rebalance, but
503
- // if they become part of a larger subtree that exceeds the depth threshold, they may be flattened.
504
- return !(right instanceof ConcatRope );
505
- }
483
+ brokenCodeRangeProfile ));
506
484
}
507
485
508
-
509
486
@ SuppressFBWarnings ("RV" )
510
487
@ Specialization (guards = { "!left.isEmpty()" , "!right.isEmpty()" , "isCodeRangeBroken(left, right)" })
511
488
protected Rope concatCrBroken (ManagedRope left , ManagedRope right , Encoding encoding ,
0 commit comments