Mercurial > octave
changeset 24064:5bf2e2ceace2
only cache parent function in anonymous function scopes
* symtab.cc (symbol_table::scope::set_parent): Only cache parent
function in anonymous function scopes. See also changeset
ef85638c605a.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 20 Sep 2017 17:45:25 -0400 |
parents | c81ed514ca2c |
children | 34506e4e3b04 |
files | libinterp/corefcn/symtab.cc |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/symtab.cc Mon Sep 18 12:49:54 2017 -0400 +++ b/libinterp/corefcn/symtab.cc Wed Sep 20 17:45:25 2017 -0400 @@ -1825,10 +1825,15 @@ // If m_parent is the top-level scope, there will be no parent // function. - octave_function *ov_fcn = m_parent->function (); + octave_function *current_fcn = function (); - if (ov_fcn) - m_parent_fcn = octave_value (ov_fcn, true); + if (current_fcn && current_fcn->is_anonymous_function ()) + { + octave_function *parent_fcn = m_parent->function (); + + if (parent_fcn) + m_parent_fcn = octave_value (parent_fcn, true); + } } }