diff options
author | Richard van Velzen <rvanvelzen@experty.com> | 2016-04-23 23:48:33 +0200 |
---|---|---|
committer | Richard van Velzen <rvanvelzen@experty.com> | 2016-04-23 23:48:33 +0200 |
commit | 4fe630431c37ffb81466959e9ea9797d6d2de21a (patch) | |
tree | a131f138cf97ff2aa46d178d5742778c06d7e8c4 /test/compress/issue-1052.js | |
parent | c55dd5ed74888d533cf8402c6ba3612916ba2885 (diff) | |
download | tracifyjs-4fe630431c37ffb81466959e9ea9797d6d2de21a.tar.gz tracifyjs-4fe630431c37ffb81466959e9ea9797d6d2de21a.zip |
Hoist functions when reversing if (x) return; ... vs. if (!x) ...
Fixes #1052
Diffstat (limited to 'test/compress/issue-1052.js')
-rw-r--r-- | test/compress/issue-1052.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/compress/issue-1052.js b/test/compress/issue-1052.js new file mode 100644 index 00000000..067eea4a --- /dev/null +++ b/test/compress/issue-1052.js @@ -0,0 +1,27 @@ +hoist_funs_when_handling_if_return_rerversal: { + options = { if_return: true, hoist_funs: false }; + input: { + "use strict"; + + ( function() { + if ( !window ) { + return; + } + + function f() {} + function g() {} + } )(); + } + expect: { + "use strict"; + + ( function() { + function f() {} + function g() {} + + // NOTE: other compression steps will reduce this + // down to just `window`. + if ( window ); + } )(); + } +} |