bool allowsAny()

in lib/src/version_union.dart [69:92]


  bool allowsAny(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.
    var ourRangesMoved = ourRanges.moveNext();
    var theirRangesMoved = theirRanges.moveNext();
    while (ourRangesMoved && theirRangesMoved) {
      if (ourRanges.current.allowsAny(theirRanges.current)) {
        return true;
      }

      // Move the constraint with the lower max value forward. This ensures that
      // we keep both lists in sync as much as possible.
      if (allowsHigher(theirRanges.current, ourRanges.current)) {
        ourRangesMoved = ourRanges.moveNext();
      } else {
        theirRangesMoved = theirRanges.moveNext();
      }
    }

    return false;
  }