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

Unified Diff: lib/src/package_graph.dart

Issue 2184303002: Make pub strong-mode clean. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 5 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/package.dart ('k') | lib/src/pubspec.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/package_graph.dart
diff --git a/lib/src/package_graph.dart b/lib/src/package_graph.dart
index f6b4a9317811de7fb20dca417a4c4f0bd3c55ef0..9e0959e281f8e4ea44c7391131b1414c81c19da7 100644
--- a/lib/src/package_graph.dart
+++ b/lib/src/package_graph.dart
@@ -2,13 +2,14 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:collection/collection.dart';
+
import 'barback/transformer_cache.dart';
import 'entrypoint.dart';
import 'lock_file.dart';
import 'package.dart';
import 'solver/version_solver.dart';
import 'source/cached.dart';
-import 'utils.dart';
/// A holistic view of the entire transitive dependency graph for an entrypoint.
class PackageGraph {
@@ -42,7 +43,7 @@ class PackageGraph {
/// the packages' pubspecs are already fully-parsed.
factory PackageGraph.fromSolveResult(Entrypoint entrypoint,
SolveResult result) {
- var packages = new Map.fromIterable(result.packages,
+ var packages = new Map<String, Package>.fromIterable(result.packages,
key: (id) => id.name,
value: (id) {
if (id.name == entrypoint.root.name) return entrypoint.root;
@@ -78,10 +79,19 @@ class PackageGraph {
if (package == entrypoint.root.name) return packages.values.toSet();
if (_transitiveDependencies == null) {
- var closure = transitiveClosure(mapMap(packages,
- value: (_, package) => package.dependencies.map((dep) => dep.name)));
- _transitiveDependencies = mapMap(closure,
- value: (_, names) => names.map((name) => packages[name]).toSet());
+ var closure = transitiveClosure(
+ mapMap/*<String, Package, String, Iterable<String>>*/(
+ packages,
+ value: (_, package) =>
+ package.dependencies.map((dep) => dep.name)));
+ _transitiveDependencies =
+ mapMap/*<String, Set<String>, String, Set<Package>>*/(
+ closure,
+ value: (depender, names) {
+ var set = names.map((name) => packages[name]).toSet();
+ set.add(packages[depender]);
+ return set;
+ });
}
return _transitiveDependencies[package];
« no previous file with comments | « lib/src/package.dart ('k') | lib/src/pubspec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698