covers method

bool covers(
  1. DiffReviewRange range
)

Whether the patch contains every source line of range.

Uses indexed bounds rather than scanning the document or enumerating arbitrarily large ranges supplied by a remote provider.

Implementation

bool covers(DiffReviewRange range) {
  final keys = _keysByFileSide[(range.start.path, range.start.side)];
  if (keys == null) return false;
  return _lowerBound(keys, range.end.line + 1) -
          _lowerBound(keys, range.start.line) ==
      range.end.line - range.start.line + 1;
}