# HG changeset patch # User jwe # Date 863759674 0 # Node ID 84c33881d0bc337dae1ae5addf578deb0cb0502e # Parent 145d5acfc68b8da5cb8388b4a822005a0ed94765 [project @ 1997-05-16 05:14:33 by jwe] diff -r 145d5acfc68b -r 84c33881d0bc src/ChangeLog --- a/src/ChangeLog Fri May 16 03:37:38 1997 +0000 +++ b/src/ChangeLog Fri May 16 05:14:34 1997 +0000 @@ -1,3 +1,13 @@ +Fri May 16 00:07:11 1997 John W. Eaton + + * pt-assign.cc (tree_simple_assignment_expression::eval, + tree_multi_assignment_expression::eval): Clear lvalue index here. + + * oct-lvalue.cc (octave_lvalue::assign): Don't clear index here. + * oct-lvalue.h (octave_lvalue::clear_index): New function. + (octave_lvalue::set_index): Rename from octave_lvalue::index. + Change all callers. + Thu May 15 11:48:10 1997 John W. Eaton * pt-select.h, pt-select.cc (class tree_if_command_list, diff -r 145d5acfc68b -r 84c33881d0bc src/oct-lvalue.cc --- a/src/oct-lvalue.cc Fri May 16 03:37:38 1997 +0000 +++ b/src/oct-lvalue.cc Fri May 16 05:14:34 1997 +0000 @@ -53,11 +53,6 @@ if (chg_fcn && chg_fcn () < 0) *val = saved_val; - - // Clear index so subsequent value() operations will not perform an - // indexing operation. - - idx = octave_value_list (); } /* diff -r 145d5acfc68b -r 84c33881d0bc src/oct-lvalue.h --- a/src/oct-lvalue.h Fri May 16 03:37:38 1997 +0000 +++ b/src/oct-lvalue.h Fri May 16 05:14:34 1997 +0000 @@ -75,7 +75,11 @@ octave_lvalue struct_elt_ref (const string& nm) { return val->struct_elt_ref (nm); } - void index (const octave_value_list& i) { idx = i; } + void set_index (const octave_value_list& i) { idx = i; } + + void clear_index (void) { idx = octave_value_list (); } + + // XXX FIXME XXX -- need to handle index increment and decrement too. void increment (void) { val->increment (); } diff -r 145d5acfc68b -r 84c33881d0bc src/pt-assign.cc --- a/src/pt-assign.cc Fri May 16 03:37:38 1997 +0000 +++ b/src/pt-assign.cc Fri May 16 05:14:34 1997 +0000 @@ -77,6 +77,9 @@ return retval; } +// XXX FIXME XXX -- this works, but it would look a little better if +// it were broken up into a couple of separate functions. + octave_value tree_simple_assignment::rvalue (void) { @@ -108,6 +111,13 @@ { ult.assign (etype, rhs_val); + // We clear any index here so that we can get the + // new value of the referenced object below, instead + // of the indexed value (which should be the same as + // the right hand side value). + + ult.clear_index (); + if (error_state) eval_error (); else if (! Vprint_rhs_assign_val) @@ -196,6 +206,9 @@ return retval; } +// XXX FIXME XXX -- this works, but it would look a little better if +// it were broken up into a couple of separate functions. + octave_value_list tree_multi_assignment::rvalue (int) { @@ -242,6 +255,15 @@ { // XXX FIXME XXX -- handle other assignment ops. ult.assign (octave_value::asn_eq, tmp); + + // We clear any index here so that we + // can get the new value of the + // referenced object below, instead of + // the indexed value (which should be + // the same as the right hand side + // value). + + ult.clear_index (); } else error ("element number %d undefined in return list", k); diff -r 145d5acfc68b -r 84c33881d0bc src/pt-idx.cc --- a/src/pt-idx.cc Fri May 16 03:37:38 1997 +0000 +++ b/src/pt-idx.cc Fri May 16 05:14:34 1997 +0000 @@ -110,7 +110,7 @@ if (list) args = list->convert_to_const_vector (); - retval.index (args); + retval.set_index (args); } }