aboutsummaryrefslogtreecommitdiff
path: root/boot/tests/transpile
diff options
context:
space:
mode:
Diffstat (limited to 'boot/tests/transpile')
-rw-r--r--boot/tests/transpile/compound_assigns.cskt13
-rw-r--r--boot/tests/transpile/loops.cskt4
2 files changed, 11 insertions, 6 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"
diff --git a/boot/tests/transpile/loops.cskt b/boot/tests/transpile/loops.cskt
index d6493d9..7121538 100644
--- a/boot/tests/transpile/loops.cskt
+++ b/boot/tests/transpile/loops.cskt
@@ -23,13 +23,13 @@ void catskill_main(void);
void catskill_main(void) {
integer i = 0;
while (i < 10) {
- i = i + 1;
+ i++;
}
{
integer j = 0;
while (j < 5) {
integer k = j;
- j = j + 1;
+ j++;
}
}
{