diff options
| -rw-r--r-- | pc.y | 2 | ||||
| -rw-r--r-- | sem_check.c | 6 | ||||
| -rw-r--r-- | sem_check.h | 2 | ||||
| -rw-r--r-- | tree.c | 1 | 
4 files changed, 9 insertions, 2 deletions
| @@ -270,6 +270,7 @@ statement  	|proc_statement  	{  		$$ = $1; +		check_call($$);  	}  	|compound_statement  	{ @@ -346,6 +347,7 @@ proc_statement  		tmp = check_exists(cur_scope, $1);  		$$ = mktree(PCALL, mkid(tmp), $3);  	} +	/*calls checked with proc_statement*/  ;  expr_list diff --git a/sem_check.c b/sem_check.c index f6e412a..af97507 100644 --- a/sem_check.c +++ b/sem_check.c @@ -183,10 +183,12 @@ ptree *t;  {  	int argc, *argv; -	print_tree(t); -	if (!(t && t->attr.nval && t->attr.nval->func_info)) +	if (!(t && (t->type == FCALL || t->type == PCALL)))  		yyerror("Tree is not a function call\n"); +	if (!(t->l && t->l->attr.nval && t->l->attr.nval->func_info)) +		yyerror("Incorrect Call Tree\n"); +  	argc = t->l->attr.nval->func_info->argc;  	if (t->l->attr.nval->func_info->argc != count_args(t->r))  		/*TODO add info about expected argument count*/ diff --git a/sem_check.h b/sem_check.h index ce7d7fb..0da2cc9 100644 --- a/sem_check.h +++ b/sem_check.h @@ -10,4 +10,6 @@ node* check_exists(scope*, char*);  int check_ret_type(ptree*); +void check_call(ptree*); +  #endif @@ -22,6 +22,7 @@ ptree *l, *r;  	t->l = l;  	t->r = r;  	t->ret_type = 0; +	t->attr.nval = 0;  	return t;  } | 
