stage3/narrow_candidate_datatypes.cc
changeset 445 e6c34ee82954
parent 444 92d40d2a7adc
child 448 1bd18fc06911
equal deleted inserted replaced
444:92d40d2a7adc 445:e6c34ee82954
    56 
    56 
    57 
    57 
    58 /* Only set the symbol's desired datatype to 'datatype' if that datatype is in the candidate_datatype list */
    58 /* Only set the symbol's desired datatype to 'datatype' if that datatype is in the candidate_datatype list */
    59 static void set_datatype(symbol_c *datatype, symbol_c *symbol) {
    59 static void set_datatype(symbol_c *datatype, symbol_c *symbol) {
    60 	symbol->datatype = NULL;   
    60 	symbol->datatype = NULL;   
    61 	if (search_in_datatype_list(datatype, symbol->candidate_datatypes) >= 0)
    61 	if (search_in_candidate_datatype_list(datatype, symbol->candidate_datatypes) >= 0)
    62 		symbol->datatype = datatype;  
    62 		symbol->datatype = datatype;  
    63 }
    63 }
    64 
    64 
    65 
    65 
    66 
    66 
   286 /* simple_specification ASSIGN constant */
   286 /* simple_specification ASSIGN constant */
   287 // SYM_REF2(simple_spec_init_c, simple_specification, constant)
   287 // SYM_REF2(simple_spec_init_c, simple_specification, constant)
   288 void *narrow_candidate_datatypes_c::visit(simple_spec_init_c *symbol) {
   288 void *narrow_candidate_datatypes_c::visit(simple_spec_init_c *symbol) {
   289 	symbol_c *datatype = base_type(symbol->simple_specification); 
   289 	symbol_c *datatype = base_type(symbol->simple_specification); 
   290 	if (NULL != symbol->constant) {
   290 	if (NULL != symbol->constant) {
   291 		int typeoffset = search_in_datatype_list(datatype, symbol->constant->candidate_datatypes);
   291 		int typeoffset = search_in_candidate_datatype_list(datatype, symbol->constant->candidate_datatypes);
   292 		if (typeoffset >= 0)
   292 		if (typeoffset >= 0)
   293 			symbol->constant->datatype = symbol->constant->candidate_datatypes[typeoffset];
   293 			symbol->constant->datatype = symbol->constant->candidate_datatypes[typeoffset];
   294 	}
   294 	}
   295 	return NULL;
   295 	return NULL;
   296 }
   296 }