94 if (NULL == symbol->datatype) |
94 if (NULL == symbol->datatype) |
95 /* not yet set to anything, so we set it to the requested data type */ |
95 /* not yet set to anything, so we set it to the requested data type */ |
96 symbol->datatype = datatype; |
96 symbol->datatype = datatype; |
97 else { |
97 else { |
98 /* had already been set previously to some data type. Let's check if they are the same! */ |
98 /* had already been set previously to some data type. Let's check if they are the same! */ |
99 if (!is_type_equal(symbol->datatype, datatype)) |
99 if (!get_datatype_info_c::is_type_equal(symbol->datatype, datatype)) |
100 symbol->datatype = &(search_constant_type_c::invalid_type_name); |
100 symbol->datatype = &(search_constant_type_c::invalid_type_name); |
101 // else |
101 // else |
102 /* we leave it unchanged, as it is the same as the requested data type! */ |
102 /* we leave it unchanged, as it is the same as the requested data type! */ |
103 } |
103 } |
104 } |
104 } |
271 /* set the called_function_declaration. */ |
271 /* set the called_function_declaration. */ |
272 fcall_data.called_function_declaration = NULL; |
272 fcall_data.called_function_declaration = NULL; |
273 |
273 |
274 /* set the called_function_declaration taking into account the datatype that we need to return */ |
274 /* set the called_function_declaration taking into account the datatype that we need to return */ |
275 for(unsigned int i = 0; i < fcall->candidate_datatypes.size(); i++) { |
275 for(unsigned int i = 0; i < fcall->candidate_datatypes.size(); i++) { |
276 if (is_type_equal(fcall->candidate_datatypes[i], fcall->datatype)) { |
276 if (get_datatype_info_c::is_type_equal(fcall->candidate_datatypes[i], fcall->datatype)) { |
277 fcall_data.called_function_declaration = fcall_data.candidate_functions[i]; |
277 fcall_data.called_function_declaration = fcall_data.candidate_functions[i]; |
278 break; |
278 break; |
279 } |
279 } |
280 } |
280 } |
281 |
281 |
396 * datatype in the current/default vairable, once this IL FB call returns. |
396 * datatype in the current/default vairable, once this IL FB call returns. |
397 * However, sometimes, (for e.g., this FB call is the last in the IL list) the subsequent FB to not aks this |
397 * However, sometimes, (for e.g., this FB call is the last in the IL list) the subsequent FB to not aks this |
398 * FB call for any datatype. In that case, then the datatype required to pass to the first parameter of the |
398 * FB call for any datatype. In that case, then the datatype required to pass to the first parameter of the |
399 * FB call must be left unchanged! |
399 * FB call must be left unchanged! |
400 */ |
400 */ |
401 if ((NULL == il_instruction->datatype) || (is_type_equal(param_value.datatype, il_instruction->datatype))) { |
401 if ((NULL == il_instruction->datatype) || (get_datatype_info_c::is_type_equal(param_value.datatype, il_instruction->datatype))) { |
402 set_datatype_in_prev_il_instructions(param_value.datatype, fake_prev_il_instruction); |
402 set_datatype_in_prev_il_instructions(param_value.datatype, fake_prev_il_instruction); |
403 } else { |
403 } else { |
404 set_datatype_in_prev_il_instructions(&search_constant_type_c::invalid_type_name, fake_prev_il_instruction); |
404 set_datatype_in_prev_il_instructions(&search_constant_type_c::invalid_type_name, fake_prev_il_instruction); |
405 } |
405 } |
406 return NULL; |
406 return NULL; |
1276 |
1276 |
1277 // SYM_LIST(case_list_c) |
1277 // SYM_LIST(case_list_c) |
1278 void *narrow_candidate_datatypes_c::visit(case_list_c *symbol) { |
1278 void *narrow_candidate_datatypes_c::visit(case_list_c *symbol) { |
1279 for (int i = 0; i < symbol->n; i++) { |
1279 for (int i = 0; i < symbol->n; i++) { |
1280 for (unsigned int k = 0; k < symbol->elements[i]->candidate_datatypes.size(); k++) { |
1280 for (unsigned int k = 0; k < symbol->elements[i]->candidate_datatypes.size(); k++) { |
1281 if (is_type_equal(symbol->datatype, symbol->elements[i]->candidate_datatypes[k])) |
1281 if (get_datatype_info_c::is_type_equal(symbol->datatype, symbol->elements[i]->candidate_datatypes[k])) |
1282 symbol->elements[i]->datatype = symbol->elements[i]->candidate_datatypes[k]; |
1282 symbol->elements[i]->datatype = symbol->elements[i]->candidate_datatypes[k]; |
1283 } |
1283 } |
1284 /* NOTE: this may be an integer, a subrange_c, or a enumerated value! */ |
1284 /* NOTE: this may be an integer, a subrange_c, or a enumerated value! */ |
1285 symbol->elements[i]->accept(*this); |
1285 symbol->elements[i]->accept(*this); |
1286 } |
1286 } |
1299 } |
1299 } |
1300 } |
1300 } |
1301 symbol->control_variable->accept(*this); |
1301 symbol->control_variable->accept(*this); |
1302 /* BEG expression */ |
1302 /* BEG expression */ |
1303 for(unsigned int i = 0; i < symbol->beg_expression->candidate_datatypes.size(); i++) { |
1303 for(unsigned int i = 0; i < symbol->beg_expression->candidate_datatypes.size(); i++) { |
1304 if (is_type_equal(symbol->control_variable->datatype,symbol->beg_expression->candidate_datatypes[i]) && |
1304 if (get_datatype_info_c::is_type_equal(symbol->control_variable->datatype,symbol->beg_expression->candidate_datatypes[i]) && |
1305 get_datatype_info_c::is_ANY_INT(symbol->beg_expression->candidate_datatypes[i])) { |
1305 get_datatype_info_c::is_ANY_INT(symbol->beg_expression->candidate_datatypes[i])) { |
1306 symbol->beg_expression->datatype = symbol->beg_expression->candidate_datatypes[i]; |
1306 symbol->beg_expression->datatype = symbol->beg_expression->candidate_datatypes[i]; |
1307 } |
1307 } |
1308 } |
1308 } |
1309 symbol->beg_expression->accept(*this); |
1309 symbol->beg_expression->accept(*this); |
1310 /* END expression */ |
1310 /* END expression */ |
1311 for(unsigned int i = 0; i < symbol->end_expression->candidate_datatypes.size(); i++) { |
1311 for(unsigned int i = 0; i < symbol->end_expression->candidate_datatypes.size(); i++) { |
1312 if (is_type_equal(symbol->control_variable->datatype,symbol->end_expression->candidate_datatypes[i]) && |
1312 if (get_datatype_info_c::is_type_equal(symbol->control_variable->datatype,symbol->end_expression->candidate_datatypes[i]) && |
1313 get_datatype_info_c::is_ANY_INT(symbol->end_expression->candidate_datatypes[i])) { |
1313 get_datatype_info_c::is_ANY_INT(symbol->end_expression->candidate_datatypes[i])) { |
1314 symbol->end_expression->datatype = symbol->end_expression->candidate_datatypes[i]; |
1314 symbol->end_expression->datatype = symbol->end_expression->candidate_datatypes[i]; |
1315 } |
1315 } |
1316 } |
1316 } |
1317 symbol->end_expression->accept(*this); |
1317 symbol->end_expression->accept(*this); |
1318 /* BY expression */ |
1318 /* BY expression */ |
1319 if (NULL != symbol->by_expression) { |
1319 if (NULL != symbol->by_expression) { |
1320 for(unsigned int i = 0; i < symbol->by_expression->candidate_datatypes.size(); i++) { |
1320 for(unsigned int i = 0; i < symbol->by_expression->candidate_datatypes.size(); i++) { |
1321 if (is_type_equal(symbol->control_variable->datatype,symbol->by_expression->candidate_datatypes[i]) && |
1321 if (get_datatype_info_c::is_type_equal(symbol->control_variable->datatype,symbol->by_expression->candidate_datatypes[i]) && |
1322 get_datatype_info_c::is_ANY_INT(symbol->by_expression->candidate_datatypes[i])) { |
1322 get_datatype_info_c::is_ANY_INT(symbol->by_expression->candidate_datatypes[i])) { |
1323 symbol->by_expression->datatype = symbol->by_expression->candidate_datatypes[i]; |
1323 symbol->by_expression->datatype = symbol->by_expression->candidate_datatypes[i]; |
1324 } |
1324 } |
1325 } |
1325 } |
1326 symbol->by_expression->accept(*this); |
1326 symbol->by_expression->accept(*this); |