Mercurial > hg > octave-terminal
changeset 2984:84c33881d0bc
[project @ 1997-05-16 05:14:33 by jwe]
author | jwe |
---|---|
date | Fri, 16 May 1997 05:14:34 +0000 |
parents | 145d5acfc68b |
children | aa9d0c0e0458 |
files | src/ChangeLog src/oct-lvalue.cc src/oct-lvalue.h src/pt-assign.cc src/pt-idx.cc |
diffstat | 5 files changed, 38 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +Fri May 16 00:07:11 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * 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 <jwe@bevo.che.wisc.edu> * pt-select.h, pt-select.cc (class tree_if_command_list,
--- a/src/oct-lvalue.cc +++ b/src/oct-lvalue.cc @@ -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 (); } /*
--- a/src/oct-lvalue.h +++ b/src/oct-lvalue.h @@ -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 (); }
--- a/src/pt-assign.cc +++ b/src/pt-assign.cc @@ -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);