packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc--to-es2015/initializer-timing/exec.js
raw symbols SCIP| 1 | function dec1(fn, context) { |
| 2 | context.addInitializer((instance) => { |
| 3 | expect(instance.value).toBe(undefined); |
| 4 | }); |
| 5 | |
| 6 | return fn; |
| 7 | } |
| 8 | |
| 9 | class Foo { |
| 10 | value = 1; |
| 11 | |
| 12 | @dec1 |
| 13 | foo() {} |
| 14 | } |
| 15 | |
| 16 | function dec2(fn, context) { |
| 17 | context.addInitializer((instance) => { |
| 18 | expect(instance.value).toBe(1); |
| 19 | }); |
| 20 | |
| 21 | return fn; |
| 22 | } |
| 23 | |
| 24 | |
| 25 | class Bar extends Foo { |
| 26 | constructor() { |
| 27 | super(); |
| 28 | |
| 29 | this.value = 2; |
| 30 | } |
| 31 | |
| 32 | @dec2 |
| 33 | bar() {} |
| 34 | } |