Debian Codegraph @

packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js

raw symbols SCIP
1 var i = 0;
2
3 function getKey() {
4 return (i++).toString();
5 }
6
7 let elements = [];
8
9 function dec(fn, context) {
10 elements.push({ fn, context });
11 }
12
13 class Foo {
14 @dec
15 [getKey()]() {
16 return 1;
17 }
18
19 @dec
20 [getKey()]() {
21 return 2;
22 }
23 }
24
25 expect(elements).toHaveLength(2);
26
27 expect(elements[0].context.name).toBe("0");
28 expect(elements[0].fn()).toBe(1);
29
30 expect(elements[1].context.name).toBe("1");
31 expect(elements[1].fn()).toBe(2);
32
33 expect(i).toBe(2);