function fillInNonLeafNodes(aT, aCannotMerge)
  {
    if (!aT._kids) {
      // Leaf node.  Has already been filled in.

    } else if (aT._kids.length === 1 && !aCannotMerge) {
      // Non-leaf node with one child.  Merge the child with the node to avoid
      // redundant entries.
      let kid = aT._kids[0];
      let kidBytes = fillInNonLeafNodes(kid);
      aT._unsafeName += '/' + kid._unsafeName;
      if (kid._kids) {
        aT._kids = kid._kids;
      } else {
        delete aT._kids;
      }
      aT._amount = kid._amount;
      aT._description = kid._description;
      if (kid._nMerged !== undefined) {
        aT._nMerged = kid._nMerged
      }
      assert(!aT._hideKids && !kid._hideKids, "_hideKids set when merging");

    } else {
      // Non-leaf node with multiple children.  Derive its _amount and
      // _description entirely from its children.
      let kidsBytes = 0;
      for (let i = 0; i < aT._kids.length; i++) {
        kidsBytes += fillInNonLeafNodes(aT._kids[i]);
      }
      aT._amount = kidsBytes;
      aT._description = "The sum of all entries below this one.";
    }
    return aT._amount;
  }
// Next, fill in the remaining properties bottom-up.
Next, fill in the remaining properties bottom-up.
Next fill in the remaining properties bottom - up .
function fillInNonLeafNodes(aT, aCannotMerge)
  {
    if (!aT._kids) {
    } else if (aT._kids.length === 1 && !aCannotMerge) {
      let kid = aT._kids[0];
      let kidBytes = fillInNonLeafNodes(kid);
      aT._unsafeName += '/' + kid._unsafeName;
      if (kid._kids) {
        aT._kids = kid._kids;
      } else {
        delete aT._kids;
      }
      aT._amount = kid._amount;
      aT._description = kid._description;
      if (kid._nMerged !== undefined) {
        aT._nMerged = kid._nMerged
      }
      assert(!aT._hideKids && !kid._hideKids, "_hideKids set when merging");
    } else {
      let kidsBytes = 0;
      for (let i = 0; i < aT._kids.length; i++) {
        kidsBytes += fillInNonLeafNodes(aT._kids[i]);
      }
      aT._amount = kidsBytes;
      aT._description = "The sum of all entries below this one.";
    }
    return aT._amount;
  }
function fillInNonLeafNodes ( aT , aCannotMerge ) { if ( ! aT . _kids ) { } else if ( aT . _kids . length === 1 && ! aCannotMerge ) { let kid = aT . _kids [ 0 ] ; let kidBytes = fillInNonLeafNodes ( kid ) ; aT . _unsafeName += '/' + kid . _unsafeName ; if ( kid . _kids ) { aT . _kids = kid . _kids ; } else { delete aT . _kids ; } aT . _amount = kid . _amount ; aT . _description = kid . _description ; if ( kid . _nMerged !== undefined ) { aT . _nMerged = kid . _nMerged } assert ( ! aT . _hideKids && ! kid . _hideKids , "_hideKids set when merging" ) ; } else { let kidsBytes = 0 ; for ( let i = 0 ; i < aT . _kids . length ; i ++ ) { kidsBytes += fillInNonLeafNodes ( aT . _kids [ i ] ) ; } aT . _amount = kidsBytes ; aT . _description = "The sum of all entries below this one." ; } return aT . _amount ; }
Next, fill in the remaining properties bottom-up.
Next fill in the remaining properties bottom - up .
// Leaf node.  Has already been filled in. // Non-leaf node with one child.  Merge the child with the node to avoid // redundant entries. // Non-leaf node with multiple children.  Derive its _amount and // _description entirely from its children.