MCPcopy Index your code
hub / github.com/nodejs/node / traverse

Method traverse

deps/v8/tools/profile.mjs:1122–1135  ·  view source on GitHub ↗

* Traverses the call graph in preorder. This function can be used for * building optionally modified tree clones. This is the boilerplate code * for this scenario: * * callTree.traverse(function(node, parentClone) { * var nodeClone = cloneNode(node); * if (parentClone) *

(f)

Source from the content-addressed store, hash-verified

1120 * The second parameter is the result of calling 'f' on the parent node.
1121 */
1122 traverse(f) {
1123 const pairsToProcess = new ConsArray();
1124 pairsToProcess.concat([{ node: this.root_, param: null }]);
1125 while (!pairsToProcess.atEnd()) {
1126 const pair = pairsToProcess.next();
1127 const node = pair.node;
1128 const newParam = f(node, pair.param);
1129 const morePairsToProcess = [];
1130 node.forEachChild((child) => {
1131 morePairsToProcess.push({ node: child, param: newParam });
1132 });
1133 pairsToProcess.concat(morePairsToProcess);
1134 }
1135 }
1136
1137 /**
1138 * Performs an indepth call graph traversal.

Callers 6

cloneSubtreeMethod · 0.95
profile_view.mjsFile · 0.80
traverseTopDownTreeMethod · 0.80
traverseBottomUpTreeMethod · 0.80
profile_view.jsFile · 0.80
profile_view.mjsFile · 0.80

Calls 8

concatMethod · 0.95
atEndMethod · 0.95
nextMethod · 0.95
forEachChildMethod · 0.80
fFunction · 0.50
enterFunction · 0.50
exitFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected