diff src/ov-fcn-handle.cc @ 7761:5adeea5de26c

symbol table reporting functions
author John W. Eaton <jwe@octave.org>
date Tue, 06 May 2008 05:51:17 -0400
parents 45de7d8dac72
children 71f068b22fcc
line wrap: on
line diff
--- a/src/ov-fcn-handle.cc	Tue May 06 03:23:12 2008 -0400
+++ b/src/ov-fcn-handle.cc	Tue May 06 05:51:17 2008 -0400
@@ -65,6 +65,16 @@
 				     "function handle",
 				     "function_handle");
 
+octave_fcn_handle::octave_fcn_handle (const octave_value& f,
+				      const std::string& n)
+  : warn_reload (true), fcn (f), nm (n)
+{
+  octave_user_function *uf = fcn.user_function_value (true);
+
+  if (uf)
+    symbol_table::cache_name (uf->scope (), nm);
+}
+
 octave_value_list
 octave_fcn_handle::subsref (const std::string& type,
 			    const std::list<octave_value_list>& idx,
@@ -358,8 +368,16 @@
 	    {
 	      octave_fcn_handle *fh = 
 		anon_fcn_handle.fcn_handle_value ();
+
 	      if (fh)
-		fcn = fh->fcn;
+		{
+		  fcn = fh->fcn;
+
+		  octave_user_function *uf = fcn.user_function_value (true);
+
+		  if (uf)
+		    symbol_table::cache_name (uf->scope (), nm);
+		}
 	      else
 		success = false;
 	    }
@@ -519,8 +537,16 @@
 	  if (parse_status == 0)
 	    {
 	      octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value ();
+
 	      if (fh)
-		fcn = fh->fcn;
+		{
+		  fcn = fh->fcn;
+
+		  octave_user_function *uf = fcn.user_function_value (true);
+
+		  if (uf)
+		    symbol_table::cache_name (uf->scope (), nm);
+		}
 	      else
 		success = false;
 	    }
@@ -968,8 +994,16 @@
 	  if (parse_status == 0)
 	    {
 	      octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value ();
+
 	      if (fh)
-		fcn = fh->fcn;
+		{
+		  fcn = fh->fcn;
+
+		  octave_user_function *uf = fcn.user_function_value (true);
+
+		  if (uf)
+		    symbol_table::cache_name (uf->scope (), nm);
+		}
 	      else
 		success = false;
 	    }