Mercurial > hg > octave-lyh
diff src/symtab.h @ 9260:9c2349a51218
properly unmark forced variables
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 26 May 2009 11:20:40 -0400 |
parents | f27a8c07f0b2 |
children | 73e36b147e45 |
line wrap: on
line diff
--- a/src/symtab.h +++ b/src/symtab.h @@ -297,7 +297,7 @@ bool is_variable (context_id context) const { - return (storage_class != local || is_defined (context) || is_forced ()); + return (! is_local () || is_defined (context) || is_forced ()); } bool is_local (void) const { return storage_class & local; } @@ -1335,6 +1335,19 @@ } // For unwind_protect. + static void unmark_forced_variables (void *arg) + { + // Unmark any symbols that may have been tagged as local variables + // while parsing (for example, by force_local_variable in lex.l). + + symbol_table::scope_id *p = static_cast <symbol_table::scope_id *> (arg); + + if (p) + unmark_forced_variables (*p); +} + + + // For unwind_protect. static void clear_variables (void *) { clear_variables (); } static void clear_functions (void) @@ -2289,7 +2302,10 @@ std::list<std::string> retval; for (table_const_iterator p = table.begin (); p != table.end (); p++) - retval.push_back (p->first); + { + if (p->second.is_variable ()) + retval.push_back (p->first); + } retval.sort ();