aboutsummaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-25 09:06:45 +0200
committerlemon <lsof@mailbox.org>2022-08-25 09:06:45 +0200
commitd42b0c4c6e69fce63cb16289213eab053a602588 (patch)
tree5dabb5594106061ba3fe626996c5392b1052f59a /bootstrap
parenta39378db8ce05f8ab45b5ae0f3252c0a5322fd70 (diff)
eu switch
Diffstat (limited to 'bootstrap')
-rw-r--r--bootstrap/test2.cff47
1 files changed, 46 insertions, 1 deletions
diff --git a/bootstrap/test2.cff b/bootstrap/test2.cff
index 0c546bb..f5dec29 100644
--- a/bootstrap/test2.cff
+++ b/bootstrap/test2.cff
@@ -45,5 +45,50 @@ extern fn main() void {
x = X + 1 + Y;
let const v= Value:None;
- v = :Int(1 + x);
+ switch v {
+ case None;
+ case Int i;
+ i;
+ case Flo *f;
+ let x f32 = *f;
+ }
+ let t = v.#tag;
+ let i = v.Int;
+ // v.#tag++;
+
+ #'outer for let i = 0; i++ < 10; {
+ printf("%d\n", i);
+ while #t {
+ if i < 2 {
+ continue #'outer;
+ }
+ break #'outer;
+ }
+ }
+
+ let x = Option<f32>:None;
+ let x = Option<int>:Some(42);
+ switch (do x;) {
+ case None;
+ printf("x empty\n");
+ case Some i;
+ printf("x by value %d\n", i);
+ }
+ switch x {
+ case None;
+ printf("x empty\n");
+ case Some *i;
+ printf("x by ptr %d\n", *i);
+ }
+
+ printf("n %d\n", n.value);
+ printf("n link %d\n", n.link.value);
+
+ let x Node<f32> = {};
+ n->ok();
+ x->ok();
+
+ Bit<i32>:foo(3);
+ Bit<i64>:foo(3);
}
+