Mercurial > hg > octave-nkf
diff libinterp/parse-tree/pt-arg-list.cc @ 16285:3389152014ca
improve validation of left hand side of assignment expressions in parser
* pt-arg-list.cc (tree_argument_list::is_valid_lvalue_list):
* oct-parse.in.yy (octave_parser::validate_for_assignment):
Improve checks.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 11 Mar 2013 18:19:10 -0400 |
parents | 2fc554ffbc28 |
children | 11115c237231 |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-arg-list.cc +++ b/libinterp/parse-tree/pt-arg-list.cc @@ -99,6 +99,29 @@ return true; } +bool +tree_argument_list::is_valid_lvalue_list (void) const +{ + bool retval = true; + + for (const_iterator p = begin (); p != end (); p++) + { + tree_expression *elt = *p; + + // There is no need for a separate check for the magic "~" because + // it represented by tree_black_hole, and that is derived from + // tree_identifier. + + if (! (elt->is_identifier () || elt->is_index_expression ())) + { + retval = false; + break; + } + } + + return retval; +} + static const octave_value *indexed_object = 0; static int index_position = 0; static int num_indices = 0;