aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-09-08 21:18:44 -0400
committerTucker Evans <tuckerevans24@gmail.com>2019-09-08 21:59:41 -0400
commit948b0460c9d079e5eff4e6247d35aa946956e4a5 (patch)
treebc3bef845747f28474327779e891a1a2fa07a7e6 /main.c
parentecfd5f25bfa7b5ce00b8feb83eb1deeb7009e7f7 (diff)
Add checking types on function call
Diffstat (limited to 'main.c')
-rw-r--r--main.c26
1 files changed, 25 insertions, 1 deletions
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