forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathswitchCaseTdz.js
More file actions
111 lines (104 loc) · 1.97 KB
/
switchCaseTdz.js
File metadata and controls
111 lines (104 loc) · 1.97 KB
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
//// [switchCaseTdz.ts]
switch (1 + 1) {
case -1:
x;
y;
z;
case 0:
var ok = 0;
let x = 0;
const y = 0;
const [z] = [0];
ok;
x;
y;
z;
case 1:
x = 0; // <- bad
y; // <- bad
z; // <- bad
ok;
if (true) {
x = 0; // <- bad
y; // <- bad
z; // <- bad
ok;
}
let f1 = function () {
x = 0; // <- bad
y; // <- bad
z; // <- bad
ok;
}
break;
case 2:
case 3:
x; // <- bad
y; // <- bad
z; // <- bad
ok;
if (true) {
x; // <- bad
y; // <- bad
z; // <- bad
ok;
}
let f2 = function () {
x; // <- bad
y; // <- bad
z; // <- bad
ok;
}
}
//// [switchCaseTdz.js]
switch (1 + 1) {
case -1:
x_1;
y_1;
z_1;
case 0:
var ok = 0;
var x_1 = 0;
var y_1 = 0;
var z_1 = [0][0];
ok;
x_1;
y_1;
z_1;
case 1:
x_1 = 0; // <- bad
y_1; // <- bad
z_1; // <- bad
ok;
if (true) {
x_1 = 0; // <- bad
y_1; // <- bad
z_1; // <- bad
ok;
}
var f1 = function () {
x_1 = 0; // <- bad
y_1; // <- bad
z_1; // <- bad
ok;
};
break;
case 2:
case 3:
x_1; // <- bad
y_1; // <- bad
z_1; // <- bad
ok;
if (true) {
x_1; // <- bad
y_1; // <- bad
z_1; // <- bad
ok;
}
var f2 = function () {
x_1; // <- bad
y_1; // <- bad
z_1; // <- bad
ok;
};
}