Fix data type check array subscript field.
--- a/stage3/print_datatypes_error.cc Wed May 09 23:04:03 2012 +0100
+++ b/stage3/print_datatypes_error.cc Wed May 09 20:05:57 2012 +0200
@@ -591,8 +591,13 @@
/* subscript_list ',' subscript */
// SYM_LIST(subscript_list_c)
-/* NOTE: we inherit from iterator visitor, so we do not need to implement this method... */
-// void *print_datatypes_error_c::visit(subscript_list_c *symbol)
+void *print_datatypes_error_c::visit(subscript_list_c *symbol) {
+ for (int i = 0; i < symbol->n; i++) {
+ if (NULL == symbol->elements[i]->datatype)
+ STAGE3_ERROR(0, symbol, symbol, "Invalid data type for array subscript field.");
+ }
+ return NULL;
+}
/* record_variable '.' field_selector */
--- a/stage3/print_datatypes_error.hh Wed May 09 23:04:03 2012 +0100
+++ b/stage3/print_datatypes_error.hh Wed May 09 20:05:57 2012 +0200
@@ -167,6 +167,7 @@
/* B 1.4.2 - Multi-element variables */
/*************************************/
void *visit(array_variable_c *symbol);
+ void *visit(subscript_list_c *symbol);
void *visit(structured_variable_c *symbol);
/******************************************/