Resuscitate the SymbolWalker API#17844
Conversation
|
@amcasey, |
|
I must have missed my test cleanup when I rebased. Just a minute... |
src/compiler/symbolWalker.ts
Outdated
| function visitObjectType(type: ObjectType): void { | ||
| const stringIndexType = getIndexTypeOfStructuredType(type, IndexKind.String); | ||
| visitType(stringIndexType); | ||
| const numberIndexType = getIndexTypeOfStructuredType(type, IndexKind.String); |
There was a problem hiding this comment.
@weswigham Is that supposed to be IndexKind.Number?
src/compiler/symbolWalker.ts
Outdated
| @@ -0,0 +1,173 @@ | |||
| /** @internal */ | |||
| namespace ts { | |||
| /** @internal */ | |||
There was a problem hiding this comment.
I wondered. Presumably, the inner one is redundant?
weswigham
left a comment
There was a problem hiding this comment.
I think visitType needs clauses for visiting the related types for index types, index access types, and mapped types - those are new since its original writing, so it doesn't handle them yet, from the look of it.
|
The travis failure is unrelated. The PR is here: ivogabe/gulp-typescript#536. |
src/compiler/symbolWalker.ts
Outdated
| } | ||
| } | ||
|
|
||
| function leftmostSymbol(expr: QualifiedName | Identifier): Symbol { |
There was a problem hiding this comment.
This can probably just be implemented as getResolvedSymbol(getFirstIdentifier(expr)), if you're willing to have getFirstIdentifier from the checker as a parameter.
...until required by an external consumer.
1. Expose visited types and symbols 2. Automatically reset before each walk
...to consume revised API.
|
Closing and re-opening to re-queue tests. |
|
@amcasey, |
Resuscitate the SymbolWalker API
All the good bits are from @weswigham (PR #9847). I just tweaked the API and made everything internal.