Beispiel #1
0
 private static void toStringTreeHelper(ScriptOrFnNode treeTop, Node n, ObjToIntMap printIds, int level, System.Text.StringBuilder sb)
 {
     if (Token.printTrees)
     {
         if (printIds == null)
         {
             printIds = new ObjToIntMap();
             generatePrintIds(treeTop, printIds);
         }
         for (int i = 0; i != level; ++i)
         {
             sb.Append(" ");
         }
         n.toString(printIds, sb);
         sb.Append('\n');
         for (Node cursor = n.FirstChild; cursor != null; cursor = cursor.Next)
         {
             if (cursor.Type == Token.FUNCTION)
             {
                 int          fnIndex = cursor.getExistingIntProp(Node.FUNCTION_PROP);
                 FunctionNode fn      = treeTop.getFunctionNode(fnIndex);
                 toStringTreeHelper(fn, fn, null, level + 1, sb);
             }
             else
             {
                 toStringTreeHelper(treeTop, cursor, printIds, level + 1, sb);
             }
         }
     }
 }
Beispiel #2
0
 private static void toStringTreeHelper(ScriptOrFnNode treeTop, Node n, ObjToIntMap printIds, int level, System.Text.StringBuilder sb)
 {
     if (Token.printTrees) {
         if (printIds == null) {
             printIds = new ObjToIntMap ();
             generatePrintIds (treeTop, printIds);
         }
         for (int i = 0; i != level; ++i) {
             sb.Append (" ");
         }
         n.toString (printIds, sb);
         sb.Append ('\n');
         for (Node cursor = n.FirstChild; cursor != null; cursor = cursor.Next) {
             if (cursor.Type == Token.FUNCTION) {
                 int fnIndex = cursor.getExistingIntProp (Node.FUNCTION_PROP);
                 FunctionNode fn = treeTop.getFunctionNode (fnIndex);
                 toStringTreeHelper (fn, fn, null, level + 1, sb);
             }
             else {
                 toStringTreeHelper (treeTop, cursor, printIds, level + 1, sb);
             }
         }
     }
 }