tools/ast_passes.js
function( src, fileName ) {
        var results = [];
        var identifiers = [];
        var ast = parse(src, fileName);
        walk.simple(ast, {
            Identifier: function( node ) {
                identifiers.push( node );
            }
        });

        for( var i = 0, len = identifiers.length; i < len; ++i ) {
            var id = identifiers[i];
            if( ignore.indexOf(id) > -1 ) {
                continue;
            }
            var constant = constants[id.name];
            if( constant === void 0 ) {
                continue;
            }
            if( constant.identifier === id ) {
                continue;
            }

            results.push( new ConstantReplacement( constant.value, id.start, id.end ) );

        }
        return convertSrc( src, results );
    }
function( src, fileName ) {
        var results = [];
        var identifiers = [];
        var ast = parse(src, fileName);
        walk.simple(ast, {
            Identifier: function( node ) {
                identifiers.push( node );
            }
        });

        for( var i = 0, len = identifiers.length; i < len; ++i ) {
            var id = identifiers[i];
            if( ignore.indexOf(id) > -1 ) {
                continue;
            }
            var constant = constants[id.name];
            if( constant === void 0 ) {
                continue;
            }
            if( constant.identifier === id ) {
                continue;
            }

            results.push( new ConstantReplacement( constant.value, id.start, id.end ) );

        }
        return convertSrc( src, results );
    }
function ( src , fileName ) { var results = [ ] ; var identifiers = [ ] ; var ast = parse ( src , fileName ) ; walk . simple ( ast , { Identifier : function ( node ) { identifiers . push ( node ) ; } } ) ; for ( var i = 0 , len = identifiers . length ; i < len ; ++ i ) { var id = identifiers [ i ] ; if ( ignore . indexOf ( id ) > - 1 ) { continue ; } var constant = constants [ id . name ] ; if ( constant === void 0 ) { continue ; } if ( constant . identifier === id ) { continue ; } results . push ( new ConstantReplacement ( constant . value , id . start , id . end ) ) ; } return convertSrc ( src , results ) ; }
Expand constants in normal source files
Expand constants in normal source files