forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(53204): call __runInitializers after super() call
- Loading branch information
1 parent
9ccf47f
commit 71f24f3
Showing
3 changed files
with
66 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
44 changes: 44 additions & 0 deletions
44
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,44 @@ | ||
//// [esDecorators-classExpression-classSuper.7.ts] | ||
class A {} | ||
class B extends A { | ||
public constructor() { | ||
super(); | ||
} | ||
|
||
@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() { | ||
super(); | ||
__runInitializers(this, _instanceExtraInitializers); | ||
} | ||
m() { } | ||
}; | ||
})(); | ||
function foo(method, _context) { | ||
return function () { | ||
method.call(this); | ||
}; | ||
} | ||
new B(); |
21 changes: 21 additions & 0 deletions
21
...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,21 @@ | ||
// @target: es2022 | ||
// @noEmitHelpers: true | ||
// @noTypesAndSymbols: true | ||
|
||
class A {} | ||
class B extends A { | ||
public constructor() { | ||
super(); | ||
} | ||
|
||
@foo | ||
public m(): void {} | ||
} | ||
|
||
function foo(method: any, _context: any): any { | ||
return function (this: any) { | ||
method.call(this); | ||
}; | ||
} | ||
|
||
new B(); |