taintable/dynamic_taint/jalangi/src/js/instrument/esnstrument.js
// {J$_i} will replace the body of the block statement with an array of statements passed as argument
{J$_i} will replace the body of the block statement with an array of statements passed as argument
{ J$_i } will replace the body of the block statement with an array of statements passed as argument
function replaceInStatement(code) {
        var asts = arguments;
        var visitorReplaceInExpr = {
            'Identifier':function (node) {
                if (node.name.indexOf(RP) === 0) {
                    var i = parseInt(node.name.substring(RP.length));
                    return asts[i];
                } else {
                    return node;
                }
            },
            'BlockStatement':function (node) {
                if (node.body[0].type === 'ExpressionStatement' && isArr(node.body[0].expression)) {
                    node.body = node.body[0].expression;
                }
                return node;
            }
        };
        var ast = acorn.parse(code);
        var newAst = astUtil.transformAst(ast, visitorReplaceInExpr, undefined, undefined, true);
        return newAst.body;
    }
function replaceInStatement ( code ) { var asts = arguments ; var visitorReplaceInExpr = { 'Identifier' : function ( node ) { if ( node . name . indexOf ( RP ) === 0 ) { var i = parseInt ( node . name . substring ( RP . length ) ) ; return asts [ i ] ; } else { return node ; } } , 'BlockStatement' : function ( node ) { if ( node . body [ 0 ] . type === 'ExpressionStatement' && isArr ( node . body [ 0 ] . expression ) ) { node . body = node . body [ 0 ] . expression ; } return node ; } } ; var ast = acorn . parse ( code ) ; var newAst = astUtil . transformAst ( ast , visitorReplaceInExpr , undefined , undefined , true ) ; return newAst . body ; }
{J$_i} will replace the body of the block statement with an array of statements passed as argument
{ J$_i } will replace the body of the block statement with an array of statements passed as argument
//        StatCollector.resumeTimer("internalParse"); //        StatCollector.suspendTimer("internalParse"); //        StatCollector.resumeTimer("replace"); //console.log(newAst); //        StatCollector.suspendTimer("replace");