aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-02-02 23:36:15 +0000
committergingerBill <bill@gingerbill.org>2020-02-02 23:36:15 +0000
commit0103cedad7b18d2f8ac2337fd4221e874eb2e1ca (patch)
tree453dff310596a7e863f791c98d214fd05c7cc228 /examples
parentd56807095a2e9a376bcb583a98aa151ecd77120d (diff)
Port code for lb_build_call_expr
Diffstat (limited to 'examples')
-rw-r--r--examples/llvm-demo/demo.odin56
1 files changed, 25 insertions, 31 deletions
diff --git a/examples/llvm-demo/demo.odin b/examples/llvm-demo/demo.odin
index 3b8953134..58bb10682 100644
--- a/examples/llvm-demo/demo.odin
+++ b/examples/llvm-demo/demo.odin
@@ -1,45 +1,39 @@
package demo
-import "core:os"
-
-// Foo :: struct {
-// x, y: int,
-// };
-// foo :: proc(x: int) -> (f: Foo) {
-// return;
-// }
+BarBar :: struct {
+ x, y: int,
+};
+foo :: proc(x: int) -> (b: BarBar) {
+ return;
+}
main :: proc() {
Foo :: enum {A=1, B, C, D};
Foo_Set :: bit_set[Foo];
- x := Foo_Set{.A, .C};
+ foo_set := Foo_Set{.A, .C};
- y := [4]int{3 = 1, 0 .. 1 = 3, 2 = 9};
- z := []int{1, 2, 3, 4};
+ array := [4]int{3 = 1, 0 .. 1 = 3, 2 = 9};
+ slice := []int{1, 2, 3, 4};
- // @thread_local a: int;
+ @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);
+ f := foo;
+ c := 1 + 2i;
+ q := 1 + 2i + 3j + 4k;
- // c := 1 + 2i;
- // q := 1 + 2i + 3j + 4k;
+ s := "Hellope";
- // s := "Hellope";
-
- // 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;
+ bb := BarBar{1, 2};
+ pc: proc "contextless" (x: i32) -> BarBar;
+ po: proc "odin" (x: i32) -> BarBar;
+ e: enum{A, B, C};
+ u: union{i32, bool};
+ u1: union{i32};
+ um: union #maybe {^int};
}