changeset 1492:af2d53865577

[project @ 1995-09-29 04:16:48 by jwe]
author jwe
date Fri, 29 Sep 1995 04:16:48 +0000
parents 893b416bb919
children bfd64ec144d1
files src/pt-exp-base.cc
diffstat 1 files changed, 35 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/src/pt-exp-base.cc	Fri Sep 29 04:08:17 1995 +0000
+++ b/src/pt-exp-base.cc	Fri Sep 29 04:16:48 1995 +0000
@@ -188,56 +188,46 @@
 
   tree_constant t1 = eval (0);
 
-  if (error_state)
-    {
-// XXX FIXME XXX
-//
-//      eval_error ();
-//
-      return expr_value;
-    }
-
-  if (t1.is_undefined ())
+  if (! error_state)
     {
-      ::error ("%s: undefined value used in conditional expression\
- near line %d, column %d", warn_for, line (), column ());
-      return expr_value;
-    }
-
-  if (t1.rows () == 0 || t1.columns () == 0)
-    {
-      int flag = user_pref.propagate_empty_matrices;
-      if (flag < 0)
-	warning ("%s: empty matrix used in conditional expression\
- near line %d, column %d", warn_for, line (), column ());
-      else if (flag == 0)
+      if (t1.is_defined ())
 	{
-	  ::error ("%s: empty matrix used in conditional expression\
- near line %d, column %d", warn_for, line (), column ());
-	  return expr_value;
+	  if (t1.rows () == 0 || t1.columns () == 0)
+	    {
+	      t1 = 0.0;
+	      int flag = user_pref.propagate_empty_matrices;
+	      if (flag < 0)
+		warning ("%s: empty matrix used in conditional expression");
+	      else if (flag == 0)
+		{
+		  ::error ("%s: empty matrix used in conditional expression");
+		  return expr_value;
+		}
+	    }
+	  else if (! t1.is_scalar_type ())
+	    {
+	      tree_constant t2 = t1.all ();
+	      if (! error_state)
+		t1 = t2.all ();
+	    }
+
+	  if (! error_state)
+	    {
+	      if (t1.is_real_scalar ())
+		expr_value = (int) t1.double_value ();
+	      else if (t1.is_complex_scalar ())
+		expr_value = t1.complex_value () != 0.0;
+	      else
+		panic_impossible ();
+	    }
+	  else
+	    ::error ("%s: invalid type in conditional expression");
 	}
-      t1 = 0.0;
+      else
+	::error ("%s: undefined value used in conditional expression");
     }
-  else if (! t1.is_scalar_type ())
-    {
-      tree_constant t2 = t1.all ();
-      if (! error_state)
-	t1 = t2.all ();
-
-      if (error_state)
-	{
-	  ::error ("%s: invalid type in conditional expression near\
- line %d, column %d", warn_for, line (), column ());
-	  return expr_value;
-	}
-    }
-
-  if (t1.is_real_scalar ())
-    expr_value = (int) t1.double_value ();
-  else if (t1.is_complex_scalar ())
-    expr_value = t1.complex_value () != 0.0;
   else
-    panic_impossible ();
+    ::error ("%s: error evaluating conditional expression");
 
   return expr_value;
 }