Chromium Code Reviews| Index: utils/pub/package.dart |
| diff --git a/utils/pub/package.dart b/utils/pub/package.dart |
| index 1449b9e8921e944d656f312b075e28c3a1ac33aa..5af11923d7b82d6c4ec23f54af2289efb7f88eec 100644 |
| --- a/utils/pub/package.dart |
| +++ b/utils/pub/package.dart |
| @@ -116,7 +116,7 @@ class PackageId implements Comparable, Hashable { |
| * The name of the package being identified. This will be the human-friendly |
| * name like "uilib". |
| */ |
| - String get name() => source.packageName(this); |
| + String get name() => source.packageName(description); |
| int hashCode() => name.hashCode() ^ |
| source.name.hashCode() ^ |
| @@ -145,6 +145,11 @@ class PackageId implements Comparable, Hashable { |
| return version.compareTo(other.version); |
| } |
| + |
| + /** |
| + * Returns the pubspec for this package. |
| + */ |
| + Future<Pubspec> describe() => source.describe(this); |
| } |
| /** |
| @@ -154,11 +159,6 @@ class PackageId implements Comparable, Hashable { |
| */ |
| class PackageRef { |
| /** |
| - * The name of the package being referenced. |
| - */ |
| - final String name; |
| - |
| - /** |
| * The [Source] used to look up the package. |
| */ |
| final Source source; |
| @@ -174,7 +174,19 @@ class PackageRef { |
| */ |
| final description; |
| - PackageRef(this.name, this.source, this.constraint, this.description); |
| + /** |
| + * The name of the package being referenced. |
| + */ |
| + String get name() => source.packageName(description); |
| + |
| + PackageRef(this.source, this.constraint, this.description); |
| String toString() => "$name $constraint from $source ($description)"; |
| + |
| + /** |
| + * Returns a [PackageId] generated from this [PackageRef] with the given |
| + * concrete version. |
| + */ |
| + PackageId withVersion(Version version) => |
|
Bob Nystrom
2012/06/29 17:24:40
"with" is a bit confusing here. Maybe "atVersion"
nweiz
2012/06/29 18:45:08
Done.
|
| + new PackageId(source, version, description); |
| } |