taintable/utils/attrFinder.js
// Executes visitor on the ast tree and its children (recursively).
Executes visitor on the ast tree and its children (recursively).
Executes visitor on the ast tree and its children ( recursively ) .
function traverse(object, domain, Visitor, cmd) {
    var key, child;
    if (Visitor.call(null, object, domain, cmd) === false) {
        return;
    }
    if (object.type === 'FunctionDeclaration'){
        domain = [...domain]
        domain.push(object.id.name);
    } else if (object.type === 'FunctionExpression'){
        domain = [...domain];
        var anonymous_func;
        if (object.id === null){
            anonymous_func = 'anon_'+ object.loc.start.line+'_'+object.loc.start.column+'_'+object.loc.end.line+'_'+object.loc.end.column;
        }else{
            anonymous_func = object.id.name;
        }
        domain.push(anonymous_func);
    }
    for (key in object) {
        if (object.hasOwnProperty(key)) {
            child = object[key];
            if (typeof child === 'object' && child !== null) {
                traverse(child, domain, Visitor, cmd);
            }
        }
    }
}
function traverse ( object , domain , Visitor , cmd ) { var key , child ; if ( Visitor . call ( null , object , domain , cmd ) === false ) { return ; } if ( object . type === 'FunctionDeclaration' ) { domain = [ ... domain ] domain . push ( object . id . name ) ; } else if ( object . type === 'FunctionExpression' ) { domain = [ ... domain ] ; var anonymous_func ; if ( object . id === null ) { anonymous_func = 'anon_' + object . loc . start . line + '_' + object . loc . start . column + '_' + object . loc . end . line + '_' + object . loc . end . column ; } else { anonymous_func = object . id . name ; } domain . push ( anonymous_func ) ; } for ( key in object ) { if ( object . hasOwnProperty ( key ) ) { child = object [ key ] ; if ( typeof child === 'object' && child !== null ) { traverse ( child , domain , Visitor , cmd ) ; } } } }
Executes visitor on the ast tree and its children (recursively).
Executes visitor on the ast tree and its children ( recursively ) .
//console.log(object); // add new scope to the domain  when enter a new function