| Index: pkg/compiler/lib/src/inferrer/type_graph_dump.dart
|
| diff --git a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
|
| index 5f786caa1fd25a65ebb33098e6e7a3134a082790..13a7e7b19a8ed9fefab8b6c6b976e9873fd8528d 100644
|
| --- a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
|
| +++ b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
|
| @@ -8,6 +8,7 @@ import '../elements/elements.dart';
|
| import '../types/types.dart';
|
| import 'inferrer_engine.dart';
|
| import 'type_graph_nodes.dart';
|
| +import 'debug.dart';
|
|
|
| /// Dumps the type inference graph in Graphviz Dot format into the `typegraph`
|
| /// subfolder of the current working directory. Each function body is dumped in
|
| @@ -79,7 +80,7 @@ class TypeGraphDump {
|
| .outputProvider('$outputDir/$name', 'dot', OutputType.debug);
|
| _GraphGenerator visitor = new _GraphGenerator(this, element, output);
|
| for (TypeInformation node in nodes[element]) {
|
| - node.accept(visitor);
|
| + visitor.visit(node);
|
| }
|
| visitor.addMissingNodes();
|
| visitor.finish();
|
| @@ -169,11 +170,15 @@ class _GraphGenerator extends TypeInformationVisitor {
|
| while (worklist.isNotEmpty) {
|
| TypeInformation node = worklist.removeLast();
|
| assert(nodeId.containsKey(node));
|
| - if (seen.contains(node)) continue;
|
| - node.accept(this);
|
| + visit(node);
|
| }
|
| }
|
|
|
| + void visit(TypeInformation info) {
|
| + if (seen.contains(info)) return;
|
| + info.accept(this);
|
| + }
|
| +
|
| void append(String string) {
|
| output..add(string)..add('\n');
|
| }
|
| @@ -311,14 +316,25 @@ class _GraphGenerator extends TypeInformationVisitor {
|
| }
|
| }
|
| }
|
| + if (PRINT_GRAPH_ALL_NODES) {
|
| + for (TypeInformation user in node.users) {
|
| + if (!isExternal(user)) {
|
| + visit(user);
|
| + }
|
| + }
|
| + }
|
| }
|
|
|
| void visitNarrowTypeInformation(NarrowTypeInformation info) {
|
| + // Omit unused Narrows.
|
| + if (!PRINT_GRAPH_ALL_NODES && info.users.isEmpty) return;
|
| addNode(info, 'Narrow\n${formatType(info.typeAnnotation)}',
|
| color: narrowColor);
|
| }
|
|
|
| void visitPhiElementTypeInformation(PhiElementTypeInformation info) {
|
| + // Omit unused Phis.
|
| + if (!PRINT_GRAPH_ALL_NODES && info.users.isEmpty) return;
|
| addNode(info, 'Phi ${info.variable?.name ?? ''}', color: phiColor);
|
| }
|
|
|
|
|