enhance inline (#5105)

This commit is contained in:
Alex Lam S.L
2021-07-27 14:47:01 +01:00
committed by GitHub
parent e219a9a78a
commit 4fe2cac35e
4 changed files with 62 additions and 21 deletions

View File

@@ -1171,11 +1171,11 @@ issue_2620_4: {
}
expect: {
var c = "FAIL";
!function() {
(function() {
switch (NaN) {
case void (c = "PASS"):
}
}();
})();
console.log(c);
}
expect_stdout: "PASS"
@@ -6565,3 +6565,38 @@ issue_5098: {
}
expect_stdout: "PASS"
}
shorter_without_void: {
options = {
inline: true,
passes: 2,
reduce_vars: true,
side_effects: true,
toplevel: true,
}
input: {
var a;
function f(b) {
a = b;
}
f("foo");
console.log(a) || f("bar");
console.log(a, f("baz"));
console.log(a);
}
expect: {
var a;
function f(b) {
a = b;
}
a = "foo";
console.log(a) || (a = "bar");
console.log(a, f("baz"));
console.log(a);
}
expect_stdout: [
"foo",
"bar undefined",
"baz",
]
}