detect boolean context across IIFEs (#3461)

This commit is contained in:
Alex Lam S.L
2019-10-10 09:37:02 +08:00
committed by GitHub
parent b18f717b46
commit 33c94d3bd9
2 changed files with 39 additions and 0 deletions

View File

@@ -979,6 +979,14 @@ TreeWalker.prototype = {
|| p instanceof AST_Conditional
|| p.tail_node() === self) {
self = p;
} else if (p instanceof AST_Return) {
var fn;
do {
fn = this.parent(++i);
if (!fn) return false;
} while (!(fn instanceof AST_Lambda));
self = this.parent(++i);
if (!self || self.TYPE != "Call" || self.expression !== fn) return false;
} else {
return false;
}