diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-09-30 19:05:12 -0400 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-09-30 21:34:31 -0400 |
commit | 6b3e004224ccba39199606f2683265c9e4606e43 (patch) | |
tree | 23ae258b00651f97a7f5e7bbeb3758312371ac45 /pc.y | |
parent | 46fa458c879ab784f6e320fdf793dd4294efcd56 (diff) |
Add check that function returns value
Diffstat (limited to 'pc.y')
-rw-r--r-- | pc.y | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -92,6 +92,8 @@ extern scope *cur_scope; %type <ival> TD +%type <sval> sub_prog_head + %% program @@ -181,6 +183,9 @@ sub_prog_declaration sub_prog_declarations compound_statement { + if ($1) + check_func_return($4, $1); + set_ret_type($4); #ifdef DEBUG print_tree($4); @@ -219,6 +224,8 @@ sub_prog_head * scope*/ cur_scope->ret_var = scope_insert(cur_scope, strdup($2)); cur_scope->ret_var->var_type = $5; + + $$ = $2; } |PROC ID arguments ';' { @@ -237,6 +244,8 @@ sub_prog_head assert(!set_func_types($3, tmp->func_info->argv, i)); free_tree($3); + + $$ = NULL; } ; |