33/// <reference path="utilities.ts" />
44
55namespace ts {
6- export const nullTransformationContext : TransformationContext = {
7- enableEmitNotification : noop ,
8- enableSubstitution : noop ,
9- endLexicalEnvironment : ( ) => undefined ,
10- getCompilerOptions : notImplemented ,
11- getEmitHost : notImplemented ,
12- getEmitResolver : notImplemented ,
13- hoistFunctionDeclaration : noop ,
14- hoistVariableDeclaration : noop ,
15- isEmitNotificationEnabled : notImplemented ,
16- isSubstitutionEnabled : notImplemented ,
17- onEmitNode : noop ,
18- onSubstituteNode : notImplemented ,
19- readEmitHelpers : notImplemented ,
20- requestEmitHelper : noop ,
21- resumeLexicalEnvironment : noop ,
22- startLexicalEnvironment : noop ,
23- suspendLexicalEnvironment : noop
24- } ;
25-
266 /**
277 * Visits a Node using the supplied visitor, possibly returning a new Node in its place.
288 *
@@ -234,7 +214,7 @@ namespace ts {
234214 const kind = node . kind ;
235215
236216 // No need to visit nodes with no children.
237- if ( ( kind > SyntaxKind . FirstToken && kind <= SyntaxKind . LastToken ) ) {
217+ if ( ( kind > SyntaxKind . FirstToken && kind <= SyntaxKind . LastToken ) || kind === SyntaxKind . ThisType ) {
238218 return node ;
239219 }
240220
@@ -293,10 +273,10 @@ namespace ts {
293273
294274 case SyntaxKind . IndexSignature :
295275 return updateIndexSignatureDeclaration ( < IndexSignatureDeclaration > node ,
296- visitParameterList ( ( < IndexSignatureDeclaration > node ) . parameters , visitor , context , nodesVisitor ) ,
297- visitNode ( ( < IndexSignatureDeclaration > node ) . type , visitor , isTypeNode ) ,
298276 nodesVisitor ( ( < IndexSignatureDeclaration > node ) . decorators , visitor , isDecorator ) ,
299- nodesVisitor ( ( < IndexSignatureDeclaration > node ) . modifiers , visitor , isModifier ) ) ;
277+ nodesVisitor ( ( < IndexSignatureDeclaration > node ) . modifiers , visitor , isModifier ) ,
278+ visitParameterList ( ( < IndexSignatureDeclaration > node ) . parameters , visitor , context , nodesVisitor ) ,
279+ visitNode ( ( < IndexSignatureDeclaration > node ) . type , visitor , isTypeNode ) ) ;
300280
301281 case SyntaxKind . Parameter :
302282 return updateParameter ( < ParameterDeclaration > node ,
@@ -314,13 +294,16 @@ namespace ts {
314294
315295 // Types
316296
317- case SyntaxKind . TypePredicate :
318- throw new Error ( "reached unsupported type in visitor." ) ;
319297 case SyntaxKind . TypeReference :
320298 return updateTypeReferenceNode ( < TypeReferenceNode > node ,
321299 visitNode ( ( < TypeReferenceNode > node ) . typeName , visitor , isEntityName ) ,
322300 nodesVisitor ( ( < TypeReferenceNode > node ) . typeArguments , visitor , isTypeNode ) ) ;
323301
302+ case SyntaxKind . TypePredicate :
303+ return updateTypePredicateNode ( < TypePredicateNode > node ,
304+ visitNode ( ( < TypePredicateNode > node ) . parameterName , visitor ) ,
305+ visitNode ( ( < TypePredicateNode > node ) . type , visitor , isTypeNode ) ) ;
306+
324307 case SyntaxKind . TypeQuery :
325308 return updateTypeQueryNode ( ( < TypeQueryNode > node ) , visitNode ( ( < TypeQueryNode > node ) . exprName , visitor , isEntityName ) ) ;
326309
@@ -339,9 +322,8 @@ namespace ts {
339322 nodesVisitor ( ( < UnionOrIntersectionTypeNode > node ) . types , visitor , isTypeNode ) ) ;
340323
341324 case SyntaxKind . ParenthesizedType :
342- throw new Error ( "reached unsupported type in visitor." ) ;
343- case SyntaxKind . ThisType :
344- throw new Error ( "reached unsupported type in visitor." ) ;
325+ Debug . fail ( "not implemented." ) ;
326+
345327 case SyntaxKind . TypeOperator :
346328 return updateTypeOperatorNode ( < TypeOperatorNode > node , visitNode ( ( < TypeOperatorNode > node ) . type , visitor , isTypeNode ) ) ;
347329 case SyntaxKind . IndexedAccessType :
@@ -376,13 +358,6 @@ namespace ts {
376358 visitNode ( ( < PropertySignature > node ) . type , visitor , isTypeNode ) ,
377359 visitNode ( ( < PropertySignature > node ) . initializer , visitor , isExpression ) ) ;
378360
379- case SyntaxKind . IndexSignature :
380- return updateIndexSignatureDeclaration ( < IndexSignatureDeclaration > node ,
381- visitParameterList ( ( < IndexSignatureDeclaration > node ) . parameters , visitor , context , nodesVisitor ) ,
382- visitNode ( ( < IndexSignatureDeclaration > node ) . type , visitor , isTypeNode ) ,
383- nodesVisitor ( ( < IndexSignatureDeclaration > node ) . decorators , visitor , isDecorator ) ,
384- nodesVisitor ( ( < IndexSignatureDeclaration > node ) . modifiers , visitor , isModifier ) ) ;
385-
386361 case SyntaxKind . PropertyDeclaration :
387362 return updateProperty ( < PropertyDeclaration > node ,
388363 nodesVisitor ( ( < PropertyDeclaration > node ) . decorators , visitor , isDecorator ) ,
0 commit comments