aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-01-26 14:21:11 +0800
committerGitHub <noreply@github.com>2018-01-26 14:21:11 +0800
commit193612ac67ef269d6b05fdf61c9638a5eebd76f7 (patch)
tree775406c79a6871980c1aa3a489a5845bfc2f1d85 /test/compress
parent95cfce68eae6173a76e8f01fae08a91f5d8996d2 (diff)
downloadtracifyjs-193612ac67ef269d6b05fdf61c9638a5eebd76f7.tar.gz
tracifyjs-193612ac67ef269d6b05fdf61c9638a5eebd76f7.zip
fix accounting after conversion to assignment (#2847)
Missing reference to `AST_SymbolRef` created by `unused` causes `collapse_vars` to misbehave. fixes #2846
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 0ac7bb33..e99d7ab1 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -1692,3 +1692,30 @@ issue_2768: {
}
expect_stdout: "PASS undefined"
}
+
+issue_2846: {
+ options = {
+ collapse_vars: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function f(a, b) {
+ var a = 0;
+ b && b(a);
+ return a++;
+ }
+ var c = f();
+ console.log(c);
+ }
+ expect: {
+ var c = function(a, b) {
+ a = 0;
+ b && b(a);
+ return a++;
+ }();
+ console.log(c);
+ }
+ expect_stdout: "0"
+}