@@ -90,8 +90,11 @@ namespace ts {
90
90
case SyntaxKind . ComputedPropertyName :
91
91
return visitComputedPropertyName ( node as ComputedPropertyName ) ;
92
92
93
- default :
93
+ case SyntaxKind . SemicolonClassElement :
94
94
return node ;
95
+
96
+ default :
97
+ return visitor ( node ) ;
95
98
}
96
99
}
97
100
@@ -138,28 +141,30 @@ namespace ts {
138
141
if ( ! forEach ( node . members , isPropertyDeclaration ) ) {
139
142
return visitEachChild ( node , visitor , context ) ;
140
143
}
144
+
141
145
const savedPendingExpressions = pendingExpressions ;
142
- pendingExpressions = undefined ;
146
+ pendingExpressions = undefined ! ;
143
147
144
148
const extendsClauseElement = getEffectiveBaseTypeNode ( node ) ;
145
149
const isDerivedClass = ! ! ( extendsClauseElement && skipOuterExpressions ( extendsClauseElement . expression ) . kind !== SyntaxKind . NullKeyword ) ;
146
150
147
151
const statements : Statement [ ] = [
148
152
updateClassDeclaration (
149
153
node ,
150
- node . decorators ,
154
+ /* decorators*/ undefined ,
151
155
node . modifiers ,
152
156
node . name ,
153
- node . typeParameters ,
154
- node . heritageClauses ,
157
+ /* typeParameters*/ undefined ,
158
+ visitNodes ( node . heritageClauses , visitor , isHeritageClause ) ,
155
159
transformClassMembers ( node , isDerivedClass )
156
160
)
157
161
] ;
158
162
159
163
// Write any pending expressions from elided or moved computed property names
160
164
if ( some ( pendingExpressions ) ) {
161
- statements . push ( createExpressionStatement ( inlineExpressions ( pendingExpressions ! ) ) ) ;
165
+ statements . push ( createExpressionStatement ( inlineExpressions ( pendingExpressions ) ) ) ;
162
166
}
167
+
163
168
pendingExpressions = savedPendingExpressions ;
164
169
165
170
// Emit static property assignment. Because classDeclaration is lexically evaluated,
@@ -199,7 +204,7 @@ namespace ts {
199
204
node ,
200
205
node . modifiers ,
201
206
node . name ,
202
- node . typeParameters ,
207
+ /* typeParameters*/ undefined ,
203
208
visitNodes ( node . heritageClauses , visitor , isHeritageClause ) ,
204
209
transformClassMembers ( node , isDerivedClass )
205
210
) ;
@@ -329,6 +334,21 @@ namespace ts {
329
334
// this.x = 1;
330
335
// }
331
336
//
337
+ if ( constructor && constructor . body ) {
338
+ let parameterPropertyDeclarationCount = 0 ;
339
+ for ( let i = indexOfFirstStatement ; i < constructor . body . statements . length ; i ++ ) {
340
+ if ( isParameterPropertyDeclaration ( getOriginalNode ( constructor . body . statements [ i ] ) ) ) {
341
+ parameterPropertyDeclarationCount ++ ;
342
+ }
343
+ else {
344
+ break ;
345
+ }
346
+ }
347
+ if ( parameterPropertyDeclarationCount > 0 ) {
348
+ addRange ( statements , visitNodes ( constructor . body . statements , visitor , isStatement , indexOfFirstStatement , parameterPropertyDeclarationCount ) ) ;
349
+ indexOfFirstStatement += parameterPropertyDeclarationCount ;
350
+ }
351
+ }
332
352
addInitializedPropertyStatements ( statements , properties , createThis ( ) ) ;
333
353
334
354
// Add existing statements, skipping the initial super call.
0 commit comments