@@ -282,28 +282,6 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
282
282
return classImplementsNode ;
283
283
}
284
284
285
- /**
286
- * Converts a ts.NodeArray of ts.Decorators into an array of ESTreeNode decorators
287
- * @param {ts.NodeArray<ts.Decorator> } decorators A ts.NodeArray of ts.Decorators to be converted
288
- * @returns {ESTreeNode[] } an array of converted ESTreeNode decorators
289
- */
290
- function convertDecorators (
291
- decorators : ts . NodeArray < ts . Decorator >
292
- ) : ESTreeNode [ ] {
293
- if ( ! decorators || ! decorators . length ) {
294
- return [ ] ;
295
- }
296
- return decorators . map ( decorator => {
297
- const expression = convertChild ( decorator . expression ) ;
298
- return {
299
- type : AST_NODE_TYPES . Decorator ,
300
- range : [ decorator . getStart ( ast ) , decorator . end ] ,
301
- loc : nodeUtils . getLoc ( decorator , ast ) ,
302
- expression
303
- } ;
304
- } ) ;
305
- }
306
-
307
285
/**
308
286
* Converts an array of ts.Node parameters into an array of ESTreeNode params
309
287
* @param {ts.Node[] } parameters An array of ts.Node params to be converted
@@ -319,7 +297,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
319
297
return convertedParam ;
320
298
}
321
299
return Object . assign ( convertedParam , {
322
- decorators : convertDecorators ( param . decorators )
300
+ decorators : param . decorators . map ( convertChild )
323
301
} ) ;
324
302
} ) ;
325
303
}
@@ -366,9 +344,8 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
366
344
)
367
345
: null ;
368
346
} else if ( key === 'decorators' ) {
369
- const decorators = convertDecorators ( ( node as any ) . decorators ) ;
370
- if ( decorators && decorators . length ) {
371
- result . decorators = decorators ;
347
+ if ( node . decorators && node . decorators . length ) {
348
+ result . decorators = node . decorators . map ( convertChild ) ;
372
349
}
373
350
} else {
374
351
if ( Array . isArray ( ( node as any ) [ key ] ) ) {
@@ -966,7 +943,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
966
943
}
967
944
968
945
if ( node . decorators ) {
969
- result . decorators = convertDecorators ( node . decorators ) ;
946
+ result . decorators = node . decorators . map ( convertChild ) ;
970
947
}
971
948
972
949
const accessibility = nodeUtils . getTSNodeAccessibility ( node ) ;
@@ -1071,7 +1048,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
1071
1048
} ) ;
1072
1049
1073
1050
if ( node . decorators ) {
1074
- result . decorators = convertDecorators ( node . decorators ) ;
1051
+ result . decorators = node . decorators . map ( convertChild ) ;
1075
1052
}
1076
1053
1077
1054
const accessibility = nodeUtils . getTSNodeAccessibility ( node ) ;
@@ -1631,7 +1608,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
1631
1608
}
1632
1609
1633
1610
if ( node . decorators ) {
1634
- result . decorators = convertDecorators ( node . decorators ) ;
1611
+ result . decorators = node . decorators . map ( convertChild ) ;
1635
1612
}
1636
1613
1637
1614
const filteredMembers = node . members . filter (
@@ -1979,6 +1956,14 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
1979
1956
break ;
1980
1957
}
1981
1958
1959
+ case SyntaxKind . Decorator : {
1960
+ Object . assign ( result , {
1961
+ type : AST_NODE_TYPES . Decorator ,
1962
+ expression : convertChild ( node . expression )
1963
+ } ) ;
1964
+ break ;
1965
+ }
1966
+
1982
1967
// Literals
1983
1968
1984
1969
case SyntaxKind . StringLiteral :
@@ -2230,16 +2215,14 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
2230
2215
type : AST_NODE_TYPES . JSXSpreadAttribute ,
2231
2216
argument : convertChild ( node . expression )
2232
2217
} ) ;
2233
-
2234
2218
break ;
2235
2219
2236
- case SyntaxKind . FirstNode : {
2220
+ case SyntaxKind . QualifiedName : {
2237
2221
Object . assign ( result , {
2238
2222
type : AST_NODE_TYPES . TSQualifiedName ,
2239
2223
left : convertChild ( node . left ) ,
2240
2224
right : convertChild ( node . right )
2241
2225
} ) ;
2242
-
2243
2226
break ;
2244
2227
}
2245
2228
@@ -2268,6 +2251,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
2268
2251
break ;
2269
2252
}
2270
2253
2254
+ case SyntaxKind . ThisType :
2271
2255
case SyntaxKind . AnyKeyword :
2272
2256
case SyntaxKind . BigIntKeyword :
2273
2257
case SyntaxKind . BooleanKeyword :
@@ -2280,7 +2264,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
2280
2264
case SyntaxKind . VoidKeyword :
2281
2265
case SyntaxKind . UndefinedKeyword : {
2282
2266
Object . assign ( result , {
2283
- type : `TS${ SyntaxKind [ node . kind ] } `
2267
+ type : AST_NODE_TYPES [ `TS${ SyntaxKind [ node . kind ] } ` ]
2284
2268
} ) ;
2285
2269
break ;
2286
2270
}
@@ -2551,7 +2535,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
2551
2535
* so we handle them here too.
2552
2536
*/
2553
2537
if ( node . decorators ) {
2554
- result . decorators = convertDecorators ( node . decorators ) ;
2538
+ result . decorators = node . decorators . map ( convertChild ) ;
2555
2539
}
2556
2540
if ( nodeUtils . hasModifier ( SyntaxKind . AbstractKeyword , node ) ) {
2557
2541
result . abstract = true ;
@@ -2606,7 +2590,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
2606
2590
* so we handle them here too.
2607
2591
*/
2608
2592
if ( node . decorators ) {
2609
- result . decorators = convertDecorators ( node . decorators ) ;
2593
+ result . decorators = node . decorators . map ( convertChild ) ;
2610
2594
}
2611
2595
break ;
2612
2596
}
@@ -2690,6 +2674,13 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
2690
2674
} ) ;
2691
2675
break ;
2692
2676
}
2677
+ case SyntaxKind . InferType : {
2678
+ Object . assign ( result , {
2679
+ type : AST_NODE_TYPES . TSInferType ,
2680
+ typeParameter : convertChildType ( node . typeParameter )
2681
+ } ) ;
2682
+ break ;
2683
+ }
2693
2684
case SyntaxKind . ImportEqualsDeclaration : {
2694
2685
Object . assign ( result , {
2695
2686
type : AST_NODE_TYPES . TSImportEqualsDeclaration ,
0 commit comments