Debian Codegraph @

packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters--to-es2015/static-private/exec.js

raw symbols SCIP
1 function dec(get, context) {
2 context.addInitializer(function() {
3 this[context.name + 'Context'] = context;
4 });
5
6 return function () {
7 return get.call(this) + 1;
8 }
9 }
10
11 class Foo {
12 static value = 1;
13
14 @dec
15 static get #a() {
16 return this.value;
17 }
18
19 static getA() {
20 return this.#a;
21 }
22 }
23
24 const aContext = Foo['#aContext'];
25
26 expect(aContext.access.get.call(Foo)).toBe(2);
27 expect(Foo.getA()).toBe(2);
28 Foo.value = 123;
29 expect(aContext.access.get.call(Foo)).toBe(124);
30 expect(Foo.getA()).toBe(124);
31
32 expect(aContext.name).toBe('#a');
33 expect(aContext.kind).toBe('getter');
34 expect(aContext.static).toBe(true);
35 expect(aContext.private).toBe(true);
36 expect(typeof aContext.addInitializer).toBe('function');