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

Unified Diff: lib/src/source/hosted.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/source/git.dart ('k') | lib/src/source/path.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/source/hosted.dart
diff --git a/lib/src/source/hosted.dart b/lib/src/source/hosted.dart
index ea282c5938e70c4ecf456dfbd3590918da6daf92..ddee56b71d30f3cded20631bbf8819a52e7c6643 100644
--- a/lib/src/source/hosted.dart
+++ b/lib/src/source/hosted.dart
@@ -45,14 +45,14 @@ class HostedSource extends Source {
/// If [url] is passed, it's the URL of the pub server from which the package
/// should be downloaded. It can be a [Uri] or a [String].
PackageRef refFor(String name, {url}) =>
- new PackageRef(name, 'hosted', _descriptionFor(name, url));
+ new PackageRef(name, this, _descriptionFor(name, url));
/// Returns an ID for a hosted package named [name] at [version].
///
/// If [url] is passed, it's the URL of the pub server from which the package
/// should be downloaded. It can be a [Uri] or a [String].
PackageId idFor(String name, Version version, {url}) =>
- new PackageId(name, 'hosted', version, _descriptionFor(name, url));
+ new PackageId(name, this, version, _descriptionFor(name, url));
/// Returns the description for a hosted package named [name] with the
/// given package server [url].
@@ -69,6 +69,8 @@ class HostedSource extends Source {
bool descriptionsEqual(description1, description2) =>
_parseDescription(description1) == _parseDescription(description2);
+ int hashDescription(description) => _parseDescription.hashCode;
+
/// Ensures that [description] is a valid hosted package description.
///
/// There are two valid formats. A plain string refers to a package with the
@@ -76,12 +78,12 @@ class HostedSource extends Source {
/// refers to a package with the given name from the host at the given URL.
PackageRef parseRef(String name, description, {String containingPath}) {
_parseDescription(description);
- return new PackageRef(name, this.name, description);
+ return new PackageRef(name, this, description);
}
PackageId parseId(String name, Version version, description) {
_parseDescription(description);
- return new PackageId(name, this.name, version, description);
+ return new PackageId(name, this, version, description);
}
/// Parses the description for a package.
« no previous file with comments | « lib/src/source/git.dart ('k') | lib/src/source/path.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698