File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,27 +13,34 @@ namespace ts {
1313 return getSymbolWalker ;
1414
1515 function getSymbolWalker ( accept : ( symbol : Symbol ) => boolean = ( ) => true ) : SymbolWalker {
16- let visited : Type [ ] = [ ] ;
16+ let visitedTypes : Type [ ] = [ ] ;
1717 let visitedSymbols : Symbol [ ] = [ ] ;
1818
1919 return {
20- visitType,
21- visitSymbol,
22- reset : ( newCallback : ( symbol : Symbol ) => boolean = ( ) => true ) => {
23- accept = newCallback ;
24- visited = [ ] ;
20+ walkType : type =>
21+ {
22+ visitedTypes = [ ] ;
2523 visitedSymbols = [ ] ;
26- }
24+ visitType ( type ) ;
25+ return { visitedTypes, visitedSymbols } ;
26+ } ,
27+ walkSymbol : symbol =>
28+ {
29+ visitedTypes = [ ] ;
30+ visitedSymbols = [ ] ;
31+ visitSymbol ( symbol ) ;
32+ return { visitedTypes, visitedSymbols } ;
33+ } ,
2734 } ;
2835
2936 function visitType ( type : Type ) : void {
3037 if ( ! type ) {
3138 return ;
3239 }
33- if ( contains ( visited , type ) ) {
40+ if ( contains ( visitedTypes , type ) ) {
3441 return ;
3542 }
36- visited . push ( type ) ;
43+ visitedTypes . push ( type ) ;
3744
3845 // Reuse visitSymbol to visit the type's symbol,
3946 // but be sure to bail on recuring into the type if accept declines the symbol.
Original file line number Diff line number Diff line change @@ -2673,9 +2673,8 @@ namespace ts {
26732673
26742674 /* @internal */
26752675 export interface SymbolWalker {
2676- visitType ( type : Type ) : void ;
2677- visitSymbol ( symbol : Symbol ) : void ;
2678- reset ( accept ?: ( symbol : Symbol ) => boolean ) : void ;
2676+ walkType ( root : Type ) : { visitedTypes : Type [ ] , visitedSymbols : Symbol [ ] } ;
2677+ walkSymbol ( root : Symbol ) : { visitedTypes : Type [ ] , visitedSymbols : Symbol [ ] } ;
26792678 }
26802679
26812680 export interface SymbolDisplayBuilder {
You can’t perform that action at this time.
0 commit comments