fix corner case in ie8 & mangle (#3476)

fixes #3475
This commit is contained in:
Alex Lam S.L
2019-10-15 14:18:12 +08:00
committed by GitHub
parent d3d1d11926
commit f86f615d83
3 changed files with 141 additions and 9 deletions

View File

@@ -1189,3 +1189,135 @@ issue_3473_ie8_toplevel: {
}
expect_stdout: "100 10 1"
}
issue_3475: {
rename = true
mangle = {
ie8: false,
toplevel: false,
}
input: {
"ooooo ddddd";
var a = "FAIL";
try {
throw 42;
} catch (b) {
(function f() {
a = "PASS";
})();
}
console.log(a);
}
expect: {
"ooooo ddddd";
var a = "FAIL";
try {
throw 42;
} catch (o) {
(function o() {
a = "PASS";
})();
}
console.log(a);
}
expect_stdout: "PASS"
}
issue_3475_ie8: {
rename = true
mangle = {
ie8: true,
toplevel: false,
}
input: {
"ooooo ddddd";
var a = "FAIL";
try {
throw 42;
} catch (b) {
(function f() {
a = "PASS";
})();
}
console.log(a);
}
expect: {
"ooooo ddddd";
var a = "FAIL";
try {
throw 42;
} catch (b) {
(function f() {
a = "PASS";
})();
}
console.log(a);
}
expect_stdout: "PASS"
}
issue_3475_toplevel: {
rename = true
mangle = {
ie8: false,
toplevel: true,
}
input: {
"ooooo ddddd";
var a = "FAIL";
try {
throw 42;
} catch (b) {
(function f() {
a = "PASS";
})();
}
console.log(a);
}
expect: {
"ooooo ddddd";
var d = "FAIL";
try {
throw 42;
} catch (o) {
(function o() {
d = "PASS";
})();
}
console.log(d);
}
expect_stdout: "PASS"
}
issue_3475_ie8_toplevel: {
rename = true
mangle = {
ie8: true,
toplevel: true,
}
input: {
"ooooo ddddd";
var a = "FAIL";
try {
throw 42;
} catch (b) {
(function f() {
a = "PASS";
})();
}
console.log(a);
}
expect: {
"ooooo ddddd";
var o = "FAIL";
try {
throw 42;
} catch (d) {
(function c() {
o = "PASS";
})();
}
console.log(o);
}
expect_stdout: "PASS"
}