323 * (called from the instruction_list_c for() loop that works backwards). We DO NOT want to visit it twice. |
323 * (called from the instruction_list_c for() loop that works backwards). We DO NOT want to visit it twice. |
324 * (Anyway, if we let the visit(il_fb_call_c *) recursively visit the current prev_il_instruction, this pointer |
324 * (Anyway, if we let the visit(il_fb_call_c *) recursively visit the current prev_il_instruction, this pointer |
325 * would be changed to the IL instruction coming before the current prev_il_instruction! => things would get all messed up!) |
325 * would be changed to the IL instruction coming before the current prev_il_instruction! => things would get all messed up!) |
326 * The easiest way to work around this is to simply use a new object, and copy the relevant details to that object! |
326 * The easiest way to work around this is to simply use a new object, and copy the relevant details to that object! |
327 */ |
327 */ |
328 printf("XX::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): fake_prev_il_instruction->candidate_datatypes.size() = %d\n",fake_prev_il_instruction->candidate_datatypes.size()); |
|
329 printf("XX::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): fake_prev_il_instruction->candidate_datatypes[0] = %p\n",fake_prev_il_instruction->candidate_datatypes[0]); |
|
330 symbol_c param_value = *fake_prev_il_instruction; /* copy the candidate_datatypes list ! */ |
328 symbol_c param_value = *fake_prev_il_instruction; /* copy the candidate_datatypes list ! */ |
331 printf("XX::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): param_value.candidate_datatypes.size() = %d\n",param_value.candidate_datatypes.size()); |
329 |
332 printf("XX::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): param_value.candidate_datatypes[0] = %p\n",param_value.candidate_datatypes[0]); |
|
333 printf("00::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): search_constant_type::time_type_name = %p\n", &search_constant_type_c::time_type_name); |
|
334 printf("00::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): search_constant_type::invalid_type_name = %p\n", &search_constant_type_c::invalid_type_name); |
|
335 |
|
336 printf("11::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): param_value.datatype = %p\n", param_value.datatype); |
|
337 identifier_c variable_name(param_name); |
330 identifier_c variable_name(param_name); |
338 // SYM_REF1(il_assign_operator_c, variable_name) |
331 // SYM_REF1(il_assign_operator_c, variable_name) |
339 il_assign_operator_c il_assign_operator(&variable_name); |
332 il_assign_operator_c il_assign_operator(&variable_name); |
340 // SYM_REF3(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list) |
333 // SYM_REF3(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list) |
341 il_param_assignment_c il_param_assignment(&il_assign_operator, ¶m_value/*il_operand*/, NULL); |
334 il_param_assignment_c il_param_assignment(&il_assign_operator, ¶m_value/*il_operand*/, NULL); |
342 il_param_list_c il_param_list; |
335 il_param_list_c il_param_list; |
343 il_param_list.add_element(&il_param_assignment); |
336 il_param_list.add_element(&il_param_assignment); |
344 // SYM_REF4(il_fb_call_c, il_call_operator, fb_name, il_operand_list, il_param_list, symbol_c *called_fb_declaration) |
337 // SYM_REF4(il_fb_call_c, il_call_operator, fb_name, il_operand_list, il_param_list, symbol_c *called_fb_declaration) |
345 CAL_operator_c CAL_operator; |
338 CAL_operator_c CAL_operator; |
346 il_fb_call_c il_fb_call(&CAL_operator, il_operand, NULL, &il_param_list); |
339 il_fb_call_c il_fb_call(&CAL_operator, il_operand, NULL, &il_param_list); |
347 printf("22::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): param_value.datatype = %p\n", param_value.datatype); |
|
348 |
340 |
349 /* A FB call does not return any datatype, but the IL instructions that come after this |
341 /* A FB call does not return any datatype, but the IL instructions that come after this |
350 * FB call may require a specific datatype in the il current/default variable, |
342 * FB call may require a specific datatype in the il current/default variable, |
351 * so we must pass this information up to the IL instruction before the FB call, since it will |
343 * so we must pass this information up to the IL instruction before the FB call, since it will |
352 * be that IL instruction that will be required to produce the desired dtataype. |
344 * be that IL instruction that will be required to produce the desired dtataype. |
355 * correctly set up the il_fb_call.datatype variable! |
347 * correctly set up the il_fb_call.datatype variable! |
356 */ |
348 */ |
357 // copy_candidate_datatype_list(il_instruction/*from*/, &il_fb_call/*to*/); |
349 // copy_candidate_datatype_list(il_instruction/*from*/, &il_fb_call/*to*/); |
358 il_fb_call.called_fb_declaration = called_fb_declaration; |
350 il_fb_call.called_fb_declaration = called_fb_declaration; |
359 il_fb_call.accept(*this); |
351 il_fb_call.accept(*this); |
360 printf("33::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): param_value.datatype = %p\n", param_value.datatype); |
|
361 |
352 |
362 /* set the required datatype of the previous IL instruction! */ |
353 /* set the required datatype of the previous IL instruction! */ |
363 /* NOTE: |
354 /* NOTE: |
364 * When handling these implicit IL calls, the parameter_value being passed to the FB parameter |
355 * When handling these implicit IL calls, the parameter_value being passed to the FB parameter |
365 * is actually the prev_il_instruction. |
356 * is actually the prev_il_instruction. |
378 * However, sometimes, (for e.g., this FB call is the last in the IL list) the subsequent FB to not aks this |
369 * However, sometimes, (for e.g., this FB call is the last in the IL list) the subsequent FB to not aks this |
379 * FB call for any datatype. In that case, then the datatype required to pass to the first parameter of the |
370 * FB call for any datatype. In that case, then the datatype required to pass to the first parameter of the |
380 * FB call must be left unchanged! |
371 * FB call must be left unchanged! |
381 */ |
372 */ |
382 if ((NULL == il_instruction->datatype) || (is_type_equal(param_value.datatype, il_instruction->datatype))) { |
373 if ((NULL == il_instruction->datatype) || (is_type_equal(param_value.datatype, il_instruction->datatype))) { |
383 printf("44::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): param_value.datatype = %p\n", param_value.datatype); |
|
384 set_datatype_in_prev_il_instructions(param_value.datatype, fake_prev_il_instruction); |
374 set_datatype_in_prev_il_instructions(param_value.datatype, fake_prev_il_instruction); |
385 } else { |
375 } else { |
386 printf("55::narrow_candidate_datatypes_c::narrow_implicit_il_fb_call(): param_value.datatype = %p\n", param_value.datatype); |
|
387 set_datatype_in_prev_il_instructions(&search_constant_type_c::invalid_type_name, fake_prev_il_instruction); |
376 set_datatype_in_prev_il_instructions(&search_constant_type_c::invalid_type_name, fake_prev_il_instruction); |
388 } |
377 } |
389 return NULL; |
378 return NULL; |
390 } |
379 } |
391 |
380 |