* Creates a subtree by cloning and merging all subtrees rooted at nodes * with a given label. E.g. cloning the following call tree on label 'A' * will give the following result: * * -- * /
(label)
| 1083 | * @param {string} label The label of the new root node. |
| 1084 | */ |
| 1085 | cloneSubtree(label) { |
| 1086 | const subTree = new CallTree(); |
| 1087 | this.traverse((node, parent) => { |
| 1088 | if (!parent && node.label != label) { |
| 1089 | return null; |
| 1090 | } |
| 1091 | const child = (parent ? parent : subTree).findOrAddChild(node.label); |
| 1092 | child.selfWeight += node.selfWeight; |
| 1093 | return child; |
| 1094 | }); |
| 1095 | return subTree; |
| 1096 | } |
| 1097 | |
| 1098 | /** |
| 1099 | * Computes total weights in the call graph. |
no test coverage detected