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

Unified Diff: lib/src/version_constraint.dart

Issue 2045803002: Add VersionConstraint.difference(). (Closed) Base URL: git@github.com:dart-lang/pub_semver@master
Patch Set: Code review changes Created 4 years, 6 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
« no previous file with comments | « lib/src/version.dart ('k') | lib/src/version_range.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/version_constraint.dart
diff --git a/lib/src/version_constraint.dart b/lib/src/version_constraint.dart
index 68827a40c4c9084336df94f3cc7bac4f973a1678..edd8abd0729c4b38f167aad50f4fc33c06411d94 100644
--- a/lib/src/version_constraint.dart
+++ b/lib/src/version_constraint.dart
@@ -229,13 +229,17 @@ abstract class VersionConstraint {
/// allows.
bool allowsAny(VersionConstraint other);
- /// Creates a new [VersionConstraint] that only allows [Version]s allowed by
- /// both this and [other].
+ /// Returns a [VersionConstraint] that only allows [Version]s allowed by both
+ /// this and [other].
VersionConstraint intersect(VersionConstraint other);
- /// Creates a new [VersionConstraint] that allows [Versions]s allowed by
- /// either this or [other].
+ /// Returns a [VersionConstraint] that allows [Versions]s allowed by either
+ /// this or [other].
VersionConstraint union(VersionConstraint other);
+
+ /// Returns a [VersionConstraint] that allows [Version]s allowed by this but
+ /// not [other].
+ VersionConstraint difference(VersionConstraint other);
}
class _EmptyVersion implements VersionConstraint {
@@ -248,6 +252,7 @@ class _EmptyVersion implements VersionConstraint {
bool allowsAny(VersionConstraint other) => false;
VersionConstraint intersect(VersionConstraint other) => this;
VersionConstraint union(VersionConstraint other) => other;
+ VersionConstraint difference(VersionConstraint other) => this;
String toString() => '<empty>';
}
« no previous file with comments | « lib/src/version.dart ('k') | lib/src/version_range.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698