aboutsummaryrefslogtreecommitdiff
path: root/test/compress/functions.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-01-04 12:58:40 +0800
committerGitHub <noreply@github.com>2018-01-04 12:58:40 +0800
commit9b58b54e2d7ce4ab2c015611add52c7475de9eab (patch)
tree0c287e5a558a71debcb187ec5f3d33bb2e795763 /test/compress/functions.js
parentc598a12af956a939587059f0f4753a0631b5b372 (diff)
downloadtracifyjs-9b58b54e2d7ce4ab2c015611add52c7475de9eab.tar.gz
tracifyjs-9b58b54e2d7ce4ab2c015611add52c7475de9eab.zip
extend `inline` (#2714)
- compress `function` with variables within loops - restrict to `AST_Var` for better compatibility with ES6+
Diffstat (limited to 'test/compress/functions.js')
-rw-r--r--test/compress/functions.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index b6b68982..ff3baeb2 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -1299,6 +1299,7 @@ issue_2630_2: {
passes: 2,
reduce_vars: true,
sequences: true,
+ side_effects: true,
unused: true,
}
input: {
@@ -1905,6 +1906,7 @@ inline_true: {
use_before_init_in_loop: {
options = {
inline: true,
+ side_effects: true,
toplevel: true,
}
input: {
@@ -1918,9 +1920,9 @@ use_before_init_in_loop: {
}
expect: {
var a = "PASS";
- for (var b = 2; --b >= 0;) (function() {
- var c = (c && (a = "FAIL"), 1);
- })();
+ for (var b = 2; --b >= 0;)
+ c = void 0, c = (c && (a = "FAIL"), 1);
+ var c;
console.log(a);
}
expect_stdout: "PASS"