changeset 27202:23962b243bad

eliminate direct access to call stack in help functions * pt-eval.h, pt-eval.cc (tree_evaluator::debug_user_code): New function. * help.cc (help_system::local_functions, Flocalfunctions): Eliminate direct access to call stack.
author John W. Eaton <jwe@octave.org>
date Mon, 01 Apr 2019 17:47:24 +0000
parents bd49997051ef
children 79065f9d5553
files libinterp/corefcn/help.cc libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-eval.h
diffstat 3 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/help.cc	Mon Apr 01 17:39:42 2019 +0000
+++ b/libinterp/corefcn/help.cc	Mon Apr 01 17:47:24 2019 +0000
@@ -44,7 +44,6 @@
 
 #include "Cell.h"
 #include "builtin-defun-decls.h"
-#include "call-stack.h"
 #include "defaults.h"
 #include "defun.h"
 #include "dirfns.h"
@@ -487,9 +486,9 @@
   {
     string_vector retval;
 
-    call_stack& cs = m_interpreter.get_call_stack ();
+    tree_evaluator& tw = m_interpreter.get_evaluator ();
 
-    octave_user_code *curr_fcn = cs.current_user_code ();
+    octave_user_code *curr_fcn = tw.current_user_code ();
 
     if (! curr_fcn)
       return retval;
@@ -812,8 +811,8 @@
   Cell retval;
 
   // Find the main function we are in.
-  octave::call_stack& cs = interp.get_call_stack ();
-  octave_user_code *parent_fcn = cs.debug_user_code ();
+  octave::tree_evaluator& tw = interp.get_evaluator ();
+  octave_user_code *parent_fcn = tw.debug_user_code ();
 
   if (! parent_fcn)
     return ovl (retval);
--- a/libinterp/parse-tree/pt-eval.cc	Mon Apr 01 17:39:42 2019 +0000
+++ b/libinterp/parse-tree/pt-eval.cc	Mon Apr 01 17:47:24 2019 +0000
@@ -1881,6 +1881,11 @@
     return m_call_stack.current_user_code ();
   }
 
+  octave_user_code * tree_evaluator::debug_user_code (void) const
+  {
+    return m_call_stack.debug_user_code ();
+  }
+
   octave_function * tree_evaluator::current_function (void) const
   {
     return m_call_stack.current ();
--- a/libinterp/parse-tree/pt-eval.h	Mon Apr 01 17:39:42 2019 +0000
+++ b/libinterp/parse-tree/pt-eval.h	Mon Apr 01 17:47:24 2019 +0000
@@ -495,6 +495,9 @@
 
     octave_user_code * caller_user_code (size_t nskip = 0) const;
 
+    // Current function that we are debugging.
+    octave_user_code * debug_user_code (void) const;
+
     octave_function * current_function (void) const;
 
     bool goto_frame (size_t n = 0, bool verbose = false);