From c1b40edd57e3474925e620c63d781bf8bf40f5b6 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Mon, 18 Nov 2019 20:39:42 -0500 Subject: stuff with type params --- decls_cgen.c | 5 ++++- main.c | 1 + test.toc | 12 ++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/decls_cgen.c b/decls_cgen.c index ad547ee..19eb0bc 100644 --- a/decls_cgen.c +++ b/decls_cgen.c @@ -10,7 +10,10 @@ static bool cgen_decls_fn_instances(CGenerator *g, Expression *e) { Instance **data = f->instances.data; for (U64 i = 0; i < f->instances.cap; i++) { if (f->instances.occupied[i]) { - if (!cgen_fn_header(g, f, e->where, (*data)->c.id, (*data)->val.tuple[0].u64)) + (*data)->fn.c.name = f->c.name; + (*data)->fn.c.id = f->c.id; + + if (!cgen_fn_header(g, &(*data)->fn, e->where, (*data)->c.id, (*data)->val.tuple[0].u64)) return false; cgen_write(g, ";"); cgen_nl(g); diff --git a/main.c b/main.c index ff79e08..cc3c36c 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,7 @@ /* TODO: deal with typing functions with type parameters (we need to type every single instance) +do typedefs for each instance struct parameters don't allow while {3; 5} (once break is added) diff --git a/test.toc b/test.toc index ddc09ab..1ea719b 100644 --- a/test.toc +++ b/test.toc @@ -9,10 +9,10 @@ puti @= fn(x: int) { -main @= fn() { - puti(f(17)); -}; +// main @= fn() { +// puti(f(17)); +// }; -f @= fn(k @ int) int { -k -}; \ No newline at end of file +// f @= fn(k @ int) int { +// k +// }; \ No newline at end of file -- cgit v1.2.3