about summary refs log tree commit diff
path: root/boot/tests/lower/compound_assigns.cskt
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2026-05-06 18:49:26 +0200
committerMel <mel@rnrd.eu>2026-05-06 18:49:26 +0200
commit952250b6d79063aa1066b0e945d58360bd70d09f (patch)
tree8eff74504b558d5a83485cebd4d8c5808e0064a9 /boot/tests/lower/compound_assigns.cskt
parentac696b22b3f03ae9670a9d1d154ce7ff848b5e55 (diff)
downloadcatskill-952250b6d79063aa1066b0e945d58360bd70d09f.tar.zst
catskill-952250b6d79063aa1066b0e945d58360bd70d09f.zip
Lowering pass test harness, and initial pass test suite
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/tests/lower/compound_assigns.cskt')
-rw-r--r--boot/tests/lower/compound_assigns.cskt31
1 files changed, 31 insertions, 0 deletions
diff --git a/boot/tests/lower/compound_assigns.cskt b/boot/tests/lower/compound_assigns.cskt
new file mode 100644
index 0000000..214fe59
--- /dev/null
+++ b/boot/tests/lower/compound_assigns.cskt
@@ -0,0 +1,31 @@
+compound assignment operators are split during lowering.
+
+<<<
+
+main = fun () {
+    var x int = 0
+    x += 1
+    x *= 2
+    x -= 3
+}
+
+>>>
+
+(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 x (ref int) (initializer (expr 0)))
+			(assign (expr (name x)) (expr (binary + (expr (name x)) (expr 1))))
+			(assign (expr (name x)) (expr (binary * (expr (name x)) (expr 2))))
+			(assign (expr (name x)) (expr (binary - (expr (name x)) (expr 3))))
+		)))
+	(emission_order 0 1 2 3 4 5 6 7))