diff options
Diffstat (limited to 'src/jdk/nashorn/internal/ir/debug/ASTWriter.java')
-rw-r--r-- | src/jdk/nashorn/internal/ir/debug/ASTWriter.java | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/jdk/nashorn/internal/ir/debug/ASTWriter.java b/src/jdk/nashorn/internal/ir/debug/ASTWriter.java index 19e4d04f..52e3c0e0 100644 --- a/src/jdk/nashorn/internal/ir/debug/ASTWriter.java +++ b/src/jdk/nashorn/internal/ir/debug/ASTWriter.java @@ -36,8 +36,11 @@ import java.util.List; import jdk.nashorn.internal.ir.BinaryNode; import jdk.nashorn.internal.ir.Block; import jdk.nashorn.internal.ir.Expression; +import jdk.nashorn.internal.ir.IdentNode; import jdk.nashorn.internal.ir.Node; +import jdk.nashorn.internal.ir.Statement; import jdk.nashorn.internal.ir.Symbol; +import jdk.nashorn.internal.ir.Terminal; import jdk.nashorn.internal.ir.TernaryNode; import jdk.nashorn.internal.ir.annotations.Ignore; import jdk.nashorn.internal.ir.annotations.Reference; @@ -104,23 +107,31 @@ public final class ASTWriter { final boolean isReference = field != null && field.isAnnotationPresent(Reference.class); - Class<?> clazz = node.getClass(); + final Class<?> clazz = node.getClass(); String type = clazz.getName(); type = type.substring(type.lastIndexOf('.') + 1, type.length()); + int truncate = type.indexOf("Node"); + if (truncate == -1) { + truncate = type.indexOf("Statement"); + } + if (truncate != -1) { + type = type.substring(0, truncate); + } + type = type.toLowerCase(); + if (isReference) { type = "ref: " + type; } - type += "@" + Debug.id(node); final Symbol symbol; - if(node instanceof Expression) { - symbol = ((Expression)node).getSymbol(); + if (node instanceof IdentNode) { + symbol = ((IdentNode)node).getSymbol(); } else { symbol = null; } if (symbol != null) { - type += "#" + symbol; + type += ">" + symbol; } if (node instanceof Block && ((Block)node).needsScope()) { @@ -135,11 +146,11 @@ public final class ASTWriter { String status = ""; - if (node.isTerminal()) { + if (node instanceof Terminal && ((Terminal)node).isTerminal()) { status += " Terminal"; } - if (node.hasGoto()) { + if (node instanceof Statement && ((Statement)node).hasGoto()) { status += " Goto "; } @@ -160,6 +171,8 @@ public final class ASTWriter { status += " (" + tname + ")"; } + status += " @" + Debug.id(node); + if (children.isEmpty()) { sb.append("["). append(type). @@ -200,7 +213,7 @@ public final class ASTWriter { } else if (value instanceof Collection) { int pos = 0; ASTWriter.indent(sb, indent + 1); - sb.append("[Collection "). + sb.append('['). append(child.getName()). append("[0.."). append(((Collection<Node>)value).size()). |