about summary refs log tree commit diff
path: root/boot/tests/transpile/compound_assigns.cskt
blob: 607268f3819a586fcdf89b98f5e72bf8963254e3 (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
compound assigns desugar to plain assignment + binary; increment
and decrement (statement or expression position) keep their own
ir node and emit `++` / `--` directly.

<<<

main = fun () {
    var x int = 0
    x += 1
    x *= 2
    x++
    x -= 3
    x--
    var y int = x++
    var z int = ++x
}

>>>

#include "core.c"
void catskill_main(void);
void catskill_main(void) {
    integer x = 0;
    x = x + 1;
    x = x * 2;
    x++;
    x = x - 3;
    x--;
    integer y = x++;
    integer z = ++x;
}
#include "runtime.c"