From 948b0460c9d079e5eff4e6247d35aa946956e4a5 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Sun, 8 Sep 2019 21:18:44 -0400 Subject: Add checking types on function call --- main.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 394e3bc..43eef9e 100644 --- a/main.c +++ b/main.c @@ -145,9 +145,10 @@ ptree *t; if (t->type == LIST){ r = count_args(t->r); l = count_args(t->l); - } else if (t->type == ID) { + } else if (t->type != LIST) { return 1; } else { + fprintf(stderr, "PTR: %x\n", t); yyerror("NOT A PARAMETER LIST\n"); } @@ -177,6 +178,29 @@ int size, *nxt; return size; } +int get_call_types(t, nxt, size) +ptree *t; +int size, *nxt; +{ + int tmp; + + if (!t) + return size; + + if (t->type == LIST){ + tmp = set_func_types(t->l, nxt, size); + for (;size > tmp; --size) ++nxt; + size = set_func_types(t->r, nxt, size); + } else { + if (--size == -1) + yyerror("VARIABLE COUNT CHANGED!!!\n"); + set_ret_type(t); + *nxt = t->ret_type; + return size; + } + return size; +} + int main() { #ifdef DEBUG_TYPES -- cgit v1.1