fix corner case in side_effects (#5315)

fixes #5314
This commit is contained in:
Alex Lam S.L
2022-01-27 00:13:19 +00:00
committed by GitHub
parent 371d25944d
commit 67438f3ff9
3 changed files with 90 additions and 3 deletions

View File

@@ -2081,3 +2081,43 @@ issue_5256: {
expect_stdout: "undefined"
node_version: ">=8"
}
issue_5314_1: {
options = {
side_effects: true,
}
input: {
A = this;
new function() {
(function(a = console.log(this === A ? "PASS" : "FAIL")) {})();
}();
}
expect: {
A = this;
(function() {
(function(a = console.log(this === A ? "PASS" : "FAIL")) {})();
})();
}
expect_stdout: "PASS"
node_version: ">=6"
}
issue_5314_2: {
options = {
side_effects: true,
}
input: {
A = this;
new function() {
((a = console.log(this === A ? "FAIL" : "PASS")) => {})();
}();
}
expect: {
A = this;
new function() {
console.log(this === A ? "FAIL" : "PASS");
}();
}
expect_stdout: "PASS"
node_version: ">=6"
}