# HG changeset patch # User John W. Eaton # Date 1289460632 18000 # Node ID 1783b360976f4268a823327e5730a59a26db6bb6 # Parent 110e570e5f8d11ee14acb49e327cd79f32ec3979 also consider parent classes when checking if class methods are out of date diff -r 110e570e5f8d -r 1783b360976f src/ChangeLog --- a/src/ChangeLog Thu Nov 11 02:26:37 2010 -0500 +++ b/src/ChangeLog Thu Nov 11 02:30:32 2010 -0500 @@ -1,3 +1,13 @@ +2010-11-11 John W. Eaton + + Bug #31165. + + * symtab.h (symbol_table::parent_classes): New static function. + * symtab.cc (out_of_date_check): Also look for methods defined + in parent classes of dispatch_type. + (symbol_table::fcn_info::fcn_info_rep::load_class_method): Call + parent_classes instead of accessing parent_map directly. + 2010-11-10 John W. Eaton * octave.cc (octave_main): Call octave_ieee_init here. diff -r 110e570e5f8d -r 1783b360976f src/symtab.cc --- a/src/symtab.cc Thu Nov 11 02:26:37 2010 -0500 +++ b/src/symtab.cc Thu Nov 11 02:30:32 2010 -0500 @@ -208,8 +208,27 @@ // decide whether it came from a relative lookup. if (! dispatch_type.empty ()) - file = load_path::find_method (dispatch_type, nm, - dir_name); + { + file = load_path::find_method (dispatch_type, nm, + dir_name); + + if (file.empty ()) + { + const std::list& plist + = symbol_table::parent_classes (dispatch_type); + std::list::const_iterator it + = plist.begin (); + + while (it != plist.end ()) + { + file = load_path::find_method (*it, nm, dir_name); + if (! file.empty ()) + break; + + it++; + } + } + } // Maybe it's an autoload? if (file.empty ()) @@ -387,25 +406,21 @@ { // Search parent classes - const_parent_map_iterator r = parent_map.find (dispatch_type); + const std::list& plist = parent_classes (dispatch_type); - if (r != parent_map.end ()) + std::list::const_iterator it = plist.begin (); + + while (it != plist.end ()) { - const std::list& plist = r->second; - std::list::const_iterator it = plist.begin (); + retval = find_method (*it); - while (it != plist.end ()) + if (retval.is_defined ()) { - retval = find_method (*it); + class_methods[dispatch_type] = retval; + break; + } - if (retval.is_defined ()) - { - class_methods[dispatch_type] = retval; - break; - } - - it++; - } + it++; } } } diff -r 110e570e5f8d -r 1783b360976f src/symtab.h --- a/src/symtab.h Thu Nov 11 02:26:37 2010 -0500 +++ b/src/symtab.h Thu Nov 11 02:30:32 2010 -0500 @@ -1825,6 +1825,19 @@ parent_map[classname] = parent_list; } + static std::list + parent_classes (const std::string& dispatch_type) + { + std::list retval; + + const_parent_map_iterator it = parent_map.find (dispatch_type); + + if (it != parent_map.end ()) + retval = it->second; + + return retval; + } + static octave_user_function *get_curr_fcn (scope_id scope = xcurrent_scope) { symbol_table *inst = get_instance (scope);