Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
leave: function(node)
{
//get call to be moved up from children:
var callsToMove = []
var candidates = estraverse.VisitorKeys[node.type]
for(var c in candidates) {
var candidate = node[candidates[c]]
if(!candidate){break}
if(candidate instanceof Array) {
for(var i in candidate){callsToMove = callsToMove.concat(candidate[i].callsToMove || [])}
} else {
callsToMove = callsToMove.concat(candidate.callsToMove || [])
}
}
//transform calls (which could be in args) by replacing with new identifier, wrapping with enter/leave marks, and adding to queue to move up.
if(!node.skipcall && node.type == 'CallExpression') {
//replace with new identifier, add to call queue.
var id = nextid++
var idNode = {type: "Identifier", name: "call"+id}
idToFunctionName[id + ""] = node.callee.name;
leave: function(node)
{
//get call to be moved up from children:
var callsToMove = [];
var candidates = estraverse.VisitorKeys[node.type];
for (var c in candidates) {
var candidate = node[candidates[c]];
if (!candidate) {break}
if (candidate instanceof Array) {
for (var i in candidate) {callsToMove = callsToMove.concat(candidate[i].callsToMove || [])}
} else {
callsToMove = callsToMove.concat(candidate.callsToMove || []);
}
}
//transform calls (which could be in args) by replacing with new identifier, wrapping with enter/leave marks, and adding to queue to move up.
if (!node.skipcall && node.type == 'CallExpression') {
//replace with new identifier, add to call queue.
var id = nextid++;
var idNode = {type: 'Identifier', name: 'call' + id};
idToFunctionName[id + ''] = node.callee.name;