diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-10-20 18:11:38 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-10-20 18:11:38 -0400 |
commit | dee2f7e0de8f3521ec77bd60fd48094f7ed3c729 (patch) | |
tree | cc3de57105b3472968084ffec12701499a4c8d84 /test.toc | |
parent | 89f00af3cf25d594f10aebaa7048a17bdd520c4b (diff) |
started fixing compile time new
Diffstat (limited to 'test.toc')
-rw-r--r-- | test.toc | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -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; }; |