src/extensions/default/JavaScriptRefactoring/ExtractToVariable.js
function findAllExpressions(parentBlockStatement, expn, text) {
        var doc   = session.editor.document,
            obj   = {},
            expns = [];

        // find all references of the expression
        obj[expn.type] = function(node) {
            if (text === doc.getText().substr(node.start, node.end - node.start)) {
                expns.push(node);
            }
        };
        ASTWalker.simple(parentBlockStatement, obj);

        return expns;
    }
function findAllExpressions(parentBlockStatement, expn, text) {
        var doc   = session.editor.document,
            obj   = {},
            expns = [];

        // find all references of the expression
        obj[expn.type] = function(node) {
            if (text === doc.getText().substr(node.start, node.end - node.start)) {
                expns.push(node);
            }
        };
        ASTWalker.simple(parentBlockStatement, obj);

        return expns;
    }
function findAllExpressions ( parentBlockStatement , expn , text ) { var doc = session . editor . document , obj = { } , expns = [ ] ; // find all references of the expression obj [ expn . type ] = function ( node ) { if ( text === doc . getText ( ) . substr ( node . start , node . end - node . start ) ) { expns . push ( node ) ; } } ; ASTWalker . simple ( parentBlockStatement , obj ) ; return expns ; }
Find all expressions in the parentBlockStatement that are same as expn
@param {!ASTNode} parentBlockStatement
@param {!ASTNode} expn
@param {!string} text - text of the expression
@return {!Array.<ASTNode>}
Find all expressions in the parentBlockStatement that are same as expn