Fix the previous commit: check for errors in expressions used as subscripts.
--- 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;