@@ -21,7 +21,6 @@ namespace ts {
21
21
getChildCount ( sourceFile ?: SourceFile ) : number ;
22
22
getChildAt ( index : number , sourceFile ?: SourceFile ) : Node ;
23
23
getChildren ( sourceFile ?: SourceFile ) : Node [ ] ;
24
- getNonJsDocCommentChildren ?( sourceFile ?: SourceFile ) : Node [ ] ;
25
24
getStart ( sourceFile ?: SourceFile , includeJsDocComment ?: boolean ) : number ;
26
25
getFullStart ( ) : number ;
27
26
getEnd ( ) : number ;
@@ -197,7 +196,6 @@ namespace ts {
197
196
public parent : Node ;
198
197
public jsDocComments : JSDocComment [ ] ;
199
198
private _children : Node [ ] ;
200
- private _nonJsDocCommentChildren : Node [ ] ;
201
199
202
200
constructor ( kind : SyntaxKind , pos : number , end : number ) {
203
201
this . pos = pos ;
@@ -275,22 +273,20 @@ namespace ts {
275
273
}
276
274
277
275
private createChildren ( sourceFile ?: SourceFile ) {
278
- let jsDocCommentChildren : Node [ ] ;
279
- let nonJsDocCommentChildren : Node [ ] ;
276
+ let children : Node [ ] ;
280
277
if ( this . kind >= SyntaxKind . FirstNode ) {
281
278
scanner . setText ( ( sourceFile || this . getSourceFile ( ) ) . text ) ;
282
- jsDocCommentChildren = [ ] ;
283
- nonJsDocCommentChildren = [ ] ;
279
+ children = [ ] ;
284
280
let pos = this . pos ;
285
281
const useJSDocScanner = this . kind >= SyntaxKind . FirstJSDocTagNode && this . kind <= SyntaxKind . LastJSDocTagNode ;
286
- const processNode = ( node : Node , children = nonJsDocCommentChildren ) => {
282
+ const processNode = ( node : Node ) => {
287
283
if ( pos < node . pos ) {
288
284
pos = this . addSyntheticNodes ( children , pos , node . pos , useJSDocScanner ) ;
289
285
}
290
286
children . push ( node ) ;
291
287
pos = node . end ;
292
288
} ;
293
- const processNodes = ( nodes : NodeArray < Node > , children = nonJsDocCommentChildren ) => {
289
+ const processNodes = ( nodes : NodeArray < Node > ) => {
294
290
if ( pos < nodes . pos ) {
295
291
pos = this . addSyntheticNodes ( children , pos , nodes . pos , useJSDocScanner ) ;
296
292
}
@@ -300,7 +296,7 @@ namespace ts {
300
296
// jsDocComments need to be the first children
301
297
if ( this . jsDocComments ) {
302
298
for ( const jsDocComment of this . jsDocComments ) {
303
- processNode ( jsDocComment , jsDocCommentChildren ) ;
299
+ processNode ( jsDocComment ) ;
304
300
}
305
301
}
306
302
// For syntactic classifications, all trivia are classcified together, including jsdoc comments.
@@ -309,12 +305,11 @@ namespace ts {
309
305
pos = this . pos ;
310
306
forEachChild ( this , processNode , processNodes ) ;
311
307
if ( pos < this . end ) {
312
- this . addSyntheticNodes ( nonJsDocCommentChildren , pos , this . end ) ;
308
+ this . addSyntheticNodes ( children , pos , this . end ) ;
313
309
}
314
310
scanner . setText ( undefined ) ;
315
311
}
316
- this . _nonJsDocCommentChildren = nonJsDocCommentChildren || emptyArray ;
317
- this . _children = concatenate ( jsDocCommentChildren , this . _nonJsDocCommentChildren ) ;
312
+ this . _children = children || emptyArray ;
318
313
}
319
314
320
315
public getChildCount ( sourceFile ?: SourceFile ) : number {
@@ -332,18 +327,6 @@ namespace ts {
332
327
return this . _children ;
333
328
}
334
329
335
- public getNonJsDocCommentChildren ( sourceFile ?: SourceFile ) : Node [ ] {
336
- // If the cached children were cleared, that means some node before the current node has changed.
337
- // so even if we have a cached nonJsDocCommentChildren, it would be outdated as well.
338
- if ( ! this . _children ) {
339
- this . createChildren ( sourceFile ) ;
340
- }
341
- // If the node has cached children but not nonJsDocCommentChildren, it means the children is not created
342
- // via calling the "createChildren" method, so it can only be a SyntaxList. As SyntaxList cannot have jsDocCommentChildren
343
- // anyways, we can just return its children.
344
- return this . _nonJsDocCommentChildren ? this . _nonJsDocCommentChildren : this . _children ;
345
- }
346
-
347
330
public getFirstToken ( sourceFile ?: SourceFile ) : Node {
348
331
const children = this . getChildren ( sourceFile ) ;
349
332
if ( ! children . length ) {
@@ -7591,6 +7574,10 @@ namespace ts {
7591
7574
* False will mean that node is not classified and traverse routine should recurse into node contents.
7592
7575
*/
7593
7576
function tryClassifyNode ( node : Node ) : boolean {
7577
+ if ( isJSDocTag ( node ) ) {
7578
+ return true ;
7579
+ }
7580
+
7594
7581
if ( nodeIsMissing ( node ) ) {
7595
7582
return true ;
7596
7583
}
@@ -7746,7 +7733,7 @@ namespace ts {
7746
7733
if ( decodedTextSpanIntersectsWith ( spanStart , spanLength , element . pos , element . getFullWidth ( ) ) ) {
7747
7734
checkForClassificationCancellation ( element . kind ) ;
7748
7735
7749
- const children = element . getNonJsDocCommentChildren ? element . getNonJsDocCommentChildren ( sourceFile ) : element . getChildren ( sourceFile ) ;
7736
+ const children = element . getChildren ( sourceFile ) ;
7750
7737
for ( let i = 0 , n = children . length ; i < n ; i ++ ) {
7751
7738
const child = children [ i ] ;
7752
7739
if ( ! tryClassifyNode ( child ) ) {
0 commit comments