File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/compiler/transformers Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -1024,8 +1024,11 @@ namespace ts {
1024
1024
}
1025
1025
}
1026
1026
1027
- // Return the result if we have an immediate super() call on the last statement.
1028
- if ( superCallExpression && statementOffset === ctorStatements . length - 1 ) {
1027
+ // Return the result if we have an immediate super() call on the last statement,
1028
+ // but only if the constructor itself doesn't use 'this' elsewhere.
1029
+ if ( superCallExpression
1030
+ && statementOffset === ctorStatements . length - 1
1031
+ && ! ( ctor . transformFlags & ( TransformFlags . ContainsLexicalThis | TransformFlags . ContainsCapturedLexicalThis ) ) ) {
1029
1032
const returnStatement = createReturn ( superCallExpression ) ;
1030
1033
1031
1034
if ( superCallExpression . kind !== SyntaxKind . BinaryExpression
You can’t perform that action at this time.
0 commit comments