From d42b0c4c6e69fce63cb16289213eab053a602588 Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 25 Aug 2022 09:06:45 +0200 Subject: eu switch --- bootstrap/test2.cff | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'bootstrap') 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:None; + let x = Option: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 = {}; + n->ok(); + x->ok(); + + Bit:foo(3); + Bit:foo(3); } + -- cgit v1.2.3