Fix the previous commit: check for errors in expressions used as subscripts.
authormjsousa <msousa@fe.up.pt>
Wed, 09 May 2012 23:13:04 +0100
changeset 550 322f063daa9f
parent 549 af9517cad953
child 551 a75e3aea98ff
Fix the previous commit: check for errors in expressions used as subscripts.
stage3/print_datatypes_error.cc
--- a/stage3/print_datatypes_error.cc	Wed May 09 20:05:57 2012 +0200
+++ b/stage3/print_datatypes_error.cc	Wed May 09 23:13:04 2012 +0100
@@ -593,7 +593,10 @@
 // SYM_LIST(subscript_list_c)
 void *print_datatypes_error_c::visit(subscript_list_c *symbol) {
 	for (int i = 0; i < symbol->n; i++) {
-		if (NULL == symbol->elements[i]->datatype)
+		int start_error_count = error_count;
+		symbol->elements[i]->accept(*this);
+		/* I (mjs) do not believe that the following error message will ever get printed, but lets play it safe and leave it in... */
+		if ((start_error_count == error_count) && (NULL == symbol->elements[i]->datatype))
 			STAGE3_ERROR(0, symbol, symbol, "Invalid data type for array subscript field.");
 	}
 	return NULL;