mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 22:28:46 +00:00
Anonymous procedure literal support
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user