568 |
568 |
569 |
569 |
570 /* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */ |
570 /* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */ |
571 // 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); |
572 void *narrow_candidate_datatypes_c::visit(il_expression_c *symbol) { |
572 void *narrow_candidate_datatypes_c::visit(il_expression_c *symbol) { |
573 symbol_c *save_prev_il_instruction = prev_il_instruction; |
573 /* first handle the operation (il_expr_operator) that will use the result coming from the parenthesised IL list (i.e. simple_instr_list) */ |
574 |
574 symbol->il_expr_operator->datatype = symbol->datatype; |
575 symbol->simple_instr_list->datatype = symbol->datatype; |
575 il_operand = symbol->il_operand; |
|
576 symbol->il_expr_operator->accept(*this); |
|
577 |
|
578 /* now give the parenthesised IL list a chance to narrow the datatypes */ |
|
579 symbol_c *save_prev_il_instruction = prev_il_instruction; /*this is not really necessary, but lets play it safe */ |
576 symbol->simple_instr_list->accept(*this); |
580 symbol->simple_instr_list->accept(*this); |
577 |
|
578 prev_il_instruction = save_prev_il_instruction; |
581 prev_il_instruction = save_prev_il_instruction; |
579 |
|
580 /* TODO: finish this */ |
|
581 return NULL; |
582 return NULL; |
582 } |
583 } |
583 |
584 |
584 /* il_call_operator prev_declared_fb_name |
585 /* il_call_operator prev_declared_fb_name |
585 * | il_call_operator prev_declared_fb_name '(' ')' |
586 * | il_call_operator prev_declared_fb_name '(' ')' |
639 return NULL; |
640 return NULL; |
640 } |
641 } |
641 |
642 |
642 |
643 |
643 // void *visit(il_operand_list_c *symbol); |
644 // void *visit(il_operand_list_c *symbol); |
|
645 |
|
646 |
|
647 /* | simple_instr_list il_simple_instruction */ |
|
648 /* This object is referenced by il_expression_c objects */ |
644 void *narrow_candidate_datatypes_c::visit(simple_instr_list_c *symbol) { |
649 void *narrow_candidate_datatypes_c::visit(simple_instr_list_c *symbol) { |
645 if (symbol->n > 0) |
650 if (symbol->n > 0) |
646 symbol->elements[symbol->n - 1]->datatype = symbol->datatype; |
651 symbol->elements[symbol->n - 1]->datatype = symbol->datatype; |
647 |
652 |
648 for(int i = symbol->n-1; i >= 0; i--) { |
653 for(int i = symbol->n-1; i >= 0; i--) { |
649 symbol->elements[i]->accept(*this); |
654 symbol->elements[i]->accept(*this); |
650 } |
655 } |
651 return NULL; |
656 return NULL; |
|
657 } |
|
658 |
|
659 |
|
660 // SYM_REF1(il_simple_instruction_c, il_simple_instruction, symbol_c *prev_il_instruction;) |
|
661 void *narrow_candidate_datatypes_c::visit(il_simple_instruction_c *symbol) { |
|
662 prev_il_instruction = symbol->prev_il_instruction; |
|
663 symbol->il_simple_instruction->datatype = symbol->datatype; |
|
664 symbol->il_simple_instruction->accept(*this); |
|
665 prev_il_instruction = NULL; |
|
666 return NULL; |
652 } |
667 } |
653 |
668 |
654 // void *visit(il_param_list_c *symbol); |
669 // void *visit(il_param_list_c *symbol); |
655 // void *visit(il_param_assignment_c *symbol); |
670 // void *visit(il_param_assignment_c *symbol); |
656 // void *visit(il_param_out_assignment_c *symbol); |
671 // void *visit(il_param_out_assignment_c *symbol); |