# HG changeset patch # User John W. Eaton # Date 1256837763 14400 # Node ID 5f8971be8e1295d0ad7150fb5bc6ef7c8f5f5fea # Parent c6b97d21834586a2948f86e830dec67315266cbc parse.y (finish_function): retrun function object unless parsing function file diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-10-29 John W. Eaton + + * parse.y (finish_function): Return function object unless parsing + function file. + 2009-10-23 Jaroslav Hajek * DLD-FUNCTIONS/tril.cc: New source. diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -2958,13 +2958,18 @@ primary_fcn_scope); } - if (! primary_fcn_ptr) + if (! reading_fcn_file) { - // FIXME -- there should be a better way to indicate that we - // should create a tree_function_def object other than - // looking at primary_fcn_ptr... - - retval = new tree_function_def (fcn); + // We are either reading a script file or defining a function + // at the command line, so this definition creates a + // tree_function object that is placed in the parse tree. + // Otherwise, it is just inserted in the symbol table, + // either as a subfunction (see above), or as the primary + // function for the file, via primary_fcn_ptr (see also + // load_fcn_from_file,, parse_fcn_file, and + // symbol_table::fcn_info::fcn_info_rep::find_user_function). + + retval = new tree_function_def (fcn); } // Unmark any symbols that may have been tagged as local