# HG changeset patch # User Manuele Conti # Date 1336586757 -7200 # Node ID af9517cad953b9de5af764d453d653b46c9265df # Parent 7cc08964e0a795973ca71f897261130f4bd3ed2f Fix data type check array subscript field. diff -r 7cc08964e0a7 -r af9517cad953 stage3/print_datatypes_error.cc --- 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 */ diff -r 7cc08964e0a7 -r af9517cad953 stage3/print_datatypes_error.hh --- 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); /******************************************/