@@ -9,7 +9,7 @@ namespace ts {
99 export function getEndLinePosition ( line : number , sourceFile : SourceFile ) : number {
1010 Debug . assert ( line >= 0 ) ;
1111 let lineStarts = sourceFile . getLineStarts ( ) ;
12-
12+
1313 let lineIndex = line ;
1414 if ( lineIndex + 1 === lineStarts . length ) {
1515 // last line - return EOF
@@ -170,7 +170,7 @@ namespace ts {
170170 case SyntaxKind . VoidExpression :
171171 case SyntaxKind . YieldExpression :
172172 case SyntaxKind . SpreadElementExpression :
173- let unaryWordExpression = ( < TypeOfExpression | DeleteExpression | VoidExpression | YieldExpression | SpreadElementExpression > n ) ;
173+ let unaryWordExpression = ( < TypeOfExpression | DeleteExpression | VoidExpression | YieldExpression | SpreadElementExpression > n ) ;
174174 return isCompletedNode ( unaryWordExpression . expression , sourceFile ) ;
175175
176176 case SyntaxKind . TaggedTemplateExpression :
@@ -252,7 +252,7 @@ namespace ts {
252252 } ) ;
253253
254254 // Either we didn't find an appropriate list, or the list must contain us.
255- Debug . assert ( ! syntaxList || contains ( syntaxList . getChildren ( ) , node ) ) ;
255+ Debug . assert ( ! syntaxList || contains ( syntaxList . getChildren ( ) , node ) ) ;
256256 return syntaxList ;
257257 }
258258
@@ -388,7 +388,7 @@ namespace ts {
388388 // if this is the case - then we should assume that token in question is located in previous child.
389389 if ( position < child . end && ( nodeHasTokens ( child ) || child . kind === SyntaxKind . JsxText ) ) {
390390 const start = child . getStart ( sourceFile ) ;
391- const lookInPreviousChild =
391+ const lookInPreviousChild =
392392 ( start >= position ) || // cursor in the leading trivia
393393 ( child . kind === SyntaxKind . JsxText && start === child . end ) ; // whitespace only JsxText
394394
@@ -425,7 +425,7 @@ namespace ts {
425425 }
426426 }
427427 }
428-
428+
429429 export function isInString ( sourceFile : SourceFile , position : number ) {
430430 let token = getTokenAtPosition ( sourceFile , position ) ;
431431 return token && token . kind === SyntaxKind . StringLiteral && position > token . getStart ( ) ;
@@ -473,7 +473,7 @@ namespace ts {
473473 let commentRanges = getLeadingCommentRanges ( sourceFile . text , token . pos ) ;
474474
475475 return forEach ( commentRanges , jsDocPrefix ) ;
476-
476+
477477 function jsDocPrefix ( c : CommentRange ) : boolean {
478478 var text = sourceFile . text ;
479479 return text . length >= c . pos + 3 && text [ c . pos ] === '/' && text [ c . pos + 1 ] === '*' && text [ c . pos + 2 ] === '*' ;
@@ -562,8 +562,13 @@ namespace ts {
562562 return kind === SyntaxKind . SingleLineCommentTrivia || kind === SyntaxKind . MultiLineCommentTrivia ;
563563 }
564564
565- export function isTemplate ( kind : SyntaxKind ) : boolean {
566- return kind >= SyntaxKind . FirstTemplateToken && kind <= SyntaxKind . LastTemplateToken ;
565+ export function isStringOrRegularExpressionOrTemplateLiteral ( kind : SyntaxKind ) : boolean {
566+ if ( kind === SyntaxKind . StringLiteral
567+ || kind === SyntaxKind . RegularExpressionLiteral
568+ || isTemplateLiteralKind ( kind ) ) {
569+ return true ;
570+ }
571+ return false ;
567572 }
568573
569574 export function isPunctuation ( kind : SyntaxKind ) : boolean {
@@ -693,7 +698,7 @@ namespace ts {
693698 }
694699
695700 export function displayPart ( text : string , kind : SymbolDisplayPartKind , symbol ?: Symbol ) : SymbolDisplayPart {
696- return < SymbolDisplayPart > {
701+ return < SymbolDisplayPart > {
697702 text : text ,
698703 kind : SymbolDisplayPartKind [ kind ]
699704 } ;
0 commit comments