stage3/print_datatypes_error.cc
changeset 443 ff4d26b7e51d
parent 441 e8de43eefcc5
child 448 1bd18fc06911
equal deleted inserted replaced
442:bd5998ee8876 443:ff4d26b7e51d
   137 			function_param_iterator_c fp_iterator(f_decl);
   137 			function_param_iterator_c fp_iterator(f_decl);
   138 			while ((param_name = fcp_iterator.next_f()) != NULL) {
   138 			while ((param_name = fcp_iterator.next_f()) != NULL) {
   139 				param_value = fcp_iterator.get_current_value();
   139 				param_value = fcp_iterator.get_current_value();
   140 				/* Find the corresponding parameter in function declaration */
   140 				/* Find the corresponding parameter in function declaration */
   141 				if (NULL == fp_iterator.search(param_name)) {
   141 				if (NULL == fp_iterator.search(param_name)) {
   142 					STAGE3_ERROR(0, fcall, fcall, "Invalid parameter '%s' when invoking %s '%s'", ((identifier_c *)param_name)->value, POU_str, ((identifier_c *)fcall_data.function_name)->value);		  
   142 					STAGE3_ERROR(0, param_name, param_name, "Invalid parameter '%s' when invoking %s '%s'", ((identifier_c *)param_name)->value, POU_str, ((identifier_c *)fcall_data.function_name)->value);		  
   143 				} else if (NULL == param_value->datatype) {
   143 				} else if (NULL == param_value->datatype) {
   144 					function_invocation_error = true;
   144 					function_invocation_error = true;
   145 					STAGE3_ERROR(0, fcall, fcall, "Data type incompatibility between parameter '%s' and value being passed, when invoking %s '%s'", ((identifier_c *)param_name)->value, POU_str, ((identifier_c *)fcall_data.function_name)->value);
   145 					STAGE3_ERROR(0, param_value, param_value, "Data type incompatibility between parameter '%s' and value being passed, when invoking %s '%s'", ((identifier_c *)param_name)->value, POU_str, ((identifier_c *)fcall_data.function_name)->value);
   146 				}
   146 				}
   147 			}
   147 			}
   148 		}
   148 		}
   149 	}
   149 	}
   150 	if (NULL != fcall_data.nonformal_operand_list) {
   150 	if (NULL != fcall_data.nonformal_operand_list) {
   151 		fcall_data.nonformal_operand_list->accept(*this);
   151 		fcall_data.nonformal_operand_list->accept(*this);
   152 		if (f_decl)
   152 		if (f_decl)
   153 			for (int i = 1; (param_value = fcp_iterator.next_nf()) != NULL; i++) {
   153 			for (int i = 1; (param_value = fcp_iterator.next_nf()) != NULL; i++) {
   154 				if (NULL == param_value->datatype) {
   154 				if (NULL == param_value->datatype) {
   155 					function_invocation_error = true;
   155 					function_invocation_error = true;
   156 					STAGE3_ERROR(0, fcall, fcall, "Data type incompatibility for value passed in position %d when invoking %s '%s'", i, POU_str, ((identifier_c *)fcall_data.function_name)->value);
   156 					STAGE3_ERROR(0, param_value, param_value, "Data type incompatibility for value passed in position %d when invoking %s '%s'", i, POU_str, ((identifier_c *)fcall_data.function_name)->value);
   157 				}
   157 				}
   158 			}
   158 			}
   159 	}
   159 	}
   160 
   160 
   161 	if (function_invocation_error) {
   161 	if (function_invocation_error) {