Mercurial > hg > octave-lyh
changeset 7754:e26d0931c044
pt-cmd.cc (tree_function_def::eval): only install command-line functions if executing in top-level scope
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 04 May 2008 21:45:47 -0400 |
parents | e76a4a6e3c47 |
children | ea9cb4d68dbf |
files | src/ChangeLog src/pt-cmd.cc |
diffstat | 2 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2008-05-04 John W. Eaton <jwe@octave.org> + * pt-cmd.cc (tree_function_def::eval): Only define command-line + function if we are executing in the top-level scope. + * symtab.h (symbol_table::fcn_info::fcn_info_rep::find_function): Initialize args_evaluated. * pt-id.cc (tree_identifier::rvalue): Likewise.
--- a/src/pt-cmd.cc +++ b/src/pt-cmd.cc @@ -47,18 +47,21 @@ void tree_function_def::eval (void) { - octave_function *f = function (); + if (symbol_table::at_top_level ()) + { + octave_function *f = function (); - if (f) - { - std::string nm = f->name (); + if (f) + { + std::string nm = f->name (); - symbol_table::install_cmdline_function (nm, fcn); + symbol_table::install_cmdline_function (nm, fcn); - // Make sure that any variable with the same name as the new - // function is cleared. + // Make sure that any variable with the same name as the new + // function is cleared. - symbol_table::varref (nm) = octave_value (); + symbol_table::varref (nm) = octave_value (); + } } }