# HG changeset patch # User mjsousa # Date 1377195130 -3600 # Node ID 5fa872f3d073328e36ec2476382e7e4d34ddc235 # Parent 39c755f41ee8e1f81f5ff5b40ccd853563eb8a11 Add code to check if an IN_OUT variable is being passed an IL list in formal IL FB/function invocations. diff -r 39c755f41ee8 -r 5fa872f3d073 stage3/lvalue_check.cc --- a/stage3/lvalue_check.cc Thu Aug 22 18:50:43 2013 +0100 +++ b/stage3/lvalue_check.cc Thu Aug 22 19:12:10 2013 +0100 @@ -163,9 +163,6 @@ /* No assigning values to expressions. */ void lvalue_check_c::check_assignment_to_expression(symbol_c *lvalue) { - /* This may occur in function invocations, when passing values (possibly an expression) to one - * of the function's OUTPUT or IN_OUT parameters. - */ /* This may occur in function invocations, when passing values (possibly an expression) to one * of the function's OUTPUT or IN_OUT parameters. */ @@ -238,6 +235,22 @@ +/* No assigning values to IL lists. */ +void lvalue_check_c::check_assignment_to_il_list(symbol_c *lvalue) { + /* This may occur in formal invocations in IL, where an embedded IL list may be used instead of a symbolic_variable + * when passing an IN_OUT parameter! Note that it will never occur to OUT parameters, as the syntax does not allow it, + * although this does not affect out algorithm here! + */ + if ( + /****************************************/ + /* B.2 - Language IL (Instruction List) */ + /****************************************/ + /***********************************/ + /* B 2.1 Instructions and Operands */ + /***********************************/ + (typeid( *lvalue ) == typeid( simple_instr_list_c))) + STAGE3_ERROR(0, lvalue, lvalue, "Assigning an IL list IN_OUT parameter is not allowed."); +} @@ -246,9 +259,10 @@ if (NULL == lvalue) return; // missing operand in source code being compiled. Error will be caught and reported by datatype checking! int init_error_count = error_count; /* stop the checks once an error has been found... */ if (error_count == init_error_count) check_assignment_to_expression(lvalue); + if (error_count == init_error_count) check_assignment_to_il_list (lvalue); if (error_count == init_error_count) check_assignment_to_controlvar(lvalue); - if (error_count == init_error_count) check_assignment_to_output(lvalue); - if (error_count == init_error_count) check_assignment_to_constant(lvalue); + if (error_count == init_error_count) check_assignment_to_output (lvalue); + if (error_count == init_error_count) check_assignment_to_constant (lvalue); } diff -r 39c755f41ee8 -r 5fa872f3d073 stage3/lvalue_check.hh --- a/stage3/lvalue_check.hh Thu Aug 22 18:50:43 2013 +0100 +++ b/stage3/lvalue_check.hh Thu Aug 22 19:12:10 2013 +0100 @@ -60,6 +60,8 @@ void check_assignment_to_output (symbol_c *lvalue); void check_assignment_to_constant (symbol_c *lvalue); void check_assignment_to_expression(symbol_c *lvalue); + void check_assignment_to_il_list (symbol_c *lvalue); + void check_formal_call (symbol_c *f_call, symbol_c *f_decl); void check_nonformal_call(symbol_c *f_call, symbol_c *f_decl);