diff options
Diffstat (limited to 'boot/tests/lower/c_for_loop.cskt')
| -rw-r--r-- | boot/tests/lower/c_for_loop.cskt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/boot/tests/lower/c_for_loop.cskt b/boot/tests/lower/c_for_loop.cskt new file mode 100644 index 0000000..98d78f0 --- /dev/null +++ b/boot/tests/lower/c_for_loop.cskt @@ -0,0 +1,35 @@ +c-style for loops are turned into the single loop kind, +with the initializer and the iteration step statements synthesized into +statements within the block. + +<<< + +main = fun () { + for i int = 0, i < 10, i++ { + var x int = i + } +} + +>>> + +(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 + (block + (declaration i (ref int) (initializer (expr 0))) + (loop (condition (expr (binary < (expr (name i)) (expr 10)))) (block + (declaration x (ref int) (initializer (expr (name i)))) + (assign (expr (name i)) (expr (binary + (expr (name i)) (expr 1)))) + )) + ) + ))) + (emission_order 0 1 2 3 4 5 6 7)) |
