Skip to content

Commit

Permalink
fix: render TemplateElement nodes
Browse files Browse the repository at this point in the history
Closes #129
  • Loading branch information
magiblot authored and davidbonnet committed Oct 13, 2019
1 parent 362c10f commit 8e5f77b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/astring.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,14 +683,17 @@ 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('}')
}
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)
Expand Down

0 comments on commit 8e5f77b

Please sign in to comment.