stage3/narrow_candidate_datatypes.cc
changeset 515 fdef852a6565
parent 502 a6211f73690b
child 534 d13a38011af4
equal deleted inserted replaced
514:c2880eba49a1 515:fdef852a6565
    94 }
    94 }
    95 
    95 
    96 
    96 
    97 
    97 
    98 bool narrow_candidate_datatypes_c::is_widening_compatible(const struct widen_entry widen_table[], symbol_c *left_type, symbol_c *right_type, symbol_c *result_type, bool *deprecated_status) {
    98 bool narrow_candidate_datatypes_c::is_widening_compatible(const struct widen_entry widen_table[], symbol_c *left_type, symbol_c *right_type, symbol_c *result_type, bool *deprecated_status) {
       
    99 	/* NOTE: According to our algorithm, left_type and right_type should never by NULL (if they are, we have an internal compiler error!
       
   100 	 *       However, result_type may be NULL if the code has a data type semantic error!
       
   101 	 */
       
   102 	if ((NULL == left_type) || (NULL == right_type) || (NULL == result_type))
       
   103 		return false;
       
   104 
    99 	for (int k = 0; NULL != widen_table[k].left;  k++) {
   105 	for (int k = 0; NULL != widen_table[k].left;  k++) {
   100 		if        ((typeid(*left_type)   == typeid(*widen_table[k].left))
   106 		if        ((typeid(*left_type)   == typeid(*widen_table[k].left))
   101 		        && (typeid(*right_type)  == typeid(*widen_table[k].right))
   107 		        && (typeid(*right_type)  == typeid(*widen_table[k].right))
   102 			&& (typeid(*result_type) == typeid(*widen_table[k].result))) {
   108 			&& (typeid(*result_type) == typeid(*widen_table[k].result))) {
   103 			if (NULL != deprecated_status)
   109 			if (NULL != deprecated_status)