@@ -1041,7 +1041,7 @@ namespace ts {
10411041 // SyntaxKind.TemplateMiddle
10421042 // SyntaxKind.TemplateTail
10431043 function emitLiteral ( node : LiteralLikeNode ) {
1044- const text = getLiteralTextOfNode ( node ) ;
1044+ const text = getLiteralTextOfNode ( node , printerOptions . neverAsciiEscape ) ;
10451045 if ( ( printerOptions . sourceMap || printerOptions . inlineSourceMap )
10461046 && ( node . kind === SyntaxKind . StringLiteral || isTemplateLiteralKind ( node . kind ) ) ) {
10471047 writeLiteral ( text ) ;
@@ -1532,7 +1532,7 @@ namespace ts {
15321532 expression = skipPartiallyEmittedExpressions ( expression ) ;
15331533 if ( isNumericLiteral ( expression ) ) {
15341534 // check if numeric literal is a decimal literal that was originally written with a dot
1535- const text = getLiteralTextOfNode ( < LiteralExpression > expression ) ;
1535+ const text = getLiteralTextOfNode ( < LiteralExpression > expression , /*neverAsciiEscape*/ true ) ;
15361536 return ! expression . numericLiteralFlags
15371537 && ! stringContains ( text , tokenToString ( SyntaxKind . DotToken ) ! ) ;
15381538 }
@@ -3306,20 +3306,20 @@ namespace ts {
33063306 return getSourceTextOfNodeFromSourceFile ( currentSourceFile , node , includeTrivia ) ;
33073307 }
33083308
3309- function getLiteralTextOfNode ( node : LiteralLikeNode ) : string {
3309+ function getLiteralTextOfNode ( node : LiteralLikeNode , neverAsciiEscape : boolean | undefined ) : string {
33103310 if ( node . kind === SyntaxKind . StringLiteral && ( < StringLiteral > node ) . textSourceNode ) {
33113311 const textSourceNode = ( < StringLiteral > node ) . textSourceNode ! ;
33123312 if ( isIdentifier ( textSourceNode ) ) {
3313- return getEmitFlags ( node ) & EmitFlags . NoAsciiEscaping ?
3313+ return neverAsciiEscape || ( getEmitFlags ( node ) & EmitFlags . NoAsciiEscaping ) ?
33143314 `"${ escapeString ( getTextOfNode ( textSourceNode ) ) } "` :
33153315 `"${ escapeNonAsciiString ( getTextOfNode ( textSourceNode ) ) } "` ;
33163316 }
33173317 else {
3318- return getLiteralTextOfNode ( textSourceNode ) ;
3318+ return getLiteralTextOfNode ( textSourceNode , neverAsciiEscape ) ;
33193319 }
33203320 }
33213321
3322- return getLiteralText ( node , currentSourceFile ) ;
3322+ return getLiteralText ( node , currentSourceFile , neverAsciiEscape ) ;
33233323 }
33243324
33253325 /**
0 commit comments