@@ -1359,16 +1359,21 @@ namespace ts {
1359
1359
if ( parameterPropertyDeclarationCount > 0 ) {
1360
1360
const parameterProperties = visitNodes ( constructor . body . statements , visitor , isStatement , indexOfFirstStatementAfterSuperAndPrologue , parameterPropertyDeclarationCount ) ;
1361
1361
1362
- let superAndPrologueStatementCount = prologueStatementCount ;
1363
- // If a synthetic super() call was added, add them just after it
1364
- if ( needsSyntheticConstructor ) {
1365
- superAndPrologueStatementCount += 1 ;
1362
+ // If there was a super() call found, add parameter properties immediately after it
1363
+ if ( superStatementIndex >= 0 ) {
1364
+ addRange ( statements , parameterProperties ) ;
1365
+ }
1366
+ else {
1367
+ // Add add parameter properties to the top of the constructor after the prologue
1368
+ let superAndPrologueStatementCount = prologueStatementCount ;
1369
+ // If a synthetic super() call was added, need to account for that
1370
+ if ( needsSyntheticConstructor ) superAndPrologueStatementCount ++ ;
1371
+ statements = [
1372
+ ...statements . slice ( 0 , superAndPrologueStatementCount ) ,
1373
+ ...parameterProperties ,
1374
+ ...statements . slice ( superAndPrologueStatementCount ) ,
1375
+ ] ;
1366
1376
}
1367
- statements = [
1368
- ...statements . slice ( 0 , superAndPrologueStatementCount ) ,
1369
- ...parameterProperties ,
1370
- ...statements . slice ( superAndPrologueStatementCount ) ,
1371
- ] ;
1372
1377
1373
1378
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount ;
1374
1379
}
0 commit comments