Index: utils/pub/package.dart |
diff --git a/utils/pub/package.dart b/utils/pub/package.dart |
index 1449b9e8921e944d656f312b075e28c3a1ac33aa..46345ed92891f1efd5b2a84e1c3d8e3bb1b52eef 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 atVersion(Version version) => |
+ new PackageId(source, version, description); |
} |