blob: 692597ae9d6902b8f7993aa419158c7317c768aa (
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
32
33
34
35
36
37
38
39
|
an endless `loop` block lowers to the single ir loop kind, with a
synthetic `true` condition. exiting the loop requires an explicit
`break` from inside the body.
<<<
main = fun () {
var count int = 0
loop {
count++
if count == 5 {
break
}
}
}
>>>
(unit
(types
(type 0 int primitive)
(type 1 uint primitive)
(type 2 bool primitive)
(type 3 string primitive)
(type 4 float primitive)
(type 5 byte primitive)
(type 6 ascii primitive)
(type 7 void primitive))
(functions
(function 0 main main (returns (ref void)) (block
(declaration count (ref int) (initializer (expr 0)))
(loop (condition (expr true)) (block
(expression-stmt (expr (postfix-++ (expr (name count)))))
(conditional (when (expr (binary == (expr (name count)) (expr 5)))) (block
(break)
))
))
)))
(emission_order 0 1 2 3 4 5 6 7))
|