summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-11-18 20:39:42 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2019-11-18 20:39:42 -0500
commitc1b40edd57e3474925e620c63d781bf8bf40f5b6 (patch)
treeb91547e9c06e9ae03da0dc6ebca5942f31d93fab
parent47ad1b1ce212ba1131480df28bec9480b7403340 (diff)
stuff with type params
-rw-r--r--decls_cgen.c5
-rw-r--r--main.c1
-rw-r--r--test.toc12
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