diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-16 12:03:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 12:03:30 +0800 |
commit | a80b228d8be37eb6585bca01c6fb5468db5bea42 (patch) | |
tree | aa6eafca577f69aaf4393ad767be2d3c69f95c18 /test/compress | |
parent | cf4bf4ceb1eee86197d51e77e640e59ca04739b8 (diff) | |
download | tracifyjs-a80b228d8be37eb6585bca01c6fb5468db5bea42.tar.gz tracifyjs-a80b228d8be37eb6585bca01c6fb5468db5bea42.zip |
fix `hoist_vars` on `reduce_vars` (#1607)
`hoist_vars` converts variable declarations into plain assignments, which then confuses `reduce_vars`
fixes #1606
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/reduce_vars.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index a5ab59f9..bc6c72d4 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -1327,3 +1327,27 @@ issue_1595_4: { })(3, 4, 5); } } + +issue_1606: { + options = { + evaluate: true, + hoist_vars: true, + reduce_vars: true, + } + input: { + function f() { + var a; + function g(){}; + var b = 2; + x(b); + } + } + expect: { + function f() { + var a, b; + function g(){}; + b = 2; + x(b); + } + } +} |