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

Unified Diff: utils/pub/version.dart

Issue 10399076: Get codebase ready for actually supporting versioning. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tiny tweak. Created 8 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: utils/pub/version.dart
diff --git a/utils/pub/version.dart b/utils/pub/version.dart
index 061c31951215d568166f189454f6b33b2192c04b..89c455d6bb8383f66b24a8fa7a6a4f154df50e8f 100644
--- a/utils/pub/version.dart
+++ b/utils/pub/version.dart
@@ -10,7 +10,9 @@
#library('pub_version');
/** A parsed semantic version number. */
-class Version implements Comparable, VersionConstraint {
+class Version implements Comparable, Hashable, VersionConstraint {
+ static get none() => new Version(0, 0, 0);
+
static final _PARSE_REGEX = const RegExp(
@'^' // Start at beginning.
@'(\d+).(\d+).(\d+)' // Version number.
@@ -104,6 +106,8 @@ class Version implements Comparable, VersionConstraint {
return 0;
}
+ int hashCode() => toString().hashCode();
+
String toString() {
var buffer = new StringBuffer();
buffer.add('$major.$minor.$patch');

Powered by Google App Engine
This is Rietveld 408576698