changeset 29065:be19672a3c49

maint: merge stable to default.
author John W. Eaton <jwe@octave.org>
date Fri, 13 Nov 2020 20:43:19 -0500
parents c170ff385070 (current diff) 336356206de7 (diff)
children 913088ffe8e3
files libinterp/corefcn/call-stack.cc libinterp/corefcn/stack-frame.cc libinterp/parse-tree/pt-eval.cc
diffstat 4 files changed, 10 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/call-stack.cc	Fri Nov 13 16:26:13 2020 -0500
+++ b/libinterp/corefcn/call-stack.cc	Fri Nov 13 20:43:19 2020 -0500
@@ -1103,11 +1103,6 @@
     return octave_value ();
   }
 
-  void call_stack::clear_current_frame_values (void)
-  {
-    m_cs[m_curr_frame]->clear_values ();
-  }
-
   void call_stack::display (void) const
   {
     std::ostream& os = octave_stdout;
--- a/libinterp/corefcn/call-stack.h	Fri Nov 13 16:26:13 2020 -0500
+++ b/libinterp/corefcn/call-stack.h	Fri Nov 13 20:43:19 2020 -0500
@@ -293,8 +293,6 @@
                                     bool have_regexp, bool return_list,
                                     bool verbose, const std::string& msg = "");
 
-    void clear_current_frame_values (void);
-
     void display (void) const;
 
     void set_auto_fcn_var (stack_frame::auto_var_type avt,
--- a/libinterp/corefcn/stack-frame.cc	Fri Nov 13 16:26:13 2020 -0500
+++ b/libinterp/corefcn/stack-frame.cc	Fri Nov 13 20:43:19 2020 -0500
@@ -1074,14 +1074,13 @@
     return new scope_stack_frame (tw, scope, index, parent_link, static_link);
   }
 
-  // This function is only implemented for user_fcn stack frames and
-  // only called for those objects using unwind_protect and the
-  // call_stack::clear_current_frame_values function.  Anything else
-  // indicates an error in the implementation.
+  // This function is only implemented and should only be called for
+  // user_fcn stack frames.  Anything else indicates an error in the
+  // implementation, but we'll simply warn if that happens.
 
   void stack_frame::clear_values (void)
   {
-    panic_impossible ();
+    warning ("invalid call to stack_frame::clear_values; please report");
   }
 
   symbol_info_list
--- a/libinterp/parse-tree/pt-eval.cc	Fri Nov 13 16:26:13 2020 -0500
+++ b/libinterp/parse-tree/pt-eval.cc	Fri Nov 13 20:43:19 2020 -0500
@@ -2861,12 +2861,12 @@
 
     // Evaluate the commands that make up the function.
 
-    unwind_protect_var<stmt_list_type>
-      upv (m_statement_context, SC_FUNCTION);
-
-    unwind_action act1 ([=] () {
-                          m_call_stack.clear_current_frame_values ();
-                        });
+    unwind_protect_var<stmt_list_type> upv (m_statement_context, SC_FUNCTION);
+
+    unwind_action act1 ([] (std::shared_ptr<stack_frame> frame)
+                       {
+                         frame->clear_values ();
+                       }, m_call_stack.get_current_stack_frame ());
 
     tree_statement_list *cmd_list = user_function.body ();