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

Unified Diff: lib/src/version.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/utils.dart ('k') | lib/src/version_constraint.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/version.dart
diff --git a/lib/src/version.dart b/lib/src/version.dart
index f2662b9aaada76cec70f5f63ccc9cebfa0c7dcaa..2d43a1aa811a33def3434000a0e25cb304f49eda 100644
--- a/lib/src/version.dart
+++ b/lib/src/version.dart
@@ -267,6 +267,9 @@ class Version implements VersionConstraint, VersionRange {
return new VersionConstraint.unionOf([this, other]);
}
+ VersionConstraint difference(VersionConstraint other) =>
+ other.allows(this) ? VersionConstraint.empty : this;
+
int compareTo(VersionRange other) {
if (other is Version) {
if (major != other.major) return major.compareTo(other.major);
« no previous file with comments | « lib/src/utils.dart ('k') | lib/src/version_constraint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698