| Index: compiler/java/com/google/dart/compiler/ast/viz/DotWriter.java
|
| ===================================================================
|
| --- compiler/java/com/google/dart/compiler/ast/viz/DotWriter.java (revision 2358)
|
| +++ compiler/java/com/google/dart/compiler/ast/viz/DotWriter.java (working copy)
|
| @@ -72,26 +72,32 @@
|
| }
|
|
|
| protected void write(String nodeType, DartNode node, String data) {
|
| - String nodeData = node.getSourceLine() + ":" + node.getSourceStart() + ":"
|
| - + node.getSourceLength() + "_" + nodeType;
|
| - nodeMap.put(node, nodeData);
|
| + String nodeId = node.getObjectIdentifier();
|
| + nodeMap.put(node, nodeId);
|
| DartNode parent = node.getParent();
|
| if (parent == null) {
|
| parent = currentUnit;
|
| }
|
| String styleAttr = getStyleAttr(nodeType, node);
|
| String label = getLabel(nodeType, node, data);
|
| - nodes.append(String.format("\t\"%s\" [label=\"%s\"%s];\n", nodeData, label, styleAttr));
|
| - edges.append(String.format("\t\"%s\" -> \"%s\";\n", nodeMap.get(parent), nodeData));
|
| + nodes.append(String.format("\t\"%s\" [label=\"%s\"%s];\n", nodeId, label, styleAttr));
|
| + edges.append(String.format("\t\"%s\" -> \"%s\";\n", nodeMap.get(parent), nodeId));
|
| }
|
|
|
| private String getLabel(String nodeType, DartNode node, String data) {
|
| StringBuffer label = new StringBuffer(nodeType);
|
| if (printDataNodes.contains(nodeType) || node instanceof DartExpression) {
|
| - label.append(String.format("\\n%s", data.replaceAll("\"", "'")));
|
| + label.append(String.format("\\n%s", escape(data)));
|
| }
|
| return label.toString();
|
| }
|
| +
|
| + private String escape(String data){
|
| + data = data.replaceAll("\"", "'");
|
| + data = data.replaceAll("\n", "\\n");
|
| + data = data.replaceAll("\r", "\\r");
|
| + return data;
|
| + }
|
|
|
| private String getStyleAttr(String nodeType, DartNode node) {
|
| StringBuffer style = new StringBuffer();
|
| @@ -102,6 +108,11 @@
|
| } else if ("DartMethodDefinition".equals(nodeType)) {
|
| style.append(", color=blue");
|
| }
|
| +
|
| + if(node.isInstrumentedNode()){
|
| + style.append(", style=filled, fillcolor=yellow");
|
| + }
|
| +
|
| return style.toString();
|
| }
|
|
|
|
|