Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: lib/src/source.dart

Issue 2079303003: Track Source objects in PackageNames. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
}

Powered by Google App Engine
This is Rietveld 408576698