diff libinterp/octave-value/ov-fcn.h @ 28432:71c34141cc2d stable

refactor handling of parent functions and localfunctions * help.cc (Flocalfunctions): Simply call symbol_scope::localfunctions for the current user function. * symscope.h, symscope.cc (symbol_scope_rep::m_fcn_name, symbol_scope_rep::m_parent_fcn_names, symbol_scope_rep::m_is_primary_fcn_scope): New data members. (symbol_scope_rep::localfunctions, symbol_scope_rep::fcn_name, symbol_scope_rep::cache_fcn_name, symbol_scope_rep::parent_fcn_names, symbol_scope_rep::cache_parent_fcn_names, symbol_scope_rep::mark_primary_fcn_scope, symbol_scope_rep::is_primary_fcn_scope, symbol_scope::localfunctions, symbol_scope::fcn_name, symbol_scope::cache_fcn_name, symbol_scope::parent_fcn_names, symbol_scope::cache_parent_fcn_names, symbol_scope::mark_primary_fcn_scope, symbol_scope::is_primary_fcn_scope): New functions. (symbol_scope_rep): Also cache parent function names. * oct-parse.yy (base_parser::push_fcn_symtab): Mark primary_fcn_scope as primary. (base_parser::finish_function): If parsing subfunction, set primary parent scope in subfunction scope. Cache parent function names in current scope. * ov-fcn.h (octave_function::parent_fcn_names): New virtual function. * ov-usr-fcn.h (octave_user_function::parent_fcn_names): New function.
author John W. Eaton <jwe@octave.org>
date Fri, 03 Apr 2020 22:00:06 -0400
parents 8eb8ba8aff9a
children e760fef2829c
line wrap: on
line diff
--- a/libinterp/octave-value/ov-fcn.h	Fri Apr 03 21:59:15 2020 -0400
+++ b/libinterp/octave-value/ov-fcn.h	Fri Apr 03 22:00:06 2020 -0400
@@ -87,6 +87,11 @@
   virtual octave::symbol_scope parent_fcn_scope (void) const
   { return octave::symbol_scope (); }
 
+  virtual std::list<std::string> parent_fcn_names (void) const
+  {
+    return std::list<std::string> ();
+  }
+
   virtual void mark_fcn_file_up_to_date (const octave::sys::time&) { }
 
   virtual octave::symbol_scope scope (void) { return octave::symbol_scope (); }