diff libinterp/interpfcn/load-path.h @ 16684:edbb123cbe3a classdef

Correct handling of package context in symbol table. This change partially revert the previous changes on the symbol table, because the function table is not a member of the symbol table, but a static field. * libinterp/interpfcn/load-path.h (load_path::do_find_method, load_path::do_methods): Remove methods. (load_path::find_method, load_path::methods): Reimplement with class load_path::loader. * libinterp/interpfcn/load-path.cc (load_path::do_find_method, load_path::do_methods): Remove methods. * libinterp/interpfcn/symtab.h (symbol_table::package_name): Remove field, moved to symbol_table::fcn_info::fcn_info_rep. Suppress all usage. (symbol_table::find): Remove scope argument. (symbol_table::alloc_package_scope): Remove method. (symbol_table::fcn_info::find_function, symbol_table::fcn_info::find_user_function, symbol_table::fcn_info::find): Remove package_name argument. (symbol_table::fcn_info::fcn_info_rep::find, symbol_table::fcn_info::fcn_info_rep::xfind, symbol_table::fcn_info::fcn_info_rep::find_function, symbol_table::fcn_info::fcn_info_rep::find_user_function, symbol_table::fcn_info::fcn_info_rep::find_package, symbol_table::fcn_info::fcn_info_rep::load_class_constructor): Likewise. (symbol_table::fcn_info::fcn_info_rep::package_name): New member. (symbol_table::fcn_info::fcn_info_rep::fcn_info_rep): Initialize it. (symbol_table::fcn_info::fcn_info_rep::full_name): New method. * libinterp/interpfcn/symtab.cc (symbol_table::fcn_info::fcn_info_rep::load_class_constructor, symbol_table::fcn_info::fcn_info_rep::find, symbol_table::fcn_info::fcn_info_rep::xfind, symbol_table::fcn_info::fcn_info_rep::find_package, symbol_table::fcn_info::fcn_info_rep::find_user_function): Remove package_name argument. Use package_name member instead. (symbol_table::fcn_info::fcn_info_rep::load_class_method): Simplify, using full_name method and package_name member. (symbol_table::fcn_info::fcn_info_rep::dump): Use full_name. (symbol_table::find): Remove scope argument. (symbol_table::do_find): Do not use (removed) package_name member. * libinterp/octave-value/ov-classdef.h (cdef_package::cdef_package_rep::scope): Remove member. Suppress all usages. * libinterp/octave-value/ov-classdef.cc (cdef_package::cdef_package_rep::find): Do not use (removed) scope member. Pass fully-qualified name to the symbol table.
author Michael Goffioul <michael.goffioul@gmail.com>
date Sat, 18 May 2013 23:12:56 -0400
parents 7368654f302f
children 1c45e22fc444
line wrap: on
line diff
--- a/libinterp/interpfcn/load-path.h
+++ b/libinterp/interpfcn/load-path.h
@@ -95,24 +95,29 @@
 
   static std::string find_method (const std::string& class_name,
                                   const std::string& meth,
-                                  std::string& dir_name)
+                                  std::string& dir_name,
+                                  const std::string& pack_name = std::string ())
   {
     return instance_ok ()
-      ? instance->do_find_method (class_name, meth, dir_name)
+      ? instance->get_loader (pack_name).find_method (class_name, meth,
+                                                      dir_name)
       : std::string ();
   }
 
   static std::string find_method (const std::string& class_name,
-                                  const std::string& meth)
+                                  const std::string& meth,
+                                  const std::string& pack_name = std::string ())
   {
     std::string dir_name;
-    return find_method (class_name, meth, dir_name);
+    return find_method (class_name, meth, dir_name, pack_name);
   }
 
-  static std::list<std::string> methods (const std::string& class_name)
+  static std::list<std::string> methods (const std::string& class_name,
+                                         const std::string& pack_name = std::string ())
   {
     return instance_ok ()
-      ? instance->do_methods (class_name) : std::list<std::string> ();
+      ? instance->get_loader(pack_name).methods (class_name)
+      : std::list<std::string> ();
   }
 
   static std::list<std::string> overloads (const std::string& meth)
@@ -659,12 +664,6 @@
     return default_loader;
   }
 
-  std::string do_find_method (const std::string& class_name,
-                              const std::string& meth,
-                              std::string& dir_name) const;
-
-  std::list<std::string> do_methods (const std::string& class_name) const;
-
   std::list<std::string> do_overloads (const std::string& meth) const;
 
   bool do_find_package (const std::string& package_name) const