mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add createRegularExpressionLiteral and expose createStringLiteral
Fixes: #23992
This commit is contained in:
1 parent
6f9dc2f976
commit
fc3ba76ab7
3 files changed
+11
-1
No files matched your search
@@ -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