285 * We cannot proceed verifying type compatibility of something that does not ecist. |
285 * We cannot proceed verifying type compatibility of something that does not ecist. |
286 */ |
286 */ |
287 return; |
287 return; |
288 } |
288 } |
289 |
289 |
|
290 /* The value being passed to the 'param_name' parameter is actually the prev_il_instruction. |
|
291 * However, we do not place that object directly in the fake il_param_list_c that we will be |
|
292 * creating, since the visit(il_fb_call_c *) method will recursively call every object in that list. |
|
293 * The il_prev_intruction object has already been visited. We DO NOT want to visit it again. |
|
294 * The easiest way to work around this is to simply use a new object, and copy the relevant details to that object! |
|
295 */ |
|
296 symbol_c param_value; |
|
297 copy_candidate_datatype_list(prev_il_instruction/*from*/, ¶m_value/*to*/); |
|
298 |
290 identifier_c variable_name(param_name); |
299 identifier_c variable_name(param_name); |
291 // SYM_REF1(il_assign_operator_c, variable_name) |
300 // SYM_REF1(il_assign_operator_c, variable_name) |
292 il_assign_operator_c il_assign_operator(&variable_name); |
301 il_assign_operator_c il_assign_operator(&variable_name); |
293 // SYM_REF3(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list) |
302 // SYM_REF3(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list) |
294 il_param_assignment_c il_param_assignment(&il_assign_operator, prev_il_instruction/*il_operand*/, NULL); |
303 il_param_assignment_c il_param_assignment(&il_assign_operator, ¶m_value/*il_operand*/, NULL); |
295 il_param_list_c il_param_list; |
304 il_param_list_c il_param_list; |
296 il_param_list.add_element(&il_param_assignment); |
305 il_param_list.add_element(&il_param_assignment); |
297 // SYM_REF4(il_fb_call_c, il_call_operator, fb_name, il_operand_list, il_param_list, symbol_c *called_fb_declaration) |
306 // SYM_REF4(il_fb_call_c, il_call_operator, fb_name, il_operand_list, il_param_list, symbol_c *called_fb_declaration) |
298 il_fb_call_c il_fb_call(NULL, il_operand, NULL, &il_param_list); |
307 il_fb_call_c il_fb_call(NULL, il_operand, NULL, &il_param_list); |
299 |
308 |
810 /* | label ':' [il_incomplete_instruction] eol_list */ |
819 /* | label ':' [il_incomplete_instruction] eol_list */ |
811 // SYM_REF2(il_instruction_c, label, il_instruction) |
820 // SYM_REF2(il_instruction_c, label, il_instruction) |
812 // void *visit(instruction_list_c *symbol); |
821 // void *visit(instruction_list_c *symbol); |
813 void *fill_candidate_datatypes_c::visit(il_instruction_c *symbol) { |
822 void *fill_candidate_datatypes_c::visit(il_instruction_c *symbol) { |
814 if (NULL == symbol->il_instruction) { |
823 if (NULL == symbol->il_instruction) { |
815 /* This object has (inherits) the same candidate datatypes as the prev_il_instruction */ |
824 /* This empty/null il_instruction does not change the value of the current/default IL variable. |
816 copy_candidate_datatype_list(symbol->prev_il_instruction /*from*/, symbol /*to*/); |
825 * So it inherits the candidate_datatypes from it's previous IL instructions! |
|
826 */ |
|
827 if (NULL != symbol->prev_il_instruction) |
|
828 copy_candidate_datatype_list(symbol->prev_il_instruction /*from*/, symbol /*to*/); |
817 } else { |
829 } else { |
818 prev_il_instruction = symbol->prev_il_instruction; |
830 prev_il_instruction = symbol->prev_il_instruction; |
819 symbol->il_instruction->accept(*this); |
831 symbol->il_instruction->accept(*this); |
820 prev_il_instruction = NULL; |
832 prev_il_instruction = NULL; |
821 |
833 |
944 /* The print_datatypes_error_c does not rely on this called_fb_declaration pointer being != NULL to conclude that |
956 /* The print_datatypes_error_c does not rely on this called_fb_declaration pointer being != NULL to conclude that |
945 * we have a datat type incompatibility error, so setting it to the correct fb_decl is actually safe, |
957 * we have a datat type incompatibility error, so setting it to the correct fb_decl is actually safe, |
946 * as the compiler will never reach the compilation stage! |
958 * as the compiler will never reach the compilation stage! |
947 */ |
959 */ |
948 symbol->called_fb_declaration = fb_decl; |
960 symbol->called_fb_declaration = fb_decl; |
|
961 |
|
962 /* This object has the same candidate datatypes as the prev_il_instruction, since it does not change the value stored in the current/default IL variable. */ |
|
963 copy_candidate_datatype_list(prev_il_instruction/*from*/, symbol/*to*/); |
949 |
964 |
950 if (debug) std::cout << "FB [] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
965 if (debug) std::cout << "FB [] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
951 return NULL; |
966 return NULL; |
952 } |
967 } |
953 |
968 |