# HG changeset patch # User John W. Eaton # Date 1225213318 14400 # Node ID 47a3d2f829e497be7dd4ed30b795195f3d28fb12 # Parent 83c59e3f31061590bfdc645495e0260e6c1fa375 clear local symbol table after parsing function diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-10-28 John W. Eaton + + * parse.y (finish_function): Clear local variables in function scope. + * symtab.h (symbol_table::clear_variables): New argument, scope. + 2008-10-28 Brian Gough * DLD-FUNCTIONS/besselj.cc: Added tests. diff --git a/src/parse.y b/src/parse.y --- 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; diff --git a/src/symtab.h b/src/symtab.h --- 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 ();