@@ -204,12 +204,13 @@ namespace ts {
204204 * @param visitor The callback used to visit each child.
205205 * @param context A lexical environment context for the visitor.
206206 */
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 ;
208208
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 {
210210 if ( node === undefined ) {
211211 return undefined ;
212212 }
213+ noop
213214
214215 const kind = node . kind ;
215216 // No need to visit nodes with no children.
@@ -396,7 +397,8 @@ namespace ts {
396397 case SyntaxKind . BinaryExpression :
397398 return updateBinary ( < BinaryExpression > node ,
398399 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 ) ;
400402
401403 case SyntaxKind . PrefixUnaryExpression :
402404 return updatePrefix ( < PrefixUnaryExpression > node ,
@@ -419,7 +421,7 @@ namespace ts {
419421
420422 case SyntaxKind . YieldExpression :
421423 return updateYield ( < YieldExpression > node ,
422- ( < YieldExpression > node ) . asteriskToken ,
424+ tokenVisitor ? visitNode ( ( < YieldExpression > node ) . asteriskToken , tokenVisitor ) : ( < YieldExpression > node ) . asteriskToken ,
423425 visitNode ( ( < YieldExpression > node ) . expression , visitor , isExpression ) ) ;
424426
425427 case SyntaxKind . SpreadElement :
@@ -555,7 +557,7 @@ namespace ts {
555557 return updateFunctionDeclaration ( < FunctionDeclaration > node ,
556558 nodesVisitor ( ( < FunctionDeclaration > node ) . decorators , visitor , isDecorator ) ,
557559 nodesVisitor ( ( < FunctionDeclaration > node ) . modifiers , visitor , isModifier ) ,
558- ( < FunctionDeclaration > node ) . asteriskToken ,
560+ visitNode ( ( < FunctionDeclaration > node ) . asteriskToken , visitor ) ,
559561 visitNode ( ( < FunctionDeclaration > node ) . name , visitor , isIdentifier ) ,
560562 nodesVisitor ( ( < FunctionDeclaration > node ) . typeParameters , visitor , isTypeParameter ) ,
561563 visitParameterList ( ( < FunctionDeclaration > node ) . parameters , visitor , context , nodesVisitor ) ,
0 commit comments