@@ -361,11 +361,24 @@ import * as classifier2020 from "./classifier2020.js";
361
361
/** The version of the language service API */
362
362
export const servicesVersion = "0.8" ;
363
363
364
- function createNode < TKind extends SyntaxKind > ( kind : TKind , pos : number , end : number , parent : Node ) : NodeObject <
10000
span class=pl-c1><TKind > | TokenObject < TKind > | IdentifierObject | PrivateIdentifierObject {
365
- const node = isNodeKind ( kind ) ? new NodeObject ( kind , pos , end ) :
366
- kind === SyntaxKind . Identifier ? new IdentifierObject ( SyntaxKind . Identifier , pos , end ) :
367
- kind === SyntaxKind . PrivateIdentifier ? new PrivateIdentifierObject ( SyntaxKind . PrivateIdentifier , pos , end ) :
368
- new TokenObject ( kind , pos , end ) ;
364
+ function createNode < TKind extends SyntaxKind > ( kind : TKind , pos : number , end : number , parent : Node ) : NodeObject < TKind > | TokenObject < TKind > | IdentifierObject | PrivateIdentifierObject | StringLiteralObject {
365
+ let node ;
366
+ if ( isNodeKind ( kind ) ) {
367
+ node = new NodeObject ( kind , pos , end ) ;
368
+ }
369
+ else if ( kind === SyntaxKind . Identifier ) {
370
+ node = new IdentifierObject ( SyntaxKind . Identifier , pos , end ) ;
371
+ }
372
+ else if ( kind === SyntaxKind . PrivateIdentifier ) {
373
+ node = new PrivateIdentifierObject ( SyntaxKind . PrivateIdentifier , pos , end ) ;
374
+ }
375
+ else if ( kind === SyntaxKind . StringLiteral ) {
376
+ node = new StringLiteralObject ( SyntaxKind . StringLiteral , pos , end ) ;
377
+ node . text = scanner . getTokenValue ( ) ;
378
+ }
379
+ else {
380
+ node = new TokenObject ( kind , pos , end ) ;
381
+ }
369
382
node . parent = parent ;
370
383
node . flags = parent . flags & NodeFlags . ContextFlags ;
371
384
return node ;
@@ -801,6 +814,22 @@ class TokenObject<TKind extends SyntaxKind> extends TokenOrIdentifierObject<TKin
801
814
}
802
815
}
803
816
817
+ class StringLiteralObject extends TokenObject < SyntaxKind . StringLiteral > implements StringLiteral {
818
+ public text ! : string ;
819
+ declare _literalExpressionBrand : any ;
820
+ declare _primaryExpressionBrand : any ;
821
+ declare _memberExpressionBrand : any ;
822
+ declare _leftHandSideExpressionBrand : any ;
823
+ declare _updateExpressionBrand : any ;
824
+ declare _unaryExpressionBrand : any ;
825
+ declare _expressionBrand : any ;
826
+ declare _declarationBrand : any ;
827
+
828
+ constructor ( kind : SyntaxKind . StringLiteral , pos : number , end : number ) {
829
+ super ( kind , pos , end ) ;
830
+ }
831
+ }
832
+
804
833
class IdentifierObject extends TokenOrIdentifierObject < SyntaxKind . Identifier > implements Identifier {
805
834
public escapedText ! : __String ;
806
835
declare _primaryExpressionBrand : any ;
0 commit comments