changeset 9761:5f8971be8e12

parse.y (finish_function): retrun function object unless parsing function file
author John W. Eaton <jwe@octave.org>
date Thu, 29 Oct 2009 13:36:03 -0400
parents c6b97d218345
children 8e277dcf1223
files src/ChangeLog src/parse.y
diffstat 2 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Oct 28 20:00:35 2009 -0400
+++ b/src/ChangeLog	Thu Oct 29 13:36:03 2009 -0400
@@ -1,3 +1,8 @@
+2009-10-29  John W. Eaton  <jwe@octave.org>
+
+	* parse.y (finish_function): Return function object unless parsing
+	function file.
+
 2009-10-23  Jaroslav Hajek  <highegg@gmail.com>
 
 	* DLD-FUNCTIONS/tril.cc: New source.
--- a/src/parse.y	Wed Oct 28 20:00:35 2009 -0400
+++ b/src/parse.y	Thu Oct 29 13:36:03 2009 -0400
@@ -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