fix dead_code on block-scoped function under "use strict" (#2006)

Technically not part of ES5, but commonly used code exists in the wild.
This commit is contained in:
Alex Lam S.L
2017-05-26 16:08:51 +08:00
committed by GitHub
parent c70fb60384
commit dc33facfcb
3 changed files with 220 additions and 3 deletions

View File

@@ -1222,7 +1222,7 @@ merge(Compressor.prototype, {
target.push(node);
return true;
}
if (node instanceof AST_Defun) {
if (node instanceof AST_Defun && (node === stat || !compressor.has_directive("use strict"))) {
target.push(node);
return true;
}