@@ -82,16 +82,19 @@ namespace ts {
82
82
case SyntaxKind . SetAccessor :
83
83
case SyntaxKind . MethodDeclaration :
84
84
// Visit the name of the member (if it's a computed property name).
85
- return visitEachChild ( node , classElementVisitor , context ) ;
85
+ return visitEachChild ( node , visitor , context ) ;
86
86
87
87
case SyntaxKind . PropertyDeclaration :
88
88
return visitPropertyDeclaration ( node as PropertyDeclaration ) ;
89
89
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 Debug . failBadSyntaxKind ( node ) ;
95
98
}
96
99
}
97
100
@@ -139,26 +142,26 @@ namespace ts {
139
142
return visitEachChild ( node , visitor , context ) ;
140
143
}
141
144
const savedPendingExpressions = pendingExpressions ;
142
- pendingExpressions = undefined ;
145
+ pendingExpressions = undefined ! ;
143
146
144
147
const extendsClauseElement = getEffectiveBaseTypeNode ( node ) ;
145
148
const isDerivedClass = ! ! ( extendsClauseElement && skipOuterExpressions ( extendsClauseElement . expression ) . kind !== SyntaxKind . NullKeyword ) ;
146
149
147
150
const statements : Statement [ ] = [
148
151
updateClassDeclaration (
149
152
node ,
150
- node . decorators ,
153
+ /* decorators*/ undefined ,
151
154
node . modifiers ,
152
155
node . name ,
153
- node . typeParameters ,
154
- node . heritageClauses ,
156
+ /* typeParameters*/ undefined ,
157
+ visitNodes ( node . heritageClauses , visitor , isHeritageClause ) ,
155
158
transformClassMembers ( node , isDerivedClass )
156
159
)
157
160
] ;
158
161
159
162
// Write any pending expressions from elided or moved computed property names
160
163
if ( some ( pendingExpressions ) ) {
161
- statements . push ( createExpressionStatement ( inlineExpressions ( pendingExpressions ! ) ) ) ;
164
+ statements . push ( createExpressionStatement ( inlineExpressions ( pendingExpressions ) ) ) ;
162
165
}
163
166
pendingExpressions = savedPendingExpressions ;
164
167
@@ -199,7 +202,7 @@ namespace ts {
199
202
node ,
200
203
node . modifiers ,
201
204
node . name ,
202
- node . typeParameters ,
205
+ /* typeParameters*/ undefined ,
203
206
visitNodes ( node . heritageClauses , visitor , isHeritageClause ) ,
204
207
transformClassMembers ( node , isDerivedClass )
205
208
) ;
@@ -329,6 +332,21 @@ namespace ts {
329
332
// this.x = 1;
330
333
// }
331
334
//
335
+ if ( constructor && constructor . body ) {
336
+ let parameterPropertyDeclarationCount = 0 ;
337
+ for ( let i = indexOfFirstStatement ; i < constructor . body . statements . length ; i ++ ) {
338
+ if ( isParameterPropertyDeclaration ( getOriginalNode ( constructor . body . statements [ i ] ) ) ) {
339
+ parameterPropertyDeclarationCount ++ ;
340
+ }
341
+ else {
342
+ break ;
343
+ }
344
+ }
345
+ if ( parameterPropertyDeclarationCount > 0 ) {
346
+ addRange ( statements , visitNodes ( constructor . body . statements , visitor , isStatement , indexOfFirstStatement , parameterPropertyDeclarationCount ) ) ;
347
+ indexOfFirstStatement += parameterPropertyDeclarationCount ;
348
+ }
349
+ }
332
350
addInitializedPropertyStatements ( statements , properties , createThis ( ) ) ;
333
351
334
352
// Add existing statements, skipping the initial super call.
0 commit comments