Index: lib/src/source.dart |
diff --git a/lib/src/source.dart b/lib/src/source.dart |
index ff51d5c7c5f0489f11db94531a6a77ce54554794..7ec29276c826896b2315921e3cd539974858297b 100644 |
--- a/lib/src/source.dart |
+++ b/lib/src/source.dart |
@@ -124,6 +124,12 @@ abstract class Source { |
/// considered equal to the reference descriptions that produced them. |
bool descriptionsEqual(description1, description2); |
+ /// Returns a hash code for [description]. |
+ /// |
+ /// Descriptions that compare equal using [descriptionsEqual] should return |
+ /// the same hash code. |
+ int hashDescription(description); |
+ |
/// Returns the source's name. |
String toString() => name; |
} |
@@ -151,7 +157,7 @@ abstract class BoundSource { |
if (ref.isRoot) { |
throw new ArgumentError("Cannot get versions for the root package."); |
} |
- if (ref.source != source.name) { |
+ if (ref.source != source) { |
throw new ArgumentError("Package $ref does not use source ${source.name}."); |
} |
@@ -187,7 +193,7 @@ abstract class BoundSource { |
/// Sources should not override this. Instead, they implement [doDescribe]. |
Future<Pubspec> describe(PackageId id) async { |
if (id.isRoot) throw new ArgumentError("Cannot describe the root package."); |
- if (id.source != source.name) { |
+ if (id.source != source) { |
throw new ArgumentError("Package $id does not use source ${source.name}."); |
Bob Nystrom
2016/06/23 20:29:49
While you're here: long line.
nweiz
2016/06/23 21:01:21
Done.
|
} |