-
Notifications
You must be signed in to change notification settings - Fork 12.8k
/
Copy pathaccessibilityModifiers.js
142 lines (134 loc) · 4.16 KB
/
accessibilityModifiers.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//// [accessibilityModifiers.ts]
// No errors
class C {
private static privateProperty;
private static privateMethod() { }
private static get privateGetter() { return 0; }
private static set privateSetter(a: number) { }
protected static protectedProperty;
protected static protectedMethod() { }
protected static get protectedGetter() { return 0; }
protected static set protectedSetter(a: number) { }
public static publicProperty;
public static publicMethod() { }
public static get publicGetter() { return 0; }
public static set publicSetter(a: number) { }
}
// Errors, accessibility modifiers must precede static
class D {
static private privateProperty;
static private privateMethod() { }
static private get privateGetter() { return 0; }
static private set privateSetter(a: number) { }
static protected protectedProperty;
static protected protectedMethod() { }
static protected get protectedGetter() { return 0; }
static protected set protectedSetter(a: number) { }
static public publicProperty;
static public publicMethod() { }
static public get publicGetter() { return 0; }
static public set publicSetter(a: number) { }
}
// Errors, multiple accessibility modifier
class E {
private public protected property;
public protected method() { }
private protected get getter() { return 0; }
public public set setter(a: number) { }
}
//// [accessibilityModifiers.js]
// No errors
var C = /** @class */ (function () {
function C() {
}
C.privateMethod = function () { };
Object.defineProperty(C, "privateGetter", {
get: function () { return 0; },
enumerable: false,
configurable: true
});
Object.defineProperty(C, "privateSetter", {
set: function (a) { },
enumerable: false,
configurable: true
});
C.protectedMethod = function () { };
Object.defineProperty(C, "protectedGetter", {
get: function () { return 0; },
enumerable: false,
configurable: true
});
Object.defineProperty(C, "protectedSetter", {
set: function (a) { },
enumerable: false,
configurable: true
});
C.publicMethod = function () { };
Object.defineProperty(C, "publicGetter", {
get: function () { return 0; },
enumerable: false,
configurable: true
});
Object.defineProperty(C, "publicSetter", {
set: function (a) { },
enumerable: false,
configurable: true
});
return C;
}());
// Errors, accessibility modifiers must precede static
var D = /** @class */ (function () {
function D() {
}
D.privateMethod = function () { };
Object.defineProperty(D, "privateGetter", {
get: function () { return 0; },
enumerable: false,
configurable: true
});
Object.defineProperty(D, "privateSetter", {
set: function (a) { },
enumerable: false,
configurable: true
});
D.protectedMethod = function () { };
Object.defineProperty(D, "protectedGetter", {
get: function () { return 0; },
enumerable: false,
configurable: true
});
Object.defineProperty(D, "protectedSetter", {
set: function (a) { },
enumerable: false,
configurable: true
});
D.publicMethod = function () { };
Object.defineProperty(D, "publicGetter", {
get: function () { return 0; },
enumerable: false,
configurable: true
});
Object.defineProperty(D, "publicSetter", {
set: function (a) { },
enumerable: false,
configurable: true
});
return D;
}());
// Errors, multiple accessibility modifier
var E = /** @class */ (function () {
function E() {
}
E.prototype.method = function () { };
Object.defineProperty(E.prototype, "getter", {
get: function () { return 0; },
enumerable: false,
configurable: true
});
Object.defineProperty(E.prototype, "setter", {
set: function (a) { },
enumerable: false,
configurable: true
});
return E;
}());