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

Unified Diff: lib/src/source/path.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/hosted.dart ('k') | lib/src/source/unknown.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/source/path.dart
diff --git a/lib/src/source/path.dart b/lib/src/source/path.dart
index b239c5327953d316c963c588d235adcc2a77607b..9eae3cbd451f5d148eb5a5b9db32530447e46192 100644
--- a/lib/src/source/path.dart
+++ b/lib/src/source/path.dart
@@ -31,7 +31,7 @@ class PathSource extends Source {
/// Returns a reference to a path package named [name] at [path].
PackageRef refFor(String name, String path) {
- return new PackageRef(name, 'path', {
+ return new PackageRef(name, this, {
"path": path,
"relative": p.isRelative(path)
});
@@ -40,7 +40,7 @@ class PathSource extends Source {
/// Returns an ID for a path package with the given [name] and [version] at
/// [path].
PackageId idFor(String name, Version version, String path) {
- return new PackageId(name, 'path', version, {
+ return new PackageId(name, this, version, {
"path": path,
"relative": p.isRelative(path)
});
@@ -53,6 +53,9 @@ class PathSource extends Source {
return path1 == path2;
}
+ int hashDescription(description) =>
+ canonicalize(description["path"]).hashCode;
+
/// Parses a path dependency.
///
/// This takes in a path string and returns a map. The "path" key will be the
@@ -79,7 +82,7 @@ class PathSource extends Source {
p.join(p.dirname(containingPath), description));
}
- return new PackageRef(name, this.name, {
+ return new PackageRef(name, this, {
"path": description,
"relative": isRelative
});
@@ -100,7 +103,7 @@ class PathSource extends Source {
"must be a boolean.");
}
- return new PackageId(name, this.name, version, description);
+ return new PackageId(name, this, version, description);
}
/// Serializes path dependency's [description].
@@ -140,8 +143,7 @@ class BoundPathSource extends BoundSource {
// There's only one package ID for a given path. We just need to find the
// version.
var pubspec = _loadPubspec(ref);
- var id = new PackageId(
- ref.name, source.name, pubspec.version, ref.description);
+ var id = new PackageId(ref.name, source, pubspec.version, ref.description);
memoizePubspec(id, pubspec);
return [id];
}
« no previous file with comments | « lib/src/source/hosted.dart ('k') | lib/src/source/unknown.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698