introduce templates (#4603)

This commit is contained in:
Alex Lam S.L
2021-02-01 09:20:13 +00:00
committed by GitHub
parent d4685640a0
commit ba6e29d6fd
9 changed files with 281 additions and 74 deletions

View File

@@ -780,7 +780,9 @@ function OutputStream(options) {
// (new foo)(bar)
if (p instanceof AST_Call) return p.expression === this;
// (new Date).getTime(), (new Date)["getTime"]()
return p instanceof AST_PropAccess;
if (p instanceof AST_PropAccess) return true;
// (new foo)`bar`
if (p instanceof AST_Template) return p.tag === this;
});
PARENS(AST_Number, function(output) {
@@ -802,6 +804,8 @@ function OutputStream(options) {
if (p instanceof AST_Conditional) return p.condition === self;
// (a = foo)["prop"] —or— (a = foo).prop
if (p instanceof AST_PropAccess) return p.expression === self;
// (a = foo)`bar`
if (p instanceof AST_Template) return p.tag === self;
// !(a = false) → true
if (p instanceof AST_Unary) return true;
}