global statement removal: hphp/test [7/x]
[hiphop-php.git] / hphp / test / quick / asm_sswitch.hhas
blobcb122883289e47eb114148c641514204e6d462fb
2 # SSwitch statement
5 .main {
6   FPushFuncD 0 "main"
7   FCall <> 0 1 "" - "" ""
8   PopC
9   Int 1
10   RetC
13 # array(0,1,2,3,4)
14 .adata my_array = """a:6:{i:0;s:7:"label_0";i:1;s:7:"label_1";i:2;s:7:"label_2";i:3;s:7:"label_3";i:4;s:7:"label_4";i:5;s:7:"default";}""";
16 .function main() {
17          .numiters 1;
19          Array @my_array
20          SetL $arr
21          PopC
23          # Loop over array and jump to each label.
24          CGetL $arr
25          IterInit 0 endfor $foo
26 loop:    CGetL $foo
27          SSwitch <"label_0":label_0
28                   "label_1":label_1
29                   "label_2":label_2
30                   "label_3":label_3
31                   "label_4":label_4
32                           -:default>
34 label_0: String "label_0\n"
35          Jmp printer
36 label_1: String "label_1\n"
37          Jmp printer
38 label_2: String "label_2\n"
39          Jmp printer
40 label_3: String "label_3\n"
41          Jmp printer
42 label_4: String "label_4\n"
43          Jmp printer
44 default: String "default\n"
46 printer: Print
47          PopC
48          IterNext 0 loop $foo
50 endfor:  Int 1
51          RetC