Mercurial > hg > truffle
changeset 22355:ef3c3b62e0fc
GraphPrintVisitor: begin a graph if visit is called without beginGraph
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Tue, 10 Nov 2015 20:13:14 +0100 |
parents | 0ad8cb1608be |
children | 364bab1763c9 |
files | truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java Tue Nov 10 14:29:08 2015 +0100 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java Tue Nov 10 20:13:14 2015 +0100 @@ -59,6 +59,7 @@ public static final String GraphVisualizerAddress = "127.0.0.1"; public static final int GraphVisualizerPort = 4444; + private static final String DEFAULT_GRAPH_NAME = "truffle tree"; private Map<Object, NodeElement> nodeMap; private List<EdgeElement> edgeList; @@ -481,7 +482,7 @@ public GraphPrintVisitor visit(Object node) { if (openGraphCount == 0) { - beginGraph("truffle tree"); + beginGraph(DEFAULT_GRAPH_NAME); } // if node is visited once again, skip @@ -502,6 +503,10 @@ } public GraphPrintVisitor visit(Object node, GraphPrintHandler handler) { + if (openGraphCount == 0) { + beginGraph(DEFAULT_GRAPH_NAME); + } + handler.visit(node, new GraphPrintAdapter()); return this;