diff options
Diffstat (limited to 'test.toc')
-rw-r--r-- | test.toc | 46 |
1 files changed, 29 insertions, 17 deletions
@@ -1,27 +1,39 @@ - - - puti @= fn(x: int) { #C("printf(\"%ld\\n\", (long)x); "); }; -main @= fn() { -puti(somesum()); -foo @= somesum(); -puti(foo); +foo @= fn() int { + x:= new(int, 10).len; + x }; -Point @= struct { - x, y : int; + +bar @= fn() int { + x := new(int,10); + (&x).len }; -sum @= fn(p: &Point) int { - p.x + p.y + +baz @= fn() int { + x: [10]int; + x.len }; -somesum @= fn() int { - p : Point; - p.x = 12389; - p.y = 29404; - total := sum(&p); - total + +quux @= fn() int { + x: [10]int; + (&x).len }; +main @= fn() { + puti(foo()); + X @= foo(); + puti(X); + puti(bar()); + Y @= bar(); + puti(Y); + puti(baz()); + Z @= baz(); + puti(Z); + puti(quux()); + W @= quux(); + puti(W); +}; |