@@ -14,6 +14,13 @@ namespace ts {
14
14
NoOriginalNode = 1 << 3 ,
15
15
}
16
16
17
+ const nodeFactoryPatchers : ( ( factory : NodeFactory ) => void ) [ ] = [ ] ;
18
+
19
+ /* @internal */
20
+ export function addNodeFactoryPatcher ( fn : ( factory : NodeFactory ) => void ) {
21
+ nodeFactoryPatchers . push ( fn ) ;
22
+ }
23
+
17
24
/**
18
25
* Creates a `NodeFactory` that can be used to create and update a syntax tree.
19
26
* @param flags Flags that control factory behavior.
@@ -161,11 +168,11 @@ namespace ts {
161
168
createObjectLiteralExpression,
162
169
updateObjectLiteralExpression,
163
170
createPropertyAccessExpression : flags & NodeFactoryFlags . NoIndentationOnFreshPropertyAccess ?
164
- ( expression , name ) => setEmitFlags ( createPropertyAccessExpression ( expression , name ) , EmitFlags . NoIndentation ) :
171
+ ( expression : Expression , name : string | MemberName ) => setEmitFlags ( createPropertyAccessExpression ( expression , name ) , EmitFlags . NoIndentation ) :
165
172
createPropertyAccessExpression ,
166
173
updatePropertyAccessExpression,
167
174
createPropertyAccessChain : flags & NodeFactoryFlags . NoIndentationOnFreshPropertyAccess ?
168
- ( expression , questionDotToken , name ) => setEmitFlags ( createPropertyAccessChain ( expression , questionDotToken , name ) , EmitFlags . NoIndentation ) :
175
+ ( expression : Expression , questionDotToken : QuestionDotToken | undefined , name : string | MemberName ) => setEmitFlags ( createPropertyAccessChain ( expression , questionDotToken , name ) , EmitFlags . NoIndentation ) :
169
176
createPropertyAccessChain ,
170
177
updatePropertyAccessChain,
171
178
createElementAccessExpression,
@@ -534,7 +541,9 @@ namespace ts {
534
541
liftToBlock,
535
542
mergeLexicalEnvironment,
536
543
updateModifiers,
537
- } ;
544
+ } as any ;
545
+
546
+ forEach ( nodeFactoryPatchers , fn => fn ( factory ) ) ;
538
547
539
548
return factory ;
540
549
0 commit comments