aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-04-18 17:03:52 +0800
committerGitHub <noreply@github.com>2019-04-18 17:03:52 +0800
commite8a2c0b5bf18659a3e1285b6038ea755a290220d (patch)
tree6519593833ec84a2f5c19ce3274a1e55b13d5900 /test/compress
parent21cd7e3f571030c889619b39287ac8420044bcc4 (diff)
downloadtracifyjs-e8a2c0b5bf18659a3e1285b6038ea755a290220d.tar.gz
tracifyjs-e8a2c0b5bf18659a3e1285b6038ea755a290220d.zip
fix corner case in `functions` (#3365)
fixes #3364
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/functions.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 2d00c594..c43c17eb 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -2916,3 +2916,68 @@ issue_2485: {
}
expect_stdout: "6"
}
+
+issue_3364: {
+ options = {
+ functions: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ mangle = {}
+ input: {
+ var s = 2, a = 100, b = 10, c = 0;
+ function f(p, e, r) {
+ try {
+ for (var i = 1; i-- > 0;)
+ var a = function(x) {
+ function g(y) {
+ y && y[a++];
+ }
+ var x = g(--s >= 0 && f(c++));
+ for (var j = 1; --j > 0;);
+ }();
+ } catch (e) {
+ try {
+ return;
+ } catch (z) {
+ for (var k = 1; --k > 0;) {
+ for (var l = 1; l > 0; --l) {
+ var n = function() {};
+ for (var k in n)
+ var o = (n, k);
+ }
+ }
+ }
+ }
+ }
+ var r = f();
+ console.log(c);
+ }
+ expect: {
+ var s = 2, c = 0;
+ (function n(r, o, a) {
+ try {
+ for (var f = 1; f-- >0;)
+ var t = function(r) {
+ (function(r) {
+ r && r[t++];
+ })(--s >= 0 && n(c++));
+ for (var o = 1; --o > 0;);
+ }();
+ } catch (o) {
+ try {
+ return;
+ } catch (r) {
+ for (var v = 1; --v > 0;)
+ for (var i = 1; i > 0;--i) {
+ function u() {}
+ for (var v in u);
+ }
+ }
+ }
+ })();
+ console.log(c);
+ }
+ expect_stdout: "2"
+}