summaryrefslogtreecommitdiff
path: root/test.toc
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-10-20 18:11:38 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2019-10-20 18:11:38 -0400
commitdee2f7e0de8f3521ec77bd60fd48094f7ed3c729 (patch)
treecc3de57105b3472968084ffec12701499a4c8d84 /test.toc
parent89f00af3cf25d594f10aebaa7048a17bdd520c4b (diff)
started fixing compile time new
Diffstat (limited to 'test.toc')
-rw-r--r--test.toc19
1 files changed, 17 insertions, 2 deletions
diff --git a/test.toc b/test.toc
index 3346b9e..d182a0f 100644
--- a/test.toc
+++ b/test.toc
@@ -5,7 +5,22 @@ puti @= fn(x: int) {
// #C("printf(\"%ld\\n\", (long)x)");
};
+foo @= fn() int {
+ X := new([100]int);
+ i := 0;
+ while i < 100 {
+ (*X)[i] = i;
+ i = i + 1;
+ }
+ total := 0;
+ i = 0;
+ while i < 100 {
+ total = total + (*X)[i];
+ i = i + 1;
+ }
+ total
+};
+
main @= fn() {
- Ar := new([5]int);
- A:=new(int, 100);
+ Ar : [foo()]int;
};