diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-01 02:36:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 10:36:45 +0800 |
commit | d4685640a00a0c998041c96ec197e613bd67b7b3 (patch) | |
tree | 53ed8185a109028e4270993fc1d6962fcc22495b /lib/output.js | |
parent | ac7b5c07d778d3b70bf39c4c0014e9411d780268 (diff) | |
download | tracifyjs-d4685640a00a0c998041c96ec197e613bd67b7b3.tar.gz tracifyjs-d4685640a00a0c998041c96ec197e613bd67b7b3.zip |
support template literals (#4601)
Diffstat (limited to 'lib/output.js')
-rw-r--r-- | lib/output.js | 13 |
1 files changed, 13 insertions, 0 deletions
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); }); |