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

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: Respond to review. 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
« no previous file with comments | « utils/pub/utils.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/version.dart
diff --git a/utils/pub/version.dart b/utils/pub/version.dart
index 061c31951215d568166f189454f6b33b2192c04b..c7b0d1d45f342edf0bd3aa04bfd136c44be3125b 100644
--- a/utils/pub/version.dart
+++ b/utils/pub/version.dart
@@ -9,8 +9,12 @@
*/
#library('pub_version');
+#import('utils.dart');
+
/** 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 +108,8 @@ class Version implements Comparable, VersionConstraint {
return 0;
}
+ int hashCode() => toString().hashCode();
+
String toString() {
var buffer = new StringBuffer();
buffer.add('$major.$minor.$patch');
@@ -201,12 +207,3 @@ class VersionRange implements VersionConstraint {
return true;
}
}
-
-/** Thrown by [Version.parse()] if the argument isn't a valid version string. */
-class FormatException implements Exception {
- final String message;
-
- FormatException(this.message);
-
- String toString() => message;
-}
« no previous file with comments | « utils/pub/utils.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698