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

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

Issue 10993059: Stop using the Hashable interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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');
11 11
12 #import('dart:math'); 12 #import('dart:math');
13 13
14 #import('utils.dart'); 14 #import('utils.dart');
15 15
16 /** A parsed semantic version number. */ 16 /** A parsed semantic version number. */
17 class Version implements Comparable, Hashable, VersionConstraint { 17 class Version implements Comparable, VersionConstraint {
18 /** No released version: i.e. "0.0.0". */ 18 /** No released version: i.e. "0.0.0". */
19 static Version get none => new Version(0, 0, 0); 19 static Version get none => new Version(0, 0, 0);
20 20
21 static const _PARSE_REGEX = const RegExp( 21 static const _PARSE_REGEX = const RegExp(
22 r'^' // Start at beginning. 22 r'^' // Start at beginning.
23 r'(\d+).(\d+).(\d+)' // Version number. 23 r'(\d+).(\d+).(\d+)' // Version number.
24 r'(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Pre-release. 24 r'(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Pre-release.
25 r'(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Build. 25 r'(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Build.
26 r'$'); // Consume entire string. 26 r'$'); // Consume entire string.
27 27
(...skipping 392 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