@@ -204,12 +204,13 @@ namespace ts {
204
204
* @param visitor The callback used to visit each child.
205
205
* @param context A lexical environment context for the visitor.
206
206
*/
207
- export function visitEachChild < T extends Node > ( node : T | undefined , visitor : Visitor , context : TransformationContext , nodesVisitor ?: typeof visitNodes ) : T | undefined ;
207
+ export function visitEachChild < T extends Node > ( node : T | undefined , visitor : Visitor , context : TransformationContext , nodesVisitor ?: typeof visitNodes , tokenVisitor ?: Visitor ) : T | undefined ;
208
208
209
- export function visitEachChild ( node : Node , visitor : Visitor , context : TransformationContext , nodesVisitor = visitNodes ) : Node {
209
+ export function visitEachChild ( node : Node , visitor : Visitor , context : TransformationContext , nodesVisitor = visitNodes , tokenVisitor ?: Visitor ) : Node {
210
210
if ( node === undefined ) {
211
211
return undefined ;
212
212
}
213
+ noop
213
214
214
215
const kind = node . kind ;
215
216
// No need to visit nodes with no children.
@@ -396,7 +397,8 @@ namespace ts {
396
397
case SyntaxKind . BinaryExpression :
397
398
return updateBinary ( < BinaryExpression > node ,
398
399
visitNode ( ( < BinaryExpression > node ) . left , visitor , isExpression ) ,
399
- visitNode ( ( < BinaryExpression > node ) . right , visitor , isExpression ) ) ;
400
+ visitNode ( ( < BinaryExpression > node ) . right , visitor , isExpression ) ,
401
+ tokenVisitor ? visitNode ( ( < BinaryExpression > node ) . operatorToken , tokenVisitor ) : ( < BinaryExpression > node ) . operatorToken ) ;
400
402
401
403
case SyntaxKind . PrefixUnaryExpression :
402
404
return updatePrefix ( < PrefixUnaryExpression > node ,
@@ -419,7 +421,7 @@ namespace ts {
419
421
420
422
case SyntaxKind . YieldExpression :
421
423
return updateYield ( < YieldExpression > node ,
422
- ( < YieldExpression > node ) . asteriskToken ,
424
+ tokenVisitor ? visitNode ( ( < YieldExpression > node ) . asteriskToken , tokenVisitor ) : ( < YieldExpression > node ) . asteriskToken ,
423
425
visitNode ( ( < YieldExpression > node ) . expression , visitor , isExpression ) ) ;
424
426
425
427
case SyntaxKind . SpreadElement :
@@ -555,7 +557,7 @@ namespace ts {
555
557
return updateFunctionDeclaration ( < FunctionDeclaration > node ,
556
558
nodesVisitor ( ( < FunctionDeclaration > node ) . decorators , visitor , isDecorator ) ,
557
559
nodesVisitor ( ( < FunctionDeclaration > node ) . modifiers , visitor , isModifier ) ,
558
- ( < FunctionDeclaration > node ) . asteriskToken ,
560
+ visitNode ( ( < FunctionDeclaration > node ) . asteriskToken , visitor ) ,
559
561
visitNode ( ( < FunctionDeclaration > node ) . name , visitor , isIdentifier ) ,
560
562
nodesVisitor ( ( < FunctionDeclaration > node ) . typeParameters , visitor , isTypeParameter ) ,
561
563
visitParameterList ( ( < FunctionDeclaration > node ) . parameters , visitor , context , nodesVisitor ) ,
0 commit comments