@@ -21,7 +21,6 @@ namespace ts {
2121 getChildCount ( sourceFile ?: SourceFile ) : number ;
2222 getChildAt ( index : number , sourceFile ?: SourceFile ) : Node ;
2323 getChildren ( sourceFile ?: SourceFile ) : Node [ ] ;
24- getNonJsDocCommentChildren ?( sourceFile ?: SourceFile ) : Node [ ] ;
2524 getStart ( sourceFile ?: SourceFile , includeJsDocComment ?: boolean ) : number ;
2625 getFullStart ( ) : number ;
2726 getEnd ( ) : number ;
@@ -197,7 +196,6 @@ namespace ts {
197196 public parent : Node ;
198197 public jsDocComments : JSDocComment [ ] ;
199198 private _children : Node [ ] ;
200- private _nonJsDocCommentChildren : Node [ ] ;
201199
202200 constructor ( kind : SyntaxKind , pos : number , end : number ) {
203201 this . pos = pos ;
@@ -275,22 +273,20 @@ namespace ts {
275273 }
276274
277275 private createChildren ( sourceFile ?: SourceFile ) {
278- let jsDocCommentChildren : Node [ ] ;
279- let nonJsDocCommentChildren : Node [ ] ;
276+ let children : Node [ ] ;
280277 if ( this . kind >= SyntaxKind . FirstNode ) {
281278 scanner . setText ( ( sourceFile || this . getSourceFile ( ) ) . text ) ;
282- jsDocCommentChildren = [ ] ;
283- nonJsDocCommentChildren = [ ] ;
279+ children = [ ] ;
284280 let pos = this . pos ;
285281 const useJSDocScanner = this . kind >= SyntaxKind . FirstJSDocTagNode && this . kind <= SyntaxKind . LastJSDocTagNode ;
286- const processNode = ( node : Node , children = nonJsDocCommentChildren ) => {
282+ const processNode = ( node : Node ) => {
287283 if ( pos < node . pos ) {
288284 pos = this . addSyntheticNodes ( children , pos , node . pos , useJSDocScanner ) ;
289285 }
290286 children . push ( node ) ;
291287 pos = node . end ;
292288 } ;
293- const processNodes = ( nodes : NodeArray < Node > , children = nonJsDocCommentChildren ) => {
289+ const processNodes = ( nodes : NodeArray < Node > ) => {
294290 if ( pos < nodes . pos ) {
295291 pos = this . addSyntheticNodes ( children , pos , nodes . pos , useJSDocScanner ) ;
296292 }
@@ -300,7 +296,7 @@ namespace ts {
300296 // jsDocComments need to be the first children
301297 if ( this . jsDocComments ) {
302298 for ( const jsDocComment of this . jsDocComments ) {
303- processNode ( jsDocComment , jsDocCommentChildren ) ;
299+ processNode ( jsDocComment ) ;
304300 }
305301 }
306302 // For syntactic classifications, all trivia are classcified together, including jsdoc comments.
@@ -309,12 +305,11 @@ namespace ts {
309305 pos = this . pos ;
310306 forEachChild ( this , processNode , processNodes ) ;
311307 if ( pos < this . end ) {
312- this . addSyntheticNodes ( nonJsDocCommentChildren , pos , this . end ) ;
308+ this . addSyntheticNodes ( children , pos , this . end ) ;
313309 }
314310 scanner . setText ( undefined ) ;
315311 }
316- this . _nonJsDocCommentChildren = nonJsDocCommentChildren || emptyArray ;
317- this . _children = concatenate ( jsDocCommentChildren , this . _nonJsDocCommentChildren ) ;
312+ this . _children = children || emptyArray ;
318313 }
319314
320315 public getChildCount ( sourceFile ?: SourceFile ) : number {
@@ -332,18 +327,6 @@ namespace ts {
332327 return this . _children ;
333328 }
334329
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-
347330 public getFirstToken ( sourceFile ?: SourceFile ) : Node {
348331 const children = this . getChildren ( sourceFile ) ;
349332 if ( ! children . length ) {
@@ -7591,6 +7574,10 @@ namespace ts {
75917574 * False will mean that node is not classified and traverse routine should recurse into node contents.
75927575 */
75937576 function tryClassifyNode ( node : Node ) : boolean {
7577+ if ( isJSDocTag ( node ) ) {
7578+ return true ;
7579+ }
7580+
75947581 if ( nodeIsMissing ( node ) ) {
75957582 return true ;
75967583 }
@@ -7746,7 +7733,7 @@ namespace ts {
77467733 if ( decodedTextSpanIntersectsWith ( spanStart , spanLength , element . pos , element . getFullWidth ( ) ) ) {
77477734 checkForClassificationCancellation ( element . kind ) ;
77487735
7749- const children = element . getNonJsDocCommentChildren ? element . getNonJsDocCommentChildren ( sourceFile ) : element . getChildren ( sourceFile ) ;
7736+ const children = element . getChildren ( sourceFile ) ;
77507737 for ( let i = 0 , n = children . length ; i < n ; i ++ ) {
77517738 const child = children [ i ] ;
77527739 if ( ! tryClassifyNode ( child ) ) {
0 commit comments