Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(53204): Bug: __runInitializers(this) is emitted before super() ca…
…ll (#53268)
- Loading branch information
1 parent
dfa30bb
commit 7a65c34
Showing
3 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tests/baselines/reference/esDecorators-classExpression-classSuper.7.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//// [esDecorators-classExpression-classSuper.7.ts] | ||
class A {} | ||
class B extends A { | ||
public constructor() { | ||
'inject'; | ||
super(); | ||
const a = 1; | ||
const b = 1; | ||
} | ||
|
||
@foo | ||
public m(): void {} | ||
} | ||
|
||
function foo(method: any, _context: any): any { | ||
return function (this: any) { | ||
method.call(this); | ||
}; | ||
} | ||
|
||
new B(); | ||
|
||
|
||
//// [esDecorators-classExpression-classSuper.7.js] | ||
class A { | ||
} | ||
let B = (() => { | ||
let _instanceExtraInitializers = []; | ||
let _m_decorators; | ||
return class B extends A { | ||
static { | ||
_m_decorators = [foo]; | ||
__esDecorate(this, null, _m_decorators, { kind: "method", name: "m", static: false, private: false, access: { has: obj => "m" in obj, get: obj => obj.m } }, null, _instanceExtraInitializers); | ||
} | ||
constructor() { | ||
'inject'; | ||
super(); | ||
__runInitializers(this, _instanceExtraInitializers); | ||
const a = 1; | ||
const b = 1; | ||
} | ||
m() { } | ||
}; | ||
})(); | ||
function foo(method, _context) { | ||
return function () { | ||
method.call(this); | ||
}; | ||
} | ||
new B(); |
24 changes: 24 additions & 0 deletions
24
...ance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.7.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// @target: es2022 | ||
// @noEmitHelpers: true | ||
// @noTypesAndSymbols: true | ||
|
||
class A {} | ||
class B extends A { | ||
public constructor() { | ||
'inject'; | ||
super(); | ||
const a = 1; | ||
const b = 1; | ||
} | ||
|
||
@foo | ||
public m(): void {} | ||
} | ||
|
||
function foo(method: any, _context: any): any { | ||
return function (this: any) { | ||
method.call(this); | ||
}; | ||
} | ||
|
||
new B(); |