aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-12-16 02:16:35 +0800
committerGitHub <noreply@github.com>2017-12-16 02:16:35 +0800
commit6c686ce59342c42b7fdcf54296e28c6c6517e6ab (patch)
tree980282288163ce232e4531d49a49c167e587c0e4 /test
parentdb902af4c6e7a8c7e7a690591a0cd6a0d611300f (diff)
downloadtracifyjs-6c686ce59342c42b7fdcf54296e28c6c6517e6ab.tar.gz
tracifyjs-6c686ce59342c42b7fdcf54296e28c6c6517e6ab.zip
fix nested `inline` (#2602)
fixes #2601
Diffstat (limited to 'test')
-rw-r--r--test/compress/functions.js75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index a36509af..8e67bc32 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -772,3 +772,78 @@ issue_2476: {
}
expect_stdout: "465"
}
+
+issue_2601_1: {
+ options = {
+ inline: true,
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ var a = "FAIL";
+ (function() {
+ function f(b) {
+ function g(b) {
+ b && b();
+ }
+ g();
+ (function() {
+ b && (a = "PASS");
+ })();
+ }
+ f("foo");
+ })();
+ console.log(a);
+ }
+ expect: {
+ var a = "FAIL";
+ (function() {
+ b = "foo",
+ function(b) {
+ b && b();
+ }(),
+ b && (a = "PASS");
+ var b;
+ })(),
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+}
+
+issue_2601_2: {
+ rename = true
+ options = {
+ evaluate: true,
+ inline: true,
+ passes: 3,
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ mangle = {}
+ input: {
+ var a = "FAIL";
+ (function() {
+ function f(b) {
+ function g(b) {
+ b && b();
+ }
+ g();
+ (function() {
+ b && (a = "PASS");
+ })();
+ }
+ f("foo");
+ })();
+ console.log(a);
+ }
+ expect: {
+ var a = "FAIL";
+ a = "PASS",
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+}