Exemple #1
0
 public Object visit(ForStmt node) {
   ListNode list = new ExprList(0);
   if (node.getInitExpr() != null) list.addElement(node.getInitExpr());
   if (node.getPredExpr() != null) list.addElement(node.getPredExpr());
   if (node.getUpdateExpr() != null) list.addElement(node.getUpdateExpr());
   list.addElement(node.getBodyStmt());
   return layoutNary("For", list);
 }
Exemple #2
0
 private DrawingTree layoutNary(String name, ListNode childNodes) {
   if (childNodes.getSize() == 0) return layoutNullary("Empty" + name);
   DrawingTree dt = layoutCaption(name);
   DrawingTree[] childTrees = new DrawingTree[childNodes.getSize()];
   int i = 0;
   for (ASTNode childNode : childNodes) {
     childTrees[i] = (DrawingTree) childNode.accept(this);
     i++;
   }
   dt.setChildren(childTrees);
   attachParent(dt, join(dt));
   return dt;
 }