aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/parser/statement_switch_with.good
blob: 28b1c8e33020c53fbd9cff4f390f6f3549085675 (plain)
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

() test()
{
    int i = 1;
    var int mode;
    
    switch i {
        case 1 with mode = 11
        case 2 with mode = 22 {
            dostuff(23);
        }
        default {
            dostuff(9);
        }
    }
    
    // Complex "with" statements are allowed, but not recommended
    switch i {
        case 1 with { dostuff(11); mode = 11; }
        case 2 with { if :true { mode = 22; } } {
            dostuff(23);
        }
        default {
            dostuff(9);
        }
    }
    
}

() dostuff(int x) { }