Skip to content

Commit ee4ac76

Browse files
author
Joseph Watts
committed
Ensure lexical environment is ended during constructor transformation
Signed-off-by: Joseph Watts <[email protected]>
1 parent a9735ba commit ee4ac76

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/compiler/transformers/esnext.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -374,18 +374,18 @@ namespace ts {
374374
}
375375

376376
function transformConstructorBody(node: ClassDeclaration | ClassExpression, constructor: ConstructorDeclaration | undefined, isDerivedClass: boolean) {
377-
resumeLexicalEnvironment();
378-
379-
let indexOfFirstStatement = 0;
380-
let statements: Statement[] = [];
381-
382377
const properties = getInitializedProperties(node, /*isStatic*/ false);
383378

384379
// Only generate synthetic constructor when there are property initializers to move.
385380
if (!constructor && !some(properties)) {
386-
return undefined;
381+
return visitFunctionBody(/*node*/ undefined, visitor, context);
387382
}
388383

384+
resumeLexicalEnvironment();
385+
386+
let indexOfFirstStatement = 0;
387+
let statements: Statement[] = [];
388+
389389
if (!constructor && isDerivedClass) {
390390
// Add a synthetic `super` call:
391391
//

0 commit comments

Comments
 (0)