Mercurial > octave-nkf
changeset 20135:a8769ccb2c4e
Fix nested classdef package lookup (bug #44856)
* load-path.cc (load_path::dir_info::is_package): Split name and call
recursively to handle nested packages correctly.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Sun, 19 Apr 2015 18:41:08 -0400 |
parents | d58ba8b9f709 |
children | e51473fdb622 |
files | libinterp/corefcn/load-path.cc |
diffstat | 1 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/load-path.cc Sun Apr 19 10:33:05 2015 -0700 +++ b/libinterp/corefcn/load-path.cc Sun Apr 19 18:41:08 2015 -0400 @@ -112,7 +112,22 @@ bool load_path::dir_info::is_package (const std::string& name) const { - return package_dir_map.find (name) != package_dir_map.end (); + size_t pos = name.find ('.'); + + if (pos == std::string::npos) + return package_dir_map.find (name) != package_dir_map.end (); + else + { + std::string name_head = name.substr (0, pos); + std::string name_tail = name.substr (pos + 1); + + const_package_dir_map_iterator it = package_dir_map.find (name_head); + + if (it != package_dir_map.end ()) + return it->second.is_package (name_tail); + else + return false; + } } void