File tree Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -13,27 +13,34 @@ namespace ts {
13
13
return getSymbolWalker ;
14
14
15
15
function getSymbolWalker ( accept : ( symbol : Symbol ) => boolean = ( ) => true ) : SymbolWalker {
16
- let visited : Type [ ] = [ ] ;
16
+ let visitedTypes : Type [ ] = [ ] ;
17
17
let visitedSymbols : Symbol [ ] = [ ] ;
18
18
19
19
return {
20
- visitType,
21
- visitSymbol,
22
- reset : ( newCallback : ( symbol : Symbol ) => boolean = ( ) => true ) => {
23
- accept = newCallback ;
24
- visited = [ ] ;
20
+ walkType : type =>
21
+ {
22
+ visitedTypes = [ ] ;
25
23
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
+ } ,
27
34
} ;
28
35
29
36
function visitType ( type : Type ) : void {
30
37
if ( ! type ) {
31
38
return ;
32
39
}
33
- if ( contains ( visited , type ) ) {
40
+ if ( contains ( visitedTypes , type ) ) {
34
41
return ;
35
42
}
36
- visited . push ( type ) ;
43
+ visitedTypes . push ( type ) ;
37
44
38
45
// Reuse visitSymbol to visit the type's symbol,
39
46
// 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 {
2673
2673
2674
2674
/* @internal */
2675
2675
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 [ ] } ;
2679
2678
}
2680
2679
2681
2680
export interface SymbolDisplayBuilder {
You can’t perform that action at this time.
0 commit comments