diff libinterp/octave-value/ov-usr-fcn.h @ 27745:7a45100a40c4

allow private scripts to be called from other private scripts This issue was discovered in bug #57236 but that report is not specifically about this problem. * symscope.cc, symscope.h (symbol_scope_rep::m_code): Rename from m_fcn. Change all uses. (symbol_scope_rep::user_code, symbol_scope::user_code): Rename from function. Change all uses. (symbol_scope_rep::set_user_code, symbol_scope::set_user_code): Rename from set_function. Change all uses. * ov-usr-fcn.h, ov-usr-fcn.cc (octave_user_code::octave_user_code): Call symbol_scope::set_user_code. (octave_user_code::octave_user_function): Don't call symbol_scope::set_function. * oct-parse.yy (base_parser::make_script): Also call stash_dir_name for scripts. * test/private-functions: New test directory. * test/module.mk: Include test/private-function/module.mk.
author John W. Eaton <jwe@octave.org>
date Sun, 24 Nov 2019 14:01:16 -0600
parents 9dd1d8973877
children b442ec6dda5c
line wrap: on
line diff
--- a/libinterp/octave-value/ov-usr-fcn.h	Sun Nov 24 13:38:37 2019 -0600
+++ b/libinterp/octave-value/ov-usr-fcn.h	Sun Nov 24 14:01:16 2019 -0600
@@ -68,7 +68,10 @@
       t_parsed (static_cast<time_t> (0)),
       t_checked (static_cast<time_t> (0)),
       m_file_info (nullptr), cmd_list (cmds)
-  { }
+  {
+    if (m_scope)
+      m_scope.set_user_code (this);
+  }
 
 public: