equal
deleted
inserted
replaced
660 /* subscripted_variable '[' subscript_list ']' */ |
660 /* subscripted_variable '[' subscript_list ']' */ |
661 // SYM_REF2(array_variable_c, subscripted_variable, subscript_list) |
661 // SYM_REF2(array_variable_c, subscripted_variable, subscript_list) |
662 void *narrow_candidate_datatypes_c::visit(array_variable_c *symbol) { |
662 void *narrow_candidate_datatypes_c::visit(array_variable_c *symbol) { |
663 /* we need to check the data types of the expressions used for the subscripts... */ |
663 /* we need to check the data types of the expressions used for the subscripts... */ |
664 symbol->subscript_list->accept(*this); |
664 symbol->subscript_list->accept(*this); |
|
665 |
|
666 /* Set the datatype of the subscripted variable and visit it recursively. For the reason why we do this, */ |
|
667 /* Please read the comments in the array_variable_c and structured_variable_c visitors in the fill_candidate_datatypes.cc file! */ |
|
668 symbol->subscripted_variable->accept(*this); // visit recursively |
|
669 |
|
670 if (symbol->subscripted_variable->candidate_datatypes.size() == 1) |
|
671 symbol->subscripted_variable->datatype = symbol->subscripted_variable->candidate_datatypes[0]; // set the datatype |
|
672 |
665 return NULL; |
673 return NULL; |
666 } |
674 } |
667 |
675 |
668 |
676 |
669 /* subscript_list ',' subscript */ |
677 /* subscript_list ',' subscript */ |
678 } |
686 } |
679 return NULL; |
687 return NULL; |
680 } |
688 } |
681 |
689 |
682 |
690 |
|
691 |
|
692 /* record_variable '.' field_selector */ |
|
693 /* WARNING: input and/or output variables of function blocks |
|
694 * may be accessed as fields of a structured variable! |
|
695 * Code handling a structured_variable_c must take |
|
696 * this into account! |
|
697 */ |
|
698 // SYM_REF2(structured_variable_c, record_variable, field_selector) |
|
699 void *narrow_candidate_datatypes_c::visit(structured_variable_c *symbol) { |
|
700 /* Set the datatype of the record_variable and visit it recursively. For the reason why we do this, */ |
|
701 /* Please read the comments in the array_variable_c and structured_variable_c visitors in the fill_candidate_datatypes.cc file! */ |
|
702 symbol->record_variable->accept(*this); // visit recursively |
|
703 |
|
704 if (symbol->record_variable->candidate_datatypes.size() == 1) |
|
705 symbol->record_variable->datatype = symbol->record_variable->candidate_datatypes[0]; // set the datatype |
|
706 |
|
707 return NULL; |
|
708 } |
683 |
709 |
684 |
710 |
685 /******************************************/ |
711 /******************************************/ |
686 /* B 1.4.3 - Declaration & Initialisation */ |
712 /* B 1.4.3 - Declaration & Initialisation */ |
687 /******************************************/ |
713 /******************************************/ |