changeset 8032:2fd4a5ef6b59

stash parent function scope for inline functions and anonymous function handles.
author John W. Eaton <jwe@octave.org>
date Tue, 12 Aug 2008 16:26:53 -0400
parents d9987dbdf91b
children 2ad5ba320b93
files src/ChangeLog src/ov-fcn-inline.cc src/pt-fcn-handle.cc
diffstat 3 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Aug 12 13:20:27 2008 -0400
+++ b/src/ChangeLog	Tue Aug 12 16:26:53 2008 -0400
@@ -1,5 +1,10 @@
 2008-08-12  John W. Eaton  <jwe@octave.org>
 
+	* pt-fcn-handle.cc (tree_anon_fcn_handle::rvalue):
+	Call stash_parent_function_scope for user function.
+	* ov-fcn-inline.cc (octave_fcn_inline::octave_fcn_inline): 
+	Likewise.
+
 	* ov-struct.cc (octave_struct::subsref): Don't allow resizing for
 	simple x(idx) case.
 
--- a/src/ov-fcn-inline.cc	Tue Aug 12 13:20:27 2008 -0400
+++ b/src/ov-fcn-inline.cc	Tue Aug 12 16:26:53 2008 -0400
@@ -39,9 +39,11 @@
 #include "oct-map.h"
 #include "ov-base.h"
 #include "ov-fcn-inline.h"
+#include "ov-usr-fcn.h"
 #include "pr-output.h"
 #include "variables.h"
 #include "parse.h"
+#include "toplev.h"
 
 #include "byte-swap.h"
 #include "ls-oct-ascii.h"
@@ -83,7 +85,14 @@
       octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value ();
 
       if (fh)
-	fcn = fh->fcn_val ();
+	{
+	  fcn = fh->fcn_val ();
+
+	  octave_user_function *uf = fcn.user_function_value ();
+
+	  if (uf)
+	    uf->stash_parent_fcn_scope (octave_call_stack::current_scope ());
+	}
     }
 
   if (fcn.is_undefined ())
--- a/src/pt-fcn-handle.cc	Tue Aug 12 13:20:27 2008 -0400
+++ b/src/pt-fcn-handle.cc	Tue Aug 12 16:26:53 2008 -0400
@@ -112,7 +112,10 @@
   octave_function *curr_fcn = octave_call_stack::current ();
 
   if (curr_fcn)
-    uf->stash_parent_fcn_name (curr_fcn->name ());
+    {
+      uf->stash_parent_fcn_name (curr_fcn->name ());
+      uf->stash_parent_fcn_scope (curr_fcn->scope ());
+    }
 
   uf->mark_as_inline_function ();