comparison src/parse.y @ 5609:bf96b0f9dbd7

[project @ 2006-02-09 02:29:59 by jwe]
author jwe
date Thu, 09 Feb 2006 02:30:00 +0000
parents 61d6cebd243b
children d01f07aeaec5
comparison
equal deleted inserted replaced
5608:320be6d5e027 5609:bf96b0f9dbd7
2569 // 2569 //
2570 // G will still refer to the variable G (with value 13) rather 2570 // G will still refer to the variable G (with value 13) rather
2571 // than the function G, until the variable G is cleared. 2571 // than the function G, until the variable G is cleared.
2572 2572
2573 curr_sym_tab->clear (id_name); 2573 curr_sym_tab->clear (id_name);
2574
2575 if (! lexer_flags.parsing_nested_function
2576 && symtab_context.top () == top_level_sym_tab)
2577 {
2578 symbol_record *sr = top_level_sym_tab->lookup (id_name);
2579
2580 // Only clear the existing name if it is already defined as a
2581 // function. If there is already a variable defined with the
2582 // same name as a the current function, it will continue to
2583 // shadow this name until the variable is cleared. This means
2584 // that for something like the following at the command line,
2585 //
2586 // f = 13;
2587 // function f () 7, end
2588 // f
2589 //
2590 // F will still refer to the variable F (with value 13) rather
2591 // than the function F, until the variable F is cleared.
2592
2593 if (sr && sr->is_function ())
2594 top_level_sym_tab->clear (id_name);
2595 }
2574 2596
2575 symbol_record *sr = fbi_sym_tab->lookup (id_name, true); 2597 symbol_record *sr = fbi_sym_tab->lookup (id_name, true);
2576 2598
2577 if (sr) 2599 if (sr)
2578 { 2600 {