Mercurial > octave
changeset 25395:a656665b671d
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 18 May 2018 19:31:24 -0400 |
parents | b860a7e526cf (current diff) 9e39a53b4e00 (diff) |
children | 75fef3484d12 |
files | libinterp/corefcn/help.cc libinterp/octave-value/ov-usr-fcn.h libinterp/parse-tree/oct-parse.in.yy |
diffstat | 3 files changed, 13 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/help.cc Wed May 16 19:01:14 2018 -0400 +++ b/libinterp/corefcn/help.cc Fri May 18 19:31:24 2018 -0400 @@ -487,16 +487,19 @@ octave_user_code *curr_fcn = cs.caller_user_code (); + if (! curr_fcn) + return retval; + // All subfunctions are listed in the top-level function of this file. - while (curr_fcn && curr_fcn->is_subfunction ()) + // If curr_fcn is a subfunction, then there must be a parent and + // curr_fcn will always be valid in and after executing this loop. + + while (curr_fcn->is_subfunction ()) { symbol_scope pscope = curr_fcn->parent_fcn_scope (); curr_fcn = pscope.function (); } - if (! curr_fcn) - return retval; - // Get subfunctions. const std::list<std::string> names = curr_fcn->subfunction_names ();
--- a/libinterp/octave-value/ov-usr-fcn.h Wed May 16 19:01:14 2018 -0400 +++ b/libinterp/octave-value/ov-usr-fcn.h Fri May 18 19:31:24 2018 -0400 @@ -267,6 +267,11 @@ std::string parent_fcn_name (void) const { return parent_name; } + octave::symbol_scope parent_fcn_scope (void) const + { + return m_scope.parent_scope (); + } + void mark_as_system_fcn_file (void); bool is_system_fcn_file (void) const { return system_fcn_file; }
--- a/libinterp/parse-tree/oct-parse.in.yy Wed May 16 19:01:14 2018 -0400 +++ b/libinterp/parse-tree/oct-parse.in.yy Fri May 18 19:31:24 2018 -0400 @@ -3399,16 +3399,6 @@ if (m_fcn_file_from_relative_lookup) fcn->mark_relative (); - if (m_curr_fcn_depth > 1 || m_parsing_subfunctions) - { - fcn->stash_parent_fcn_name (m_lexer.m_fcn_file_name); - - if (m_curr_fcn_depth > 1) - fcn->stash_parent_fcn_scope (m_function_scopes.parent_scope ()); - else - fcn->stash_parent_fcn_scope (m_primary_fcn_scope); - } - if (m_lexer.m_parsing_class_method) { if (m_curr_class_name == id_name) @@ -3494,6 +3484,7 @@ if (m_curr_fcn_depth > 1 || m_parsing_subfunctions) { fcn->stash_fcn_location (l, c); + fcn->stash_parent_fcn_name (m_lexer.m_fcn_file_name); octave_value ov_fcn (fcn);