Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions src/compiler/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,54 @@ namespace ts {
: node;
}

export function createTemplateHead(text: string) {
const node = <TemplateHead>createSynthesizedNode(SyntaxKind.TemplateHead);
node.text = text;
return node;
}

export function updateTemplateHead(node: TemplateHead, text: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally we only update Node or NodeArray properties, not strings (e.g. there's no update method for Identifier). I don't think we need these update methods.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright then, will remove.

return node.text !== text
? updateNode(createTemplateHead(text), node)
: node;
}

export function createTemplateMiddle(text: string) {
const node = <TemplateMiddle>createSynthesizedNode(SyntaxKind.TemplateMiddle);
node.text = text;
return node;
}

export function updateTemplateMiddle(node: TemplateMiddle, text: string) {
return node.text !== text
? updateNode(createTemplateMiddle(text), node)
: node;
}

export function createTemplateTail(text: string) {
const node = <TemplateTail>createSynthesizedNode(SyntaxKind.TemplateTail);
node.text = text;
return node;
}

export function updateTemplateTail(node: TemplateTail, text: string) {
return node.text !== text
? updateNode(createTemplateTail(text), node)
: node;
}

export function createNoSubstitutionTemplateLiteral(text: string) {
const node = <NoSubstitutionTemplateLiteral>createSynthesizedNode(SyntaxKind.NoSubstitutionTemplateLiteral);
node.text = text;
return node;
}

export function updateNoSubstitutionTemplateLiteral(node: NoSubstitutionTemplateLiteral, text: string) {
return node.text !== text
? updateNode(createNoSubstitutionTemplateLiteral(text), node)
: node;
}

export function createYield(expression?: Expression): YieldExpression;
export function createYield(asteriskToken: AsteriskToken, expression: Expression): YieldExpression;
export function createYield(asteriskTokenOrExpression?: AsteriskToken | Expression, expression?: Expression) {
Expand Down