equal
deleted
inserted
replaced
98 |
98 |
99 /* fb_instance.var := ... is not valid if var is output variable */ |
99 /* fb_instance.var := ... is not valid if var is output variable */ |
100 /* NOTE, if a fb_instance1.fb_instance2.fb_instance3.var is used, we must iteratively check that none of the |
100 /* NOTE, if a fb_instance1.fb_instance2.fb_instance3.var is used, we must iteratively check that none of the |
101 * FB records are declared as OUTPUT variables!! |
101 * FB records are declared as OUTPUT variables!! |
102 * This is the reason why we have the while() loop in this function! |
102 * This is the reason why we have the while() loop in this function! |
|
103 * |
|
104 * Note, however, that the first record (fb_instance1 in the above example) may be an output variable! |
103 */ |
105 */ |
104 void lvalue_check_c::check_assignment_to_output(symbol_c *lvalue) { |
106 void lvalue_check_c::check_assignment_to_output(symbol_c *lvalue) { |
105 decompose_var_instance_name_c decompose_lvalue(lvalue); |
107 decompose_var_instance_name_c decompose_lvalue(lvalue); |
106 search_base_type_c search_base_type; |
108 search_base_type_c search_base_type; |
107 |
109 |
276 } while ((strcmp(param_name->value, "EN") == 0) || (strcmp(param_name->value, "ENO") == 0)); |
278 } while ((strcmp(param_name->value, "EN") == 0) || (strcmp(param_name->value, "ENO") == 0)); |
277 |
279 |
278 /* Determine the direction (IN, OUT, IN_OUT) of the parameter... */ |
280 /* Determine the direction (IN, OUT, IN_OUT) of the parameter... */ |
279 function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
281 function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
280 |
282 |
281 /* We only check if 'call_param_value' is a valid lvalue if the value is being passed |
283 /* We only process the parameter value if the paramater itself is valid... */ |
282 * to a valid paramater of the function being called, and that parameter is either OUT or IN_OUT. |
284 if (param_name != NULL) { |
283 */ |
285 /* If the parameter is either OUT or IN_OUT, we check if 'call_param_value' is a valid lvalue */ |
284 if ((param_name != NULL) && ((function_param_iterator_c::direction_out == param_direction) || (function_param_iterator_c::direction_inout == param_direction))) { |
286 if ((function_param_iterator_c::direction_out == param_direction) || (function_param_iterator_c::direction_inout == param_direction)) |
285 verify_is_lvalue(call_param_value); |
287 verify_is_lvalue(call_param_value); |
|
288 /* parameter values to IN parameters may be expressions with function invocations that must also be checked! */ |
|
289 if (function_param_iterator_c::direction_in == param_direction) |
|
290 call_param_value->accept(*this); |
286 } |
291 } |
287 } |
292 } |
288 } |
293 } |
289 |
294 |
290 |
295 |
313 |
318 |
314 /* Find the corresponding parameter in function declaration, and it's direction (IN, OUT, IN_OUT) */ |
319 /* Find the corresponding parameter in function declaration, and it's direction (IN, OUT, IN_OUT) */ |
315 identifier_c *param_name = fp_iterator.search(call_param_name); |
320 identifier_c *param_name = fp_iterator.search(call_param_name); |
316 function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
321 function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
317 |
322 |
318 /* We only check if 'call_param_value' is a valid lvalue if the value is being passed |
323 /* We only process the parameter value if the paramater itself is valid... */ |
319 * to a valid paramater of the function being called, and that parameter is either OUT or IN_OUT. |
324 if (param_name != NULL) { |
320 */ |
325 /* If the parameter is either OUT or IN_OUT, we check if 'call_param_value' is a valid lvalue */ |
321 if ((param_name != NULL) && ((function_param_iterator_c::direction_out == param_direction) || (function_param_iterator_c::direction_inout == param_direction))) { |
326 if ((function_param_iterator_c::direction_out == param_direction) || (function_param_iterator_c::direction_inout == param_direction)) |
322 verify_is_lvalue(call_param_value); |
327 verify_is_lvalue(call_param_value); |
323 } |
328 /* parameter values to IN parameters may be expressions with function invocations that must also be checked! */ |
|
329 if (function_param_iterator_c::direction_in == param_direction) |
|
330 call_param_value->accept(*this); |
|
331 |
|
332 } |
324 } |
333 } |
325 } |
334 } |
326 |
335 |
327 |
336 |
328 |
337 |