diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-04-07 12:32:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-07 12:32:56 +0800 |
commit | 281e882d27ace48c5c415f19292e2590dd4473dc (patch) | |
tree | a8a1a1fdae3a6f30aec01e1fc9c0a58173391ac4 /test/compress/reduce_vars.js | |
parent | cc6aa3e5ac13c0da9f2481181f5b4f11275ca8c8 (diff) | |
download | tracifyjs-281e882d27ace48c5c415f19292e2590dd4473dc.tar.gz tracifyjs-281e882d27ace48c5c415f19292e2590dd4473dc.zip |
fix `reduce_vars` on catch variable (#1794)
Improved catch handling in `figure_out_scope()` means special case treatment of IE8 is no longer valid in `reset_opt_flags()`.
Also fixed recursive assignment in variable definition.
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r-- | test/compress/reduce_vars.js | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index fdfec99e..842d8de4 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -1917,7 +1917,7 @@ side_effects_assign: { expect_stdout: "undefined" } -pure_getters: { +pure_getters_1: { options = { pure_getters: true, reduce_vars: true, @@ -1938,3 +1938,45 @@ pure_getters: { } expect_stdout: "undefined" } + +pure_getters_2: { + options = { + pure_getters: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var a; + var a = a && a.b; + } + expect: { + var a; + var a = a && a.b; + } +} + +catch_var: { + options = { + booleans: true, + evaluate: true, + reduce_vars: true, + } + input: { + try { + throw {}; + } catch (e) { + var e; + console.log(!!e); + } + } + expect: { + try { + throw {}; + } catch (e) { + var e; + console.log(!!e); + } + } + expect_stdout: "true" +} |