summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-04-25 01:07:14 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-04-25 01:07:14 -0400
commit56e18402300f730828204f5aa05eac9df7adfca3 (patch)
treeeca72a9d6881b9688f3597edbe3c8f0a5e395698 /tests
parent0513b05f6fdc8a400a0b85fa8ca5784184bab2a0 (diff)
fixed problem where local structs were named in c
Diffstat (limited to 'tests')
-rw-r--r--tests/arr3.toc14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/arr3.toc b/tests/arr3.toc
index cfbbc5a..4310d64 100644
--- a/tests/arr3.toc
+++ b/tests/arr3.toc
@@ -1,11 +1,6 @@
#include "io.toc";
#include "mem.toc";
-Arr ::= struct (t :: Type) {
- data: []t;
- len, cap: int;
-};
-
arr_add ::= fn(t ::=, a : &Arr(t), x : t) {
if a.len >= a.cap {
@@ -33,14 +28,14 @@ square ::= fn(t ::=, x : t) t {
};
-// ArrInt ::= Arr(int);
+ArrInt ::= Arr(int);
inc ::= fn(t ::=, x : t) t {
x + 1
};
main ::= fn() {
- arr : Arr(int);
+ arr : ArrInt;
farr : Arr(float);
for i := 1..100 {
arr_add(&arr, inc(square(i)));
@@ -53,3 +48,8 @@ main ::= fn() {
puti(farr.data[i] as int);
}
};
+
+Arr ::= struct (t :: Type) {
+ data: []t;
+ len, cap: int;
+};