aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-28 21:25:49 +0800
committerGitHub <noreply@github.com>2017-03-28 21:25:49 +0800
commitc909ffb7156eb99e83afd8e1e75a876039bdc65b (patch)
treee1866f7038b6e23f78582438c2cd114b77519aea /test/compress
parentf71f4905b004a559f0612e0e0928204f912a66bc (diff)
downloadtracifyjs-c909ffb7156eb99e83afd8e1e75a876039bdc65b.tar.gz
tracifyjs-c909ffb7156eb99e83afd8e1e75a876039bdc65b.zip
fix `unused` on var of the same name within catch (#1716)
fixes #1715
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/drop-unused.js87
1 files changed, 87 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index 10ca5499..aa875ece 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -844,3 +844,90 @@ issue_1709: {
}
expect_stdout: true
}
+
+issue_1715_1: {
+ options = {
+ unused: true,
+ }
+ input: {
+ var a = 1;
+ function f() {
+ a++;
+ try {} catch (a) {
+ var a;
+ }
+ }
+ f();
+ console.log(a);
+ }
+ expect: {
+ var a = 1;
+ function f() {
+ a++;
+ try {} catch (a) {
+ var a;
+ }
+ }
+ f();
+ console.log(a);
+ }
+ expect_stdout: "1"
+}
+
+issue_1715_2: {
+ options = {
+ unused: true,
+ }
+ input: {
+ var a = 1;
+ function f() {
+ a++;
+ try {} catch (a) {
+ var a = 2;
+ }
+ }
+ f();
+ console.log(a);
+ }
+ expect: {
+ var a = 1;
+ function f() {
+ a++;
+ try {} catch (a) {
+ var a;
+ }
+ }
+ f();
+ console.log(a);
+ }
+ expect_stdout: "1"
+}
+
+issue_1715_3: {
+ options = {
+ unused: true,
+ }
+ input: {
+ var a = 1;
+ function f() {
+ a++;
+ try {} catch (a) {
+ var a = 2 + x();
+ }
+ }
+ f();
+ console.log(a);
+ }
+ expect: {
+ var a = 1;
+ function f() {
+ a++;
+ try {} catch (a) {
+ var a = x();
+ }
+ }
+ f();
+ console.log(a);
+ }
+ expect_stdout: "1"
+}