aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-08-16 22:06:54 -0400
committerTucker Evans <tuckerevans24@gmail.com>2019-08-17 11:44:09 -0400
commit190274a66622d65cd30726a8daf3edb02dfe009e (patch)
tree262a42ff7863d3a49c370cdea2039244545c4a18
parent06ebf6a87ca1db975bdbf4f7f3126ea7c26ddde6 (diff)
Fix MULOP/ADDOP return BOOL in check_ret_type
Removes some debug printing
-rw-r--r--sem_check.c8
-rw-r--r--tree.c1
2 files changed, 8 insertions, 1 deletions
diff --git a/sem_check.c b/sem_check.c
index ae1fa4c..2e9b5ba 100644
--- a/sem_check.c
+++ b/sem_check.c
@@ -53,6 +53,14 @@ ptree *t;
case ADDOP :
case MULOP :
+ if (!(t->r && t->l))
+ yyerror("Missing nodes\n");
+
+ if (t->r->ret_type == t->l->ret_type)
+ return t->r->ret_type;
+ else
+ yyerror("Misssing nodes\n");
+ break;
case RELOP :
if (!(t->r && t->l))
yyerror("Missing nodes\n");
diff --git a/tree.c b/tree.c
index 7a8c458..eead0e5 100644
--- a/tree.c
+++ b/tree.c
@@ -136,7 +136,6 @@ ptree *t;
fprintf(stderr, "\t%d", t->type);
yyerror("Error in tree_print");
}
- fprintf(stderr, "\nWHAT: %d\n", t->type);
set_ret_type(t->l);
set_ret_type(t->r);
t->ret_type = check_ret_type(t);