# HG changeset patch # User Lachlan # Date 1455573803 28800 # Node ID dfce76507f4beb7ca6009dc55adf7029cfb68f10 # Parent cf2eae837cc82f5f193a3c868ca8b6a17d2372fd Fix dbstop to find subfuncs of old-style class methods (bug #34804). * symtab.cc (find_submethod): New function to find subfunc in old-style class method. * symtab.h (find_method): Call find_submethod if function exists but not found through find_method. * symtab.h (find_submethod): Prototype for new function. diff -r cf2eae837cc8 -r dfce76507f4b libinterp/corefcn/symtab.cc --- a/libinterp/corefcn/symtab.cc Mon Feb 15 11:04:52 2016 -0800 +++ b/libinterp/corefcn/symtab.cc Mon Feb 15 14:03:23 2016 -0800 @@ -1322,6 +1322,43 @@ return retval; } +// look for @class/method>subfunction +octave_value +symbol_table::find_submethod (const std::string& name, + const std::string& dispatch_type) +{ + octave_value fcn; + + std::string full_name = "@" + dispatch_type + file_ops::dir_sep_str () + name; + size_t pos = full_name.find_first_of (Vfilemarker); + + if (pos != std::string::npos) + { + std::string fcn_scope = full_name.substr (0, pos); + scope_id stored_scope = xcurrent_scope; + xcurrent_scope = xtop_scope; + octave_value parent = find_function (full_name.substr (0, pos), + octave_value_list (), false); + if (parent.is_defined ()) + { + octave_function *parent_fcn = parent.function_value (); + + if (parent_fcn) + { + xcurrent_scope = parent_fcn->scope (); + + if (xcurrent_scope > 1) + fcn = find_function (full_name.substr (pos + 1), + octave_value_list ()); + } + } + + xcurrent_scope = stored_scope; + } + + return fcn; +} + void symbol_table::dump (std::ostream& os, scope_id scope) { diff -r cf2eae837cc8 -r dfce76507f4b libinterp/corefcn/symtab.h --- a/libinterp/corefcn/symtab.h Mon Feb 15 11:04:52 2016 -0800 +++ b/libinterp/corefcn/symtab.h Mon Feb 15 14:03:23 2016 -0800 @@ -1497,13 +1497,23 @@ fcn_table_const_iterator p = fcn_table.find (name); if (p != fcn_table.end ()) - return p->second.find_method (dispatch_type); + { + 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 ()) fcn_table[name] = finfo; @@ -1512,6 +1522,9 @@ } static octave_value + find_submethod (const std::string& name, const std::string& dispatch_type); + + static octave_value find_built_in_function (const std::string& name) { fcn_table_const_iterator p = fcn_table.find (name);