stage3/narrow_candidate_datatypes.cc
changeset 690 6156ee2b4e32
parent 676 ca4f17211251
child 693 51a2fa6441b9
equal deleted inserted replaced
689:45c35d829db9 690:6156ee2b4e32
   717   /* now give the parenthesised IL list a chance to narrow the datatypes */
   717   /* now give the parenthesised IL list a chance to narrow the datatypes */
   718   /* The datatype that is must return was set by the call symbol->il_expr_operator->accept(*this) */
   718   /* The datatype that is must return was set by the call symbol->il_expr_operator->accept(*this) */
   719   il_instruction_c *save_fake_prev_il_instruction = fake_prev_il_instruction; /*this is not really necessary, but lets play it safe */
   719   il_instruction_c *save_fake_prev_il_instruction = fake_prev_il_instruction; /*this is not really necessary, but lets play it safe */
   720   symbol->simple_instr_list->accept(*this);
   720   symbol->simple_instr_list->accept(*this);
   721   fake_prev_il_instruction = save_fake_prev_il_instruction;
   721   fake_prev_il_instruction = save_fake_prev_il_instruction;
       
   722   
       
   723   /* Since stage2 will insert an artificial (and equivalent) LD <il_operand> to the simple_instr_list when an 'il_operand' exists, we know
       
   724    * that if (symbol->il_operand != NULL), then the first IL instruction in the simple_instr_list will be the equivalent and artificial
       
   725    * 'LD <il_operand>' IL instruction.
       
   726    * Just to be consistent, we will copy the datatype info back into the il_operand, even though this should not be necessary!
       
   727    */
       
   728   if ((NULL != symbol->il_operand) && ((NULL == symbol->simple_instr_list) || (0 == ((list_c *)symbol->simple_instr_list)->n))) ERROR; // stage2 is not behaving as we expect it to!
       
   729   if  (NULL != symbol->il_operand)
       
   730     symbol->il_operand->datatype = ((list_c *)symbol->simple_instr_list)->elements[0]->datatype;
       
   731   
   722   return NULL;
   732   return NULL;
   723 }
   733 }
   724 
   734 
   725 
   735 
   726 
   736