stage3/narrow_candidate_datatypes.cc
changeset 452 79ac274d1cc4
parent 451 a1b87eb155e4
child 453 4733f662362a
equal deleted inserted replaced
451:a1b87eb155e4 452:79ac274d1cc4
   564 	}
   564 	}
   565 
   565 
   566 	return NULL;
   566 	return NULL;
   567 }
   567 }
   568 
   568 
   569 /* MJS: Manuele, could you please not delete the following 2 lines of comments. They help me understand where this class is used
   569 
   570  *     and when it is created by bison - syntax parse, and how it can show up in the abstract syntax tree.
       
   571  *
       
   572  *       Actually, it could be helpful if we could have all the similar comments already present in visit_expression_type_c
       
   573  *       in the 3 new classes fill/narrow/print candidate datatype 
       
   574  */
       
   575 /* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */
   570 /* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */
   576 // SYM_REF3(il_expression_c, il_expr_operator, il_operand, simple_instr_list);
   571 // SYM_REF3(il_expression_c, il_expr_operator, il_operand, simple_instr_list);
   577 void *narrow_candidate_datatypes_c::visit(il_expression_c *symbol) {
   572 void *narrow_candidate_datatypes_c::visit(il_expression_c *symbol) {
   578 /* MJS: TODO... */
   573   symbol_c *save_prev_il_instruction = prev_il_instruction;
       
   574   
       
   575   symbol->simple_instr_list->datatype = symbol->datatype;
       
   576   symbol->simple_instr_list->accept(*this);
       
   577 
       
   578   prev_il_instruction = save_prev_il_instruction;
       
   579 
       
   580   /* TODO: finish this */
   579 return NULL;
   581 return NULL;
   580 }
   582 }
   581 
   583 
   582 /*   il_call_operator prev_declared_fb_name
   584 /*   il_call_operator prev_declared_fb_name
   583  * | il_call_operator prev_declared_fb_name '(' ')'
   585  * | il_call_operator prev_declared_fb_name '(' ')'
   636 	/* The desired datatype of the previous il instruction was already set by narrow_function_invocation() */
   638 	/* The desired datatype of the previous il instruction was already set by narrow_function_invocation() */
   637 	return NULL;
   639 	return NULL;
   638 }
   640 }
   639 
   641 
   640 
   642 
   641 /*
   643 //     void *visit(il_operand_list_c *symbol);
   642     void *visit(il_operand_list_c *symbol);
   644 void *narrow_candidate_datatypes_c::visit(simple_instr_list_c *symbol) {
   643     void *visit(simple_instr_list_c *symbol);
   645 	if (symbol->n > 0)
   644     void *visit(il_param_list_c *symbol);
   646 		symbol->elements[symbol->n - 1]->datatype = symbol->datatype;
   645     void *visit(il_param_assignment_c *symbol);
   647 
   646     void *visit(il_param_out_assignment_c *symbol);
   648 	for(int i = symbol->n-1; i >= 0; i--) {
   647  */
   649 		symbol->elements[i]->accept(*this);
       
   650 	}
       
   651 	return NULL;
       
   652 }
       
   653 
       
   654 //     void *visit(il_param_list_c *symbol);
       
   655 //     void *visit(il_param_assignment_c *symbol);
       
   656 //     void *visit(il_param_out_assignment_c *symbol);
       
   657 
   648 
   658 
   649 /*******************/
   659 /*******************/
   650 /* B 2.2 Operators */
   660 /* B 2.2 Operators */
   651 /*******************/
   661 /*******************/
   652 
   662