Skip to content

Commit 466906b

Browse files
author
Joseph Watts
committed
Ensure lexical environment is ended during constructor transformation
1 parent 5e9f170 commit 466906b

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
@@ -357,18 +357,18 @@ namespace ts {
357357
}
358358

359359
function transformConstructorBody(node: ClassDeclaration | ClassExpression, constructor: ConstructorDeclaration | undefined, isDerivedClass: boolean) {
360-
resumeLexicalEnvironment();
361-
362-
let indexOfFirstStatement = 0;
363-
let statements: Statement[] = [];
364-
365360
const properties = getInitializedProperties(node, /*isStatic*/ false);
366361

367362
// Only generate synthetic constructor when there are property initializers to move.
368363
if (!constructor && !some(properties)) {
369-
return undefined;
364+
return visitFunctionBody(/*node*/ undefined, visitor, context);
370365
}
371366

367+
resumeLexicalEnvironment();
368+
369+
let indexOfFirstStatement = 0;
370+
let statements: Statement[] = [];
371+
372372
if (!constructor && isDerivedClass) {
373373
// Add a synthetic `super` call:
374374
//

0 commit comments

Comments
 (0)