unwind IIFE class patterns (#3373)

fixes #2332
This commit is contained in:
Alex Lam S.L
2019-04-21 09:49:07 +08:00
committed by GitHub
parent 338dd144b8
commit f01cc1e413
3 changed files with 80 additions and 25 deletions

View File

@@ -3003,12 +3003,10 @@ issue_3366: {
f();
}
expect: {
(function() {
function a() {}
(function() {
this && a && console.log("PASS");
})();
})();
void function() {
this && a && console.log("PASS");
}();
function a() {}
}
expect_stdout: "PASS"
}
@@ -3041,3 +3039,29 @@ issue_3371: {
}
expect_stdout: "function"
}
class_iife: {
options = {
inline: true,
sequences: true,
toplevel: true,
}
input: {
var A = function() {
function B() {}
B.prototype.m = function() {
console.log("PASS");
};
return B;
}();
new A().m();
}
expect: {
var A = (B.prototype.m = function() {
console.log("PASS");
}, B);
function B() {}
new A().m();
}
expect_stdout: "PASS"
}