Debian Codegraph @

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

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