diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 8413454bcc5..bd9720ba257 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -127,7 +127,7 @@ namespace ts { export function createIdentifier(text: string, location?: TextRange): Identifier { const node = createNode(SyntaxKind.Identifier, location); - node.text = text; + node.text = escapeIdentifier(text); return node; } diff --git a/src/compiler/printer.ts b/src/compiler/printer.ts index b229f7c153b..c14fb3d7811 100644 --- a/src/compiler/printer.ts +++ b/src/compiler/printer.ts @@ -2349,7 +2349,7 @@ const _super = (function (geti, seti) { return getGeneratedIdentifier(node); } else if (nodeIsSynthesized(node) || !node.parent) { - return node.text; + return unescapeIdentifier(node.text); } } else if (isLiteralExpression(node) && (nodeIsSynthesized(node) || !node.parent)) {