From d4685640a00a0c998041c96ec197e613bd67b7b3 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Mon, 1 Feb 2021 02:36:45 +0000 Subject: support template literals (#4601) --- lib/output.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/output.js') diff --git a/lib/output.js b/lib/output.js index 8521d7ef..73a63c7d 100644 --- a/lib/output.js +++ b/lib/output.js @@ -1486,6 +1486,19 @@ function OutputStream(options) { DEFPRINT(AST_This, function(output) { output.print("this"); }); + DEFPRINT(AST_Template, function(output) { + var self = this; + if (self.tag) self.tag.print(output); + output.print("`"); + for (var i = 0; i < self.expressions.length; i++) { + output.print(self.strings[i]); + output.print("${"); + self.expressions[i].print(output); + output.print("}"); + } + output.print(self.strings[i]); + output.print("`"); + }); DEFPRINT(AST_Constant, function(output) { output.print(this.value); }); -- cgit v1.2.3