From 8e5f77b5016356171f6e0eff5508fbfbfb7193fc Mon Sep 17 00:00:00 2001 From: magiblot Date: Sun, 13 Oct 2019 23:00:09 +0200 Subject: [PATCH] fix: render TemplateElement nodes Closes #129 --- src/astring.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/astring.js b/src/astring.js index b3400c17..bd55f276 100644 --- a/src/astring.js +++ b/src/astring.js @@ -683,7 +683,7 @@ export const baseGenerator = { const { length } = expressions for (let i = 0; i < length; i++) { const expression = expressions[i] - state.write(quasis[i].value.raw) + this.TemplateElement(quasis[i], state) state.write('${') this[expression.type](expression, state) state.write('}') @@ -691,6 +691,9 @@ export const baseGenerator = { state.write(quasis[quasis.length - 1].value.raw) state.write('`') }, + TemplateElement(node, state) { + state.write(node.value.raw) + }, TaggedTemplateExpression(node, state) { this[node.tag.type](node.tag, state) this[node.quasi.type](node.quasi, state)