Mercurial > octave
changeset 28327:8db2d4c9a64f stable
correctly find all symbols in script when saving values (bug #58382)
* stack-frame.h, stack-frame.cc (stack_frame::glob_symbol_info,
stack_frame::regexp_symbol_info): Use symbol_info_accumulator to find
all symbols visible in current stack frame, including those in parent
frames accessible throuch access_links. Move definition from header
to source file.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 18 May 2020 16:06:27 -0400 |
parents | 991dc4d31949 |
children | 5cb09ac94e81 |
files | libinterp/corefcn/stack-frame.cc libinterp/corefcn/stack-frame.h |
diffstat | 2 files changed, 22 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/stack-frame.cc Mon May 18 14:52:14 2020 -0400 +++ b/libinterp/corefcn/stack-frame.cc Mon May 18 16:06:27 2020 -0400 @@ -312,6 +312,8 @@ return retval; } + // FIXME: Should this function also find any variables in parent + // scopes accessible through access_links? std::list<std::string> stack_frame::variable_names (void) const { @@ -332,6 +334,24 @@ return retval; } + symbol_info_list stack_frame::glob_symbol_info (const std::string& pattern) + { + symbol_info_accumulator sia (pattern, false); + + accept (sia); + + return sia.symbol_info (); + } + + symbol_info_list stack_frame::regexp_symbol_info (const std::string& pattern) + { + symbol_info_accumulator sia (pattern, true); + + accept (sia); + + return sia.symbol_info (); + } + size_t stack_frame::size (void) const { // This function should only be called for user_fcn_stack_frame or
--- a/libinterp/corefcn/stack-frame.h Mon May 18 14:52:14 2020 -0400 +++ b/libinterp/corefcn/stack-frame.h Mon May 18 16:06:27 2020 -0400 @@ -258,19 +258,9 @@ // insert if missing. virtual symbol_record insert_symbol (const std::string&) = 0; - // FIXME: should these functions should return all symbols visible in - // the current stack frame including those that come from a parent - // scope/frame? + symbol_info_list glob_symbol_info (const std::string& pattern); - symbol_info_list glob_symbol_info (const std::string& pattern) const - { - return make_symbol_info_list (glob (pattern)); - } - - symbol_info_list regexp_symbol_info (const std::string& pattern) const - { - return make_symbol_info_list (regexp (pattern)); - } + symbol_info_list regexp_symbol_info (const std::string& pattern); symbol_info_list get_symbol_info (void) {