437 if (typeid(*type_symbol) == typeid(boolean_false_c)) {return true;} |
437 if (typeid(*type_symbol) == typeid(boolean_false_c)) {return true;} |
438 if (is_nonneg_literal_integer_type(type_symbol)) |
438 if (is_nonneg_literal_integer_type(type_symbol)) |
439 if (sizeoftype(&bool_t) >= sizeoftype(type_symbol)) {return true;} |
439 if (sizeoftype(&bool_t) >= sizeoftype(type_symbol)) {return true;} |
440 return false; |
440 return false; |
441 } |
441 } |
|
442 |
|
443 bool visit_expression_type_c::is_ANY_ELEMENTARY_OR_ENUMERATED_compatible(symbol_c *type_symbol) { |
|
444 if (type_symbol == NULL) {return false;} |
|
445 if (search_base_type.type_is_enumerated(type_symbol)) {return true;} |
|
446 return is_ANY_ELEMENTARY_compatible(type_symbol); |
|
447 } |
|
448 |
442 |
449 |
443 /* Determine the common data type between two data types. |
450 /* Determine the common data type between two data types. |
444 * If no common data type found, return NULL. |
451 * If no common data type found, return NULL. |
445 * |
452 * |
446 * If data types are identical, return the first (actually any would do...). |
453 * If data types are identical, return the first (actually any would do...). |
1783 |
1790 |
1784 |
1791 |
1785 void *visit_expression_type_c::visit(equ_expression_c *symbol) { |
1792 void *visit_expression_type_c::visit(equ_expression_c *symbol) { |
1786 symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); |
1793 symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); |
1787 symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); |
1794 symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); |
1788 compute_expression(left_type, right_type, &visit_expression_type_c::is_ANY_ELEMENTARY_compatible, symbol->l_exp, symbol->r_exp); |
1795 compute_expression(left_type, right_type, &visit_expression_type_c::is_ANY_ELEMENTARY_OR_ENUMERATED_compatible, symbol->l_exp, symbol->r_exp); |
1789 return &search_expression_type_c::bool_type_name; |
1796 return &search_expression_type_c::bool_type_name; |
1790 } |
1797 } |
1791 |
1798 |
1792 |
1799 |
1793 void *visit_expression_type_c::visit(notequ_expression_c *symbol) { |
1800 void *visit_expression_type_c::visit(notequ_expression_c *symbol) { |
1794 symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); |
1801 symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); |
1795 symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); |
1802 symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); |
1796 compute_expression(left_type, right_type, &visit_expression_type_c::is_ANY_ELEMENTARY_compatible, symbol->l_exp, symbol->r_exp); |
1803 compute_expression(left_type, right_type, &visit_expression_type_c::is_ANY_ELEMENTARY_OR_ENUMERATED_compatible, symbol->l_exp, symbol->r_exp); |
1797 return &search_expression_type_c::bool_type_name; |
1804 return &search_expression_type_c::bool_type_name; |
1798 } |
1805 } |
1799 |
1806 |
1800 |
1807 |
1801 void *visit_expression_type_c::visit(lt_expression_c *symbol) { |
1808 void *visit_expression_type_c::visit(lt_expression_c *symbol) { |