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

Unified Diff: bin/verify_deps.dart

Issue 1412903002: include fields in verify_deps, refactor graph dfs (Closed) Base URL: git@github.com:dart-lang/dart2js_info.git@master
Patch Set: Created 5 years, 2 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 | « bin/function_size_analysis.dart ('k') | lib/src/graph.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/verify_deps.dart
diff --git a/bin/verify_deps.dart b/bin/verify_deps.dart
index 61542c70d16bef833cc8db9288960b63e638bd12..05fef0f91df8c47e33e24ba40c9cafe3ee0568cd 100644
--- a/bin/verify_deps.dart
+++ b/bin/verify_deps.dart
@@ -29,9 +29,11 @@ Future main(List<String> args) async {
var entrypoint = info.program.entrypoint;
var reachables = findReachable(graph, entrypoint);
- var unreachables = info.functions.where((func) => !reachables.contains(func));
+ var functionsAndFields = []..addAll(info.functions)..addAll(info.fields);
+ var unreachables =
+ functionsAndFields.where((func) => !reachables.contains(func));
if (unreachables.isNotEmpty) {
- unreachables.forEach(print);
+ unreachables.forEach((x) => print(longName(x)));
exit(1);
} else {
print('all elements are reachable from the entrypoint');
@@ -39,17 +41,8 @@ Future main(List<String> args) async {
}
/// Finds the set of nodes reachable from [start] in [graph].
-Set<Info> findReachable(Graph<Info> graph, Info start) {
- var visited = new Set<Info>();
- var stack = <Info>[start];
- while (stack.isNotEmpty) {
- var next = stack.removeLast();
- visited.add(next);
- stack.addAll(
- graph.targetsOf(next).where((target) => !visited.contains(target)));
- }
- return visited;
-}
+Set<Info> findReachable(Graph<Info> graph, Info start) =>
+ new Set.from(graph.preOrder(start));
void printUsage() {
print('usage: dart2js_info_verify_deps <info file>');
« no previous file with comments | « bin/function_size_analysis.dart ('k') | lib/src/graph.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698