diff options
| author | 2022-08-07 09:35:07 +0200 | |
|---|---|---|
| committer | 2022-08-07 09:35:07 +0200 | |
| commit | f97e08b3da14c79f7f78e439d06988753c79384b (patch) | |
| tree | f4d51145f057a38c99bc304d15a422546dc766ef /bootstrap/test.cff | |
| parent | 59988a43079d0097151f57f941ea8f01a0b714d7 (diff) | |
many decl bugfixes
Diffstat (limited to 'bootstrap/test.cff')
| -rw-r--r-- | bootstrap/test.cff | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/bootstrap/test.cff b/bootstrap/test.cff index 4d1393b..14d489e 100644 --- a/bootstrap/test.cff +++ b/bootstrap/test.cff @@ -1,5 +1,4 @@ import "libc.hff"; -import "libc.hff"; union Val { u u32, @@ -18,10 +17,9 @@ defmacro each(i, x, arr, ...body) [ } ] -static xs *void = {}, - ok = 6; +static xs *void = {}; -fn isort(xs *int, n usize) void { +fn isort(xs *int, n usize) void { fn icmp(lhs *const void, rhs *const void, _ *void) int { let lhs = *as(*int)lhs, rhs = *as(*int)rhs; @@ -34,6 +32,23 @@ fn isort(xs *int, n usize) void { x(); } +struct List; +struct List { + next *List, + val int, + + fn ok(l List) void; + + fn length(l *List) usize { + let n = 0z; + ok(*l); + for ; l; l = l.next { ++n; } + return n; + } + + fn ok(l List) void {} +} + struct Vec2f; struct Vec2f { x f32, @@ -51,7 +66,7 @@ struct Vec2f { fn spanz(cstr *const u8) [#]const u8 { extern fn strlen(s *const u8) usize; - return cstr[0::strlen(cstr) + 1]; + return cstr[0 :: strlen(cstr)]; } defmacro transmute(Type, x) [ |