aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-02-02 18:33:13 +0000
committergingerBill <bill@gingerbill.org>2020-02-02 18:33:13 +0000
commitd56807095a2e9a376bcb583a98aa151ecd77120d (patch)
treeebb3680735016def577b4f87b59e6e6ba0d8b0cd /examples
parent5dc82c2720524b2c99f3b35c3636e0b0f10dcbb7 (diff)
Implement constant value generation from ExactValue
Diffstat (limited to 'examples')
-rw-r--r--examples/llvm-demo/demo.odin49
1 files changed, 32 insertions, 17 deletions
diff --git a/examples/llvm-demo/demo.odin b/examples/llvm-demo/demo.odin
index e3727e610..3b8953134 100644
--- a/examples/llvm-demo/demo.odin
+++ b/examples/llvm-demo/demo.odin
@@ -2,29 +2,44 @@ package demo
import "core:os"
+// Foo :: struct {
+// x, y: int,
+// };
+// foo :: proc(x: int) -> (f: Foo) {
+// return;
+// }
+
main :: proc() {
- Foo :: struct {
- x, y: int,
- };
+ Foo :: enum {A=1, B, C, D};
+ Foo_Set :: bit_set[Foo];
+ x := Foo_Set{.A, .C};
+
+ y := [4]int{3 = 1, 0 .. 1 = 3, 2 = 9};
+ z := []int{1, 2, 3, 4};
+
+ // @thread_local a: int;
+
+ // x := i32(1);
+ // y := i32(2);
+ // z := x + y;
+ // w := z - 2;
- x := i32(1);
- y := i32(2);
- z := x + y;
- w := z - 2;
+ // foo(123);
- c := 1 + 2i;
- q := 1 + 2i + 3j + 4k;
+ // c := 1 + 2i;
+ // q := 1 + 2i + 3j + 4k;
- s := "Hellope";
+ // s := "Hellope";
- f: Foo;
- pc: proc "contextless" (x: i32) -> Foo;
- po: proc "odin" (x: i32) -> Foo;
- e: enum{A, B, C};
- u: union{i32, bool};
- u1: union{i32};
- um: union #maybe {^int};
+ // f := Foo{1, 2};
+ // pc: proc "contextless" (x: i32) -> Foo;
+ // po: proc "odin" (x: i32) -> Foo;
+ // e: enum{A, B, C};
+ // u: union{i32, bool};
+ // u1: union{i32};
+ // um: union #maybe {^int};
// os.write_string(os.stdout, "Hellope\n");
+ return;
}