Mercurial > octave
diff libinterp/octave-value/ov-usr-fcn.h @ 23599:5cb3a2bb5e1e
don't use singleton for symbol_table
This is the first of a series of changes to make the symbol table a
part of the interpreter instead of a global object. These changes
also aim to simplify the implementation of symbol table so that it is
easier to understand and modify.
* Functions now own their scope (workspace) data.
* The list of subfunctions is contained in the scope rather than a
global list.
* symtab.h, symtab.cc (class symbol_table): Don't use singleton
pattern.
* interpreter.h, interpreter.cc (interpreter::m_symbol_table): New
data member.
(interpreter::~interpreter): Don't set instance to 0.
* interpreter-private.h, interpreter-private.cc
(__get_symbol_table__): New function.
Change all uses of call_stack to access call_stack object from the
interpreter.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 09 Jun 2017 02:21:28 -0400 |
parents | 084245f9bd03 |
children | 214cb58ccc1c |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-usr-fcn.h Fri Jun 09 11:36:34 2017 -0400 +++ b/libinterp/octave-value/ov-usr-fcn.h Fri Jun 09 02:21:28 2017 -0400 @@ -222,7 +222,7 @@ void stash_parent_fcn_name (const std::string& p) { parent_name = p; } - void stash_parent_fcn_scope (symbol_table::scope_id ps) { parent_scope = ps; } + void stash_parent_fcn_scope (symbol_table::scope_id ps); void stash_leading_comment (octave_comment_list *lc) { lead_comm = lc; } @@ -256,21 +256,13 @@ bool is_user_function (void) const { return true; } - void erase_subfunctions (void) - { - symbol_table::erase_subfunctions_in_scope (local_scope); - } + void erase_subfunctions (void); bool takes_varargs (void) const; bool takes_var_return (void) const; - void mark_as_private_function (const std::string& cname = "") - { - symbol_table::mark_subfunctions_in_scope_as_private (local_scope, cname); - - octave_function::mark_as_private_function (cname); - } + void mark_as_private_function (const std::string& cname = ""); void lock_subfunctions (void); @@ -401,6 +393,9 @@ classdef }; + // Our symbol table scope. + symbol_table::scope *m_scope; + // List of arguments for this function. These are local variables. octave::tree_parameter_list *param_list;