private static bool AllChangesCanBeApplied( SimpleIntervalTree <TextChange, IntervalIntrospector> cumulativeChanges, ImmutableArray <TextChange> currentChanges, ref TemporaryArray <TextChange> overlappingSpans, ref TemporaryArray <TextChange> intersectingSpans) { foreach (var change in currentChanges) { overlappingSpans.Clear(); intersectingSpans.Clear(); cumulativeChanges.FillWithIntervalsThatOverlapWith( change.Span.Start, change.Span.Length, ref overlappingSpans); cumulativeChanges.FillWithIntervalsThatIntersectWith( change.Span.Start, change.Span.Length, ref intersectingSpans); var value = ChangeCanBeApplied(change, overlappingSpans: in overlappingSpans, intersectingSpans: in intersectingSpans); if (!value) { return(false); } } // All the changes would merge in fine. We can absorb this. return(true); }