stage3/fill_candidate_datatypes.cc
changeset 462 f7dada0a8952
parent 459 01f6664bf8c5
child 464 319ee8b218f3
equal deleted inserted replaced
461:fcbc0927fc96 462:f7dada0a8952
   564 /* B 1.2.3.1 - Duration */
   564 /* B 1.2.3.1 - Duration */
   565 /************************/
   565 /************************/
   566 void *fill_candidate_datatypes_c::visit(duration_c *symbol) {
   566 void *fill_candidate_datatypes_c::visit(duration_c *symbol) {
   567 	/* TODO: check whether the literal follows the rules specified in section '2.2.3.1 Duration' of the standard! */
   567 	/* TODO: check whether the literal follows the rules specified in section '2.2.3.1 Duration' of the standard! */
   568 	
   568 	
       
   569 	/* Either of the following two lines is correct. Each of them will have advantages and drawbacks during compiler debugging. Use whichever suits you best... */
   569 	symbol->candidate_datatypes.push_back(&search_constant_type_c::time_type_name);
   570 	symbol->candidate_datatypes.push_back(&search_constant_type_c::time_type_name);
   570 // 	symbol->candidate_datatypes.push_back(symbol->type_name);
   571 // 	symbol->candidate_datatypes.push_back(symbol->type_name);
   571 	if (debug) std::cout << "TIME_LITERAL [" << symbol->candidate_datatypes.size() << "]\n";
   572 	if (debug) std::cout << "TIME_LITERAL [" << symbol->candidate_datatypes.size() << "]\n";
   572 	return NULL;
   573 	return NULL;
   573 }
   574 }
   811 		/* This empty/null il_instruction does not change the value of the current/default IL variable.
   812 		/* This empty/null il_instruction does not change the value of the current/default IL variable.
   812 		 * So it inherits the candidate_datatypes from it's previous IL instructions!
   813 		 * So it inherits the candidate_datatypes from it's previous IL instructions!
   813 		 */
   814 		 */
   814 		intersect_prev_candidate_datatype_lists(symbol);
   815 		intersect_prev_candidate_datatype_lists(symbol);
   815 	} else {
   816 	} else {
   816 // 		if (symbol->prev_il_instruction.size() > 1) ERROR; /* This assertion is only valid for now. Remove it once flow_control_analysis_c is complete */
       
   817 		il_instruction_c fake_prev_il_instruction = *symbol;
   817 		il_instruction_c fake_prev_il_instruction = *symbol;
   818 		intersect_prev_candidate_datatype_lists(&fake_prev_il_instruction);
   818 		intersect_prev_candidate_datatype_lists(&fake_prev_il_instruction);
   819 
   819 
   820 		if (symbol->prev_il_instruction.size() == 0)  prev_il_instruction = NULL;
   820 		if (symbol->prev_il_instruction.size() == 0)  prev_il_instruction = NULL;
   821 		else                                          prev_il_instruction = &fake_prev_il_instruction;
   821 		else                                          prev_il_instruction = &fake_prev_il_instruction;
   916   /* This object has the same candidate datatypes as the il_expr_operator. */
   916   /* This object has the same candidate datatypes as the il_expr_operator. */
   917   copy_candidate_datatype_list(symbol->il_expr_operator/*from*/, symbol/*to*/);
   917   copy_candidate_datatype_list(symbol->il_expr_operator/*from*/, symbol/*to*/);
   918   return NULL;
   918   return NULL;
   919 }
   919 }
   920 
   920 
       
   921 
   921 void *fill_candidate_datatypes_c::visit(il_jump_operation_c *symbol) {
   922 void *fill_candidate_datatypes_c::visit(il_jump_operation_c *symbol) {
   922   /* recursive call to fill the candidate data types list */
   923   /* recursive call to fill the candidate data types list */
   923   il_operand = NULL;
   924   il_operand = NULL;
   924   symbol->il_jump_operator->accept(*this);
   925   symbol->il_jump_operator->accept(*this);
   925   il_operand = NULL;
   926   il_operand = NULL;
       
   927   /* This object has the same candidate datatypes as the il_jump_operator. */
       
   928   copy_candidate_datatype_list(symbol->il_jump_operator/*from*/, symbol/*to*/);
   926   return NULL;
   929   return NULL;
   927 }
   930 }
   928 
   931 
   929 
   932 
   930 /*   il_call_operator prev_declared_fb_name
   933 /*   il_call_operator prev_declared_fb_name