stage4/generate_c/search_expression_type.cc
changeset 123 a9b4af71cfa4
parent 70 e1f0ebd2d9ec
child 149 05ca171a3d57
equal deleted inserted replaced
122:9e57c6d79398 123:a9b4af71cfa4
    97     bool is_time_type(symbol_c *type_symbol) {
    97     bool is_time_type(symbol_c *type_symbol) {
    98       if (typeid(*type_symbol) == typeid(time_type_name_c)) {return true;}
    98       if (typeid(*type_symbol) == typeid(time_type_name_c)) {return true;}
    99       if (typeid(*type_symbol) == typeid(date_type_name_c)) {return true;}
    99       if (typeid(*type_symbol) == typeid(date_type_name_c)) {return true;}
   100       if (typeid(*type_symbol) == typeid(tod_type_name_c)) {return true;}
   100       if (typeid(*type_symbol) == typeid(tod_type_name_c)) {return true;}
   101       if (typeid(*type_symbol) == typeid(dt_type_name_c)) {return true;}
   101       if (typeid(*type_symbol) == typeid(dt_type_name_c)) {return true;}
       
   102       return false;
       
   103     }
       
   104 
       
   105     /* A helper function... */
       
   106     bool is_string_type(symbol_c *type_symbol) {
       
   107       if (typeid(*type_symbol) == typeid(string_type_name_c)) {return true;}
       
   108       if (typeid(*type_symbol) == typeid(wstring_type_name_c)) {return true;}
   102       return false;
   109       return false;
   103     }
   110     }
   104 
   111 
   105     /* A helper function... */
   112     /* A helper function... */
   106     bool is_integer_type(symbol_c *type_symbol) {
   113     bool is_integer_type(symbol_c *type_symbol) {
   462   }
   469   }
   463   
   470   
   464   void *visit(neg_expression_c *symbol) {
   471   void *visit(neg_expression_c *symbol) {
   465     symbol_c *exp_type = base_type((symbol_c *)symbol->exp->accept(*this));
   472     symbol_c *exp_type = base_type((symbol_c *)symbol->exp->accept(*this));
   466     if (is_num_type(exp_type) || typeid(*exp_type) == typeid(time_type_name_c)){
   473     if (is_num_type(exp_type) || typeid(*exp_type) == typeid(time_type_name_c)){
   467             return (void *)exp_type;
   474         return (void *)exp_type;
   468          }
   475     }
   469     ERROR;
   476     ERROR;
   470     return NULL;
   477     return NULL;
   471   }
   478   }
   472   
   479   
   473   void *visit(not_expression_c *symbol) {
   480   void *visit(not_expression_c *symbol) {