allowsAll method

bool allowsAll (VersionConstraint other)
override

Returns true if this constraint allows all the versions that other allows.

Implementation

bool allowsAll(VersionConstraint other) {
  var ourRanges = ranges.iterator;
  var theirRanges = _rangesFor(other).iterator;

  // Because both lists of ranges are ordered by minimum version, we can
  // safely move through them linearly here.
  ourRanges.moveNext();
  theirRanges.moveNext();
  while (ourRanges.current != null && theirRanges.current != null) {
    if (ourRanges.current.allowsAll(theirRanges.current)) {
      theirRanges.moveNext();
    } else {
      ourRanges.moveNext();
    }
  }

  // If our ranges have allowed all of their ranges, we'll have consumed all
  // of them.
  return theirRanges.current == null;
}