aboutsummaryrefslogtreecommitdiff
path: root/test/compress/functions.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-06-13 01:40:14 +0800
committerGitHub <noreply@github.com>2017-06-13 01:40:14 +0800
commit2bdc8802ddd913a8b3b921426e898fc2f2257265 (patch)
tree8ae7323ea65471a23575fea7b3f337bdf3c0891b /test/compress/functions.js
parent5ef7cb372abf82f28d7f1b014fd0ddb2ef5bdec8 (diff)
downloadtracifyjs-2bdc8802ddd913a8b3b921426e898fc2f2257265.tar.gz
tracifyjs-2bdc8802ddd913a8b3b921426e898fc2f2257265.zip
fix variable accounting in `inline` (#2085)
fixes #2084
Diffstat (limited to 'test/compress/functions.js')
-rw-r--r--test/compress/functions.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 180bb11a..1359670e 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -297,3 +297,42 @@ webkit: {
expect_exact: "console.log((function(){1+1}).a=1);"
expect_stdout: "1"
}
+
+issue_2084: {
+ options = {
+ collapse_vars: true,
+ conditionals: true,
+ evaluate: true,
+ inline: true,
+ passes: 2,
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ var c = 0;
+ !function() {
+ !function(c) {
+ c = 1 + c;
+ var c = 0;
+ function f14(a_1) {
+ if (c = 1 + c, 0 !== 23..toString())
+ c = 1 + c, a_1 && (a_1[0] = 0);
+ }
+ f14();
+ }(-1);
+ }();
+ console.log(c);
+ }
+ expect: {
+ var c = 0;
+ !function(c) {
+ c = 1 + c,
+ c = 1 + (c = 0),
+ 0 !== 23..toString() && (c = 1 + c);
+ }(-1),
+ console.log(c);
+ }
+ expect_stdout: "0"
+}