summaryrefslogtreecommitdiff
path: root/test.toc
blob: ec65787333c8ebf6e81a44fc4a79603ef47dc858 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "std/mem.toc", mem;
#include "tests/std/io.toc", io;
use mem;
sum_slice ::= fn(a : &[]int) total := 0 {
	for i := 0..a.len-1 {
		total += a[i];
	}
}

thing ::= fn() int {
	bar : []int;
	defer dels(bar);
	bar = news(int, 3);
	b := sum_slice(&bar);
	b
}

main ::= fn() {
	a := thing();
	b ::= thing();
	io.puti(a);
	io.puti(b);
}