diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-10-18 12:40:11 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-10-18 12:40:11 -0400 |
commit | 9a1054929db42852de237c8d0a7af8c1b5ac123e (patch) | |
tree | 74149d55107c7f0ef13b21d0cdccc4dcf37c736c | |
parent | 19fbfe432de43b2aece74f8014c217c7de6cb655 (diff) |
arr stuff
-rw-r--r-- | cgen.c | 9 | ||||
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | out.c | 8 | ||||
-rw-r--r-- | test.toc | 1 |
4 files changed, 17 insertions, 2 deletions
@@ -179,7 +179,14 @@ static bool cgen_type_post(CGenerator *g, Type *t, Location where) { return false; break; case TYPE_ARR: - cgen_write(g, "[%lu])", (unsigned long)t->arr.n); + if (t->flags & TYPE_FLAG_RESOLVED) + cgen_write(g, "[%lu])", (unsigned long)t->arr.n); + else { + cgen_write(g, "["); + if (!cgen_expr(g, t->arr.n_expr)) + return false; + cgen_write(g, "]"); + } if (!cgen_type_post(g, t->arr.of, where)) return false; break; @@ -1,5 +1,6 @@ /* TODO: +slices new run-time type resolution unicode variable names make sure initializers for global variables are compile-time constants @@ -49,6 +49,14 @@ void main__(void) { a2_ = y; }(puti(a2_)); }; + i64( asdf[78636112]); { + i64( expr__[78636112]); { + size_t i;i64(*arr__in) = expr__; i64(*arr__out) = ((i64([78636112]))calloc(1, sizeof(i64([100]))); + for (i = 0; i < 78636112; i++) arr__out[i] = arr__in[i]; + }{ + size_t i;i64(*arr__in) = asdf; i64(*arr__out) = expr__; + for (i = 0; i < 78636112; i++) arr__out[i] = arr__in[i]; + }} }} @@ -13,5 +13,4 @@ main @= fn() { while y < 10 { puti({y = y + 1; y}); } - };
\ No newline at end of file |