Mercurial > octave
diff libinterp/operators/op-class.cc @ 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 | 0c468af9dc00 |
children | b9378eff6d13 |
line wrap: on
line diff
--- a/libinterp/operators/op-class.cc Fri Jun 09 11:36:34 2017 -0400 +++ b/libinterp/operators/op-class.cc Fri Jun 09 02:21:28 2017 -0400 @@ -27,6 +27,7 @@ #include "oct-time.h" #include "errwarn.h" +#include "interpreter-private.h" #include "load-path.h" #include "ovl.h" #include "ov.h" @@ -46,7 +47,9 @@ \ std::string class_name = a.class_name (); \ \ - octave_value meth = symbol_table::find_method (#name, class_name); \ + symbol_table& symtab = octave::__get_symbol_table__ ("oct_unop_" #name); \ + \ + octave_value meth = symtab.find_method (#name, class_name); \ \ if (meth.is_undefined ()) \ error ("%s method not defined for %s class", #name, \ @@ -81,7 +84,9 @@ std::string dispatch_type \ = (a1.isobject () ? a1.class_name () : a2.class_name ()); \ \ - octave_value meth = symbol_table::find_method (#name, dispatch_type); \ + symbol_table& symtab = octave::__get_symbol_table__ ("oct_unop_" #name); \ + \ + octave_value meth = symtab.find_method (#name, dispatch_type); \ \ if (meth.is_undefined ()) \ error ("%s method not defined for %s class", #name, \