changeset 33231:92ca2f6c6b85

find help for default constructor in one more place (bug #65258) * help.cc (help_system::raw_help_from_symbol_table): Return signature of default constructor if searching for class_name.class_name and the class is found but not the constructor. (help_system::raw_help_for_class): Fix spacing for default constructor signature.
author John W. Eaton <jwe@octave.org>
date Thu, 21 Mar 2024 10:40:31 -0400
parents 515c1cc1b45e
children c5dc54712378
files libinterp/corefcn/help.cc
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/help.cc	Wed Mar 20 23:14:22 2024 -0400
+++ b/libinterp/corefcn/help.cc	Thu Mar 21 10:40:31 2024 -0400
@@ -748,7 +748,7 @@
       // We found a class, but no docstring for it and there is no
       // constructor explicitly defined.
 
-      help = "default constructor: obj = " + name + "()";
+      help = "default constructor: obj = " + name + " ()";
       what = "constructor";
       symbol_found = true;
       return true;
@@ -840,7 +840,21 @@
       octave_value ov_meth = cls.get_method (nm);
 
       if (get_help_from_fcn (nm, ov_meth, help, what, symbol_found))
-        return true;
+        {
+          what = "class method";
+          return true;
+        }
+
+      // Found class but no method.  If the NM is the same as the name
+      // of the class, then we have a default constructor.
+
+      if (cls.get_name () == nm)
+        {
+          help = "default constructor: obj = " + nm + " ()";
+          what = "constructor";
+          symbol_found = true;
+          return true;
+        }
 
       // FIXME: Should we only find public properties here?