From 3a9747434de494fa189cf02ac31f6a4cff7fc761 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Thu, 5 Sep 2019 18:15:32 -0400 Subject: Add procedure argument types --- pc.y | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pc.y b/pc.y index dc7b704..72e9b6a 100644 --- a/pc.y +++ b/pc.y @@ -195,8 +195,20 @@ sub_prog_head } |PROC ID arguments ';' { + node *tmp; + int i = 0; + check_id(cur_scope->prev, $2); - scope_insert(cur_scope->prev, $2); + tmp = scope_insert(cur_scope->prev, $2); + + i = count_args($3); + + tmp->func_info = malloc(sizeof(struct fi)); + assert(tmp->func_info); + tmp->func_info->argc = i; + assert(tmp->func_info->argv = malloc(i * sizeof(int))); + + assert(!set_func_types($3, tmp->func_info->argv, i)); } ; -- cgit v1.1