| OLD | NEW |
| 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 /// Handles version numbers, following the [Semantic Versioning][semver] spec. | 5 /// Handles version numbers, following the [Semantic Versioning][semver] spec. |
| 6 /// | 6 /// |
| 7 /// [semver]: http://semver.org/ | 7 /// [semver]: http://semver.org/ |
| 8 library version; | 8 library version; |
| 9 | 9 |
| 10 import 'dart:math'; | 10 import 'dart:math'; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 return aPart.compareTo(bPart); | 185 return aPart.compareTo(bPart); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 /// Splits a string of dot-delimited identifiers into their component parts. | 192 /// Splits a string of dot-delimited identifiers into their component parts. |
| 193 /// Identifiers that are numeric are converted to numbers. | 193 /// Identifiers that are numeric are converted to numbers. |
| 194 List _splitParts(String text) { | 194 List _splitParts(String text) { |
| 195 return text.split('.').mappedBy((part) { | 195 return text.split('.').map((part) { |
| 196 try { | 196 try { |
| 197 return int.parse(part); | 197 return int.parse(part); |
| 198 } on FormatException catch (ex) { | 198 } on FormatException catch (ex) { |
| 199 // Not a number. | 199 // Not a number. |
| 200 return part; | 200 return part; |
| 201 } | 201 } |
| 202 }).toList(); | 202 }).toList(); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 419 |
| 420 class _EmptyVersion implements VersionConstraint { | 420 class _EmptyVersion implements VersionConstraint { |
| 421 const _EmptyVersion(); | 421 const _EmptyVersion(); |
| 422 | 422 |
| 423 bool get isEmpty => true; | 423 bool get isEmpty => true; |
| 424 bool get isAny => false; | 424 bool get isAny => false; |
| 425 bool allows(Version other) => false; | 425 bool allows(Version other) => false; |
| 426 VersionConstraint intersect(VersionConstraint other) => this; | 426 VersionConstraint intersect(VersionConstraint other) => this; |
| 427 String toString() => '<empty>'; | 427 String toString() => '<empty>'; |
| 428 } | 428 } |
| OLD | NEW |