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

Side by Side Diff: utils/pub/version.dart

Issue 11191078: Make hashCode a getter and not a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Handles version numbers, following the [Semantic Versioning][semver] spec. 6 * Handles version numbers, following the [Semantic Versioning][semver] spec.
7 * 7 *
8 * [semver]: http://semver.org/ 8 * [semver]: http://semver.org/
9 */ 9 */
10 library version; 10 library version;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Builds always come after no build string. 119 // Builds always come after no build string.
120 if (build == null) return -1; 120 if (build == null) return -1;
121 if (other.build == null) return 1; 121 if (other.build == null) return 1;
122 122
123 return _compareStrings(build, other.build); 123 return _compareStrings(build, other.build);
124 } 124 }
125 125
126 return 0; 126 return 0;
127 } 127 }
128 128
129 int hashCode() => toString().hashCode(); 129 int get hashCode => toString().hashCode;
130 130
131 String toString() { 131 String toString() {
132 var buffer = new StringBuffer(); 132 var buffer = new StringBuffer();
133 buffer.add('$major.$minor.$patch'); 133 buffer.add('$major.$minor.$patch');
134 if (preRelease != null) buffer.add('-$preRelease'); 134 if (preRelease != null) buffer.add('-$preRelease');
135 if (build != null) buffer.add('+$build'); 135 if (build != null) buffer.add('+$build');
136 return buffer.toString(); 136 return buffer.toString();
137 } 137 }
138 138
139 /** 139 /**
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 case '<': return new VersionRange(max: version, includeMax: false); 420 case '<': return new VersionRange(max: version, includeMax: false);
421 case '>=': return new VersionRange(min: version, includeMin: true); 421 case '>=': return new VersionRange(min: version, includeMin: true);
422 case '>': return new VersionRange(min: version, includeMin: false); 422 case '>': return new VersionRange(min: version, includeMin: false);
423 } 423 }
424 } 424 }
425 425
426 // Otherwise, it must be an explicit version. 426 // Otherwise, it must be an explicit version.
427 return new Version.parse(text); 427 return new Version.parse(text);
428 } 428 }
429 } 429 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698