Mercurial > octave
diff libinterp/parse-tree/oct-parse.yy @ 30108:3efce22b7350
eliminate duplicate parent function name info in symbol scope objects
* symscope.h, symscope.cc (symbol_scope_rep::m_parent_fcn_names):
Delete member variable.
(symbol_scope_rep::cache_parent_fcn_names):
Delete function and all uses.
(symbol_scope_rep::parent_fcn_names): Generate list of parent function
names from parent scope info as needed.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 02 Sep 2021 11:20:53 -0400 |
parents | 67994b92a613 |
children | a9e3e1c96c47 |
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.yy Thu Sep 02 11:17:45 2021 -0400 +++ b/libinterp/parse-tree/oct-parse.yy Thu Sep 02 11:20:53 2021 -0400 @@ -4216,6 +4216,7 @@ symbol_scope pscope = m_function_scopes.parent_scope (); fcn_scope.set_parent (pscope); fcn_scope.set_primary_parent (m_primary_fcn_scope); + pscope.install_nestfunction (fcn_nm, ov_fcn, fcn_scope); // For nested functions, the list of parent functions is @@ -4225,18 +4226,12 @@ { fcn->mark_as_subfunction (); m_subfunction_names.push_back (fcn_nm); + fcn_scope.set_parent (m_primary_fcn_scope); if (m_parsing_subfunctions) fcn_scope.set_primary_parent (m_primary_fcn_scope); + m_primary_fcn_scope.install_subfunction (fcn_nm, ov_fcn); - - // Prepend name of primary function to list of parent - // functions (if any) for subfunction. - - std::list<std::string> plst - = fcn_scope.parent_fcn_names (); - plst.push_front (m_primary_fcn_scope.fcn_name ()); - fcn_scope.cache_parent_fcn_names (plst); } }