Debian Codegraph @

packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-classes--to-es2015/initializers/exec.js

raw symbols SCIP
1 function dec1(Foo, { addInitializer }) {
2 expect(Foo.field).toBe(undefined);
3 addInitializer(() => {
4 Foo.initField = 123;
5 });
6 }
7
8 @dec1
9 class Foo {
10 static {
11 expect(this.initField).toBe(undefined);
12 }
13
14 static field = 123;
15 }
16
17 expect(Foo.initField).toBe(123);
18 expect(Foo.field).toBe(123);
19
20 function dec2(Bar, { addInitializer }) {
21 expect(Bar.field).toBe(123);
22 expect(Bar.otherField).toBe(undefined);
23 expect(Bar.initField).toBe(123);
24 addInitializer(() => {
25 Bar.initField = 456;
26 });
27 }
28
29 @dec2
30 class Bar extends Foo {
31 static {
32 expect(this.initField).toBe(123);
33 this.otherField = 456;
34 }
35
36 static field = 456;
37 }
38
39 expect(Bar.initField).toBe(456);
40 expect(Bar.field).toBe(456);
41 expect(Bar.otherField).toBe(456);