aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-29 01:00:21 +0800
committerGitHub <noreply@github.com>2017-03-29 01:00:21 +0800
commiteb48a035e7880e73e7fe4f23727775cff365ffbc (patch)
tree92d22d7029dc4a1ec6e777c25366070b039d84f2 /test/compress
parent6ab3224c0d724322597f5709e3f382cc913d96bb (diff)
downloadtracifyjs-eb48a035e7880e73e7fe4f23727775cff365ffbc.tar.gz
tracifyjs-eb48a035e7880e73e7fe4f23727775cff365ffbc.zip
fix corner case in `unused` (#1718)
When fixing catch-related issue in #1715, it tries to optimise for duplicate definitions but did not take anonymous functions into account. Remove such optimisation for now and we can cover this as a more general rule later.
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/drop-unused.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index aa875ece..d0b87764 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -931,3 +931,30 @@ issue_1715_3: {
}
expect_stdout: "1"
}
+
+issue_1715_4: {
+ options = {
+ unused: true,
+ }
+ input: {
+ var a = 1;
+ !function a() {
+ a++;
+ try {} catch (a) {
+ var a;
+ }
+ }();
+ console.log(a);
+ }
+ expect: {
+ var a = 1;
+ !function() {
+ a++;
+ try {} catch (a) {
+ var a;
+ }
+ }();
+ console.log(a);
+ }
+ expect_stdout: "1"
+}