aboutsummaryrefslogtreecommitdiff
path: root/test/compress/let.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-05-30 04:07:55 +0100
committerGitHub <noreply@github.com>2021-05-30 11:07:55 +0800
commit7e88d52faeb7032f54e9526b85042f06098e71b9 (patch)
tree633d8cc523a61689d9e50648cce47c0f5b07cc2f /test/compress/let.js
parentb9d5bba5fb8e70c10f25f56ff6e7228739461cfb (diff)
downloadtracifyjs-7e88d52faeb7032f54e9526b85042f06098e71b9.tar.gz
tracifyjs-7e88d52faeb7032f54e9526b85042f06098e71b9.zip
fix corner case in `dead_code` (#4984)
Diffstat (limited to 'test/compress/let.js')
-rw-r--r--test/compress/let.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/compress/let.js b/test/compress/let.js
index c59308c4..4df5bb01 100644
--- a/test/compress/let.js
+++ b/test/compress/let.js
@@ -20,6 +20,39 @@ retain_block: {
node_version: ">=4"
}
+retain_assignment: {
+ options = {
+ dead_code: true,
+ reduce_vars: true,
+ }
+ input: {
+ "use strict";
+ function f() {
+ return a = 0;
+ let a;
+ }
+ try {
+ f();
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect: {
+ "use strict";
+ function f() {
+ return a = 0;
+ let a;
+ }
+ try {
+ f();
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect_stdout: "PASS"
+ node_version: ">=4"
+}
+
retain_catch: {
options = {
dead_code: true,
@@ -897,6 +930,7 @@ issue_4210: {
issue_4212_1: {
options = {
dead_code: true,
+ reduce_vars: true,
}
input: {
"use strict";