@@ -1331,7 +1331,9 @@ export class JavaScriptParserVisitor {
13311331 this . mapTypeParametersAsObject ( node ) ,
13321332 new JContainer (
13331333 this . prefix ( node . getChildAt ( node . getChildren ( ) . findIndex ( n => n . pos === node . parameters . pos ) - 1 ) ) ,
1334- node . parameters . map ( p => this . rightPadded ( this . visit ( p ) , this . suffix ( p ) ) )
1334+ node . parameters . length == 0 ?
1335+ [ this . rightPadded ( this . newJEmpty ( ) , this . prefix ( this . findChildNode ( node , ts . SyntaxKind . CloseParenToken ) ! ) ) ]
1336+ : node . parameters . map ( p => this . rightPadded ( this . visit ( p ) , this . suffix ( p ) ) )
13351337 . concat ( node . parameters . hasTrailingComma ? this . rightPadded ( this . newJEmpty ( ) , this . prefix ( this . findChildNode ( node , ts . SyntaxKind . CloseParenToken ) ! ) ) : [ ] ) ,
13361338 Markers . EMPTY ) ,
13371339 this . prefix ( this . findChildNode ( node , ts . SyntaxKind . EqualsGreaterThanToken ) ! ) ,
@@ -2123,7 +2125,7 @@ export class JavaScriptParserVisitor {
21232125 randomId ( ) ,
21242126 this . prefix ( node ) ,
21252127 Markers . EMPTY ,
2126- this . leftPadded ( this . prefix ( node . getFirstToken ( ) ! ) , unaryOperator ) ,
2128+ this . leftPadded ( this . suffix ( node . operand ) , unaryOperator ) ,
21272129 this . convert ( node . operand ) ,
21282130 this . mapType ( node )
21292131 ) ;
@@ -2608,7 +2610,7 @@ export class JavaScriptParserVisitor {
26082610 this . rightPadded (
26092611 this . convert ( node . statement ) ,
26102612 this . semicolonPrefix ( node . statement ) ,
2611- node . statement . getLastToken ( ) ?. kind == ts . SyntaxKind . SemicolonToken ? Markers . build ( [ new Semicolon ( randomId ( ) ) ] ) : Markers . EMPTY
2613+ node . statement . getChildAt ( node . statement . getChildCount ( ) - 1 ) ?. kind == ts . SyntaxKind . SemicolonToken ? Markers . build ( [ new Semicolon ( randomId ( ) ) ] ) : Markers . EMPTY
26122614 )
26132615 ) ;
26142616 }
@@ -2823,6 +2825,8 @@ export class JavaScriptParserVisitor {
28232825 ? JS . ScopedVariableDeclarations . Scope . Let
28242826 : kind ?. kind === ts . SyntaxKind . ConstKeyword
28252827 ? JS . ScopedVariableDeclarations . Scope . Const
2828+ : kind ?. kind === ts . SyntaxKind . UsingKeyword
2829+ ? JS . ScopedVariableDeclarations . Scope . Using
28262830 : JS . ScopedVariableDeclarations . Scope . Var
28272831 ) ,
28282832 node . declarations . map ( ( declaration ) => {
@@ -3785,7 +3789,7 @@ export class JavaScriptParserVisitor {
37853789 private mapTypeParametersAsJContainer ( node : ts . ClassDeclaration | ts . InterfaceDeclaration | ts . ClassExpression ) : JContainer < J . TypeParameter > | null {
37863790 return node . typeParameters
37873791 ? JContainer . build (
3788- this . suffix ( this . findChildNode ( node , ts . SyntaxKind . Identifier ) ! ) ,
3792+ this . prefix ( this . findChildNode ( node , ts . SyntaxKind . LessThanToken ) ! ) ,
37893793 this . mapTypeParametersList ( node . typeParameters )
37903794 . concat ( node . typeParameters . hasTrailingComma ? this . rightPadded (
37913795 new J . TypeParameter ( randomId ( ) , Space . EMPTY , Markers . EMPTY , [ ] , [ ] , this . newJEmpty ( ) , null ) ,
@@ -3802,10 +3806,12 @@ export class JavaScriptParserVisitor {
38023806
38033807 return new J . TypeParameters (
38043808 randomId ( ) ,
3805- this . prefix ( node . getChildAt ( node . getChildren ( ) . findIndex ( n => n . pos === typeParameters [ 0 ] . pos ) - 1 ) ) ,
3809+ this . prefix ( this . findChildNode ( node , ts . SyntaxKind . LessThanToken ) ! ) ,
38063810 Markers . EMPTY ,
38073811 [ ] ,
3808- typeParameters . map ( tp => this . rightPadded ( this . visit ( tp ) , this . suffix ( tp ) ) )
3812+ typeParameters . length == 0 ?
3813+ [ this . rightPadded ( new J . TypeParameter ( randomId ( ) , Space . EMPTY , Markers . EMPTY , [ ] , [ ] , this . newJEmpty ( ) , null ) , this . prefix ( this . findChildNode ( node , ts . SyntaxKind . GreaterThanToken ) ! ) ) ]
3814+ : typeParameters . map ( tp => this . rightPadded ( this . visit ( tp ) , this . suffix ( tp ) ) )
38093815 . concat ( typeParameters . hasTrailingComma ? this . rightPadded (
38103816 new J . TypeParameter ( randomId ( ) , Space . EMPTY , Markers . EMPTY , [ ] , [ ] , this . newJEmpty ( ) , null ) ,
38113817 this . prefix ( this . findChildNode ( node , ts . SyntaxKind . GreaterThanToken ) ! ) ) : [ ] ) ,
0 commit comments