stage3/fill_candidate_datatypes.cc
changeset 726 9b61eb4f00dc
parent 724 d19877568878
child 728 3700fd83e5de
equal deleted inserted replaced
725:bfbe4aca6b77 726:9b61eb4f00dc
   894 
   894 
   895 /* helper symbol for enumerated_specification->enumerated_spec_init */
   895 /* helper symbol for enumerated_specification->enumerated_spec_init */
   896 /* enumerated_value_list ',' enumerated_value */
   896 /* enumerated_value_list ',' enumerated_value */
   897 // SYM_LIST(enumerated_value_list_c)
   897 // SYM_LIST(enumerated_value_list_c)
   898 void *fill_candidate_datatypes_c::visit(enumerated_value_list_c *symbol) {
   898 void *fill_candidate_datatypes_c::visit(enumerated_value_list_c *symbol) {
   899   if (NULL == current_enumerated_spec_type) ERROR;
   899   if (NULL == current_enumerated_spec_type) ERROR;  
   900   
       
   901   /* Actually, all this passing of symbol_c * through the  current_enumerated_spec_type is actually useless, as the base type
       
   902    * is actually this enumerated_value_list_c symbol!!! However, it is safer to do it this way, as we can then later change 
       
   903    * search_base_type_c without having to change this fill_candidate_datatypes_c class too!!
       
   904    */
       
   905   current_enumerated_spec_type = base_type(current_enumerated_spec_type);
   900   current_enumerated_spec_type = base_type(current_enumerated_spec_type);
   906   if (NULL == current_enumerated_spec_type) ERROR;
   901   if (NULL == current_enumerated_spec_type) ERROR;
   907   
   902   
   908   /* We already know the datatype of the enumerated_value(s) in the list, so we set them directly instead of recursively calling the enumerated_value_c visit method! */
   903   /* We already know the datatype of the enumerated_value(s) in the list, so we set them directly instead of recursively calling the enumerated_value_c visit method! */
   909   for(int i = 0; i < symbol->n; i++) {
   904   for(int i = 0; i < symbol->n; i++)
   910     add_datatype_to_candidate_list(symbol->elements[i], current_enumerated_spec_type);
   905     add_datatype_to_candidate_list(symbol->elements[i], current_enumerated_spec_type);
   911     symbol->elements[i]->datatype = current_enumerated_spec_type; // To be consistent, this should really be done in the narrow_candidate_datatypes_c !!
   906 
   912   }
       
   913   return NULL;  
   907   return NULL;  
   914 }
   908 }
   915 
   909 
   916 
   910 
   917 /* enumerated_type_name '#' identifier */
   911 /* enumerated_type_name '#' identifier */