fix corner case in if_return (#4851)

fixes #4848
This commit is contained in:
Alex Lam S.L
2021-04-08 01:57:59 +01:00
committed by GitHub
parent ebe4e1ad28
commit 8a82822654
5 changed files with 153 additions and 7 deletions

View File

@@ -1493,3 +1493,51 @@ mangle_properties: {
expect_stdout: "PASS 42"
node_version: ">=14.6"
}
issue_4848: {
options = {
if_return: true,
}
input: {
"use strict";
function f(a) {
a(function() {
new A();
});
if (!console)
return;
class A {
constructor() {
console.log("PASS");
}
}
}
var g;
f(function(h) {
g = h;
});
g();
}
expect: {
"use strict";
function f(a) {
a(function() {
new A();
});
if (!console)
return;
class A {
constructor() {
console.log("PASS");
}
}
}
var g;
f(function(h) {
g = h;
});
g();
}
expect_stdout: "PASS"
node_version: ">=4"
}