# HG changeset patch # User John W. Eaton # Date 1593457287 14400 # Node ID 49f4d7814760957f2fc5ca5514929eea577a95af # Parent fab862fedf85f3c44bdd6b272919cf85f158b589 find help for not-yet-loaded classdef methods defined in @DIR files. * cdef-method.h, cdef-method.cc (cdef_method::get_doc_string, (cdef_method::cdef_method_rep::get_doc_string): New methods. * ov-classdef.cc (octave_classdef_meta::doc_string): Use find_method to lookup classdef method definition instead of instead of get_method. If method is defined, use cdef_method::get_doc_string to access doc string. diff -r fab862fedf85 -r 49f4d7814760 libinterp/octave-value/cdef-method.cc --- a/libinterp/octave-value/cdef-method.cc Fri May 29 10:57:04 2020 -0400 +++ b/libinterp/octave-value/cdef-method.cc Mon Jun 29 15:01:27 2020 -0400 @@ -190,6 +190,16 @@ : false); } + std::string + cdef_method::cdef_method_rep::get_doc_string (void) + { + check_method (); + + octave_function *fcn = function.function_value (); + + return fcn ? fcn->doc_string () : ""; + } + bool cdef_method::cdef_method_rep::check_access (void) const { diff -r fab862fedf85 -r 49f4d7814760 libinterp/octave-value/cdef-method.h --- a/libinterp/octave-value/cdef-method.h Fri May 29 10:57:04 2020 -0400 +++ b/libinterp/octave-value/cdef-method.h Mon Jun 29 15:01:27 2020 -0400 @@ -73,6 +73,8 @@ void set_function (const octave_value& fcn) { function = fcn; } + std::string get_doc_string (void); + bool check_access (void) const; bool is_external (void) const { return ! dispatch_type.empty (); } @@ -190,6 +192,11 @@ return get_rep ()->get_function (); } + std::string get_doc_string (void) + { + return get_rep ()->get_doc_string (); + } + bool is_constructor (void) const { return get_rep ()->is_constructor (); diff -r fab862fedf85 -r 49f4d7814760 libinterp/octave-value/ov-classdef.cc --- a/libinterp/octave-value/ov-classdef.cc Fri May 29 10:57:04 2020 -0400 +++ b/libinterp/octave-value/ov-classdef.cc Mon Jun 29 15:01:27 2020 -0400 @@ -437,15 +437,10 @@ if (meth_name.empty ()) return cls.doc_string (); - octave_value ov_meth = cls.get_method (meth_name); + octave::cdef_method cdef_meth = cls.find_method (meth_name); - if (ov_meth.is_defined ()) - { - octave_function *fcn = ov_meth.function_value (); - - if (fcn) - return fcn->doc_string (); - } + if (cdef_meth.ok ()) + return cdef_meth.get_doc_string (); } return "";