531 /* handle the two equality comparison operations, i.e. = (euqal) and != (not equal) */ |
531 /* handle the two equality comparison operations, i.e. = (euqal) and != (not equal) */ |
532 /* This function is special, as it will also allow enumeration data types to be compared, with the result being a BOOL data type! |
532 /* This function is special, as it will also allow enumeration data types to be compared, with the result being a BOOL data type! |
533 * This possibility os not expressed in the 'widening' tables, so we need to hard code it here |
533 * This possibility os not expressed in the 'widening' tables, so we need to hard code it here |
534 */ |
534 */ |
535 void *fill_candidate_datatypes_c::handle_equality_comparison(const struct widen_entry widen_table[], symbol_c *symbol, symbol_c *l_expr, symbol_c *r_expr) { |
535 void *fill_candidate_datatypes_c::handle_equality_comparison(const struct widen_entry widen_table[], symbol_c *symbol, symbol_c *l_expr, symbol_c *r_expr) { |
536 search_base_type_c search_base_type; |
|
537 handle_binary_expression(widen_table, symbol, l_expr, r_expr); |
536 handle_binary_expression(widen_table, symbol, l_expr, r_expr); |
538 for(unsigned int i = 0; i < l_expr->candidate_datatypes.size(); i++) |
537 for(unsigned int i = 0; i < l_expr->candidate_datatypes.size(); i++) |
539 for(unsigned int j = 0; j < r_expr->candidate_datatypes.size(); j++) { |
538 for(unsigned int j = 0; j < r_expr->candidate_datatypes.size(); j++) { |
540 if ((l_expr->candidate_datatypes[i] == r_expr->candidate_datatypes[j]) && search_base_type.type_is_enumerated(l_expr->candidate_datatypes[i])) |
539 if ((l_expr->candidate_datatypes[i] == r_expr->candidate_datatypes[j]) && search_base_type_c::type_is_enumerated(l_expr->candidate_datatypes[i])) |
541 add_datatype_to_candidate_list(symbol, &get_datatype_info_c::bool_type_name); |
540 add_datatype_to_candidate_list(symbol, &get_datatype_info_c::bool_type_name); |
542 } |
541 } |
543 return NULL; |
542 return NULL; |
544 } |
543 } |
545 |
544 |
546 |
545 |
547 |
546 |
548 /* a helper function... */ |
547 /* a helper function... */ |
549 symbol_c *fill_candidate_datatypes_c::base_type(symbol_c *symbol) { |
548 symbol_c *fill_candidate_datatypes_c::base_type(symbol_c *symbol) { |
550 /* NOTE: symbol == NULL is valid. It will occur when, for e.g., an undefined/undeclared symbolic_variable is used |
549 /* NOTE: symbol == NULL is valid. It will occur when, for e.g., an undefined/undeclared symbolic_variable is used in the code. */ |
551 * in the code. |
|
552 */ |
|
553 if (symbol == NULL) return NULL; |
550 if (symbol == NULL) return NULL; |
554 return (symbol_c *)symbol->accept(search_base_type); |
551 return search_base_type_c::get_basetype_decl(symbol); |
555 } |
552 } |
556 |
553 |
557 /*********************/ |
554 /*********************/ |
558 /* B 1.2 - Constants */ |
555 /* B 1.2 - Constants */ |
559 /*********************/ |
556 /*********************/ |