aboutsummaryrefslogtreecommitdiff
path: root/test/compress/collapse_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-20 12:54:49 +0800
committerGitHub <noreply@github.com>2019-11-20 12:54:49 +0800
commit81caadb70900654d309f4750d8d0fbfb8f97a99a (patch)
tree85e448d64237e9929fdb7e032358a0b3fcd8c76f /test/compress/collapse_vars.js
parentd959e0b86ff36156be2e7ec2cffdd57f1e30e8dd (diff)
downloadtracifyjs-81caadb70900654d309f4750d8d0fbfb8f97a99a.tar.gz
tracifyjs-81caadb70900654d309f4750d8d0fbfb8f97a99a.zip
enhance collapse_vars (#3602)
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r--test/compress/collapse_vars.js31
1 files changed, 28 insertions, 3 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 81f24175..abdd9c2a 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -3852,10 +3852,9 @@ issue_2436_9: {
expect: {
var o = console;
console.log({
- x: (c = o).a,
- y: c.b,
+ x: o.a,
+ y: o.b,
});
- var c;
}
expect_stdout: true
}
@@ -6567,3 +6566,29 @@ issue_3596: {
}
expect_stdout: "42"
}
+
+local_value_replacement: {
+ options = {
+ collapse_vars: true,
+ unused: true,
+ }
+ input: {
+ function f(a, b) {
+ (a = b) && g(a);
+ }
+ function g(c) {
+ console.log(c);
+ }
+ f("FAIL", "PASS");
+ }
+ expect: {
+ function f(a, b) {
+ (a = b) && g(a);
+ }
+ function g(c) {
+ console.log(c);
+ }
+ f("FAIL", "PASS");
+ }
+ expect_stdout: "PASS"
+}