Sha256: 1189121dafb25453d59c50eb4b9500f6abdfd983d53668881d5e9c5596b53ff2

Contents?: true

Size: 1.86 KB

Versions: 141

Compression:

Stored size: 1.86 KB

Contents

dead_code_1: {
    options = {
        dead_code: true
    };
    input: {
        function f() {
            a();
            b();
            x = 10;
            return;
            if (x) {
                y();
            }
        }
    }
    expect: {
        function f() {
            a();
            b();
            x = 10;
            return;
        }
    }
}

dead_code_2_should_warn: {
    options = {
        dead_code: true
    };
    input: {
        function f() {
            g();
            x = 10;
            throw "foo";
            // completely discarding the `if` would introduce some
            // bugs.  UglifyJS v1 doesn't deal with this issue; in v2
            // we copy any declarations to the upper scope.
            if (x) {
                y();
                var x;
                function g(){};
                // but nested declarations should not be kept.
                (function(){
                    var q;
                    function y(){};
                })();
            }
        }
    }
    expect: {
        function f() {
            g();
            x = 10;
            throw "foo";
            var x;
            function g(){};
        }
    }
}

dead_code_constant_boolean_should_warn_more: {
    options = {
        dead_code    : true,
        loops        : true,
        booleans     : true,
        conditionals : true,
        evaluate     : true
    };
    input: {
        while (!((foo && bar) || (x + "0"))) {
            console.log("unreachable");
            var foo;
            function bar() {}
        }
        for (var x = 10; x && (y || x) && (!typeof x); ++x) {
            asdf();
            foo();
            var moo;
        }
    }
    expect: {
        var foo;
        function bar() {}
        // nothing for the while
        // as for the for, it should keep:
        var x = 10;
        var moo;
    }
}

Version data entries

141 entries across 138 versions & 7 rubygems

Version Path
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/handlebars/node_modules/uglify-js/test/compress/dead-code.js