Mercurial > hg > octave-nkf
diff src/pt-assign.cc @ 3977:95663a3a2682
[project @ 2002-07-05 17:43:37 by jwe]
author | jwe |
---|---|
date | Fri, 05 Jul 2002 17:43:38 +0000 |
parents | edd758a7ca8d |
children | b79da8779a0e |
line wrap: on
line diff
--- a/src/pt-assign.cc +++ b/src/pt-assign.cc @@ -208,84 +208,86 @@ if (rhs) { - int n_out = lhs->length (); + int n_out = lhs->nargout_count (); + + if (error_state) + return retval; octave_value_list rhs_val = rhs->rvalue (n_out); - if (! error_state) - { - if (rhs_val.empty ()) - { - error ("value on right hand side of assignment is undefined"); - eval_error (); - } - else - { - int k = 0; - - int n = rhs_val.length (); + if (error_state) + return retval; - retval.resize (n, octave_value ()); - - for (Pix p = lhs->first (); p != 0; lhs->next (p)) - { - tree_expression *lhs_elt = lhs->operator () (p); + if (rhs_val.empty ()) + { + error ("value on right hand side of assignment is undefined"); + eval_error (); + } + else + { + int k = 0; - if (lhs_elt) - { - octave_lvalue ult = lhs_elt->lvalue (); + int n = rhs_val.length (); - if (error_state) - eval_error (); - else if (k < n) - { - ult.assign (etype, rhs_val(k)); + retval.resize (n, octave_value ()); - if (! error_state) - { - if (etype == octave_value::op_asn_eq) - retval(k) = rhs_val(k); - else - retval(k) = ult.value (); - } - } - else - error ("element number %d undefined in return list", - k+1); + for (Pix p = lhs->first (); p != 0; lhs->next (p)) + { + tree_expression *lhs_elt = lhs->operator () (p); + + if (lhs_elt) + { + octave_lvalue ult = lhs_elt->lvalue (); - if (error_state) - eval_error (); - else if (print_result ()) + if (error_state) + eval_error (); + else if (k < n) + { + ult.assign (etype, rhs_val(k)); + + if (! error_state) { - if (Vprint_rhs_assign_val) - retval(k).print_with_name - (octave_stdout, lhs_elt->str_print_code ()); + if (etype == octave_value::op_asn_eq) + retval(k) = rhs_val(k); else - { - // 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 (); - - octave_value lhs_val = ult.value (); - - if (! error_state) - lhs_val.print_with_name (octave_stdout, - lhs_elt->name ()); - } + retval(k) = ult.value (); } } else - eval_error (); + error ("element number %d undefined in return list", k+1); if (error_state) - break; + eval_error (); + else if (print_result ()) + { + if (Vprint_rhs_assign_val) + retval(k).print_with_name + (octave_stdout, lhs_elt->str_print_code ()); + else + { + // 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 (); - k++; + octave_value lhs_val = ult.value (); + + if (! error_state) + lhs_val.print_with_name (octave_stdout, + lhs_elt->name ()); + } + } } + else + eval_error (); + + if (error_state) + break; + + k++; } } }