stage3/visit_expression_type.cc
changeset 305 fe5cb87610fa
parent 289 02d0c5844a82
child 319 1669977e84f4
equal deleted inserted replaced
304:1b6d8e3df1b2 305:fe5cb87610fa
   893   }
   893   }
   894   return NULL;
   894   return NULL;
   895 }
   895 }
   896 
   896 
   897 
   897 
       
   898 /********************************/
       
   899 /* B 1.3.3 - Derived data types */
       
   900 /********************************/
       
   901 void *visit_expression_type_c::visit(data_type_declaration_c *symbol) {
       
   902   // TODO !!!
       
   903   /* for the moment we must return NULL so semantic analysis of remaining code is not interrupted! */
       
   904   return NULL;
       
   905 }
   898 
   906 
   899 
   907 
   900 /*********************/
   908 /*********************/
   901 /* B 1.4 - Variables */
   909 /* B 1.4 - Variables */
   902 /*********************/
   910 /*********************/
  1987 
  1995 
  1988 void *visit_expression_type_c::visit(assignment_statement_c *symbol) {
  1996 void *visit_expression_type_c::visit(assignment_statement_c *symbol) {
  1989   symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this));
  1997   symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this));
  1990   symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this));
  1998   symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this));
  1991 
  1999 
       
  2000   if (debug) {
       
  2001     printf("visit_expression_type_c::visit(assignment_statement_c) called. Checking --->");  
       
  2002     symbolic_variable_c *hi = dynamic_cast<symbolic_variable_c *>(symbol->l_exp);  
       
  2003     if (hi != NULL) {
       
  2004       identifier_c *hi1 = dynamic_cast<identifier_c *>(hi->var_name);  
       
  2005       if (hi1 != NULL) printf(hi1->value);
       
  2006     }
       
  2007     printf(" := ");
       
  2008     hex_integer_c *hi2 = dynamic_cast<hex_integer_c *>(symbol->r_exp);  
       
  2009     if (hi2 != NULL) printf(hi2->value);
       
  2010     printf("\n");
       
  2011   } // if (debug)
       
  2012   
  1992   if (!is_valid_assignment(left_type, right_type))  {
  2013   if (!is_valid_assignment(left_type, right_type))  {
  1993      STAGE3_ERROR(symbol, symbol, "data type mismatch in assignment statement!\n");
  2014      STAGE3_ERROR(symbol, symbol, "data type mismatch in assignment statement!\n");
  1994   }
  2015   }
  1995   return NULL;
  2016   return NULL;
  1996 }
  2017 }