| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library pub_semver.src.version_constraint; | 5 library pub_semver.src.version_constraint; |
| 6 | 6 |
| 7 import 'patterns.dart'; | 7 import 'patterns.dart'; |
| 8 import 'version.dart'; | 8 import 'version.dart'; |
| 9 import 'version_range.dart'; | 9 import 'version_range.dart'; |
| 10 import 'version_union.dart'; | 10 import 'version_union.dart'; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 throw new FormatException('Cannot include other constraints with ' | 107 throw new FormatException('Cannot include other constraints with ' |
| 108 '"$COMPATIBLE_WITH" constraint in "$originalText".'); | 108 '"$COMPATIBLE_WITH" constraint in "$originalText".'); |
| 109 } | 109 } |
| 110 | 110 |
| 111 return new VersionConstraint.compatibleWith(version); | 111 return new VersionConstraint.compatibleWith(version); |
| 112 } | 112 } |
| 113 | 113 |
| 114 var compatibleWith = matchCompatibleWith(); | 114 var compatibleWith = matchCompatibleWith(); |
| 115 if (compatibleWith != null) return compatibleWith; | 115 if (compatibleWith != null) return compatibleWith; |
| 116 | 116 |
| 117 var constraints = []; | 117 var constraints = <VersionConstraint>[]; |
| 118 | 118 |
| 119 while (true) { | 119 while (true) { |
| 120 skipWhitespace(); | 120 skipWhitespace(); |
| 121 | 121 |
| 122 if (text.isEmpty) break; | 122 if (text.isEmpty) break; |
| 123 | 123 |
| 124 var version = matchVersion(); | 124 var version = matchVersion(); |
| 125 if (version != null) { | 125 if (version != null) { |
| 126 constraints.add(version); | 126 constraints.add(version); |
| 127 continue; | 127 continue; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 String toString() => '<empty>'; | 216 String toString() => '<empty>'; |
| 217 } | 217 } |
| 218 | 218 |
| 219 class _CompatibleWithVersionRange extends VersionRange { | 219 class _CompatibleWithVersionRange extends VersionRange { |
| 220 _CompatibleWithVersionRange(Version version) : super( | 220 _CompatibleWithVersionRange(Version version) : super( |
| 221 min: version, includeMin: true, | 221 min: version, includeMin: true, |
| 222 max: version.nextBreaking, includeMax: false); | 222 max: version.nextBreaking, includeMax: false); |
| 223 | 223 |
| 224 String toString() => '^$min'; | 224 String toString() => '^$min'; |
| 225 } | 225 } |
| OLD | NEW |