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

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: Code review changes 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
« no previous file with comments | « lib/src/solver/version_solver.dart ('k') | lib/src/source/git.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/source.dart
diff --git a/lib/src/source.dart b/lib/src/source.dart
index ff51d5c7c5f0489f11db94531a6a77ce54554794..6263d7feae7d61d17e42f2da2b60f4e1f0ef0abc 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,8 +193,9 @@ 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) {
- throw new ArgumentError("Package $id does not use source ${source.name}.");
+ if (id.source != source) {
+ throw new ArgumentError(
+ "Package $id does not use source ${source.name}.");
}
var pubspec = _pubspecs[id];
« no previous file with comments | « lib/src/solver/version_solver.dart ('k') | lib/src/source/git.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698