changeset 3965:edd758a7ca8d

[project @ 2002-06-28 19:00:56 by jwe]
author jwe
date Fri, 28 Jun 2002 19:00:56 +0000
parents 3030cb6cb559
children c5cf860b756d
files src/ChangeLog src/pt-assign.cc src/pt-binop.cc src/pt-colon.cc src/pt-decl.cc src/pt-idx.cc src/pt-loop.cc src/pt-select.cc src/pt-unop.cc
diffstat 9 files changed, 63 insertions(+), 67 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
+2002-06-28  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* pt-decl.cc (tree_static_command::eval, tree_global_command::eval):
+	Call error for any non-zero value of error_state.
+	* pt-select.cc (tree_if_command::eval): Likewise.
+	* pt-loop.cc (tree_while_command::eval_error): Don't check error_state.
+	(tree_do_until_command::eval_error): Likewise.
+	(tree_simple_for_command::eval_error): Likewise.
+	(tree_complex_for_command::eval_error): Likewise.
+	* pt-assign.cc (tree_multi_assignment::eval_error): Likewise.
+	(tree_simple_assignment::eval_error): Likewise.
+	* pt-idx.cc (tree_index_expression::eval_error): Likewise.
+	* pt-colon.cc (tree_colon_expression::eval_error): Likewise.
+	(tree_colon_expression::rvalue): Delete rendundant error_state check.
+
 2002-06-26  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* ov-mapper.cc (MAPPER_LOOP, MAPPER_LOOP_1, MAPPER_LOOP_2): New	macros.
--- a/src/pt-assign.cc
+++ b/src/pt-assign.cc
@@ -152,15 +152,12 @@
 void
 tree_simple_assignment::eval_error (void)
 {
-  if (error_state > 0)
-    {
-      int l = line ();
-      int c = column ();
+  int l = line ();
+  int c = column ();
 
-      if (l != -1 && c != -1)
-	::error ("evaluating assignment expression near line %d, column %d",
-		 l, c);
-    }
+  if (l != -1 && c != -1)
+    ::error ("evaluating assignment expression near line %d, column %d",
+	     l, c);
 }
 
 std::string
@@ -301,15 +298,12 @@
 void
 tree_multi_assignment::eval_error (void)
 {
-  if (error_state > 0)
-    {
-      int l = line ();
-      int c = column ();
+  int l = line ();
+  int c = column ();
 
-      if (l != -1 && c != -1)
-	::error ("evaluating assignment expression near line %d, column %d",
-		 l, c);
-    }
+  if (l != -1 && c != -1)
+    ::error ("evaluating assignment expression near line %d, column %d",
+	     l, c);
 }
 
 std::string
--- a/src/pt-binop.cc
+++ b/src/pt-binop.cc
@@ -98,9 +98,8 @@
 void
 tree_binary_expression::eval_error (void)
 {
-  if (error_state > 0)
-    ::error ("evaluating binary operator `%s' near line %d, column %d",
-	     oper () . c_str (), line (), column ());
+  ::error ("evaluating binary operator `%s' near line %d, column %d",
+	   oper () . c_str (), line (), column ());
 }
 
 std::string
--- a/src/pt-colon.cc
+++ b/src/pt-colon.cc
@@ -151,10 +151,8 @@
 
   if (error_state)
     {
-      if (error_state)
-	eval_error ();
-
-      return octave_value ();
+      retval = octave_value ();
+      eval_error ();
     }
 
   return retval;
@@ -163,14 +161,11 @@
 void
 tree_colon_expression::eval_error (const std::string& s)
 {
-  if (error_state > 0)
-    {
-      if (! s.empty ())
-	::error ("%s", s.c_str ());
+  if (! s.empty ())
+    ::error ("%s", s.c_str ());
 
-      ::error ("evaluating colon expression near line %d column %d",
-	       line (), column ());
-    }
+  ::error ("evaluating colon expression near line %d column %d",
+	   line (), column ());
 }
 
 void
--- a/src/pt-decl.cc
+++ b/src/pt-decl.cc
@@ -130,7 +130,7 @@
       initialized = true;
     }
 
-  if (error_state > 0)
+  if (error_state)
     ::error ("evaluating global command near line %d, column %d",
 	     line (), column ());
 }
@@ -170,7 +170,7 @@
 
       initialized = true;
 
-      if (error_state > 0)
+      if (error_state)
 	::error ("evaluating static command near line %d, column %d",
 		 line (), column ());
     }
--- a/src/pt-idx.cc
+++ b/src/pt-idx.cc
@@ -317,25 +317,22 @@
 void
 tree_index_expression::eval_error (void)
 {
-  if (error_state > 0)
-    {
-      int l = line ();
-      int c = column ();
+  int l = line ();
+  int c = column ();
 
-      const char *type_str;
+  const char *type_str;
 
-      if (type[0] == '.')
-	type_str = "structure reference operator";
-      else if (args.front ())
-	type_str = "index expression";
-      else
-	type_str = "expression";
+  if (type[0] == '.')
+    type_str = "structure reference operator";
+  else if (args.front ())
+    type_str = "index expression";
+  else
+    type_str = "expression";
 
-      if (l != -1 && c != -1)
-	::error ("evaluating %s near line %d, column %d", type_str, l, c);
-      else
-	::error ("evaluating %s", type_str);
-    }
+  if (l != -1 && c != -1)
+    ::error ("evaluating %s near line %d, column %d", type_str, l, c);
+  else
+    ::error ("evaluating %s", type_str);
 }
 
 void
--- a/src/pt-loop.cc
+++ b/src/pt-loop.cc
@@ -120,9 +120,8 @@
 void
 tree_while_command::eval_error (void)
 {
-  if (error_state > 0)
-    ::error ("evaluating while command near line %d, column %d",
-	     line (), column ());
+  ::error ("evaluating while command near line %d, column %d",
+	   line (), column ());
 }
 
 void
@@ -174,9 +173,8 @@
 void
 tree_do_until_command::eval_error (void)
 {
-  if (error_state > 0)
-    ::error ("evaluating do-until command near line %d, column %d",
-	     line (), column ());
+  ::error ("evaluating do-until command near line %d, column %d",
+	   line (), column ());
 }
 
 void
@@ -399,9 +397,8 @@
 void
 tree_simple_for_command::eval_error (void)
 {
-  if (error_state > 0)
-    ::error ("evaluating for command near line %d, column %d",
-	     line (), column ());
+  ::error ("evaluating for command near line %d, column %d",
+	   line (), column ());
 }
 
 void
@@ -507,9 +504,8 @@
 void
 tree_complex_for_command::eval_error (void)
 {
-  if (error_state > 0)
-    ::error ("evaluating for command near line %d, column %d",
-	     line (), column ());
+  ::error ("evaluating for command near line %d, column %d",
+	   line (), column ());
 }
 
 void
--- a/src/pt-select.cc
+++ b/src/pt-select.cc
@@ -103,7 +103,7 @@
   if (list)
     list->eval ();
 
-  if (error_state > 0)
+  if (error_state)
     ::error ("evaluating if command near line %d, column %d",
 	     line (), column ());
 }
--- a/src/pt-unop.cc
+++ b/src/pt-unop.cc
@@ -110,6 +110,8 @@
 	    eval_error ();
 	}
     }
+  else
+    eval_error ();
 
   return retval;
 }
@@ -117,9 +119,8 @@
 void
 tree_prefix_expression::eval_error (void)
 {
-  if (error_state > 0)
-    ::error ("evaluating prefix operator `%s' near line %d, column %d",
-	     oper () . c_str (), line (), column ());
+  ::error ("evaluating prefix operator `%s' near line %d, column %d",
+	   oper () . c_str (), line (), column ());
 }
 
 void
@@ -203,9 +204,8 @@
 void
 tree_postfix_expression::eval_error (void)
 {
-  if (error_state > 0)
-    ::error ("evaluating postfix operator `%s' near line %d, column %d",
-	     oper () . c_str (), line (), column ());
+  ::error ("evaluating postfix operator `%s' near line %d, column %d",
+	   oper () . c_str (), line (), column ());
 }
 
 void