terinjokes/gulp-uglify

uglifyjs sometimes generate wrong code if inner function has same variable name with one in closure.

Closed this issue · 1 comments

When I am trying to minify the following code, I got:

for (var func in conversions) {
  // export Raw versions
  convert[func + "Raw"] =  (function(func) {
    // accept array or plain args
    return function(arg) {
      if (typeof arg == "number")
        arg = Array.prototype.slice.call(arguments);
      return conversions[func](arg);
    }
  })(func);
}
for (var o in n) {
    a[o + "Raw"] = (u = o,
    function(t) {
        return "number" == typeof t && (t = Array.prototype.slice.call(arguments)),
        n[u](t)
    }
    );
}

These two code has difference behavior when u defined outside of the function.

This project only provides a Gulp interface to UglifyJS. You need to file an issue with the UglifyJS project if you think the minified code is wrong.