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 library pub.package; | 5 library pub.package; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:barback/barback.dart'; | 9 import 'package:barback/barback.dart'; |
10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 } | 392 } |
393 | 393 |
394 /// A reference to a constrained range of versions of one package. | 394 /// A reference to a constrained range of versions of one package. |
395 class PackageDep extends _PackageName { | 395 class PackageDep extends _PackageName { |
396 /// The allowed package versions. | 396 /// The allowed package versions. |
397 final VersionConstraint constraint; | 397 final VersionConstraint constraint; |
398 | 398 |
399 PackageDep(String name, String source, this.constraint, description) | 399 PackageDep(String name, String source, this.constraint, description) |
400 : super(name, source, description); | 400 : super(name, source, description); |
401 | 401 |
| 402 PackageDep.magic(String name) |
| 403 : super.magic(name), |
| 404 constraint = Version.none; |
| 405 |
402 String toString() { | 406 String toString() { |
403 if (isRoot) return "$name $constraint (root)"; | 407 if (isRoot) return "$name $constraint (root)"; |
| 408 if (isMagic) return name; |
404 return "$name $constraint from $source ($description)"; | 409 return "$name $constraint from $source ($description)"; |
405 } | 410 } |
406 | 411 |
407 int get hashCode => name.hashCode ^ source.hashCode; | 412 int get hashCode => name.hashCode ^ source.hashCode; |
408 | 413 |
409 bool operator ==(other) { | 414 bool operator ==(other) { |
410 // TODO(rnystrom): We're assuming here that we don't need to delve into the | 415 // TODO(rnystrom): We're assuming here that we don't need to delve into the |
411 // description. | 416 // description. |
412 return other is PackageDep && | 417 return other is PackageDep && |
413 other.name == name && | 418 other.name == name && |
414 other.source == source && | 419 other.source == source && |
415 other.constraint == constraint; | 420 other.constraint == constraint; |
416 } | 421 } |
417 } | 422 } |
OLD | NEW |