fix corner cases with block-scoped functions (#4695)
This commit is contained in:
@@ -1454,3 +1454,47 @@ issue_4689: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
issue_4691: {
|
||||
options = {
|
||||
if_return: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
function A() {}
|
||||
A.prototype.f = function() {
|
||||
if (!this)
|
||||
return;
|
||||
const a = "PA";
|
||||
function g(b) {
|
||||
h(a + b);
|
||||
}
|
||||
[ "SS" ].forEach(function(c) {
|
||||
g(c);
|
||||
});
|
||||
};
|
||||
function h(d) {
|
||||
console.log(d);
|
||||
}
|
||||
new A().f();
|
||||
}
|
||||
expect: {
|
||||
function A() {}
|
||||
A.prototype.f = function() {
|
||||
if (this) {
|
||||
const a = "PA";
|
||||
[ "SS" ].forEach(function(c) {
|
||||
g(c);
|
||||
});
|
||||
function g(b) {
|
||||
h(a + b);
|
||||
}
|
||||
}
|
||||
};
|
||||
function h(d) {
|
||||
console.log(d);
|
||||
}
|
||||
new A().f();
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user