enhance side_effects (#4638)

This commit is contained in:
Alex Lam S.L
2021-02-10 10:09:54 +00:00
committed by GitHub
parent 5ec82e5801
commit a98ec7e4df
3 changed files with 77 additions and 3 deletions

View File

@@ -667,6 +667,44 @@ inline_nested_yield: {
node_version: ">=4"
}
drop_body: {
options = {
side_effects: true,
yields: true,
}
input: {
(function*([ , a = console.log("foo") ]) {
console.log("bar");
})([ console.log("baz") ]);
}
expect: {
[ [ , 0[0] = console.log("foo") ] ] = [ [ console.log("baz") ] ];
}
expect_stdout: [
"baz",
"foo",
]
node_version: ">=6"
}
drop_unused_call: {
options = {
inline: true,
side_effects: true,
toplevel: true,
unused: true,
yields: true,
}
input: {
var a = function*(){}(console.log("PASS"));
}
expect: {
console.log("PASS");
}
expect_stdout: "PASS"
node_version: ">=4"
}
issue_4454_1: {
rename = false
options = {