fix corner cases with template literals (#4903)

fixes #4902
This commit is contained in:
Alex Lam S.L
2021-05-03 15:26:20 +01:00
committed by GitHub
parent 45b6d23d36
commit 5d9224deb8
2 changed files with 36 additions and 0 deletions

View File

@@ -709,6 +709,8 @@ function OutputStream(options) {
// (x++)[y]
// (typeof x).y
if (p instanceof AST_PropAccess) return p.expression === this;
// (~x)`foo`
if (p instanceof AST_Template) return p.tag === this;
}
PARENS(AST_Await, needs_parens_unary);
PARENS(AST_Unary, needs_parens_unary);
@@ -782,6 +784,8 @@ function OutputStream(options) {
if (p instanceof AST_Class) return true;
// (foo && bar)["prop"], (foo && bar).prop
if (p instanceof AST_PropAccess) return p.expression === this;
// (foo && bar)``
if (p instanceof AST_Template) return p.tag === this;
// typeof (foo && bar)
if (p instanceof AST_Unary) return true;
});