Add createRegularExpressionLiteral and expose createStringLiteral

Fixes: #23992
This commit is contained in:
Klaus Meinhardt
2018-05-09 22:22:46 +02:00
parent 6f9dc2f976
commit fc3ba76ab7
3 changed files with 11 additions and 1 deletions

View File

@@ -93,12 +93,18 @@ namespace ts {
return node;
}
function createStringLiteral(text: string): StringLiteral {
export function createStringLiteral(text: string): StringLiteral {
const node = <StringLiteral>createSynthesizedNode(SyntaxKind.StringLiteral);
node.text = text;
return node;
}
export function createRegularExpressionLiteral(text: string): RegularExpressionLiteral {
const node = <RegularExpressionLiteral>createSynthesizedNode(SyntaxKind.RegularExpressionLiteral);
node.text = text;
return node;
}
function createLiteralFromNode(sourceNode: PropertyNameLiteral): StringLiteral {
const node = createStringLiteral(getTextOfIdentifierOrLiteral(sourceNode));
node.textSourceNode = sourceNode;