diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-12-14 18:47:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-14 18:47:05 +0800 |
commit | 3f18a61532a86f0f52edbb50ca7d81e0869ad7c3 (patch) | |
tree | 943cf4b5f809d106057225215e6ea30d218fae3f /test/compress/reduce_vars.js | |
parent | 02a6ce07eba11223518a22bce18e209371f78f39 (diff) | |
download | tracifyjs-3f18a61532a86f0f52edbb50ca7d81e0869ad7c3.tar.gz tracifyjs-3f18a61532a86f0f52edbb50ca7d81e0869ad7c3.zip |
fix `reduce_vars` on single `AST_Defun` reference across loop (#2593)
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r-- | test/compress/reduce_vars.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 108dc0e9..ff93079d 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -4838,3 +4838,31 @@ inverted_var: { } expect_stdout: true } + +defun_single_use_loop: { + options = { + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + for (var x, i = 2; --i >= 0; ) { + var y = x; + x = f; + console.log(x === y); + } + function f() {}; + } + expect: { + for (var x, i = 2; --i >= 0; ) { + var y = x; + x = f; + console.log(x === y); + } + function f() {}; + } + expect_stdout: [ + "false", + "true", + ] +} |