Mercurial > octave-nkf
changeset 20087:8b501a0db1e9
only insert package names into loader map if package dir exists (bug #43769)
* load-path.h, load-path.cc (load_path::::is_package): New function.
(load_path::dir_info::is_package): New function.
(load_path::get_loader): Don't insert name into loader map unless is
it is also a +package directory somewhere in the load path.
* ov-classdef.cc (cdef_manager::do_find_package_symbol):
Undo change from changeset 8fe29850fb74.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 02 Apr 2015 17:16:03 -0400 |
parents | 10600b2dd3c1 |
children | ac59136f1f10 |
files | libinterp/corefcn/load-path.cc libinterp/corefcn/load-path.h libinterp/octave-value/ov-classdef.cc |
diffstat | 3 files changed, 26 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/load-path.cc Wed Apr 08 16:46:10 2015 -0400 +++ b/libinterp/corefcn/load-path.cc Thu Apr 02 17:16:03 2015 -0400 @@ -109,6 +109,12 @@ } } +bool +load_path::dir_info::is_package (const std::string& name) const +{ + return package_dir_map.find (name) != package_dir_map.end (); +} + void load_path::dir_info::initialize (void) { @@ -1218,6 +1224,20 @@ return retval; } +bool +load_path::is_package (const std::string& name) const +{ + for (const_dir_info_list_iterator p = dir_info_list.begin (); + p != dir_info_list.end (); + p++) + { + if (p->is_package (name)) + return true; + } + + return false; +} + std::list<std::string> load_path::do_overloads (const std::string& meth) const {
--- a/libinterp/corefcn/load-path.h Wed Apr 08 16:46:10 2015 -0400 +++ b/libinterp/corefcn/load-path.h Thu Apr 02 17:16:03 2015 -0400 @@ -395,6 +395,8 @@ method_file_map_type method_file_map; package_dir_map_type package_dir_map; + bool is_package (const std::string& name) const; + private: void initialize (void); @@ -658,9 +660,11 @@ check_file_type (std::string& fname, int type, int possible_types, const std::string& fcn, const char *who); + bool is_package (const std::string& name) const; + loader& get_loader (const std::string& name) const { - if (! name.empty ()) + if (! name.empty () && is_package (name)) { loader_map_iterator l = loader_map.find (name);
--- a/libinterp/octave-value/ov-classdef.cc Wed Apr 08 16:46:10 2015 -0400 +++ b/libinterp/octave-value/ov-classdef.cc Thu Apr 02 17:16:03 2015 -0400 @@ -3978,7 +3978,7 @@ { octave_function* retval = 0; - cdef_package pack = find_package (pack_name, false, false); + cdef_package pack = find_package (pack_name, false); if (pack.ok ()) retval = new octave_classdef_meta (pack);