changeset 24297:9a1b193ddd01

Recognize docstrings from subfunctions (bug #46008). * oct-parse.in.yy (base_parser::start_function): Remove test for '! parsing_subfunctions' so that help_text is added whenever a function or subfunction is parsed for the first time.
author Rik <rik@octave.org>
date Thu, 23 Nov 2017 10:45:19 -0800
parents 3981e3a11150
children 1523c409b2d4
files libinterp/parse-tree/oct-parse.in.yy
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy	Thu Nov 23 18:12:40 2017 +0000
+++ b/libinterp/parse-tree/oct-parse.in.yy	Thu Nov 23 10:45:19 2017 -0800
@@ -3417,8 +3417,12 @@
 
     fcn->stash_function_name (id_name);
 
-    if (! m_lexer.help_text.empty () && m_curr_fcn_depth == 1
-        && ! m_parsing_subfunctions)
+    // Record help text for functions other than nested functions.
+    // We cannot currently record help for nested functions (bug #46008)
+    // because the doc_string of the outermost function is read first,
+    // whereas this function is called for the innermost function first.
+    // We could have a stack of help_text in lexer.
+    if (! m_lexer.help_text.empty () && m_curr_fcn_depth == 1)
       {
         fcn->document (m_lexer.help_text);