forked from babel/babel
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
exec.js
67 lines (55 loc) · 1.19 KB
/
exec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var log = [];
function push(x) {
log.push(x);
return x;
}
function logClassDecoratorRun(a, b, c) {
push(a);
return function (el, { addInitializer }) {
push(b);
addInitializer(function () {
push(c);
});
return el;
};
}
function logAccessorDecoratorRun(a, b, c, d) {
push(a);
return function (el, { addInitializer }) {
push(b);
addInitializer(function () {
push(c);
});
return {
init: () => push(d),
};
};
}
function logFieldDecoratorRun(a, b) {
push(a);
return function (el) { push(b); return el; };
}
@logClassDecoratorRun(0, 19, 21)
@logClassDecoratorRun(1, 18, 20)
class A {
@logAccessorDecoratorRun(2, 11, 23, 26)
@logAccessorDecoratorRun(3, 10, 22, 27)
accessor a;
@logFieldDecoratorRun(4, 15)
@logFieldDecoratorRun(5, 14)
b;
@logFieldDecoratorRun(6, 17)
@logFieldDecoratorRun(7, 16)
#c;
@logAccessorDecoratorRun(8, 13, 25, 28)
@logAccessorDecoratorRun(9, 12, 24, 29)
accessor #d;
constructor() {
this.a = this.#d = null;
}
}
var nums = Array.from({ length: 22 }, (_, i) => i);
expect(log).toEqual(nums);
new A();
var nums = Array.from({ length: 30 }, (_, i) => i);
expect(log).toEqual(nums);