diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-09-01 23:11:28 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-09-01 23:11:28 -0400 |
commit | e71901e1f0a981aff8eb37162ab053e1bb9df5aa (patch) | |
tree | 7c1388df139b4ec9206e6ca8b27483c329677333 /base_cgen.c | |
parent | 16b12d6f3135b2addab50ad257f30301928759db (diff) |
#C directive
Diffstat (limited to 'base_cgen.c')
-rw-r--r-- | base_cgen.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/base_cgen.c b/base_cgen.c index 817354f..64d96d0 100644 --- a/base_cgen.c +++ b/base_cgen.c @@ -154,6 +154,9 @@ static void cgen_type_pre(CGenerator *g, Type *t) { case TYPE_TUPLE: assert(0); return; + case TYPE_UNKNOWN: + err_print(t->where, "Type of unknown-typed expression required (x := #C(\"...\") will not work; you need to annotate the type of x)."); + abort(); case TYPE_ARR: cgen_type_pre(g, t->arr.of); break; @@ -226,6 +229,9 @@ static void cgen_type_post(CGenerator *g, Type *t) { cgen_write(g, "[%lu]", t->arr.n); cgen_type_post(g, t->arr.of); break; + case TYPE_UNKNOWN: /* we should always do pre first */ + assert(0); + break; } } @@ -269,12 +275,12 @@ static bool cgen_fn_header(CGenerator *g, FnExpr *f) { static bool cgen_block_enter(CGenerator *g, Block *b) { g->block = b; - return block_enter(b); + return block_enter(b, &b->stmts); } static bool cgen_block_exit(CGenerator *g, Block *into) { Block *b = g->block; g->block = into; - return block_exit(b); + return block_exit(b, &b->stmts); } |