changeset 3940:1b58576bdaa6

[project @ 2002-05-16 18:11:50 by jwe]
author jwe
date Thu, 16 May 2002 18:11:50 +0000
parents 3dd8d3dc28d4
children fab8337340a1
files src/ChangeLog src/oct-lvalue.cc src/ov-cell.cc src/ov-list.cc
diffstat 4 files changed, 57 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu May 16 16:34:20 2002 +0000
+++ b/src/ChangeLog	Thu May 16 18:11:50 2002 +0000
@@ -1,5 +1,11 @@
 2002-05-16  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* ov-cell.cc (octave_cell::subsasgn): If an error has occurred,
+	skip final assignment step.
+	* ov-list.cc (octave_list::subsasgn): Likewise.
+	* oct-lvalue.cc (octave_lvalue::assign): Add parens to clarify intent.
+	(octave_lvalue::do_unary_op): Likewise.
+
 	* parse.y (function_end): Also accept end of input as end of
 	function if input is coming from an eval string.
 
--- a/src/oct-lvalue.cc	Thu May 16 16:34:20 2002 +0000
+++ b/src/oct-lvalue.cc	Thu May 16 18:11:50 2002 +0000
@@ -36,7 +36,7 @@
 		    ? val->assign (op, rhs)
 		    : val->assign (op, type, idx, rhs));
 
-  if (! (error_state || chg_fcn && chg_fcn () < 0))
+  if (! (error_state || (chg_fcn && chg_fcn () < 0)))
     *val = tmp;
 }
 
@@ -61,7 +61,7 @@
 		    ? val->do_non_const_unary_op (op)
 		    : val->do_non_const_unary_op (op, type, idx));
 
-  if (! (error_state || chg_fcn && chg_fcn () < 0))
+  if (! (error_state || (chg_fcn && chg_fcn () < 0)))
     *val = tmp;
 }
 
--- a/src/ov-cell.cc	Thu May 16 16:34:20 2002 +0000
+++ b/src/ov-cell.cc	Thu May 16 18:11:50 2002 +0000
@@ -165,40 +165,43 @@
 	}
     }
 
-  switch (type[0])
+  if (! error_state)
     {
-    case '(':
-      {
-	octave_value_list i = idx.front ();
+      switch (type[0])
+	{
+	case '(':
+	  {
+	    octave_value_list i = idx.front ();
 
-	if (t_rhs.is_cell ())
-	  octave_base_matrix<Cell>::assign (i, t_rhs.cell_value ());
-	else
-	  octave_base_matrix<Cell>::assign (i, Cell (t_rhs));
+	    if (t_rhs.is_cell ())
+	      octave_base_matrix<Cell>::assign (i, t_rhs.cell_value ());
+	    else
+	      octave_base_matrix<Cell>::assign (i, Cell (t_rhs));
 
-	retval = octave_value (this, count + 1);
-      }
-      break;
+	    retval = octave_value (this, count + 1);
+	  }
+	  break;
 
-    case '{':
-      {
-	octave_value_list i = idx.front ();
+	case '{':
+	  {
+	    octave_value_list i = idx.front ();
 
-	octave_base_matrix<Cell>::assign (i, Cell (t_rhs));
+	    octave_base_matrix<Cell>::assign (i, Cell (t_rhs));
 
-	retval = octave_value (this, count + 1);
-      }
-      break;
+	    retval = octave_value (this, count + 1);
+	  }
+	  break;
 
-    case '.':
-      {
-	std::string nm = type_name ();
-	error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
+	case '.':
+	  {
+	    std::string nm = type_name ();
+	    error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+	  }
+	  break;
 
-    default:
-      panic_impossible ();
+	default:
+	  panic_impossible ();
+	}
     }
 
   return retval;
--- a/src/ov-list.cc	Thu May 16 16:34:20 2002 +0000
+++ b/src/ov-list.cc	Thu May 16 18:11:50 2002 +0000
@@ -160,28 +160,31 @@
 	}
     }
 
-  switch (type[0])
+  if (! error_state)
     {
-    case '(':
-      {
-	octave_value_list i = idx.front ();
+      switch (type[0])
+	{
+	case '(':
+	  {
+	    octave_value_list i = idx.front ();
 
-	assign (i, t_rhs);
+	    assign (i, t_rhs);
 
-	retval = octave_value (this, count + 1);
-      }
-      break;
+	    retval = octave_value (this, count + 1);
+	  }
+	  break;
 
-    case '{':
-    case '.':
-      {
-	std::string nm = type_name ();
-	error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
+	case '{':
+	case '.':
+	  {
+	    std::string nm = type_name ();
+	    error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+	  }
+	  break;
 
-    default:
-      panic_impossible ();
+	default:
+	  panic_impossible ();
+	}
     }
 
   return retval;