# HG changeset patch # User John W. Eaton # Date 1371048629 14400 # Node ID 787168f5f858b52492ee8e3e987482db015c1ada # Parent 022dba56de1e78b660f036efda6fdfdd3cc34234 tag symbols in indexed assignments as variables (bug #39240) * pt-arg-list.cc (tree_argument_list::variable_names): Also return the symbol names from index expressions. * parser.tst: New test. diff -r 022dba56de1e -r 787168f5f858 libinterp/parse-tree/pt-arg-list.cc --- a/libinterp/parse-tree/pt-arg-list.cc Wed Jun 12 10:03:50 2013 -0400 +++ b/libinterp/parse-tree/pt-arg-list.cc Wed Jun 12 10:50:29 2013 -0400 @@ -298,6 +298,13 @@ retval.push_back (id->name ()); } + else if (elt->is_index_expression ()) + { + tree_index_expression *idx_expr + = dynamic_cast (elt); + + retval.push_back (idx_expr->name ()); + } } return retval; diff -r 022dba56de1e -r 787168f5f858 test/parser.tst --- a/test/parser.tst Wed Jun 12 10:03:50 2013 -0400 +++ b/test/parser.tst Wed Jun 12 10:50:29 2013 -0400 @@ -257,3 +257,9 @@ %! R = @(rot) [cos(rot) -sin(rot); sin(rot) cos(rot)]; %! assert (R(pi/2), [cos(pi/2), -sin(pi/2); sin(pi/2),cos(pi/2)]); +## Check that xyz is tagged as a variable in the parser. Both +## expressions must remain on one line for this test to work as +## intended. +%!test +%! xyz(1) = 1; xyz /= 1; +%! assert (xyz, 1);