File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
src/compiler/transformers
tests/baselines/reference Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,10 @@ namespace ts {
2323 IsNamedExternalExport = 1 << 4 ,
2424 IsDefaultExternalExport = 1 << 5 ,
2525 IsDerivedClass = 1 << 6 ,
26+ UseImmediatelyInvokedFunctionExpression = 1 << 7 ,
2627
2728 HasAnyDecorators = HasConstructorDecorators | HasMemberDecorators ,
2829 NeedsName = HasStaticInitializedProperties | HasMemberDecorators ,
29- UseImmediatelyInvokedFunctionExpression = HasAnyDecorators | HasStaticInitializedProperties ,
3030 IsExported = IsExportOfNamespace | IsDefaultExternalExport | IsNamedExternalExport ,
3131 }
3232
@@ -595,6 +595,10 @@ namespace ts {
595595 if ( isExportOfNamespace ( node ) ) facts |= ClassFacts . IsExportOfNamespace ;
596596 else if ( isDefaultExternalModuleExport ( node ) ) facts |= ClassFacts . IsDefaultExternalExport ;
597597 else if ( isNamedExternalModuleExport ( node ) ) facts |= ClassFacts . IsNamedExternalExport ;
598+ if ( facts & ClassFacts . HasAnyDecorators ) facts |= ClassFacts . UseImmediatelyInvokedFunctionExpression ;
599+ if ( facts & ClassFacts . HasStaticInitializedProperties ) {
600+ if ( languageVersion < ScriptTarget . ESNext || ! compilerOptions . useDefineForClassFields ) facts |= ClassFacts . UseImmediatelyInvokedFunctionExpression ;
601+ }
598602 return facts ;
599603 }
600604
Original file line number Diff line number Diff line change @@ -11,13 +11,10 @@ class Foo {
1111
1212//// [thisInClassBodyStaticESNext.js]
1313// all are allowed with es-compliant class field emit
14- let Foo = /** @class */ ( ( ) => {
15- class Foo {
16- x = this ;
17- static t = this ;
18- static at = ( ) => this ;
19- static ft = function ( ) { return this ; } ;
20- static mt ( ) { return this ; }
21- }
22- return Foo ;
23- } ) ( ) ;
14+ class Foo {
15+ x = this ;
16+ static t = this ;
17+ static at = ( ) => this ;
18+ static ft = function ( ) { return this ; } ;
19+ static mt ( ) { return this ; }
20+ }
You can’t perform that action at this time.
0 commit comments