• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// @allowUnreachableCode: true
2// @target: ES6
3
4
5// Control flow statements with blocks
6if (true) {
7    const c1 = 0;
8}
9else {
10    const c2 = 0;
11}
12
13while (true) {
14    const c3 = 0;
15}
16
17do {
18    const c4 = 0;
19} while (true);
20
21var obj;
22with (obj) {
23    const c5 = 0;
24}
25
26for (var i = 0; i < 10; i++) {
27    const c6 = 0;
28}
29
30for (var i2 in {}) {
31    const c7 = 0;
32}
33
34if (true) {
35    label: const c8 = 0;
36}
37
38while (false) {
39    label2: label3: label4: const c9 = 0;
40}
41
42// Try/catch/finally
43try {
44    const c10 = 0;
45}
46catch (e) {
47    const c11 = 0;
48}
49finally {
50    const c12 = 0;
51}
52
53// Switch
54switch (0) {
55    case 0:
56        const c13 = 0;
57        break;
58    default:
59        const c14 = 0;
60        break;
61}
62
63// blocks
64{
65    const c15 = 0;
66    {
67        const c16 = 0
68        label17: const c17 = 0;
69    }
70}
71
72// global
73const c18 = 0;
74
75// functions
76function F() {
77    const c19 = 0;
78}
79
80var F2 = () => {
81    const c20 = 0;
82};
83
84var F3 = function () {
85    const c21 = 0;
86};
87
88// modules
89module m {
90    const c22 = 0;
91
92    {
93          const c23 = 0;
94    }
95}
96
97// methods
98class C {
99    constructor() {
100        const c24 = 0;
101    }
102
103    method() {
104        const c25 = 0;
105    }
106
107    get v() {
108        const c26 = 0;
109        return c26;
110    }
111
112    set v(value) {
113        const c27 = value;
114    }
115}
116
117// object literals
118var o = {
119    f() {
120        const c28 = 0;
121    },
122    f2: () => {
123        const c29 = 0;
124    }
125}