diff src/ov-fcn-inline.cc @ 8045:24701aa75ecb

scope fixes for anonymous and inline functions that appear inside subfunctions
author John W. Eaton <jwe@octave.org>
date Wed, 20 Aug 2008 15:57:14 -0400
parents 2fd4a5ef6b59
children 25bc2d31e1bf
line wrap: on
line diff
--- a/src/ov-fcn-inline.cc	Wed Aug 20 15:14:54 2008 -0400
+++ b/src/ov-fcn-inline.cc	Wed Aug 20 15:57:14 2008 -0400
@@ -91,7 +91,20 @@
 	  octave_user_function *uf = fcn.user_function_value ();
 
 	  if (uf)
-	    uf->stash_parent_fcn_scope (octave_call_stack::current_scope ());
+	    {
+	      octave_function *curr_fcn = octave_call_stack::current ();
+
+	      if (curr_fcn)
+		{
+		  symbol_table::scope_id parent_scope
+		    = curr_fcn->parent_fcn_scope ();
+
+		  if (parent_scope < 0)
+		    parent_scope = curr_fcn->scope ();
+	
+		  uf->stash_parent_fcn_scope (parent_scope);
+		}
+	    }
 	}
     }