Skip to content

Commit b2ec333

Browse files
authored
Add missing factory functions for template head, middle, tail, and no substituion template literal (#18709)
1 parent 25ad0b5 commit b2ec333

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/compiler/factory.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,54 @@ namespace ts {
12071207
: node;
12081208
}
12091209

1210+
export function createTemplateHead(text: string) {
1211+
const node = <TemplateHead>createSynthesizedNode(SyntaxKind.TemplateHead);
1212+
node.text = text;
1213+
return node;
1214+
}
1215+
1216+
export function updateTemplateHead(node: TemplateHead, text: string) {
1217+
return node.text !== text
1218+
? updateNode(createTemplateHead(text), node)
1219+
: node;
1220+
}
1221+
1222+
export function createTemplateMiddle(text: string) {
1223+
const node = <TemplateMiddle>createSynthesizedNode(SyntaxKind.TemplateMiddle);
1224+
node.text = text;
1225+
return node;
1226+
}
1227+
1228+
export function updateTemplateMiddle(node: TemplateMiddle, text: string) {
1229+
return node.text !== text
1230+
? updateNode(createTemplateMiddle(text), node)
1231+
: node;
1232+
}
1233+
1234+
export function createTemplateTail(text: string) {
1235+
const node = <TemplateTail>createSynthesizedNode(SyntaxKind.TemplateTail);
1236+
node.text = text;
1237+
return node;
1238+
}
1239+
1240+
export function updateTemplateTail(node: TemplateTail, text: string) {
1241+
return node.text !== text
1242+
? updateNode(createTemplateTail(text), node)
1243+
: node;
1244+
}
1245+
1246+
export function createNoSubstitutionTemplateLiteral(text: string) {
1247+
const node = <NoSubstitutionTemplateLiteral>createSynthesizedNode(SyntaxKind.NoSubstitutionTemplateLiteral);
1248+
node.text = text;
1249+
return node;
1250+
}
1251+
1252+
export function updateNoSubstitutionTemplateLiteral(node: NoSubstitutionTemplateLiteral, text: string) {
1253+
return node.text !== text
1254+
? updateNode(createNoSubstitutionTemplateLiteral(text), node)
1255+
: node;
1256+
}
1257+
12101258
export function createYield(expression?: Expression): YieldExpression;
12111259
export function createYield(asteriskToken: AsteriskToken, expression: Expression): YieldExpression;
12121260
export function createYield(asteriskTokenOrExpression?: AsteriskToken | Expression, expression?: Expression) {

0 commit comments

Comments
 (0)