fix corner case with parentheses (#4409)

fixes #4408
This commit is contained in:
Alex Lam S.L
2020-12-18 17:01:49 +00:00
committed by GitHub
parent 44e494f16f
commit 7d9dad0289
2 changed files with 79 additions and 5 deletions

View File

@@ -1198,11 +1198,9 @@ function OutputStream(options) {
// need to take some precautions here:
// https://github.com/mishoo/UglifyJS/issues/60
if (noin) node.walk(new TreeWalker(function(node) {
if (parens || node instanceof AST_Scope) return true;
if (node instanceof AST_Binary && node.operator == "in") {
parens = true;
return true;
}
if (parens) return true;
if (node instanceof AST_Binary && node.operator == "in") return parens = true;
if (node instanceof AST_Scope && !(node instanceof AST_Arrow && node.value)) return true;
}));
node.print(output, parens);
}