Mercurial > hg > octave-lojdl
changeset 8282:47a3d2f829e4
clear local symbol table after parsing function
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Oct 2008 13:01:58 -0400 |
parents | 83c59e3f3106 |
children | 54c25dc5b17d |
files | src/ChangeLog src/parse.y src/symtab.h |
diffstat | 3 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-10-28 John W. Eaton <jwe@octave.org> + + * parse.y (finish_function): Clear local variables in function scope. + * symtab.h (symbol_table::clear_variables): New argument, scope. + 2008-10-28 Brian Gough <bjg@gnu.org> * DLD-FUNCTIONS/besselj.cc: Added tests.
--- a/src/parse.y +++ b/src/parse.y @@ -2618,6 +2618,11 @@ retval = new tree_function_def (fcn); } + + // Clear any local variables that may have been added by + // while parsing (for example, by force_local_variable in lex.l). + + symbol_table::clear_variables (fcn->scope ()); } return retval;
--- a/src/symtab.h +++ b/src/symtab.h @@ -1287,9 +1287,9 @@ clear_functions (); } - static void clear_variables (void) + static void clear_variables (scope_id scope = xcurrent_scope) { - symbol_table *inst = get_instance (xcurrent_scope); + symbol_table *inst = get_instance (scope); if (inst) inst->do_clear_variables ();