changeset 32794:512e07384ae9 stable

atttempt to make isargout work properly in more cases (bug #65153) * parse-tree/pt-eval.cc (tree_evaluator::execute_user_function): Except for anonymous functions, invalidate lvalue_list after generating list of ignored outputs. * parse-tree/pt-mat.cc (tree_matrix::evaluate): Invalidate lvalue_list before evaluating matrix list elements. * pt-assign.cc (tree_multi_assignment::evaluate_n): Eliminate useless setting of lvalue_list to nullptr.
author John W. Eaton <jwe@octave.org>
date Sat, 20 Jan 2024 13:28:22 -0500
parents 8fb76692bbbd
children aee5333aebb1
files libinterp/parse-tree/pt-assign.cc libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-mat.cc
diffstat 3 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-assign.cc	Sat Jan 20 13:16:20 2024 -0500
+++ b/libinterp/parse-tree/pt-assign.cc	Sat Jan 20 13:28:22 2024 -0500
@@ -207,8 +207,6 @@
                                          ? rhs_val1(0).list_value ()
                                          : rhs_val1);
 
-      tw.set_lvalue_list (nullptr);
-
       octave_idx_type k = 0;
 
       octave_idx_type n = rhs_val.length ();
--- a/libinterp/parse-tree/pt-eval.cc	Sat Jan 20 13:16:20 2024 -0500
+++ b/libinterp/parse-tree/pt-eval.cc	Sat Jan 20 13:28:22 2024 -0500
@@ -3556,6 +3556,14 @@
   // FIXME: this probably shouldn't be a double-precision matrix.
   Matrix ignored_outputs = ignored_fcn_outputs ();
 
+  unwind_protect frame;
+
+  if (! user_function.is_anonymous_function ())
+    {
+      frame.protect_var (m_lvalue_list);
+      m_lvalue_list = nullptr;
+    }
+
   octave_value_list ret_args;
 
   int nargin = args.length ();
--- a/libinterp/parse-tree/pt-mat.cc	Sat Jan 20 13:16:20 2024 -0500
+++ b/libinterp/parse-tree/pt-mat.cc	Sat Jan 20 13:28:22 2024 -0500
@@ -47,6 +47,13 @@
 octave_value
 tree_matrix::evaluate (tree_evaluator& tw, int)
 {
+  unwind_action act ([&tw] (const std::list<octave_lvalue> *lvl)
+  {
+    tw.set_lvalue_list (lvl);
+  }, tw.lvalue_list ());
+
+  tw.set_lvalue_list (nullptr);
+
   tm_const tmp (*this, tw);
 
   return tmp.concat (tw.string_fill_char ());