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

Unified Diff: sdk/lib/_internal/pub/lib/src/package_graph.dart

Issue 24016002: Support transformers that depend on other transformers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 3 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: sdk/lib/_internal/pub/lib/src/package_graph.dart
diff --git a/sdk/lib/_internal/pub/lib/src/package_graph.dart b/sdk/lib/_internal/pub/lib/src/package_graph.dart
index 687b7202ace05cbed9dd68757723106d6a4213fb..634eb5ce5918cbda59e756ed339b564406472cb8 100644
--- a/sdk/lib/_internal/pub/lib/src/package_graph.dart
+++ b/sdk/lib/_internal/pub/lib/src/package_graph.dart
@@ -18,4 +18,22 @@ class PackageGraph {
final Map<String, Package> packages;
PackageGraph(this.entrypoint, this.packages);
+
+ /// Returns the set of transitive dependencies of the package named
+ /// [packageName].
+ Set<Package> transitiveDependencies(String packageName) {
+ var seen = new Set<Package>();
+ traverse(Package package) {
+ if (seen.contains(package)) return;
+ seen.add(package);
+ for (var dep in package.dependencies) {
+ traverse(packages[dep.name]);
+ }
+ }
+
+ var package = packages[packageName];
+ traverse(package);
+ seen.remove(package);
+ return seen;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698