Bug report or feature request?
Bug. Fuzzer found it. But okay, I nudged it there.
uglify-js version (uglifyjs -V)
uglify-js 2.8.16 (git master)
So this is a language oddity; the default clause in JS switch statements doesn't need to be last. The fall-through cases are even more of a brainf* in this context... ;)
switch (undefined) {
default:
console.log('FAIL');
break;
case undefined:
console.log('PASS');
break;
}
$ bin/uglifyjs s.js -c
WARN: Dropping unreachable code [s.js:4,4]
WARN: Dropping unreachable code [s.js:5,2]
console.log("FAIL");
md5-a97ef0d5cc2535e26d5da5a59e1452b2
$ node s.js && bin/uglifyjs s.js -c | node
PASS
WARN: Dropping unreachable code [s.js:4,4]
WARN: Dropping unreachable code [s.js:5,2]
FAIL
(Away for most of the rest of the day. Maybe you can enjoy the Saturday better this way... ;) )
Pretty sure this case is the same bug:
function f() {
function g() {
switch (0) {
default:
case console.log('PASS'):
}
}
g();
}
f();
It's a different issue, but I might as well fix it under the same PR.
Edit: scrap that, it's #1678