Mercurial > octave
diff libinterp/corefcn/symscope.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 | a75d1e82a7d3 |
children | b442ec6dda5c |
line wrap: on
line diff
--- a/libinterp/corefcn/symscope.h Sun Nov 24 13:38:37 2019 -0600 +++ b/libinterp/corefcn/symscope.h Sun Nov 24 14:01:16 2019 -0600 @@ -65,7 +65,7 @@ symbol_scope_rep (const std::string& name = "") : m_name (name), m_symbols (), m_subfunctions (), - m_persistent_values (), m_fcn (nullptr), m_parent (), + m_persistent_values (), m_code (nullptr), m_parent (), m_primary_parent (), m_children (), m_nesting_depth (0), m_is_static (false) { @@ -123,7 +123,7 @@ new_sid->m_subfunctions = m_subfunctions; new_sid->m_persistent_values = m_persistent_values; new_sid->m_subfunction_names = m_subfunction_names; - new_sid->m_fcn = m_fcn; + new_sid->m_code = m_code; new_sid->m_parent = m_parent; new_sid->m_primary_parent = m_primary_parent; new_sid->m_children = m_children; @@ -242,9 +242,9 @@ void cache_name (const std::string& name) { m_name = name; } - octave_user_function *function (void) const { return m_fcn; } + octave_user_code *user_code (void) const { return m_code; } - void set_function (octave_user_function *fcn) { m_fcn = fcn; } + void set_user_code (octave_user_code *code) { m_code = code; } void set_parent (const std::shared_ptr<symbol_scope_rep>& parent); @@ -296,7 +296,7 @@ //! The associated user code (may be null). - octave_user_function *m_fcn; + octave_user_code *m_code; //! Parent of nested function (may be null). @@ -525,15 +525,15 @@ m_rep->cache_name (name); } - octave_user_function * function (void) const + octave_user_code * user_code (void) const { - return m_rep ? m_rep->function () : nullptr; + return m_rep ? m_rep->user_code () : nullptr; } - void set_function (octave_user_function *fcn) + void set_user_code (octave_user_code *code) { if (m_rep) - m_rep->set_function (fcn); + m_rep->set_user_code (code); } void set_parent (const symbol_scope& p)