Fix printing of data type errors in while and repeat statements.
authorMario de Sousa <msousa@fe.up.pt>
Mon, 16 Apr 2012 15:40:12 +0100
changeset 514 c2880eba49a1
parent 513 99aa36a77703
child 515 fdef852a6565
Fix printing of data type errors in while and repeat statements.
stage3/print_datatypes_error.cc
--- a/stage3/print_datatypes_error.cc	Mon Apr 16 15:27:53 2012 +0100
+++ b/stage3/print_datatypes_error.cc	Mon Apr 16 15:40:12 2012 +0100
@@ -1249,7 +1249,7 @@
 
 void *print_datatypes_error_c::visit(while_statement_c *symbol) {
 	symbol->expression->accept(*this);
-	if (symbol->candidate_datatypes.size() != 1) {
+	if (!is_type_valid(symbol->expression->datatype)) {
 		STAGE3_ERROR(0, symbol, symbol, "Invalid data type for 'WHILE' condition.");
 		return NULL;
 	}
@@ -1259,7 +1259,7 @@
 }
 
 void *print_datatypes_error_c::visit(repeat_statement_c *symbol) {
-	if (symbol->candidate_datatypes.size() != 1) {
+	if (!is_type_valid(symbol->expression->datatype)) {
 		STAGE3_ERROR(0, symbol, symbol, "Invalid data type for 'REPEAT' condition.");
 		return NULL;
 	}