Debian Codegraph @

packages/babel-plugin-transform-block-scoping/test/fixtures/general/switch-inside-loop/input.js

raw symbols SCIP
1 // it shouldn't break on a case-break statement
2 var i;
3 for (i = 0; i < 10; i++) {
4 switch (i) {
5 case 1:
6 break;
7 }
8
9 const z = 3; // to force the plugin to convert to loop function call
10 () => z;
11 }
12
13 expect(i).toBe(10);
14
15 // it should continue on continue statements within switch
16 var j = 0;
17 for (i = 0; i < 10; i++) {
18 switch (i) {
19 case 0:
20 continue;
21 }
22 j++;
23
24 const z = 3;
25 () => z;
26 }
27
28 expect(j).toBe(9);
29
30 // it should work with loops nested within switch
31 j = 0;
32 for (i = 0; i < 10; i++) {
33 switch (i) {
34 case 0:
35 for (var k = 0; k < 10; k++) {
36 const z = 3;
37 () => z;
38 j++;
39 break;
40 }
41 break;
42 }
43
44 const z = 3;
45 () => z;
46 }
47
48 expect(j).toBe(1);