changeset 14328:19078011cdc3

fix problem with recursion and anonymous functions (bug #31371) * ov-user-fcn.cc (octave_user_function::do_multi_index_op): Don't increment the symbol table_context in the call stack or push a new symbol table context for recursive anonymous function calls.
author John W. Eaton <jwe@octave.org>
date Sun, 05 Feb 2012 13:16:07 -0500
parents 63f1bdf08339
children 8d1ae996c122
files src/ov-usr-fcn.cc
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ov-usr-fcn.cc
+++ b/src/ov-usr-fcn.cc
@@ -387,10 +387,12 @@
   // Save old and set current symbol table context, for
   // eval_undefined_error().
 
-  octave_call_stack::push (this, local_scope, call_depth);
+  int context = is_anonymous_function () ? 0 : call_depth;
+
+  octave_call_stack::push (this, local_scope, context);
   frame.add_fcn (octave_call_stack::pop);
 
-  if (call_depth > 0)
+  if (call_depth > 0 && ! is_anonymous_function ())
     {
       symbol_table::push_context ();