Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: lib/src/version_union.dart

Issue 2035983002: Make VersionRange implement Comparable. (Closed) Base URL: git@github.com:dart-lang/pub_semver@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/version_union.dart
diff --git a/lib/src/version_union.dart b/lib/src/version_union.dart
index dbdadcf0d6e667ed9b9b4d379371fb9edee506c0..d0e1e2bf46fa95000916bf7cf6f49e4c40c187fc 100644
--- a/lib/src/version_union.dart
+++ b/lib/src/version_union.dart
@@ -19,7 +19,7 @@ class VersionUnion implements VersionConstraint {
///
/// This list has two invariants:
///
- /// * Its contents are sorted from lowest to highest matched versions.
+ /// * Its contents are sorted using the standard ordering of [VersionRange]s.
/// * Its contents are disjoint and non-adjacent. In other words, for any two
/// constraints next to each other in the list, there's some version between
/// those constraints that they don't match.
@@ -74,8 +74,8 @@ class VersionUnion implements VersionConstraint {
return true;
}
- // Move the constraint with the higher max value forward. This ensures
- // that we keep both lists in sync as much as possible.
+ // Move the constraint with the lower max value forward. This ensures that
+ // we keep both lists in sync as much as possible.
if (compareMax(ourRanges.current, theirRanges.current) < 0) {
ourRanges.moveNext();
} else {
@@ -101,9 +101,9 @@ class VersionUnion implements VersionConstraint {
if (!intersection.isEmpty) newRanges.add(intersection);
- // Move the constraint with the higher max value forward. This ensures
- // that we keep both lists in sync as much as possible, and that large
- // ranges have a chance to match multiple small ranges that they contain.
+ // Move the constraint with the lower max value forward. This ensures that
+ // we keep both lists in sync as much as possible, and that large ranges
+ // have a chance to match multiple small ranges that they contain.
if (compareMax(ourRanges.current, theirRanges.current) < 0) {
ourRanges.moveNext();
} else {

Powered by Google App Engine
This is Rietveld 408576698