You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
864 B
33 lines
864 B
"use strict"; |
|
|
|
Object.defineProperty(exports, "__esModule", { |
|
value: true |
|
}); |
|
exports.TaggedTemplateExpression = TaggedTemplateExpression; |
|
exports.TemplateElement = TemplateElement; |
|
exports.TemplateLiteral = TemplateLiteral; |
|
|
|
function TaggedTemplateExpression(node) { |
|
this.print(node.tag, node); |
|
this.print(node.typeParameters, node); |
|
this.print(node.quasi, node); |
|
} |
|
|
|
function TemplateElement(node, parent) { |
|
const isFirst = parent.quasis[0] === node; |
|
const isLast = parent.quasis[parent.quasis.length - 1] === node; |
|
const value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); |
|
this.token(value); |
|
} |
|
|
|
function TemplateLiteral(node) { |
|
const quasis = node.quasis; |
|
|
|
for (let i = 0; i < quasis.length; i++) { |
|
this.print(quasis[i], node); |
|
|
|
if (i + 1 < quasis.length) { |
|
this.print(node.expressions[i], node); |
|
} |
|
} |
|
} |