# HG changeset patch # User Mario de Sousa # Date 1319910985 -3600 # Node ID 606443ffd5897ade632661546eb0ae7c48e7373e # Parent 450d684013dcb7ee1284be4587600b0f3abeefb7 Fix semantic verification of enumerated data types. diff -r 450d684013dc -r 606443ffd589 absyntax_utils/search_constant_type.cc --- a/absyntax_utils/search_constant_type.cc Fri Oct 28 10:25:07 2011 +0100 +++ b/absyntax_utils/search_constant_type.cc Sat Oct 29 18:56:25 2011 +0100 @@ -124,13 +124,13 @@ /* B 1.3.3 - Derived data types */ /********************************/ void *search_constant_type_c::visit(enumerated_value_c *symbol) { - if (symbol->type != NULL) - return (void *)(symbol->type); + if (symbol->type != NULL) + return (void *)(symbol->type); - symbol_c *value_type = enumerated_value_symtable.find_value(symbol->value); - if (value_type == enumerated_value_symtable.end_value()) ERROR; - - return (void *)value_type; + symbol_c *value_type = enumerated_value_symtable.find_value(symbol->value); + if (value_type == enumerated_value_symtable.end_value()) + return NULL; + return (void *)value_type; } real_type_name_c search_constant_type_c::real_type_name; diff -r 450d684013dc -r 606443ffd589 stage3/visit_expression_type.cc --- a/stage3/visit_expression_type.cc Fri Oct 28 10:25:07 2011 +0100 +++ b/stage3/visit_expression_type.cc Sat Oct 29 18:56:25 2011 +0100 @@ -2076,9 +2076,9 @@ } // if (debug) if (NULL == left_type) { - STAGE3_ERROR(symbol->l_exp, symbol->l_exp, "Could not determine data type of expression (undefined variable or strcuture element?).\n"); + STAGE3_ERROR(symbol->l_exp, symbol->l_exp, "Could not determine data type of expression (undefined variable, constant, or structure element?).\n"); } else if (NULL == right_type) { - STAGE3_ERROR(symbol->r_exp, symbol->r_exp, "Could not determine data type of expression (undefined variable or strcuture element?).\n"); + STAGE3_ERROR(symbol->r_exp, symbol->r_exp, "Could not determine data type of expression (undefined variable, constant, or structure element?).\n"); } else if (!is_valid_assignment(left_type, right_type)) STAGE3_ERROR(symbol, symbol, "data type mismatch in assignment statement!\n");