fix corner cases with template literals (#4780)

This commit is contained in:
Alex Lam S.L
2021-03-15 13:54:05 +00:00
committed by GitHub
parent 01aa078e9c
commit 176581d732
4 changed files with 46 additions and 2 deletions

View File

@@ -1511,6 +1511,8 @@ merge(Compressor.prototype, {
var wrap = false;
if (parent.TYPE == "Call") {
wrap = parent.expression === orig && needs_unbinding(compressor, val);
} else if (parent instanceof AST_Template) {
wrap = parent.tag === orig && needs_unbinding(compressor, val);
} else if (parent instanceof AST_UnaryPrefix) {
wrap = parent.operator == "delete"
|| parent.operator == "typeof" && is_undeclared_ref(val);