diff options
| author | Mel <mel@rnrd.eu> | 2026-05-24 20:14:29 +0200 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2026-05-24 20:14:29 +0200 |
| commit | 2a893246711442dd8407264c05991b44d1d1f66f (patch) | |
| tree | a0d4a621994ebb259331b7082a977e4ae2861bde /boot/tests/transpile/compound_assigns.cskt | |
| parent | f028bc7ef3101facfa004c21f3aa5feb3dc6f107 (diff) | |
| download | catskill-2a893246711442dd8407264c05991b44d1d1f66f.tar.zst catskill-2a893246711442dd8407264c05991b44d1d1f66f.zip | |
Emit IR/C increment/decrement in expression position
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/tests/transpile/compound_assigns.cskt')
| -rw-r--r-- | boot/tests/transpile/compound_assigns.cskt | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/boot/tests/transpile/compound_assigns.cskt b/boot/tests/transpile/compound_assigns.cskt index e480f31..607268f 100644 --- a/boot/tests/transpile/compound_assigns.cskt +++ b/boot/tests/transpile/compound_assigns.cskt @@ -1,5 +1,6 @@ -compound assigns are desugared during lowering so the c output -only ever has plain assignments. +compound assigns desugar to plain assignment + binary; increment +and decrement (statement or expression position) keep their own +ir node and emit `++` / `--` directly. <<< @@ -10,6 +11,8 @@ main = fun () { x++ x -= 3 x-- + var y int = x++ + var z int = ++x } >>> @@ -20,8 +23,10 @@ void catskill_main(void) { integer x = 0; x = x + 1; x = x * 2; - x = x + 1; + x++; x = x - 3; - x = x - 1; + x--; + integer y = x++; + integer z = ++x; } #include "runtime.c" |
