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 import 'patterns.dart'; | 5 import 'patterns.dart'; |
6 import 'version.dart'; | 6 import 'version.dart'; |
7 import 'version_range.dart'; | 7 import 'version_range.dart'; |
8 import 'version_union.dart'; | 8 import 'version_union.dart'; |
9 import 'utils.dart'; | 9 import 'utils.dart'; |
10 | 10 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 /// allows. | 229 /// allows. |
230 bool allowsAny(VersionConstraint other); | 230 bool allowsAny(VersionConstraint other); |
231 | 231 |
232 /// Creates a new [VersionConstraint] that only allows [Version]s allowed by | 232 /// Creates a new [VersionConstraint] that only allows [Version]s allowed by |
233 /// both this and [other]. | 233 /// both this and [other]. |
234 VersionConstraint intersect(VersionConstraint other); | 234 VersionConstraint intersect(VersionConstraint other); |
235 | 235 |
236 /// Creates a new [VersionConstraint] that allows [Versions]s allowed by | 236 /// Creates a new [VersionConstraint] that allows [Versions]s allowed by |
237 /// either this or [other]. | 237 /// either this or [other]. |
238 VersionConstraint union(VersionConstraint other); | 238 VersionConstraint union(VersionConstraint other); |
239 | |
240 /// Creates a new [VersionConstraint] that allows [Version]s allowed by this | |
Bob Nystrom
2016/06/08 22:51:06
Technically, these don't always create *new* const
nweiz
2016/06/08 23:39:02
Done.
| |
241 /// but not [other]. | |
242 VersionConstraint difference(VersionConstraint other); | |
239 } | 243 } |
240 | 244 |
241 class _EmptyVersion implements VersionConstraint { | 245 class _EmptyVersion implements VersionConstraint { |
242 const _EmptyVersion(); | 246 const _EmptyVersion(); |
243 | 247 |
244 bool get isEmpty => true; | 248 bool get isEmpty => true; |
245 bool get isAny => false; | 249 bool get isAny => false; |
246 bool allows(Version other) => false; | 250 bool allows(Version other) => false; |
247 bool allowsAll(VersionConstraint other) => other.isEmpty; | 251 bool allowsAll(VersionConstraint other) => other.isEmpty; |
248 bool allowsAny(VersionConstraint other) => false; | 252 bool allowsAny(VersionConstraint other) => false; |
249 VersionConstraint intersect(VersionConstraint other) => this; | 253 VersionConstraint intersect(VersionConstraint other) => this; |
250 VersionConstraint union(VersionConstraint other) => other; | 254 VersionConstraint union(VersionConstraint other) => other; |
255 VersionConstraint difference(VersionConstraint other) => this; | |
251 String toString() => '<empty>'; | 256 String toString() => '<empty>'; |
252 } | 257 } |
253 | 258 |
254 class _CompatibleWithVersionRange extends VersionRange { | 259 class _CompatibleWithVersionRange extends VersionRange { |
255 _CompatibleWithVersionRange(Version version) : super( | 260 _CompatibleWithVersionRange(Version version) : super( |
256 min: version, includeMin: true, | 261 min: version, includeMin: true, |
257 max: version.nextBreaking, includeMax: false); | 262 max: version.nextBreaking, includeMax: false); |
258 | 263 |
259 String toString() => '^$min'; | 264 String toString() => '^$min'; |
260 } | 265 } |
OLD | NEW |