@@ -188,6 +188,7 @@ import {
188
188
getLineStarts ,
189
189
getModeForUsageLocation ,
190
190
getNameOfDeclaration ,
191
+ getNodeChildren ,
191
192
getNormalizedAbsolutePath ,
192
193
getNormalizedPathComponents ,
193
194
getOwnKeys ,
@@ -511,7 +512,6 @@ import {
511
512
SymbolFlags ,
512
513
SymbolTable ,
513
514
SyntaxKind ,
514
- SyntaxList ,
515
515
TaggedTemplateExpression ,
516
516
TemplateExpression ,
517
517
TemplateLiteral ,
@@ -1162,8 +1162,11 @@ export function getTokenPosOfNode(node: Node, sourceFile?: SourceFileLike, inclu
1162
1162
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
1163
1163
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
1164
1164
// first child to determine the actual position of its first token.
1165
- if ( node . kind === SyntaxKind . SyntaxList && ( node as SyntaxList ) . _children . length > 0 ) {
1166
- return getTokenPosOfNode ( ( node as SyntaxList ) . _children [ 0 ] , sourceFile , includeJsDoc ) ;
1165
+ if ( node . kind === SyntaxKind . SyntaxList ) {
1166
+ const first = firstOrUndefined ( getNodeChildren ( node ) ) ;
1167
+ if ( first ) {
1168
+ return getTokenPosOfNode ( first , sourceFile , includeJsDoc ) ;
1169
+ }
1167
1170
}
1168
1171
1169
1172
return skipTrivia (
@@ -8155,6 +8158,7 @@ export interface ObjectAllocator {
8155
8158
}
8156
8159
8157
8160
function Symbol ( this : Symbol , flags : SymbolFlags , name : __String ) {
8161
+ // Note: if modifying this, be sure to update SymbolObject in src/services/services.ts
8158
8162
this . flags = flags ;
8159
8163
this . escapedName = name ;
8160
8164
this . declarations = undefined ;
@@ -8172,20 +8176,23 @@ function Symbol(this: Symbol, flags: SymbolFlags, name: __String) {
8172
8176
}
8173
8177
8174
8178
function Type ( this : Type , checker : TypeChecker , flags : TypeFlags ) {
8179
+ // Note: if modifying this, be sure to update TypeObject in src/services/services.ts
8175
8180
this . flags = flags ;
8176
8181
if ( Debug . isDebugging || tracing ) {
8177
8182
this . checker = checker ;
8178
8183
}
8179
8184
}
8180
8185
8181
8186
function Signature ( this : Signature , checker : TypeChecker , flags : SignatureFlags ) {
8187
+ // Note: if modifying this, be sure to update SignatureObject in src/services/services.ts
8182
8188
this . flags = flags ;
8183
8189
if ( Debug . isDebugging ) {
8184
8190
this . checker = checker ;
8185
8191
}
8186
8192
}
8187
8193
8188
8194
function Node ( this : Mutable < Node > , kind : SyntaxKind , pos : number , end : number ) {
8195
+ // Note: if modifying this, be sure to update NodeObject in src/services/services.ts
8189
8196
this . pos = pos ;
8190
8197
this . end = end ;
8191
8198
this . kind = kind ;
@@ -8199,6 +8206,7 @@ function Node(this: Mutable<Node>, kind: SyntaxKind, pos: number, end: number) {
8199
8206
}
8200
8207
8201
8208
function Token ( this : Mutable < Node > , kind : SyntaxKind , pos : number , end : number ) {
8209
+ // Note: if modifying this, be sure to update TokenOrIdentifierObject in src/services/services.ts
8202
8210
this . pos = pos ;
8203
8211
this . end = end ;
8204
8212
this . kind = kind ;
@@ -8210,6 +8218,7 @@ function Token(this: Mutable<Node>, kind: SyntaxKind, pos: number, end: number)
8210
8218
}
8211
8219
8212
8220
function Identifier ( this : Mutable < Node > , kind : SyntaxKind , pos : number , end : number ) {
8221
+ // Note: if modifying this, be sure to update TokenOrIdentifierObject in src/services/services.ts
8213
8222
this . pos = pos ;
8214
8223
this . end = end ;
8215
8224
this . kind = kind ;
@@ -8222,6 +8231,7 @@ function Identifier(this: Mutable<Node>, kind: SyntaxKind, pos: number, end: num
8222
8231
}
8223
8232
8224
8233
function SourceMapSource ( this : SourceMapSource , fileName : string , text : string , skipTrivia ?: ( pos : number ) => number ) {
8234
+ // Note: if modifying this, be sure to update SourceMapSourceObject in src/services/services.ts
8225
8235
this . fileName = fileName ;
8226
8236
this . text = text ;
8227
8237
this . skipTrivia = skipTrivia || ( pos => pos ) ;
0 commit comments