changeset 6657:86354a8cd6a7

[project @ 2007-05-23 04:35:04 by jwe]
author jwe
date Wed, 23 May 2007 04:35:04 +0000
parents c92e679d9cc5
children db6d908e8a03
files src/ChangeLog src/ov-fcn-handle.cc src/ov-usr-fcn.cc src/parse.y
diffstat 4 files changed, 19 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue May 22 21:20:58 2007 +0000
+++ b/src/ChangeLog	Wed May 23 04:35:04 2007 +0000
@@ -1,3 +1,11 @@
+2007-05-23  John W. Eaton  <jwe@octave.org>
+
+	* parse.y (make_anon_fcn_handle): Don't build assignment expression.
+	* ov-fcn-handle.cc (octave_fcn_handle::print_raw):
+	Don't split assignment expression.
+	* ov-usr-fcn.cc (octave_user_function::do_multi_index_op):
+	Special case for inline function body evaluation.
+
 2007-05-22  John W. Eaton  <jwe@octave.org>
 
 	* version.h (OCTAVE_VERSION): Now 2.9.12.
--- a/src/ov-fcn-handle.cc	Tue May 22 21:20:58 2007 +0000
+++ b/src/ov-fcn-handle.cc	Wed May 23 04:35:04 2007 +0000
@@ -1265,23 +1265,7 @@
 		      tree_expression *e = s->expression ();
 
 		      if (e)
-			{
-			  if (e->is_assignment_expression ())
-			    {
-			      // The parser builds an assignment to
-			      // __retval__, and we don't want to
-			      // display that part.
-
-			      tree_simple_assignment *tsa
-				= reinterpret_cast <tree_simple_assignment *> (e);
-			      tree_expression *rhs = tsa->right_hand_side ();
-
-			      if (rhs)
-				rhs->accept (tpc);
-			    }
-			  else
-			    e->accept (tpc);
-			}
+			e->accept (tpc);
 		    }
 		  else
 		    {
--- a/src/ov-usr-fcn.cc	Tue May 22 21:20:58 2007 +0000
+++ b/src/ov-usr-fcn.cc	Wed May 23 04:35:04 2007 +0000
@@ -356,7 +356,14 @@
     unwind_protect_bool (evaluating_function_body);
     evaluating_function_body = true;
 
-    cmd_list->eval ();
+    if (is_inline_function ())
+      {
+	assert (cmd_list->length () == 1);
+
+	retval = cmd_list->eval (false, nargout);
+      }
+    else
+      cmd_list->eval ();
 
     if (echo_commands)
       print_code_function_trailer ();
@@ -375,7 +382,7 @@
     
     // Copy return values out.
 
-    if (ret_list)
+    if (ret_list && ! is_inline_function ())
       {
 	ret_list->initialize_undefined_elements (my_name, nargout, Matrix ());
 
--- a/src/parse.y	Tue May 22 21:20:58 2007 +0000
+++ b/src/parse.y	Wed May 23 04:35:04 2007 +0000
@@ -1782,28 +1782,7 @@
   symtab_context.pop ();
 
   if (stmt && stmt->is_expression ())
-    {
-      symbol_record *sr = fcn_sym_tab->lookup ("__retval__", true);
-
-      tree_expression *e = stmt->expression ();
-
-      tree_identifier *id = new tree_identifier (sr);
-
-      tree_simple_assignment *asn = new tree_simple_assignment (id, e);
-
-      stmt->set_expression (asn);
-
-      stmt->set_print_flag (false);
-
-      // FIXME -- would like to delete old_stmt here or
-      // replace expression inside it with the new expression we just
-      // created so we don't have to create a new statement at all.
-
-      id = new tree_identifier (sr);
-      tree_decl_elt *elt = new tree_decl_elt (id);
-
-      ret_list = new tree_parameter_list (elt);
-    }
+    stmt->set_print_flag (false);
 
   tree_statement_list *body = new tree_statement_list (stmt);