comparison src/ov-usr-fcn.cc @ 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 8758dfa21cac
children b76f0740940e
comparison
equal deleted inserted replaced
14326:63f1bdf08339 14328:19078011cdc3
385 } 385 }
386 386
387 // Save old and set current symbol table context, for 387 // Save old and set current symbol table context, for
388 // eval_undefined_error(). 388 // eval_undefined_error().
389 389
390 octave_call_stack::push (this, local_scope, call_depth); 390 int context = is_anonymous_function () ? 0 : call_depth;
391
392 octave_call_stack::push (this, local_scope, context);
391 frame.add_fcn (octave_call_stack::pop); 393 frame.add_fcn (octave_call_stack::pop);
392 394
393 if (call_depth > 0) 395 if (call_depth > 0 && ! is_anonymous_function ())
394 { 396 {
395 symbol_table::push_context (); 397 symbol_table::push_context ();
396 398
397 frame.add_fcn (symbol_table::pop_context); 399 frame.add_fcn (symbol_table::pop_context);
398 } 400 }