fix corner case in side_effects (#4765)

fixes #4764
This commit is contained in:
Alex Lam S.L
2021-03-12 18:40:28 +00:00
committed by GitHub
parent 24b73a95fa
commit c36c3cb470
2 changed files with 92 additions and 9 deletions

View File

@@ -564,7 +564,7 @@ drop_return: {
input: {
(async function(a) {
while (!console);
return console.log(a);
return !console.log(a);
})(42);
}
expect: {
@@ -1408,3 +1408,78 @@ issue_4747: {
expect_stdout: "PASS"
node_version: ">=8"
}
issue_4764_1: {
options = {
side_effects: true,
}
input: {
(async function() {
return {
then() {
console.log("PASS");
},
};
})();
}
expect: {
(async function() {
return {
then() {
console.log("PASS");
},
};
})();
}
expect_stdout: "PASS"
node_version: ">=8"
}
issue_4764_2: {
options = {
arrows: true,
side_effects: true,
}
input: {
(async () => ({
get then() {
console.log("PASS");
},
}))();
}
expect: {
(async () => ({
get then() {
console.log("PASS");
},
}))();
}
expect_stdout: "PASS"
node_version: ">=8"
}
issue_4764_3: {
options = {
side_effects: true,
}
input: {
(async function(o) {
return o;
})({
then() {
console.log("PASS");
},
});
}
expect: {
(async function(o) {
return o;
})({
then() {
console.log("PASS");
},
});
}
expect_stdout: "PASS"
node_version: ">=8"
}