Mercurial > hg > octave-lojdl
changeset 8045:24701aa75ecb
scope fixes for anonymous and inline functions that appear inside subfunctions
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 20 Aug 2008 15:57:14 -0400 |
parents | faf0abc5fd51 |
children | c4482fc30c7f |
files | src/ov-fcn-inline.cc src/pt-fcn-handle.cc |
diffstat | 2 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ov-fcn-inline.cc +++ b/src/ov-fcn-inline.cc @@ -91,7 +91,20 @@ octave_user_function *uf = fcn.user_function_value (); if (uf) - uf->stash_parent_fcn_scope (octave_call_stack::current_scope ()); + { + octave_function *curr_fcn = octave_call_stack::current (); + + if (curr_fcn) + { + symbol_table::scope_id parent_scope + = curr_fcn->parent_fcn_scope (); + + if (parent_scope < 0) + parent_scope = curr_fcn->scope (); + + uf->stash_parent_fcn_scope (parent_scope); + } + } } }
--- a/src/pt-fcn-handle.cc +++ b/src/pt-fcn-handle.cc @@ -114,7 +114,13 @@ if (curr_fcn) { uf->stash_parent_fcn_name (curr_fcn->name ()); - uf->stash_parent_fcn_scope (curr_fcn->scope ()); + + symbol_table::scope_id parent_scope = curr_fcn->parent_fcn_scope (); + + if (parent_scope < 0) + parent_scope = curr_fcn->scope (); + + uf->stash_parent_fcn_scope (parent_scope); } uf->mark_as_inline_function ();