mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Merge pull request #24000 from ajafff/regex-factory
Add createRegularExpressionLiteral and expose createStringLiteral
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user