Skip to content

Commit 03aad2a

Browse files
committed
Updated struct test to have static method
1 parent 771afb1 commit 03aad2a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/struct

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ include std.cn
33
unpack struct Vector2
44
int x
55
int y
6+
static
7+
proc from_array [2] int -> Vector2:
8+
bind arr:
9+
0 arr []
10+
1 arr []
11+
Vector2
12+
end
13+
end
614
end
715

816
struct (Vector2) AutoVector2
@@ -49,6 +57,13 @@ bind vec:
4957
end
5058

5159
AutoVector2 .y print
60+
61+
var arr [2] int
62+
45 0 arr *[] !
63+
123 1 arr *[] !
64+
arr Vector2.from_array
65+
dup .x print
66+
.y print
5267
:
5368
69
5469
42
@@ -59,3 +74,5 @@ AutoVector2 .y print
5974
4
6075
Side effect
6176
42
77+
45
78+
123

0 commit comments

Comments
 (0)