# HG changeset patch # User jwe # Date 1095389993 0 # Node ID 2bcd013bc8673ce82c7142684ae53d78b9eefe37 # Parent 62da6b854fdb0c03837189e8dd4d71e2db909fb2 [project @ 2004-09-17 02:59:53 by jwe] diff -r 62da6b854fdb -r 2bcd013bc867 src/ChangeLog --- a/src/ChangeLog Fri Sep 17 01:57:41 2004 +0000 +++ b/src/ChangeLog Fri Sep 17 02:59:53 2004 +0000 @@ -1,5 +1,8 @@ 2004-09-16 John W. Eaton + * parse.y (frob_function): Clear id_name from curr_sym_tab, not + top_level_sym_tab. + * symtab.cc (maybe_list): Count sizes using size_t, not int. * variables.cc (symbol_out_of_date): Always look in LOADPATH. diff -r 62da6b854fdb -r 2bcd013bc867 src/parse.y --- a/src/parse.y Fri Sep 17 01:57:41 2004 +0000 +++ b/src/parse.y Fri Sep 17 02:59:53 2004 +0000 @@ -2715,7 +2715,21 @@ fcn->stash_function_name (id_name); - top_level_sym_tab->clear (id_name); + // Enter the new function in fbi_sym_tab. If there is already a + // variable of the same name in the current symbol table, we won't + // find the new function when we try to call it, so we need to clear + // the old symbol from the current symbol table. Note that this + // means that for things like + // + // function f () eval ("function g () 1, end"); end + // g = 13; + // f (); + // g + // + // G will still refer to the variable G (with value 13) rather + // than the function G, until the variable G is cleared. + + curr_sym_tab->clear (id_name); symbol_record *sr = fbi_sym_tab->lookup (id_name, true); diff -r 62da6b854fdb -r 2bcd013bc867 src/symtab.cc --- a/src/symtab.cc Fri Sep 17 01:57:41 2004 +0000 +++ b/src/symtab.cc Fri Sep 17 02:59:53 2004 +0000 @@ -1554,9 +1554,9 @@ } os << "\nTotal is " - << elements << (elements > 1 ? " elements" : "element") + << elements << (elements == 1 ? " element" : " elements") << " using " - << bytes << (bytes > 1 ? " bytes" : "byte") + << bytes << (bytes == 1 ? " byte" : " bytes") << "\n"; status = 1;