# HG changeset patch # User jwe # Date 1179894904 0 # Node ID 86354a8cd6a7d2c898a21b0d5e9fdc03409f71aa # Parent c92e679d9cc5381874e7bb36f74d3bbff3cbacd6 [project @ 2007-05-23 04:35:04 by jwe] diff -r c92e679d9cc5 -r 86354a8cd6a7 src/ChangeLog --- 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 + + * 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 * version.h (OCTAVE_VERSION): Now 2.9.12. diff -r c92e679d9cc5 -r 86354a8cd6a7 src/ov-fcn-handle.cc --- 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 (e); - tree_expression *rhs = tsa->right_hand_side (); - - if (rhs) - rhs->accept (tpc); - } - else - e->accept (tpc); - } + e->accept (tpc); } else { diff -r c92e679d9cc5 -r 86354a8cd6a7 src/ov-usr-fcn.cc --- 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 ()); diff -r c92e679d9cc5 -r 86354a8cd6a7 src/parse.y --- 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);