# HG changeset patch # User John W. Eaton # Date 1589832387 14400 # Node ID 8db2d4c9a64f91186ede5229d44b70d6d4e78826 # Parent 991dc4d31949d95357e4286ed1a21326f089a230 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. diff -r 991dc4d31949 -r 8db2d4c9a64f libinterp/corefcn/stack-frame.cc --- 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 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 diff -r 991dc4d31949 -r 8db2d4c9a64f libinterp/corefcn/stack-frame.h --- 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) {