diff src/symtab.cc @ 11238:1783b360976f

also consider parent classes when checking if class methods are out of date
author John W. Eaton <jwe@octave.org>
date Thu, 11 Nov 2010 02:30:32 -0500
parents 89f4d7e294cc
children c78247b664fc
line wrap: on
line diff
--- 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<std::string>& plist
+                                    = symbol_table::parent_classes (dispatch_type);
+                                  std::list<std::string>::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<std::string>& plist = parent_classes (dispatch_type);
 
-          if (r != parent_map.end ())
+          std::list<std::string>::const_iterator it = plist.begin ();
+
+          while (it != plist.end ())
             {
-              const std::list<std::string>& plist = r->second;
-              std::list<std::string>::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++;
             }
         }
     }