-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
There's a bug in which a break statement is left in a function when uglifying a do while loop.
I've inherited a DojoX project and there is a function which uses a do while(false) which can be found in https://github.com/dojo/dojox/blob/master/gfx/_base.js the splitFontString method on line 864. Our current build process causes an illegal break statement syntax error for this function as it leaves the break statement in whilst removing the do while.
I've managed to simplify the function to the bare minimum:
Input
var test = function(str) {
var font = '';
do {
if (str.length < 5){
break;
}
font = str;
} while (false);
return font;
}
Output
var test=function(t){if(t.length<5)break;return t};
Command
uglifyjs --compress --mangle -- input.js
The expected output should not leave the break statement in as there's no containing loop or case to break out of.
Found broken in version 2.8.3, working in version 2.7.0 (using uglify as dependency of grunt-contrib-uglify).