Anonymous procedure literal support

This commit is contained in:
gingerBill
2020-02-08 12:49:38 +00:00
parent 66da96284a
commit 35711a400c
5 changed files with 268 additions and 36 deletions
+21 -4
View File
@@ -1,9 +1,12 @@
package demo
import "core:os"
BarBar :: struct {
x, y: int,
};
foo :: proc(x: int) -> (b: BarBar) {
b = {1, 2};
return;
}
@@ -15,12 +18,19 @@ main :: proc() {
array := [4]int{3 = 1, 0 .. 1 = 3, 2 = 9};
slice := []int{1, 2, 3, 4};
x: ^int = nil;
y := slice != nil;
@thread_local a: int;
x := i32(1);
y := i32(2);
z := x + y;
w := z - 2;
if true {
foo(1);
}
x1 := i32(1);
y1 := i32(2);
z1 := x1 + y1;
w1 := z1 - 2;
f := foo;
@@ -29,6 +39,13 @@ main :: proc() {
s := "Hellope";
b := true;
aaa := b ? int(123) : int(34);
defer aaa = 333;
p := proc(x: int) {};
bb := BarBar{1, 2};
pc: proc "contextless" (x: i32) -> BarBar;
po: proc "odin" (x: i32) -> BarBar;