stage3/print_datatypes_error.cc
changeset 451 a1b87eb155e4
parent 449 3c6225521059
child 453 4733f662362a
equal deleted inserted replaced
450:eb1b28acec2e 451:a1b87eb155e4
   588 
   588 
   589 /* | function_name [il_operand_list] */
   589 /* | function_name [il_operand_list] */
   590 /* NOTE: The parameters 'called_function_declaration' and 'extensible_param_count' are used to pass data between the stage 3 and stage 4. */
   590 /* NOTE: The parameters 'called_function_declaration' and 'extensible_param_count' are used to pass data between the stage 3 and stage 4. */
   591 // SYM_REF2(il_function_call_c, function_name, il_operand_list, symbol_c *called_function_declaration; int extensible_param_count;)
   591 // SYM_REF2(il_function_call_c, function_name, il_operand_list, symbol_c *called_function_declaration; int extensible_param_count;)
   592 void *print_datatypes_error_c::visit(il_function_call_c *symbol) {
   592 void *print_datatypes_error_c::visit(il_function_call_c *symbol) {
       
   593 	/* The first parameter of a non formal function call in IL will be the 'current value' (i.e. the prev_il_instruction)
       
   594 	 * In order to be able to handle this without coding special cases, we will simply prepend that symbol
       
   595 	 * to the il_operand_list, and remove it after calling handle_function_call().
       
   596 	 *
       
   597 	 * However, if no further paramters are given, then il_operand_list will be NULL, and we will
       
   598 	 * need to create a new object to hold the pointer to prev_il_instruction.
       
   599 	 * This change will also be undone later in print_datatypes_error_c.
       
   600 	 */
       
   601 	if (NULL == symbol->il_operand_list)  symbol->il_operand_list = new il_operand_list_c;
       
   602 	if (NULL == symbol->il_operand_list)  ERROR;
       
   603 
       
   604 	((list_c *)symbol->il_operand_list)->insert_element(prev_il_instruction, 0);
       
   605 
   593 	generic_function_call_t fcall_param = {
   606 	generic_function_call_t fcall_param = {
   594 		/* fcall_param.function_name               = */ symbol->function_name,
   607 		/* fcall_param.function_name               = */ symbol->function_name,
   595 		/* fcall_param.nonformal_operand_list      = */ symbol->il_operand_list,
   608 		/* fcall_param.nonformal_operand_list      = */ symbol->il_operand_list,
   596 		/* fcall_param.formal_operand_list         = */ NULL,
   609 		/* fcall_param.formal_operand_list         = */ NULL,
   597 		/* enum {POU_FB, POU_function} POU_type    = */ generic_function_call_t::POU_function,
   610 		/* enum {POU_FB, POU_function} POU_type    = */ generic_function_call_t::POU_function,