diff src/parse.y @ 5006:2bcd013bc867

[project @ 2004-09-17 02:59:53 by jwe]
author jwe
date Fri, 17 Sep 2004 02:59:53 +0000
parents c0d8e8afa82f
children 1eb9ce5c0152
line wrap: on
line diff
--- 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);