Mercurial > hg > truffle
changeset 16548:a3b0a2d61e62
extract method in NodeUtil
author | Christian Wirth <christian.wirth@oracle.com> |
---|---|
date | Thu, 17 Jul 2014 11:51:35 +0200 |
parents | 36bc37806c61 |
children | 0f28c558d850 |
files | graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java |
diffstat | 1 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Thu Jul 17 11:49:10 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Thu Jul 17 11:51:35 2014 +0200 @@ -795,15 +795,7 @@ p.print(" = "); printTree(p, (Node) value, level + 1); } else if (field.getKind() == NodeFieldKind.CHILDREN) { - Node[] children = (Node[]) value; - p.print(" = ["); - sep = ""; - for (Node child : children) { - p.print(sep); - sep = ", "; - printTree(p, child, level + 1); - } - p.print("]"); + printChildren(p, level, value); } } printNewLine(p, level - 1); @@ -811,6 +803,19 @@ } } + private static void printChildren(PrintWriter p, int level, Object value) { + String sep; + Node[] children = (Node[]) value; + p.print(" = ["); + sep = ""; + for (Node child : children) { + p.print(sep); + sep = ", "; + printTree(p, child, level + 1); + } + p.print("]"); + } + private static void printNewLine(PrintWriter p, int level) { p.println(); for (int i = 0; i < level; i++) {