aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-05-26 16:08:51 +0800
committerGitHub <noreply@github.com>2017-05-26 16:08:51 +0800
commitdc33facfcb7899c0422cb14b08dddfcf06b1c949 (patch)
tree1409988235910fe711a5e8c07f25a4b6d3cfb9ec /lib/compress.js
parentc70fb6038448cf072cfa96cee78eaa55aa99c0fa (diff)
downloadtracifyjs-dc33facfcb7899c0422cb14b08dddfcf06b1c949.tar.gz
tracifyjs-dc33facfcb7899c0422cb14b08dddfcf06b1c949.zip
fix `dead_code` on block-scoped `function` under "use strict" (#2006)
Technically not part of ES5, but commonly used code exists in the wild.
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index a2f8f267..bd017e10 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -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;
}