Uglifyjs: Invalid function inlining.

Created on 10 Apr 2020  路  3Comments  路  Source: mishoo/UglifyJS

Bug report or feature request?

Bug.

Uglify version (uglifyjs -V)

$ uglifyjs -V
uglify-js 3.8.1

JavaScript input

var echo = (function () {

    function _tzset() {
        if (!_tzset.called) {
            _tzset.called = true;
            console.warn('you must see this once');
        }
    }

    return function echo(v) {
        _tzset();
        console.log(v);
    };
})();

echo(1);
echo(2);

The uglifyjs CLI command executed or minify() options used.

uglifyjs -c unused -b width=70 test.js

JavaScript output or error produced.

var echo = function(v) {
    !function _tzset() {
        _tzset.called || (_tzset.called = !0, console.warn("you must see this once"));
    }(), console.log(v);
};

echo(1), echo(2);

The message you must see this once will be mistakenly seen twice.

bug

All 3 comments

Thanks for the detailed report - will investigate 馃憤

That was fast, thanks!

You are welcome 馃槈

(Assuming nothing bad pops up in testing, except a new release next Monday.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexlamsl picture alexlamsl  路  4Comments

buu700 picture buu700  路  5Comments

andreialecu picture andreialecu  路  5Comments

utdrmac picture utdrmac  路  4Comments

neverfox picture neverfox  路  4Comments