equal
deleted
inserted
replaced
116 identifier_c *extensible_parameter_name; |
116 identifier_c *extensible_parameter_name; |
117 unsigned int i; |
117 unsigned int i; |
118 |
118 |
119 /* Iterating through the formal parameters of the function call */ |
119 /* Iterating through the formal parameters of the function call */ |
120 while((call_param_name = fcp_iterator.next_f()) != NULL) { |
120 while((call_param_name = fcp_iterator.next_f()) != NULL) { |
121 |
121 /* TODO: check whether direction (IN, OUT, IN_OUT) and assignment types (:= , =>) are compatible !!! */ |
122 /* Obtaining the value being passed in the function call */ |
122 /* Obtaining the value being passed in the function call */ |
123 call_param_value = fcp_iterator.get_current_value(); |
123 call_param_value = fcp_iterator.get_current_value(); |
124 /* the following should never occur. If it does, then we have a bug in our code... */ |
124 /* the following should never occur. If it does, then we have a bug in our code... */ |
125 if (NULL == call_param_value) ERROR; |
125 if (NULL == call_param_value) ERROR; |
126 |
126 |
236 return; |
236 return; |
237 } |
237 } |
238 |
238 |
239 |
239 |
240 /* handle implicit FB call in IL. |
240 /* handle implicit FB call in IL. |
241 * e.g. CLK ton_car |
241 * e.g. CLK ton_var |
242 * CU counter_var |
242 * CU counter_var |
243 * |
243 * |
244 * The algorithm will be to build a fake il_fb_call_c equivalent to the implicit IL FB call, and let |
244 * The algorithm will be to build a fake il_fb_call_c equivalent to the implicit IL FB call, and let |
245 * the visit(il_fb_call_c *) method handle it! |
245 * the visit(il_fb_call_c *) method handle it! |
246 */ |
246 */ |
247 void fill_candidate_datatypes_c::handle_implicit_il_fb_call(symbol_c *il_instruction, const char *param_name, symbol_c *&called_fb_declaration) { |
247 void fill_candidate_datatypes_c::handle_implicit_il_fb_call(symbol_c *il_instruction, const char *param_name, symbol_c *&called_fb_declaration) { |
|
248 if (NULL == il_operand) |
|
249 /* No FB to call was specified. There is nothing we can do... */ |
|
250 return; |
|
251 |
248 symbol_c *fb_type_id = search_varfb_instance_type->get_basetype_id(il_operand); |
252 symbol_c *fb_type_id = search_varfb_instance_type->get_basetype_id(il_operand); |
249 /* This is a call to a non-declared FB/Variable is a semantic error (which is currently caught by stage 2, so this should never occur) |
253 /* This is a call to a non-declared FB/Variable is a semantic error (which is currently caught by stage 2, so this should never occur) |
250 * or no operand was given (il_operand == NULL). In this case, we just give up! |
254 * or no operand was given (il_operand == NULL). In this case, we just give up! |
251 */ |
255 */ |
252 if (NULL == fb_type_id) |
256 if (NULL == fb_type_id) |
258 * this is a smeantic error, so there is no way we can evaluate the rest of the code. We simply give up, and leave |
262 * this is a smeantic error, so there is no way we can evaluate the rest of the code. We simply give up, and leave |
259 * the candidate_datatype_list empty, and the called_fb_declaration pointing to NULL |
263 * the candidate_datatype_list empty, and the called_fb_declaration pointing to NULL |
260 */ |
264 */ |
261 return; |
265 return; |
262 |
266 |
|
267 if (NULL == prev_il_instruction) { |
|
268 /* This IL implicit FB call (e.g. CLK ton_var) is not preceded by another IL instruction |
|
269 * (or list of instructions) that will set the IL current/default value. |
|
270 * We cannot proceed verifying type compatibility of something that does not ecist. |
|
271 */ |
|
272 return; |
|
273 } |
263 |
274 |
264 identifier_c variable_name(param_name); |
275 identifier_c variable_name(param_name); |
265 // SYM_REF1(il_assign_operator_c, variable_name) |
276 // SYM_REF1(il_assign_operator_c, variable_name) |
266 il_assign_operator_c il_assign_operator(&variable_name); |
277 il_assign_operator_c il_assign_operator(&variable_name); |
267 // SYM_REF3(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list) |
278 // SYM_REF3(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list) |
783 |
794 |
784 /* | label ':' [il_incomplete_instruction] eol_list */ |
795 /* | label ':' [il_incomplete_instruction] eol_list */ |
785 // SYM_REF2(il_instruction_c, label, il_instruction) |
796 // SYM_REF2(il_instruction_c, label, il_instruction) |
786 // void *visit(instruction_list_c *symbol); |
797 // void *visit(instruction_list_c *symbol); |
787 void *fill_candidate_datatypes_c::visit(il_instruction_c *symbol) { |
798 void *fill_candidate_datatypes_c::visit(il_instruction_c *symbol) { |
788 if (NULL == symbol->il_instruction) |
799 if (NULL == symbol->il_instruction) { |
789 return NULL; |
800 /* This object has (inherits) the same candidate datatypes as the prev_il_instruction */ |
790 |
801 copy_candidate_datatype_list(symbol->prev_il_instruction /*from*/, symbol /*to*/); |
791 prev_il_instruction = symbol->prev_il_instruction; |
802 } else { |
792 symbol->il_instruction->accept(*this); |
803 prev_il_instruction = symbol->prev_il_instruction; |
793 /* This object has (inherits) the same candidate datatypes as the il_instruction */ |
804 symbol->il_instruction->accept(*this); |
794 copy_candidate_datatype_list(symbol->il_instruction /*from*/, symbol /*to*/); |
805 prev_il_instruction = NULL; |
795 prev_il_instruction = NULL; |
806 |
|
807 /* This object has (inherits) the same candidate datatypes as the il_instruction */ |
|
808 copy_candidate_datatype_list(symbol->il_instruction /*from*/, symbol /*to*/); |
|
809 } |
796 |
810 |
797 return NULL; |
811 return NULL; |
798 } |
812 } |
799 |
813 |
800 |
814 |