forked from babel/babel
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
exec.js
77 lines (64 loc) · 1.39 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
68
69
70
71
72
73
74
75
76
77
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 logMethodDecoratorRun(a, b, c, d) {
push(a);
return function (el, { addInitializer }) {
push(b);
addInitializer(function () {
push(c);
});
return () => (el(), push(d))
};
}
@logClassDecoratorRun(0, 19, 29)
@logClassDecoratorRun(1, 18, 28)
class A {
static {
A.b(), A.#c();
}
@logAccessorDecoratorRun(2, 15, 31, 34)
@logAccessorDecoratorRun(3, 14, 30, 35)
accessor a;
@logMethodDecoratorRun(4, 11, 21, 25)
@logMethodDecoratorRun(5, 10, 20, 24)
static b() {};
@logMethodDecoratorRun(6, 13, 23, 27)
@logMethodDecoratorRun(7, 12, 22, 26)
static #c() {};
@logAccessorDecoratorRun(8, 17, 33, 36)
@logAccessorDecoratorRun(9, 16, 32, 37)
accessor #d;
constructor() {
this.a = this.#d = null;
}
}
var nums = Array.from({ length: 30 }, (_, i) => i);
expect(log).toEqual(nums);
new A();
var nums = Array.from({ length: 38 }, (_, i) => i);
expect(log).toEqual(nums);