Mercurial > octave
diff libinterp/corefcn/symtab.h @ 26065:2eb71b83d3e2
partially refactor function lookup in symbol table
* symtab.h, symtab.cc (symbol_table::find): delete.
(symbol_table::find_function): Simplify. Don't decode
@class/method>sub names. Assume name is a single function name.
(symbol_table::find_method): Simplify. Don't call find_submethod.
(symbol_table::find_submethod): Delete.
* ov-usr-fcn.h, ov-usr-fcn.cc (octave_user_code::find_subfunction):
New virtual function.
(octave_user_function::find_subfunction): New function.
* pt-eval.cc (tree_evaluator::get_user_code):
Decode function name here instead of in symbol_table::find_function.
* ov-classdef.cc (cdef_package::cdef_package_rep::find): Use
symbol_scope::find instead of symbol_table::find.
(cdef_manager::find_class): Likewise.
* file-editor-tab.cc (file_editor_tab::exit_debug_and_clear): Likewise.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 13 Nov 2018 02:26:52 -0500 |
parents | cb1606f78f6b |
children | e142769913f8 |
line wrap: on
line diff
--- a/libinterp/corefcn/symtab.h Mon Nov 12 16:54:55 2018 -0800 +++ b/libinterp/corefcn/symtab.h Tue Nov 13 02:26:52 2018 -0500 @@ -138,13 +138,6 @@ bool at_top_level (void) { return m_current_scope == m_top_scope; } - // Find a value corresponding to the given name in the table. - octave_value - find (const std::string& name, - const octave_value_list& args = octave_value_list (), - bool skip_variables = false, - bool local_funcs = true); - void assign (const std::string& name, const octave_value& value, bool force_add) { if (m_current_scope) @@ -195,38 +188,10 @@ return val.is_defined (); } + // FIXME: this function only finds legacy class methods, not + // classdef methods. octave_value - find_method (const std::string& name, const std::string& dispatch_type) - { - fcn_table_const_iterator p = m_fcn_table.find (name); - - if (p != m_fcn_table.end ()) - { - octave_value fcn = p->second.find_method (dispatch_type); - - if (! fcn.is_defined ()) - fcn = find_submethod (name, dispatch_type); - - return fcn; - } - else - { - fcn_info finfo (name); - - octave_value fcn = finfo.find_method (dispatch_type); - - if (! fcn.is_defined ()) - fcn = find_submethod (name, dispatch_type); - - if (fcn.is_defined ()) - m_fcn_table[name] = finfo; - - return fcn; - } - } - - octave_value - find_submethod (const std::string& name, const std::string& dispatch_type); + find_method (const std::string& name, const std::string& dispatch_type); octave_value find_built_in_function (const std::string& name)