diff --git a/libinterp/corefcn/fcn-info.cc b/libinterp/corefcn/fcn-info.cc --- a/libinterp/corefcn/fcn-info.cc +++ b/libinterp/corefcn/fcn-info.cc @@ -409,21 +409,56 @@ namespace octave // would not check for it when finding symbol definitions. static inline bool - load_out_of_date_fcn (const std::string& ff, const std::string& dir_name, + load_out_of_date_fcn (const std::string& file_name, + const std::string& dir_name_arg, octave_value& function, const std::string& dispatch_type = "", const std::string& package_name = "") { bool retval = false; + std::string dir_name = dir_name_arg; + + if (dir_name.empty ()) + { + size_t pos = file_name.find_last_of (sys::file_ops::dir_sep_chars ()); + + dir_name = file_name.substr (0, pos); + } + + size_t pos = dir_name.find_last_of (sys::file_ops::dir_sep_chars ()); + + bool is_private_fcn + = pos != std::string::npos && dir_name.substr (pos+1) == "private"; + + if (is_private_fcn) + dir_name = dir_name.substr (0, pos); + + std::string class_name; + + pos = dir_name.find_last_of (sys::file_ops::dir_sep_chars ()); + + if (pos != std::string::npos) + { + std::string tmp = dir_name.substr (pos+1); + + if (tmp[0] == '@') + class_name = tmp.substr (1); + } + octave_value ov_fcn - = load_fcn_from_file (ff, dir_name, dispatch_type, + = load_fcn_from_file (file_name, dir_name, dispatch_type, package_name); if (ov_fcn.is_defined ()) { retval = true; + octave_function *fcn = ov_fcn.function_value (); + + if (is_private_fcn) + fcn->mark_as_private_function (class_name); + function = ov_fcn; } else