diff options
Diffstat (limited to 'test.toc')
-rw-r--r-- | test.toc | 51 |
1 files changed, 9 insertions, 42 deletions
@@ -1,47 +1,14 @@ -#include "tests/std/io.toc", io; -#include "std/mem.toc"; - -main ::= fn() { - nums := news(int, 10); - for x, i := &nums { - *x = i*i; - } - l := slice_to_ll(nums); - p := &l; - while p { - io.puti(p.head); - p = p.tail; - } - f: Foo; - f.k = -173; - f.b = new(Bar); - f.b.f.b = new(Bar); - f.b.f.b.f.k = 9; - io.puti(f.k); - io.puti(f.b.f.k); - io.puti(f.b.f.b.f.k); -} - -slice_to_ll ::= fn(t::=, slice: []t) use ll: LinkedList(t) { - head = slice[0]; - if slice.len == 1 { - tail = null; +Point ::= struct { + #if 1 { + #include "point.toc"; } else { - tail = new(LinkedList(t)); - *tail = slice_to_ll(slice[1:]); + z: int; } } -LinkedList ::= struct (of :: Type) { - head: of; - tail: &LinkedList(of); -} - -Foo ::= struct { - k: int; - b: &Bar; -} - -Bar ::= struct { - f: Foo; +main ::= fn() { + p : Point; + p.x; + p.y; + p.z; } |